2017-05-11 16:39:54 +02:00
|
|
|
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
|
|
|
|
|
|
|
package cloudfront_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2017-07-23 09:51:42 +02:00
|
|
|
"strings"
|
2017-05-11 16:39:54 +02:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
2017-07-23 09:51:42 +02:00
|
|
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
2017-05-11 16:39:54 +02:00
|
|
|
"github.com/aws/aws-sdk-go/aws/session"
|
|
|
|
"github.com/aws/aws-sdk-go/service/cloudfront"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ time.Duration
|
2017-07-23 09:51:42 +02:00
|
|
|
var _ strings.Reader
|
|
|
|
var _ aws.Config
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func parseTime(layout, value string) *time.Time {
|
|
|
|
t, err := time.Parse(layout, value)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
panic(err)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
2017-07-23 09:51:42 +02:00
|
|
|
return &t
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
func ExampleCloudFront_CreateCloudFrontOriginAccessIdentity_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.CreateCloudFrontOriginAccessIdentityInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.CreateCloudFrontOriginAccessIdentity(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeOriginAccessIdentityAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeOriginAccessIdentityAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCloudFrontOriginAccessIdentities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCloudFrontOriginAccessIdentities, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
func ExampleCloudFront_CreateDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.CreateDistributionInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.CreateDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeCNAMEAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeCNAMEAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeDistributionAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeDistributionAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOrigin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOrigin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyTrustedSigners:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyTrustedSigners, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTrustedSignerDoesNotExist:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTrustedSignerDoesNotExist, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidViewerCertificate:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidViewerCertificate, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidMinimumProtocolVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidMinimumProtocolVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributionCNAMEs:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributionCNAMEs, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributions:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributions, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidDefaultRootObject:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidDefaultRootObject, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidRelativePath:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidRelativePath, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidErrorCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidErrorCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidResponseCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidResponseCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidRequiredProtocol:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidRequiredProtocol, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchOrigin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchOrigin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyOrigins:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyOrigins, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCacheBehaviors:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCacheBehaviors, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCookieNamesInWhiteList:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCookieNamesInWhiteList, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidForwardCookies:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidForwardCookies, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyHeadersInForwardedValues:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyHeadersInForwardedValues, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidHeadersForS3Origin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidHeadersForS3Origin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCertificates:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCertificates, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidLocationCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidLocationCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidGeoRestrictionParameter:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidGeoRestrictionParameter, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidProtocolSettings:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidProtocolSettings, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidTTLOrder:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidTTLOrder, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidWebACLId:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidWebACLId, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyOriginCustomHeaders:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyOriginCustomHeaders, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyQueryStringParameters:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyQueryStringParameters, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidQueryStringParameters:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidQueryStringParameters, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributionsWithLambdaAssociations:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributionsWithLambdaAssociations, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyLambdaFunctionAssociations:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyLambdaFunctionAssociations, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidLambdaFunctionAssociation:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidLambdaFunctionAssociation, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginReadTimeout:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginReadTimeout, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginKeepaliveTimeout:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginKeepaliveTimeout, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
func ExampleCloudFront_CreateDistributionWithTags_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.CreateDistributionWithTagsInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.CreateDistributionWithTags(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeCNAMEAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeCNAMEAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeDistributionAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeDistributionAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOrigin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOrigin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyTrustedSigners:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyTrustedSigners, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTrustedSignerDoesNotExist:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTrustedSignerDoesNotExist, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidViewerCertificate:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidViewerCertificate, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidMinimumProtocolVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidMinimumProtocolVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributionCNAMEs:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributionCNAMEs, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributions:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributions, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidDefaultRootObject:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidDefaultRootObject, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidRelativePath:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidRelativePath, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidErrorCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidErrorCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidResponseCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidResponseCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidRequiredProtocol:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidRequiredProtocol, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchOrigin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchOrigin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyOrigins:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyOrigins, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCacheBehaviors:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCacheBehaviors, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCookieNamesInWhiteList:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCookieNamesInWhiteList, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidForwardCookies:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidForwardCookies, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyHeadersInForwardedValues:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyHeadersInForwardedValues, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidHeadersForS3Origin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidHeadersForS3Origin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCertificates:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCertificates, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidLocationCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidLocationCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidGeoRestrictionParameter:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidGeoRestrictionParameter, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidProtocolSettings:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidProtocolSettings, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidTTLOrder:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidTTLOrder, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidWebACLId:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidWebACLId, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyOriginCustomHeaders:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyOriginCustomHeaders, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidTagging:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidTagging, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyQueryStringParameters:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyQueryStringParameters, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidQueryStringParameters:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidQueryStringParameters, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributionsWithLambdaAssociations:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributionsWithLambdaAssociations, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyLambdaFunctionAssociations:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyLambdaFunctionAssociations, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidLambdaFunctionAssociation:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidLambdaFunctionAssociation, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginReadTimeout:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginReadTimeout, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginKeepaliveTimeout:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginKeepaliveTimeout, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
func ExampleCloudFront_CreateInvalidation_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.CreateInvalidationInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.CreateInvalidation(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeBatchTooLarge:
|
|
|
|
fmt.Println(cloudfront.ErrCodeBatchTooLarge, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyInvalidationsInProgress:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyInvalidationsInProgress, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_CreateStreamingDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.CreateStreamingDistributionInput{}
|
|
|
|
|
|
|
|
result, err := svc.CreateStreamingDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeCNAMEAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeCNAMEAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeStreamingDistributionAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeStreamingDistributionAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOrigin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOrigin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyTrustedSigners:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyTrustedSigners, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTrustedSignerDoesNotExist:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTrustedSignerDoesNotExist, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyStreamingDistributionCNAMEs:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyStreamingDistributionCNAMEs, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyStreamingDistributions:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyStreamingDistributions, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_DeleteCloudFrontOriginAccessIdentity_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.DeleteCloudFrontOriginAccessIdentityInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.DeleteCloudFrontOriginAccessIdentity(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidIfMatchVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidIfMatchVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodePreconditionFailed:
|
|
|
|
fmt.Println(cloudfront.ErrCodePreconditionFailed, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeOriginAccessIdentityInUse:
|
|
|
|
fmt.Println(cloudfront.ErrCodeOriginAccessIdentityInUse, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_DeleteDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.DeleteDistributionInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.DeleteDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeDistributionNotDisabled:
|
|
|
|
fmt.Println(cloudfront.ErrCodeDistributionNotDisabled, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidIfMatchVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidIfMatchVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodePreconditionFailed:
|
|
|
|
fmt.Println(cloudfront.ErrCodePreconditionFailed, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_DeleteStreamingDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.DeleteStreamingDistributionInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.DeleteStreamingDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeStreamingDistributionNotDisabled:
|
|
|
|
fmt.Println(cloudfront.ErrCodeStreamingDistributionNotDisabled, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidIfMatchVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidIfMatchVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchStreamingDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchStreamingDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodePreconditionFailed:
|
|
|
|
fmt.Println(cloudfront.ErrCodePreconditionFailed, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_GetCloudFrontOriginAccessIdentity_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.GetCloudFrontOriginAccessIdentityInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.GetCloudFrontOriginAccessIdentity(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_GetCloudFrontOriginAccessIdentityConfig_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.GetCloudFrontOriginAccessIdentityConfigInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.GetCloudFrontOriginAccessIdentityConfig(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_GetDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.GetDistributionInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.GetDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeNoSuchDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_GetDistributionConfig_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.GetDistributionConfigInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.GetDistributionConfig(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeNoSuchDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_GetInvalidation_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.GetInvalidationInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.GetInvalidation(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeNoSuchInvalidation:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchInvalidation, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_GetStreamingDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.GetStreamingDistributionInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.GetStreamingDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeNoSuchStreamingDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchStreamingDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_GetStreamingDistributionConfig_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.GetStreamingDistributionConfigInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.GetStreamingDistributionConfig(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeNoSuchStreamingDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchStreamingDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_ListCloudFrontOriginAccessIdentities_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.ListCloudFrontOriginAccessIdentitiesInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.ListCloudFrontOriginAccessIdentities(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_ListDistributions_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.ListDistributionsInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.ListDistributions(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_ListDistributionsByWebACLId_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.ListDistributionsByWebACLIdInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.ListDistributionsByWebACLId(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidWebACLId:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidWebACLId, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_ListInvalidations_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.ListInvalidationsInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.ListInvalidations(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_ListStreamingDistributions_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.ListStreamingDistributionsInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.ListStreamingDistributions(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_ListTagsForResource_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.ListTagsForResourceInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.ListTagsForResource(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidTagging:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidTagging, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchResource:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchResource, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
func ExampleCloudFront_TagResource_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.TagResourceInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.TagResource(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidTagging:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidTagging, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchResource:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchResource, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_UntagResource_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.UntagResourceInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.UntagResource(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidTagging:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidTagging, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchResource:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchResource, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.UpdateCloudFrontOriginAccessIdentity(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeIllegalUpdate:
|
|
|
|
fmt.Println(cloudfront.ErrCodeIllegalUpdate, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidIfMatchVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidIfMatchVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchCloudFrontOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodePreconditionFailed:
|
|
|
|
fmt.Println(cloudfront.ErrCodePreconditionFailed, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
func ExampleCloudFront_UpdateDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.UpdateDistributionInput{}
|
|
|
|
|
|
|
|
result, err := svc.UpdateDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeCNAMEAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeCNAMEAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeIllegalUpdate:
|
|
|
|
fmt.Println(cloudfront.ErrCodeIllegalUpdate, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidIfMatchVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidIfMatchVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodePreconditionFailed:
|
|
|
|
fmt.Println(cloudfront.ErrCodePreconditionFailed, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributionCNAMEs:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributionCNAMEs, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidDefaultRootObject:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidDefaultRootObject, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidRelativePath:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidRelativePath, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidErrorCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidErrorCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidResponseCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidResponseCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyTrustedSigners:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyTrustedSigners, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTrustedSignerDoesNotExist:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTrustedSignerDoesNotExist, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidViewerCertificate:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidViewerCertificate, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidMinimumProtocolVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidMinimumProtocolVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidRequiredProtocol:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidRequiredProtocol, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchOrigin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchOrigin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyOrigins:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyOrigins, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCacheBehaviors:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCacheBehaviors, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCookieNamesInWhiteList:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCookieNamesInWhiteList, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidForwardCookies:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidForwardCookies, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyHeadersInForwardedValues:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyHeadersInForwardedValues, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidHeadersForS3Origin:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidHeadersForS3Origin, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyCertificates:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyCertificates, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidLocationCode:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidLocationCode, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidGeoRestrictionParameter:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidGeoRestrictionParameter, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidTTLOrder:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidTTLOrder, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidWebACLId:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidWebACLId, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyOriginCustomHeaders:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyOriginCustomHeaders, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyQueryStringParameters:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyQueryStringParameters, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidQueryStringParameters:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidQueryStringParameters, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyDistributionsWithLambdaAssociations:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyDistributionsWithLambdaAssociations, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyLambdaFunctionAssociations:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyLambdaFunctionAssociations, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidLambdaFunctionAssociation:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidLambdaFunctionAssociation, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginReadTimeout:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginReadTimeout, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginKeepaliveTimeout:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginKeepaliveTimeout, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
func ExampleCloudFront_UpdateStreamingDistribution_shared00() {
|
|
|
|
svc := cloudfront.New(session.New())
|
|
|
|
input := &cloudfront.UpdateStreamingDistributionInput{}
|
2017-05-11 16:39:54 +02:00
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
result, err := svc.UpdateStreamingDistribution(input)
|
2017-05-11 16:39:54 +02:00
|
|
|
if err != nil {
|
2017-07-23 09:51:42 +02:00
|
|
|
if aerr, ok := err.(awserr.Error); ok {
|
|
|
|
switch aerr.Code() {
|
|
|
|
case cloudfront.ErrCodeAccessDenied:
|
|
|
|
fmt.Println(cloudfront.ErrCodeAccessDenied, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeCNAMEAlreadyExists:
|
|
|
|
fmt.Println(cloudfront.ErrCodeCNAMEAlreadyExists, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeIllegalUpdate:
|
|
|
|
fmt.Println(cloudfront.ErrCodeIllegalUpdate, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidIfMatchVersion:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidIfMatchVersion, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeMissingBody:
|
|
|
|
fmt.Println(cloudfront.ErrCodeMissingBody, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeNoSuchStreamingDistribution:
|
|
|
|
fmt.Println(cloudfront.ErrCodeNoSuchStreamingDistribution, aerr.Error())
|
|
|
|
case cloudfront.ErrCodePreconditionFailed:
|
|
|
|
fmt.Println(cloudfront.ErrCodePreconditionFailed, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyStreamingDistributionCNAMEs:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyStreamingDistributionCNAMEs, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidArgument:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidArgument, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInvalidOriginAccessIdentity:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInvalidOriginAccessIdentity, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTooManyTrustedSigners:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTooManyTrustedSigners, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeTrustedSignerDoesNotExist:
|
|
|
|
fmt.Println(cloudfront.ErrCodeTrustedSignerDoesNotExist, aerr.Error())
|
|
|
|
case cloudfront.ErrCodeInconsistentQuantities:
|
|
|
|
fmt.Println(cloudfront.ErrCodeInconsistentQuantities, aerr.Error())
|
|
|
|
default:
|
|
|
|
fmt.Println(aerr.Error())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Print the error, cast err to awserr.Error to get the Code and
|
|
|
|
// Message from an error.
|
|
|
|
fmt.Println(err.Error())
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2017-07-23 09:51:42 +02:00
|
|
|
fmt.Println(result)
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|