func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() { svc := cloudfront.New(nil) params := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{ CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required CallerReference: aws.String("string"), // Required Comment: aws.String("string"), // Required }, ID: aws.String("string"), // Required IfMatch: aws.String("string"), } resp, err := svc.UpdateCloudFrontOriginAccessIdentity(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudFront_ListStreamingDistributions() { svc := cloudfront.New(nil) params := &cloudfront.ListStreamingDistributionsInput{ Marker: aws.String("string"), MaxItems: aws.Int64(1), } resp, err := svc.ListStreamingDistributions(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudFront_UpdateStreamingDistribution() { svc := cloudfront.New(nil) params := &cloudfront.UpdateStreamingDistributionInput{ ID: aws.String("string"), // Required StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required CallerReference: aws.String("string"), // Required Comment: aws.String("string"), // Required Enabled: aws.Bool(true), // Required S3Origin: &cloudfront.S3Origin{ // Required DomainName: aws.String("string"), // Required OriginAccessIdentity: aws.String("string"), // Required }, TrustedSigners: &cloudfront.TrustedSigners{ // Required Enabled: aws.Bool(true), // Required Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, Aliases: &cloudfront.Aliases{ Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, Logging: &cloudfront.StreamingLoggingConfig{ Bucket: aws.String("string"), // Required Enabled: aws.Bool(true), // Required Prefix: aws.String("string"), // Required }, PriceClass: aws.String("PriceClass"), }, IfMatch: aws.String("string"), } resp, err := svc.UpdateStreamingDistribution(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCloudFront_CreateInvalidation() { svc := cloudfront.New(nil) params := &cloudfront.CreateInvalidationInput{ DistributionID: aws.String("string"), // Required InvalidationBatch: &cloudfront.InvalidationBatch{ // Required CallerReference: aws.String("string"), // Required Paths: &cloudfront.Paths{ // Required Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, }, } resp, err := svc.CreateInvalidation(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func init() { Before("@cloudfront", func() { World["client"] = cloudfront.New(nil) }) }
func TestInterface(t *testing.T) { assert.Implements(t, (*cloudfrontiface.CloudFrontAPI)(nil), cloudfront.New(nil)) }
func ExampleCloudFront_UpdateDistribution() { svc := cloudfront.New(nil) params := &cloudfront.UpdateDistributionInput{ DistributionConfig: &cloudfront.DistributionConfig{ // Required CallerReference: aws.String("string"), // Required Comment: aws.String("string"), // Required DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required ForwardedValues: &cloudfront.ForwardedValues{ // Required Cookies: &cloudfront.CookiePreference{ // Required Forward: aws.String("ItemSelection"), // Required WhitelistedNames: &cloudfront.CookieNames{ Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, }, QueryString: aws.Bool(true), // Required Headers: &cloudfront.Headers{ Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, }, MinTTL: aws.Int64(1), // Required TargetOriginID: aws.String("string"), // Required TrustedSigners: &cloudfront.TrustedSigners{ // Required Enabled: aws.Bool(true), // Required Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required AllowedMethods: &cloudfront.AllowedMethods{ Items: []*string{ // Required aws.String("Method"), // Required // More values... }, Quantity: aws.Int64(1), // Required CachedMethods: &cloudfront.CachedMethods{ Items: []*string{ // Required aws.String("Method"), // Required // More values... }, Quantity: aws.Int64(1), // Required }, }, DefaultTTL: aws.Int64(1), MaxTTL: aws.Int64(1), SmoothStreaming: aws.Bool(true), }, Enabled: aws.Bool(true), // Required Origins: &cloudfront.Origins{ // Required Quantity: aws.Int64(1), // Required Items: []*cloudfront.Origin{ { // Required DomainName: aws.String("string"), // Required ID: aws.String("string"), // Required CustomOriginConfig: &cloudfront.CustomOriginConfig{ HTTPPort: aws.Int64(1), // Required HTTPSPort: aws.Int64(1), // Required OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required }, OriginPath: aws.String("string"), S3OriginConfig: &cloudfront.S3OriginConfig{ OriginAccessIdentity: aws.String("string"), // Required }, }, // More values... }, }, Aliases: &cloudfront.Aliases{ Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, CacheBehaviors: &cloudfront.CacheBehaviors{ Quantity: aws.Int64(1), // Required Items: []*cloudfront.CacheBehavior{ { // Required ForwardedValues: &cloudfront.ForwardedValues{ // Required Cookies: &cloudfront.CookiePreference{ // Required Forward: aws.String("ItemSelection"), // Required WhitelistedNames: &cloudfront.CookieNames{ Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, }, QueryString: aws.Bool(true), // Required Headers: &cloudfront.Headers{ Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, }, MinTTL: aws.Int64(1), // Required PathPattern: aws.String("string"), // Required TargetOriginID: aws.String("string"), // Required TrustedSigners: &cloudfront.TrustedSigners{ // Required Enabled: aws.Bool(true), // Required Quantity: aws.Int64(1), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required AllowedMethods: &cloudfront.AllowedMethods{ Items: []*string{ // Required aws.String("Method"), // Required // More values... }, Quantity: aws.Int64(1), // Required CachedMethods: &cloudfront.CachedMethods{ Items: []*string{ // Required aws.String("Method"), // Required // More values... }, Quantity: aws.Int64(1), // Required }, }, DefaultTTL: aws.Int64(1), MaxTTL: aws.Int64(1), SmoothStreaming: aws.Bool(true), }, // More values... }, }, CustomErrorResponses: &cloudfront.CustomErrorResponses{ Quantity: aws.Int64(1), // Required Items: []*cloudfront.CustomErrorResponse{ { // Required ErrorCode: aws.Int64(1), // Required ErrorCachingMinTTL: aws.Int64(1), ResponseCode: aws.String("string"), ResponsePagePath: aws.String("string"), }, // More values... }, }, DefaultRootObject: aws.String("string"), Logging: &cloudfront.LoggingConfig{ Bucket: aws.String("string"), // Required Enabled: aws.Bool(true), // Required IncludeCookies: aws.Bool(true), // Required Prefix: aws.String("string"), // Required }, PriceClass: aws.String("PriceClass"), Restrictions: &cloudfront.Restrictions{ GeoRestriction: &cloudfront.GeoRestriction{ // Required Quantity: aws.Int64(1), // Required RestrictionType: aws.String("GeoRestrictionType"), // Required Items: []*string{ aws.String("string"), // Required // More values... }, }, }, ViewerCertificate: &cloudfront.ViewerCertificate{ CloudFrontDefaultCertificate: aws.Bool(true), IAMCertificateID: aws.String("string"), MinimumProtocolVersion: aws.String("MinimumProtocolVersion"), SSLSupportMethod: aws.String("SSLSupportMethod"), }, }, ID: aws.String("string"), // Required IfMatch: aws.String("string"), } resp, err := svc.UpdateDistribution(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }