]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
deploy: Update InvalidateCloudFront to use Go CDK helper
authorOleksandr Redko <Oleksandr_Redko@epam.com>
Mon, 21 Aug 2023 13:09:15 +0000 (16:09 +0300)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 21 Aug 2023 14:57:41 +0000 (16:57 +0200)
deploy/cloudfront.go

index 2f6d94b187952dd12793744edd551bd6414d9870..2f673dc97b22fb23e6d4921904dccf68b69923c6 100644 (file)
@@ -21,21 +21,14 @@ import (
        "time"
 
        "github.com/aws/aws-sdk-go/aws"
-       "github.com/aws/aws-sdk-go/aws/session"
        "github.com/aws/aws-sdk-go/service/cloudfront"
+       gcaws "gocloud.dev/aws"
 )
 
 // InvalidateCloudFront invalidates the CloudFront cache for distributionID.
 // It uses the default AWS credentials from the environment.
 func InvalidateCloudFront(ctx context.Context, distributionID string) error {
-       // SharedConfigEnable enables loading "shared config (~/.aws/config) and
-       // shared credentials (~/.aws/credentials) files".
-       // See https://docs.aws.amazon.com/sdk-for-go/api/aws/session/ for more
-       // details.
-       // This is the same codepath used by Go CDK when creating an s3 URL.
-       // TODO: Update this to a Go CDK helper once available
-       // (https://github.com/google/go-cloud/issues/2003).
-       sess, err := session.NewSessionWithOptions(session.Options{SharedConfigState: session.SharedConfigEnable})
+       sess, err := gcaws.NewDefaultSession()
        if err != nil {
                return err
        }