コード例 #1
0
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))
}
コード例 #2
0
func TestValidateCRC32AlreadyErrorSkip(t *testing.T) {
	req := mockCRCResponse(db, 400, "{}", "1234")
	assert.Error(t, req.Error)

	aerr := aws.Error(req.Error)
	assert.NotEqual(t, "CRC32CheckFailed", aerr.Code)
}
コード例 #3
0
func ExampleLambda_UploadFunction() {
	svc := lambda.New(nil)

	params := &lambda.UploadFunctionInput{
		FunctionName: aws.String("FunctionName"),         // Required
		FunctionZip:  bytes.NewReader([]byte("PAYLOAD")), // Required
		Handler:      aws.String("Handler"),              // Required
		Mode:         aws.String("Mode"),                 // Required
		Role:         aws.String("RoleArn"),              // Required
		Runtime:      aws.String("Runtime"),              // Required
		Description:  aws.String("Description"),
		MemorySize:   aws.Long(1),
		Timeout:      aws.Long(1),
	}
	resp, err := svc.UploadFunction(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))
}
コード例 #4
0
func ExampleS3_ListObjectVersions() {
	svc := s3.New(nil)

	params := &s3.ListObjectVersionsInput{
		Bucket:          aws.String("BucketName"), // Required
		Delimiter:       aws.String("Delimiter"),
		EncodingType:    aws.String("EncodingType"),
		KeyMarker:       aws.String("KeyMarker"),
		MaxKeys:         aws.Long(1),
		Prefix:          aws.String("Prefix"),
		VersionIDMarker: aws.String("VersionIdMarker"),
	}
	resp, err := svc.ListObjectVersions(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))
}
コード例 #5
0
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))
}
コード例 #6
0
func ExampleS3_UploadPartCopy() {
	svc := s3.New(nil)

	params := &s3.UploadPartCopyInput{
		Bucket:                         aws.String("BucketName"),        // Required
		CopySource:                     aws.String("CopySource"),        // Required
		Key:                            aws.String("ObjectKey"),         // Required
		PartNumber:                     aws.Long(1),                     // Required
		UploadID:                       aws.String("MultipartUploadId"), // Required
		CopySourceIfMatch:              aws.String("CopySourceIfMatch"),
		CopySourceIfModifiedSince:      aws.Time(time.Now()),
		CopySourceIfNoneMatch:          aws.String("CopySourceIfNoneMatch"),
		CopySourceIfUnmodifiedSince:    aws.Time(time.Now()),
		CopySourceRange:                aws.String("CopySourceRange"),
		CopySourceSSECustomerAlgorithm: aws.String("CopySourceSSECustomerAlgorithm"),
		CopySourceSSECustomerKey:       aws.String("CopySourceSSECustomerKey"),
		CopySourceSSECustomerKeyMD5:    aws.String("CopySourceSSECustomerKeyMD5"),
		RequestPayer:                   aws.String("RequestPayer"),
		SSECustomerAlgorithm:           aws.String("SSECustomerAlgorithm"),
		SSECustomerKey:                 aws.String("SSECustomerKey"),
		SSECustomerKeyMD5:              aws.String("SSECustomerKeyMD5"),
	}
	resp, err := svc.UploadPartCopy(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))
}
コード例 #7
0
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))
}
コード例 #8
0
func ExampleRDS_DescribeDBEngineVersions() {
	svc := rds.New(nil)

	params := &rds.DescribeDBEngineVersionsInput{
		DBParameterGroupFamily: aws.String("String"),
		DefaultOnly:            aws.Boolean(true),
		Engine:                 aws.String("String"),
		EngineVersion:          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...
		},
		ListSupportedCharacterSets: aws.Boolean(true),
		Marker:     aws.String("String"),
		MaxRecords: aws.Long(1),
	}
	resp, err := svc.DescribeDBEngineVersions(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))
}
コード例 #9
0
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))
}
コード例 #10
0
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))
}
コード例 #11
0
func ExampleRDS_CreateOptionGroup() {
	svc := rds.New(nil)

	params := &rds.CreateOptionGroupInput{
		EngineName:             aws.String("String"), // Required
		MajorEngineVersion:     aws.String("String"), // Required
		OptionGroupDescription: aws.String("String"), // Required
		OptionGroupName:        aws.String("String"), // Required
		Tags: []*rds.Tag{
			&rds.Tag{ // Required
				Key:   aws.String("String"),
				Value: aws.String("String"),
			},
			// More values...
		},
	}
	resp, err := svc.CreateOptionGroup(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))
}
コード例 #12
0
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))
}
コード例 #13
0
func ExampleRDS_CreateDBInstance() {
	svc := rds.New(nil)

	params := &rds.CreateDBInstanceInput{
		AllocatedStorage:        aws.Long(1),          // Required
		DBInstanceClass:         aws.String("String"), // Required
		DBInstanceIdentifier:    aws.String("String"), // Required
		Engine:                  aws.String("String"), // Required
		MasterUserPassword:      aws.String("String"), // Required
		MasterUsername:          aws.String("String"), // Required
		AutoMinorVersionUpgrade: aws.Boolean(true),
		AvailabilityZone:        aws.String("String"),
		BackupRetentionPeriod:   aws.Long(1),
		CharacterSetName:        aws.String("String"),
		DBName:                  aws.String("String"),
		DBParameterGroupName:    aws.String("String"),
		DBSecurityGroups: []*string{
			aws.String("String"), // Required
			// More values...
		},
		DBSubnetGroupName: aws.String("String"),
		EngineVersion:     aws.String("String"),
		IOPS:              aws.Long(1),
		KMSKeyID:          aws.String("String"),
		LicenseModel:      aws.String("String"),
		MultiAZ:           aws.Boolean(true),
		OptionGroupName:   aws.String("String"),
		Port:              aws.Long(1),
		PreferredBackupWindow:      aws.String("String"),
		PreferredMaintenanceWindow: aws.String("String"),
		PubliclyAccessible:         aws.Boolean(true),
		StorageEncrypted:           aws.Boolean(true),
		StorageType:                aws.String("String"),
		TDECredentialARN:           aws.String("String"),
		TDECredentialPassword:      aws.String("String"),
		Tags: []*rds.Tag{
			&rds.Tag{ // Required
				Key:   aws.String("String"),
				Value: aws.String("String"),
			},
			// More values...
		},
		VPCSecurityGroupIDs: []*string{
			aws.String("String"), // Required
			// More values...
		},
	}
	resp, err := svc.CreateDBInstance(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))
}
コード例 #14
0
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))
}
コード例 #15
0
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))
}
コード例 #16
0
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))
}
コード例 #17
0
func ExampleS3_UploadPart() {
	svc := s3.New(nil)

	params := &s3.UploadPartInput{
		Bucket:               aws.String("BucketName"),        // Required
		Key:                  aws.String("ObjectKey"),         // Required
		PartNumber:           aws.Long(1),                     // Required
		UploadID:             aws.String("MultipartUploadId"), // Required
		Body:                 bytes.NewReader([]byte("PAYLOAD")),
		ContentLength:        aws.Long(1),
		RequestPayer:         aws.String("RequestPayer"),
		SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
		SSECustomerKey:       aws.String("SSECustomerKey"),
		SSECustomerKeyMD5:    aws.String("SSECustomerKeyMD5"),
	}
	resp, err := svc.UploadPart(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))
}
コード例 #18
0
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)
}
コード例 #19
0
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))
}
コード例 #20
0
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))
}
コード例 #21
0
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))
}
コード例 #22
0
func ExampleCloudTrail_UpdateTrail() {
	svc := cloudtrail.New(nil)

	params := &cloudtrail.UpdateTrailInput{
		Name: aws.String("String"), // Required
		CloudWatchLogsLogGroupARN:  aws.String("String"),
		CloudWatchLogsRoleARN:      aws.String("String"),
		IncludeGlobalServiceEvents: aws.Boolean(true),
		S3BucketName:               aws.String("String"),
		S3KeyPrefix:                aws.String("String"),
		SNSTopicName:               aws.String("String"),
	}
	resp, err := svc.UpdateTrail(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))
}
コード例 #23
0
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))
}
コード例 #24
0
func ExampleS3_PutBucketReplication() {
	svc := s3.New(nil)

	params := &s3.PutBucketReplicationInput{
		Bucket: aws.String("BucketName"), // Required
		ReplicationConfiguration: &s3.ReplicationConfiguration{ // Required
			Role: aws.String("Role"), // Required
			Rules: []*s3.ReplicationRule{ // Required
				&s3.ReplicationRule{ // Required
					Destination: &s3.Destination{ // Required
						Bucket: aws.String("BucketName"), // Required
					},
					Prefix: aws.String("Prefix"),                // Required
					Status: aws.String("ReplicationRuleStatus"), // Required
					ID:     aws.String("ID"),
				},
				// More values...
			},
		},
	}
	resp, err := svc.PutBucketReplication(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))
}
コード例 #25
0
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))
}
コード例 #26
0
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))
}
コード例 #27
0
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))
}
コード例 #28
0
func ExampleS3_CreateBucket() {
	svc := s3.New(nil)

	params := &s3.CreateBucketInput{
		Bucket: aws.String("BucketName"), // Required
		ACL:    aws.String("BucketCannedACL"),
		CreateBucketConfiguration: &s3.CreateBucketConfiguration{
			LocationConstraint: aws.String("BucketLocationConstraint"),
		},
		GrantFullControl: aws.String("GrantFullControl"),
		GrantRead:        aws.String("GrantRead"),
		GrantReadACP:     aws.String("GrantReadACP"),
		GrantWrite:       aws.String("GrantWrite"),
		GrantWriteACP:    aws.String("GrantWriteACP"),
	}
	resp, err := svc.CreateBucket(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))
}
コード例 #29
0
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))
}
コード例 #30
0
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))
}