func ExampleSQS_ReceiveMessage() { svc := sqs.New(nil) params := &sqs.ReceiveMessageInput{ QueueUrl: aws.String("String"), // Required AttributeNames: []*string{ aws.String("QueueAttributeName"), // Required // More values... }, MaxNumberOfMessages: aws.Int64(1), MessageAttributeNames: []*string{ aws.String("MessageAttributeName"), // Required // More values... }, VisibilityTimeout: aws.Int64(1), WaitTimeSeconds: aws.Int64(1), } resp, err := svc.ReceiveMessage(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleWorkSpaces_DescribeWorkspaces() { svc := workspaces.New(nil) params := &workspaces.DescribeWorkspacesInput{ BundleId: aws.String("BundleId"), DirectoryId: aws.String("DirectoryId"), Limit: aws.Int64(1), NextToken: aws.String("PaginationToken"), UserName: aws.String("UserName"), WorkspaceIds: []*string{ aws.String("WorkspaceId"), // Required // More values... }, } resp, err := svc.DescribeWorkspaces(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleGlacier_SetVaultNotifications() { svc := glacier.New(nil) params := &glacier.SetVaultNotificationsInput{ AccountId: aws.String("string"), // Required VaultName: aws.String("string"), // Required VaultNotificationConfig: &glacier.VaultNotificationConfig{ Events: []*string{ aws.String("string"), // Required // More values... }, SNSTopic: aws.String("string"), }, } resp, err := svc.SetVaultNotifications(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCloudSearch_DefineSuggester() { svc := cloudsearch.New(nil) params := &cloudsearch.DefineSuggesterInput{ DomainName: aws.String("DomainName"), // Required Suggester: &cloudsearch.Suggester{ // Required DocumentSuggesterOptions: &cloudsearch.DocumentSuggesterOptions{ // Required SourceField: aws.String("FieldName"), // Required FuzzyMatching: aws.String("SuggesterFuzzyMatching"), SortExpression: aws.String("String"), }, SuggesterName: aws.String("StandardName"), // Required }, } resp, err := svc.DefineSuggester(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleElastiCache_ResetCacheParameterGroup() { svc := elasticache.New(nil) params := &elasticache.ResetCacheParameterGroupInput{ CacheParameterGroupName: aws.String("String"), // Required ParameterNameValues: []*elasticache.ParameterNameValue{ // Required { // Required ParameterName: aws.String("String"), ParameterValue: aws.String("String"), }, // More values... }, ResetAllParameters: aws.Bool(true), } resp, err := svc.ResetCacheParameterGroup(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleELB_CreateLoadBalancerListeners() { svc := elb.New(nil) params := &elb.CreateLoadBalancerListenersInput{ Listeners: []*elb.Listener{ // Required { // Required InstancePort: aws.Int64(1), // Required LoadBalancerPort: aws.Int64(1), // Required Protocol: aws.String("Protocol"), // Required InstanceProtocol: aws.String("Protocol"), SSLCertificateId: aws.String("SSLCertificateId"), }, // More values... }, LoadBalancerName: aws.String("AccessPointName"), // Required } resp, err := svc.CreateLoadBalancerListeners(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleELB_RemoveTags() { svc := elb.New(nil) params := &elb.RemoveTagsInput{ LoadBalancerNames: []*string{ // Required aws.String("AccessPointName"), // Required // More values... }, Tags: []*elb.TagKeyOnly{ // Required { // Required Key: aws.String("TagKey"), }, // More values... }, } resp, err := svc.RemoveTags(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleRoute53Domains_UpdateTagsForDomain() { svc := route53domains.New(nil) params := &route53domains.UpdateTagsForDomainInput{ DomainName: aws.String("DomainName"), // Required TagsToUpdate: []*route53domains.Tag{ { // Required Key: aws.String("TagKey"), Value: aws.String("TagValue"), }, // More values... }, } resp, err := svc.UpdateTagsForDomain(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCloudWatchLogs_FilterLogEvents() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.FilterLogEventsInput{ LogGroupName: aws.String("LogGroupName"), // Required EndTime: aws.Int64(1), FilterPattern: aws.String("FilterPattern"), Interleaved: aws.Bool(true), Limit: aws.Int64(1), LogStreamNames: []*string{ aws.String("LogStreamName"), // Required // More values... }, NextToken: aws.String("NextToken"), StartTime: aws.Int64(1), } resp, err := svc.FilterLogEvents(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleStorageGateway_AddTagsToResource() { svc := storagegateway.New(nil) params := &storagegateway.AddTagsToResourceInput{ ResourceARN: aws.String("ResourceARN"), // Required Tags: []*storagegateway.Tag{ // Required { // Required Key: aws.String("TagKey"), // Required Value: aws.String("TagValue"), // Required }, // More values... }, } resp, err := svc.AddTagsToResource(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleRoute53Domains_UpdateDomainNameservers() { svc := route53domains.New(nil) params := &route53domains.UpdateDomainNameserversInput{ DomainName: aws.String("DomainName"), // Required Nameservers: []*route53domains.Nameserver{ // Required { // Required Name: aws.String("HostName"), // Required GlueIps: []*string{ aws.String("GlueIp"), // Required // More values... }, }, // More values... }, FIAuthKey: aws.String("FIAuthKey"), } resp, err := svc.UpdateDomainNameservers(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
// Retrieve generates a new set of temporary credentials using STS. func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { // Apply defaults where parameters are not set. if p.Client == nil { p.Client = sts.New(nil) } if p.RoleSessionName == "" { // Try to work out a role name that will hopefully end up unique. p.RoleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano()) } if p.Duration == 0 { // Expire as often as AWS permits. p.Duration = 15 * time.Minute } roleOutput, err := p.Client.AssumeRole(&sts.AssumeRoleInput{ DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), RoleArn: aws.String(p.RoleARN), RoleSessionName: aws.String(p.RoleSessionName), ExternalId: p.ExternalID, }) if err != nil { return credentials.Value{}, err } // We will proactively generate new credentials before they expire. p.SetExpiration(*roleOutput.Credentials.Expiration, p.ExpiryWindow) return credentials.Value{ AccessKeyID: *roleOutput.Credentials.AccessKeyId, SecretAccessKey: *roleOutput.Credentials.SecretAccessKey, SessionToken: *roleOutput.Credentials.SessionToken, }, nil }
func ExampleKinesis_PutRecords() { svc := kinesis.New(nil) params := &kinesis.PutRecordsInput{ Records: []*kinesis.PutRecordsRequestEntry{ // Required { // Required Data: []byte("PAYLOAD"), // Required PartitionKey: aws.String("PartitionKey"), // Required ExplicitHashKey: aws.String("HashKey"), }, // More values... }, StreamName: aws.String("StreamName"), // Required } resp, err := svc.PutRecords(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleSQS_ChangeMessageVisibilityBatch() { svc := sqs.New(nil) params := &sqs.ChangeMessageVisibilityBatchInput{ Entries: []*sqs.ChangeMessageVisibilityBatchRequestEntry{ // Required { // Required Id: aws.String("String"), // Required ReceiptHandle: aws.String("String"), // Required VisibilityTimeout: aws.Int64(1), }, // More values... }, QueueUrl: aws.String("String"), // Required } resp, err := svc.ChangeMessageVisibilityBatch(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCloudTrail_LookupEvents() { svc := cloudtrail.New(nil) params := &cloudtrail.LookupEventsInput{ EndTime: aws.Time(time.Now()), LookupAttributes: []*cloudtrail.LookupAttribute{ { // Required AttributeKey: aws.String("LookupAttributeKey"), // Required AttributeValue: aws.String("String"), // Required }, // More values... }, MaxResults: aws.Int64(1), NextToken: aws.String("NextToken"), StartTime: aws.Time(time.Now()), } resp, err := svc.LookupEvents(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCloudWatchLogs_PutLogEvents() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.PutLogEventsInput{ LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required { // Required Message: aws.String("EventMessage"), // Required Timestamp: aws.Int64(1), // Required }, // More values... }, LogGroupName: aws.String("LogGroupName"), // Required LogStreamName: aws.String("LogStreamName"), // Required SequenceToken: aws.String("SequenceToken"), } resp, err := svc.PutLogEvents(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCloudTrail_RemoveTags() { svc := cloudtrail.New(nil) params := &cloudtrail.RemoveTagsInput{ ResourceId: aws.String("String"), // Required TagsList: []*cloudtrail.Tag{ { // Required Key: aws.String("String"), // Required Value: aws.String("String"), }, // More values... }, } resp, err := svc.RemoveTags(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCodeDeploy_ListDeployments() { svc := codedeploy.New(nil) params := &codedeploy.ListDeploymentsInput{ ApplicationName: aws.String("ApplicationName"), CreateTimeRange: &codedeploy.TimeRange{ End: aws.Time(time.Now()), Start: aws.Time(time.Now()), }, DeploymentGroupName: aws.String("DeploymentGroupName"), IncludeOnlyStatuses: []*string{ aws.String("DeploymentStatus"), // Required // More values... }, NextToken: aws.String("NextToken"), } resp, err := svc.ListDeployments(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleELB_CreateLoadBalancerPolicy() { svc := elb.New(nil) params := &elb.CreateLoadBalancerPolicyInput{ LoadBalancerName: aws.String("AccessPointName"), // Required PolicyName: aws.String("PolicyName"), // Required PolicyTypeName: aws.String("PolicyTypeName"), // Required PolicyAttributes: []*elb.PolicyAttribute{ { // Required AttributeName: aws.String("AttributeName"), AttributeValue: aws.String("AttributeValue"), }, // More values... }, } resp, err := svc.CreateLoadBalancerPolicy(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCodeDeploy_ListOnPremisesInstances() { svc := codedeploy.New(nil) params := &codedeploy.ListOnPremisesInstancesInput{ NextToken: aws.String("NextToken"), RegistrationStatus: aws.String("RegistrationStatus"), TagFilters: []*codedeploy.TagFilter{ { // Required Key: aws.String("Key"), Type: aws.String("TagFilterType"), Value: aws.String("Value"), }, // More values... }, } resp, err := svc.ListOnPremisesInstances(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleELB_ConfigureHealthCheck() { svc := elb.New(nil) params := &elb.ConfigureHealthCheckInput{ HealthCheck: &elb.HealthCheck{ // Required HealthyThreshold: aws.Int64(1), // Required Interval: aws.Int64(1), // Required Target: aws.String("HealthCheckTarget"), // Required Timeout: aws.Int64(1), // Required UnhealthyThreshold: aws.Int64(1), // Required }, LoadBalancerName: aws.String("AccessPointName"), // Required } resp, err := svc.ConfigureHealthCheck(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCodeDeploy_RegisterApplicationRevision() { svc := codedeploy.New(nil) params := &codedeploy.RegisterApplicationRevisionInput{ ApplicationName: aws.String("ApplicationName"), // Required Revision: &codedeploy.RevisionLocation{ // Required GitHubLocation: &codedeploy.GitHubLocation{ CommitId: aws.String("CommitId"), Repository: aws.String("Repository"), }, RevisionType: aws.String("RevisionLocationType"), S3Location: &codedeploy.S3Location{ Bucket: aws.String("S3Bucket"), BundleType: aws.String("BundleType"), ETag: aws.String("ETag"), Key: aws.String("S3Key"), Version: aws.String("VersionId"), }, }, Description: aws.String("Description"), } resp, err := svc.RegisterApplicationRevision(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleElastiCache_AddTagsToResource() { svc := elasticache.New(nil) params := &elasticache.AddTagsToResourceInput{ ResourceName: aws.String("String"), // Required Tags: []*elasticache.Tag{ // Required { // Required Key: aws.String("String"), Value: aws.String("String"), }, // More values... }, } resp, err := svc.AddTagsToResource(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() { svc := codedeploy.New(nil) params := &codedeploy.RemoveTagsFromOnPremisesInstancesInput{ InstanceNames: []*string{ // Required aws.String("InstanceName"), // Required // More values... }, Tags: []*codedeploy.Tag{ // Required { // Required Key: aws.String("Key"), Value: aws.String("Value"), }, // More values... }, } resp, err := svc.RemoveTagsFromOnPremisesInstances(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleWorkSpaces_CreateWorkspaces() { svc := workspaces.New(nil) params := &workspaces.CreateWorkspacesInput{ Workspaces: []*workspaces.WorkspaceRequest{ // Required { // Required BundleId: aws.String("BundleId"), // Required DirectoryId: aws.String("DirectoryId"), // Required UserName: aws.String("UserName"), // Required RootVolumeEncryptionEnabled: aws.Bool(true), UserVolumeEncryptionEnabled: aws.Bool(true), VolumeEncryptionKey: aws.String("VolumeEncryptionKey"), }, // More values... }, } resp, err := svc.CreateWorkspaces(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleWAF_UpdateIPSet() { svc := waf.New(nil) params := &waf.UpdateIPSetInput{ ChangeToken: aws.String("ChangeToken"), // Required IPSetId: aws.String("ResourceId"), // Required Updates: []*waf.IPSetUpdate{ // Required { // Required Action: aws.String("ChangeAction"), // Required IPSetDescriptor: &waf.IPSetDescriptor{ // Required Type: aws.String("IPSetDescriptorType"), // Required Value: aws.String("IPSetDescriptorValue"), // Required }, }, // More values... }, } resp, err := svc.UpdateIPSet(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleGlacier_SetDataRetrievalPolicy() { svc := glacier.New(nil) params := &glacier.SetDataRetrievalPolicyInput{ AccountId: aws.String("string"), // Required Policy: &glacier.DataRetrievalPolicy{ Rules: []*glacier.DataRetrievalRule{ { // Required BytesPerHour: aws.Int64(1), Strategy: aws.String("string"), }, // More values... }, }, } resp, err := svc.SetDataRetrievalPolicy(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleWAF_UpdateRule() { svc := waf.New(nil) params := &waf.UpdateRuleInput{ ChangeToken: aws.String("ChangeToken"), // Required RuleId: aws.String("ResourceId"), // Required Updates: []*waf.RuleUpdate{ // Required { // Required Action: aws.String("ChangeAction"), // Required Predicate: &waf.Predicate{ // Required DataId: aws.String("PredicateDataId"), // Required Negated: aws.Bool(true), // Required Type: aws.String("PredicateType"), // Required }, }, // More values... }, } resp, err := svc.UpdateRule(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleCloudSearchDomain_Search() { svc := cloudsearchdomain.New(nil) params := &cloudsearchdomain.SearchInput{ Query: aws.String("Query"), // Required Cursor: aws.String("Cursor"), Expr: aws.String("Expr"), Facet: aws.String("Facet"), FilterQuery: aws.String("FilterQuery"), Highlight: aws.String("Highlight"), Partial: aws.Bool(true), QueryOptions: aws.String("QueryOptions"), QueryParser: aws.String("QueryParser"), Return: aws.String("Return"), Size: aws.Int64(1), Sort: aws.String("Sort"), Start: aws.Int64(1), } resp, err := svc.Search(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }
func ExampleSQS_AddPermission() { svc := sqs.New(nil) params := &sqs.AddPermissionInput{ AWSAccountIds: []*string{ // Required aws.String("String"), // Required // More values... }, Actions: []*string{ // Required aws.String("String"), // Required // More values... }, Label: aws.String("String"), // Required QueueUrl: aws.String("String"), // Required } resp, err := svc.AddPermission(params) if err != nil { // Print the error, cast err to awserr.Error to get the Code and // Message from an error. fmt.Println(err.Error()) return } // Pretty-print the response data. fmt.Println(resp) }