func ExampleCloudWatchLogs_PutLogEvents() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.PutLogEventsInput{ LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required &cloudwatchlogs.InputLogEvent{ // Required Message: aws.String("EventMessage"), // Required Timestamp: aws.Long(1), // Required }, // More values... }, LogGroupName: aws.String("LogGroupName"), // Required LogStreamName: aws.String("LogStreamName"), // Required SequenceToken: aws.String("SequenceToken"), } resp, err := svc.PutLogEvents(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleSSM_UpdateAssociationStatus() { svc := ssm.New(nil) params := &ssm.UpdateAssociationStatusInput{ AssociationStatus: &ssm.AssociationStatus{ // Required Date: aws.Time(time.Now()), // Required Message: aws.String("StatusMessage"), // Required Name: aws.String("AssociationStatusName"), // Required AdditionalInfo: aws.String("StatusAdditionalInfo"), }, InstanceID: aws.String("InstanceId"), // Required Name: aws.String("DocumentName"), // Required } resp, err := svc.UpdateAssociationStatus(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleLambda_AddEventSource() { svc := lambda.New(nil) params := &lambda.AddEventSourceInput{ EventSource: aws.String("String"), // Required FunctionName: aws.String("FunctionName"), // Required Role: aws.String("RoleArn"), // Required BatchSize: aws.Long(1), Parameters: &map[string]*string{ "Key": aws.String("String"), // Required // More values... }, } resp, err := svc.AddEventSource(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleS3_DeleteObjects() { svc := s3.New(nil) params := &s3.DeleteObjectsInput{ Bucket: aws.String("BucketName"), // Required Delete: &s3.Delete{ // Required Objects: []*s3.ObjectIdentifier{ // Required &s3.ObjectIdentifier{ // Required Key: aws.String("ObjectKey"), // Required VersionID: aws.String("ObjectVersionId"), }, // More values... }, Quiet: aws.Boolean(true), }, MFA: aws.String("MFA"), RequestPayer: aws.String("RequestPayer"), } resp, err := svc.DeleteObjects(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleS3_HeadObject() { svc := s3.New(nil) params := &s3.HeadObjectInput{ Bucket: aws.String("BucketName"), // Required Key: aws.String("ObjectKey"), // Required IfMatch: aws.String("IfMatch"), IfModifiedSince: aws.Time(time.Now()), IfNoneMatch: aws.String("IfNoneMatch"), IfUnmodifiedSince: aws.Time(time.Now()), Range: aws.String("Range"), RequestPayer: aws.String("RequestPayer"), SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), SSECustomerKey: aws.String("SSECustomerKey"), SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), VersionID: aws.String("ObjectVersionId"), } resp, err := svc.HeadObject(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func TestCreateDistribution(t *testing.T) { client := cloudfront.New(nil) _, serr := client.CreateDistribution(&cloudfront.CreateDistributionInput{ DistributionConfig: &cloudfront.DistributionConfig{ CallerReference: aws.String("ID1"), Enabled: aws.Boolean(true), Comment: aws.String("A comment"), Origins: &cloudfront.Origins{Quantity: aws.Long(0)}, DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ ForwardedValues: &cloudfront.ForwardedValues{ Cookies: &cloudfront.CookiePreference{Forward: aws.String("cookie")}, QueryString: aws.Boolean(true), }, TargetOriginID: aws.String("origin"), TrustedSigners: &cloudfront.TrustedSigners{ Enabled: aws.Boolean(true), Quantity: aws.Long(0), }, ViewerProtocolPolicy: aws.String("policy"), MinTTL: aws.Long(0), }, }, }) err := aws.Error(serr) assert.NotNil(t, err) assert.Equal(t, "MalformedXML", err.Code) assertMatches(t, "validation errors detected", err.Message) }
func ExampleS3_PutBucketTagging() { svc := s3.New(nil) params := &s3.PutBucketTaggingInput{ Bucket: aws.String("BucketName"), // Required Tagging: &s3.Tagging{ // Required TagSet: []*s3.Tag{ // Required &s3.Tag{ // Required Key: aws.String("ObjectKey"), // Required Value: aws.String("Value"), // Required }, // More values... }, }, } resp, err := svc.PutBucketTagging(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRoute53_UpdateHealthCheck() { svc := route53.New(nil) params := &route53.UpdateHealthCheckInput{ HealthCheckID: aws.String("HealthCheckId"), // Required FailureThreshold: aws.Long(1), FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"), HealthCheckVersion: aws.Long(1), IPAddress: aws.String("IPAddress"), Port: aws.Long(1), ResourcePath: aws.String("ResourcePath"), SearchString: aws.String("SearchString"), } resp, err := svc.UpdateHealthCheck(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRoute53_ChangeTagsForResource() { svc := route53.New(nil) params := &route53.ChangeTagsForResourceInput{ ResourceID: aws.String("TagResourceId"), // Required ResourceType: aws.String("TagResourceType"), // Required AddTags: []*route53.Tag{ &route53.Tag{ // Required Key: aws.String("TagKey"), Value: aws.String("TagValue"), }, // More values... }, RemoveTagKeys: []*string{ aws.String("TagKey"), // Required // More values... }, } resp, err := svc.ChangeTagsForResource(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleELB_RemoveTags() { svc := elb.New(nil) params := &elb.RemoveTagsInput{ LoadBalancerNames: []*string{ // Required aws.String("AccessPointName"), // Required // More values... }, Tags: []*elb.TagKeyOnly{ // Required &elb.TagKeyOnly{ // Required Key: aws.String("TagKey"), }, // More values... }, } resp, err := svc.RemoveTags(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleELB_ConfigureHealthCheck() { svc := elb.New(nil) params := &elb.ConfigureHealthCheckInput{ HealthCheck: &elb.HealthCheck{ // Required HealthyThreshold: aws.Long(1), // Required Interval: aws.Long(1), // Required Target: aws.String("HealthCheckTarget"), // Required Timeout: aws.Long(1), // Required UnhealthyThreshold: aws.Long(1), // Required }, LoadBalancerName: aws.String("AccessPointName"), // Required } resp, err := svc.ConfigureHealthCheck(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleELB_RegisterInstancesWithLoadBalancer() { svc := elb.New(nil) params := &elb.RegisterInstancesWithLoadBalancerInput{ Instances: []*elb.Instance{ // Required &elb.Instance{ // Required InstanceID: aws.String("InstanceId"), }, // More values... }, LoadBalancerName: aws.String("AccessPointName"), // Required } resp, err := svc.RegisterInstancesWithLoadBalancer(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(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{ &elb.PolicyAttribute{ // Required AttributeName: aws.String("AttributeName"), AttributeValue: aws.String("AttributeValue"), }, // More values... }, } resp, err := svc.CreateLoadBalancerPolicy(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleELB_CreateLoadBalancerListeners() { svc := elb.New(nil) params := &elb.CreateLoadBalancerListenersInput{ Listeners: []*elb.Listener{ // Required &elb.Listener{ // Required InstancePort: aws.Long(1), // Required LoadBalancerPort: aws.Long(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 awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_DescribeDBLogFiles() { svc := rds.New(nil) params := &rds.DescribeDBLogFilesInput{ DBInstanceIdentifier: aws.String("String"), // Required FileLastWritten: aws.Long(1), FileSize: aws.Long(1), FilenameContains: aws.String("String"), Filters: []*rds.Filter{ &rds.Filter{ // Required Name: aws.String("String"), // Required Values: []*string{ // Required aws.String("String"), // Required // More values... }, }, // More values... }, Marker: aws.String("String"), MaxRecords: aws.Long(1), } resp, err := svc.DescribeDBLogFiles(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_ModifyEventSubscription() { svc := rds.New(nil) params := &rds.ModifyEventSubscriptionInput{ SubscriptionName: aws.String("String"), // Required Enabled: aws.Boolean(true), EventCategories: []*string{ aws.String("String"), // Required // More values... }, SNSTopicARN: aws.String("String"), SourceType: aws.String("String"), } resp, err := svc.ModifyEventSubscription(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_DescribeEventSubscriptions() { svc := rds.New(nil) params := &rds.DescribeEventSubscriptionsInput{ Filters: []*rds.Filter{ &rds.Filter{ // Required Name: aws.String("String"), // Required Values: []*string{ // Required aws.String("String"), // Required // More values... }, }, // More values... }, Marker: aws.String("String"), MaxRecords: aws.Long(1), SubscriptionName: aws.String("String"), } resp, err := svc.DescribeEventSubscriptions(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_PurchaseReservedDBInstancesOffering() { svc := rds.New(nil) params := &rds.PurchaseReservedDBInstancesOfferingInput{ ReservedDBInstancesOfferingID: aws.String("String"), // Required DBInstanceCount: aws.Long(1), ReservedDBInstanceID: aws.String("String"), Tags: []*rds.Tag{ &rds.Tag{ // Required Key: aws.String("String"), Value: aws.String("String"), }, // More values... }, } resp, err := svc.PurchaseReservedDBInstancesOffering(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleCloudTrail_LookupEvents() { svc := cloudtrail.New(nil) params := &cloudtrail.LookupEventsInput{ EndTime: aws.Time(time.Now()), LookupAttributes: []*cloudtrail.LookupAttribute{ &cloudtrail.LookupAttribute{ // Required AttributeKey: aws.String("LookupAttributeKey"), // Required AttributeValue: aws.String("String"), // Required }, // More values... }, MaxResults: aws.Long(1), NextToken: aws.String("NextToken"), StartTime: aws.Time(time.Now()), } resp, err := svc.LookupEvents(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_ResetDBParameterGroup() { svc := rds.New(nil) params := &rds.ResetDBParameterGroupInput{ DBParameterGroupName: aws.String("String"), // Required Parameters: []*rds.Parameter{ &rds.Parameter{ // Required AllowedValues: aws.String("String"), ApplyMethod: aws.String("ApplyMethod"), ApplyType: aws.String("String"), DataType: aws.String("String"), Description: aws.String("String"), IsModifiable: aws.Boolean(true), MinimumEngineVersion: aws.String("String"), ParameterName: aws.String("String"), ParameterValue: aws.String("String"), Source: aws.String("String"), }, // More values... }, ResetAllParameters: aws.Boolean(true), } resp, err := svc.ResetDBParameterGroup(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleS3_RestoreObject() { svc := s3.New(nil) params := &s3.RestoreObjectInput{ Bucket: aws.String("BucketName"), // Required Key: aws.String("ObjectKey"), // Required RequestPayer: aws.String("RequestPayer"), RestoreRequest: &s3.RestoreRequest{ Days: aws.Long(1), // Required }, VersionID: aws.String("ObjectVersionId"), } resp, err := svc.RestoreObject(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_CopyOptionGroup() { svc := rds.New(nil) params := &rds.CopyOptionGroupInput{ SourceOptionGroupIdentifier: aws.String("String"), // Required TargetOptionGroupDescription: aws.String("String"), // Required TargetOptionGroupIdentifier: aws.String("String"), // Required Tags: []*rds.Tag{ &rds.Tag{ // Required Key: aws.String("String"), Value: aws.String("String"), }, // More values... }, } resp, err := svc.CopyOptionGroup(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleS3_CompleteMultipartUpload() { svc := s3.New(nil) params := &s3.CompleteMultipartUploadInput{ Bucket: aws.String("BucketName"), // Required Key: aws.String("ObjectKey"), // Required UploadID: aws.String("MultipartUploadId"), // Required MultipartUpload: &s3.CompletedMultipartUpload{ Parts: []*s3.CompletedPart{ &s3.CompletedPart{ // Required ETag: aws.String("ETag"), PartNumber: aws.Long(1), }, // More values... }, }, RequestPayer: aws.String("RequestPayer"), } resp, err := svc.CompleteMultipartUpload(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_CreateDBSnapshot() { svc := rds.New(nil) params := &rds.CreateDBSnapshotInput{ DBInstanceIdentifier: aws.String("String"), // Required DBSnapshotIdentifier: aws.String("String"), // Required Tags: []*rds.Tag{ &rds.Tag{ // Required Key: aws.String("String"), Value: aws.String("String"), }, // More values... }, } resp, err := svc.CreateDBSnapshot(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleSSM_ListDocuments() { svc := ssm.New(nil) params := &ssm.ListDocumentsInput{ DocumentFilterList: []*ssm.DocumentFilter{ &ssm.DocumentFilter{ // Required Key: aws.String("DocumentFilterKey"), // Required Value: aws.String("DocumentFilterValue"), // Required }, // More values... }, MaxResults: aws.Long(1), NextToken: aws.String("NextToken"), } resp, err := svc.ListDocuments(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_AddTagsToResource() { svc := rds.New(nil) params := &rds.AddTagsToResourceInput{ ResourceName: aws.String("String"), // Required Tags: []*rds.Tag{ // Required &rds.Tag{ // Required Key: aws.String("String"), Value: aws.String("String"), }, // More values... }, } resp, err := svc.AddTagsToResource(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleSSM_CreateAssociationBatch() { svc := ssm.New(nil) params := &ssm.CreateAssociationBatchInput{ Entries: []*ssm.CreateAssociationBatchRequestEntry{ // Required &ssm.CreateAssociationBatchRequestEntry{ // Required InstanceID: aws.String("InstanceId"), Name: aws.String("DocumentName"), }, // More values... }, } resp, err := svc.CreateAssociationBatch(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleRDS_CreateDBSubnetGroup() { svc := rds.New(nil) params := &rds.CreateDBSubnetGroupInput{ DBSubnetGroupDescription: aws.String("String"), // Required DBSubnetGroupName: aws.String("String"), // Required SubnetIDs: []*string{ // Required aws.String("String"), // Required // More values... }, Tags: []*rds.Tag{ &rds.Tag{ // Required Key: aws.String("String"), Value: aws.String("String"), }, // More values... }, } resp, err := svc.CreateDBSubnetGroup(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleConfigService_GetResourceConfigHistory() { svc := configservice.New(nil) params := &configservice.GetResourceConfigHistoryInput{ ResourceID: aws.String("ResourceId"), // Required ResourceType: aws.String("ResourceType"), // Required ChronologicalOrder: aws.String("ChronologicalOrder"), EarlierTime: aws.Time(time.Now()), LaterTime: aws.Time(time.Now()), Limit: aws.Long(1), NextToken: aws.String("NextToken"), } resp, err := svc.GetResourceConfigHistory(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleCloudWatchLogs_GetLogEvents() { svc := cloudwatchlogs.New(nil) params := &cloudwatchlogs.GetLogEventsInput{ LogGroupName: aws.String("LogGroupName"), // Required LogStreamName: aws.String("LogStreamName"), // Required EndTime: aws.Long(1), Limit: aws.Long(1), NextToken: aws.String("NextToken"), StartFromHead: aws.Boolean(true), StartTime: aws.Long(1), } resp, err := svc.GetLogEvents(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }