diff options
author | Franky W <[email protected]> | 2022-04-28 19:43:30 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-01-31 22:12:48 +0100 |
commit | a1c64989df475fad2a2d30224167398b4382ec5a (patch) | |
tree | 0f6f16338534e0681dd1a0ff1ae26189bd9af6b2 /deploy | |
parent | 6c3b6ba3e6ccc220cbca9cc83fab78db0a78604e (diff) | |
download | hugo-a1c64989df475fad2a2d30224167398b4382ec5a.tar.gz hugo-a1c64989df475fad2a2d30224167398b4382ec5a.zip |
Upgrade to deploy to use AWS SDK V2
Diffstat (limited to 'deploy')
-rw-r--r-- | deploy/cloudfront.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/deploy/cloudfront.go b/deploy/cloudfront.go index 8ed9b858d..a91126c5d 100644 --- a/deploy/cloudfront.go +++ b/deploy/cloudfront.go @@ -21,8 +21,9 @@ import ( "net/url" "time" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/cloudfront" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/cloudfront" + "github.com/aws/aws-sdk-go-v2/service/cloudfront/types" gcaws "gocloud.dev/aws" ) @@ -33,20 +34,21 @@ func InvalidateCloudFront(ctx context.Context, target *Target) error { if err != nil { return err } - sess, _, err := gcaws.NewSessionFromURLParams(u.Query()) + cfg, err := gcaws.V2ConfigFromURLParams(ctx, u.Query()) if err != nil { return err } + cf := cloudfront.NewFromConfig(cfg) req := &cloudfront.CreateInvalidationInput{ DistributionId: aws.String(target.CloudFrontDistributionID), - InvalidationBatch: &cloudfront.InvalidationBatch{ + InvalidationBatch: &types.InvalidationBatch{ CallerReference: aws.String(time.Now().Format("20060102150405")), - Paths: &cloudfront.Paths{ - Items: []*string{aws.String("/*")}, - Quantity: aws.Int64(1), + Paths: &types.Paths{ + Items: []string{"/*"}, + Quantity: aws.Int32(1), }, }, } - _, err = cloudfront.New(sess).CreateInvalidationWithContext(ctx, req) + _, err = cf.CreateInvalidation(ctx, req) return err } |