Skip to content

Commit

Permalink
Added note on anonymous credentials usage for GetBucketRegion
Browse files Browse the repository at this point in the history
Signed-off-by: Tiger Kaovilai <[email protected]>
  • Loading branch information
kaovilai committed Jul 17, 2024
1 parent 44aa01f commit 6268101
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion feature/s3/manager/bucket_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const bucketRegionHeader = "X-Amz-Bucket-Region"
// GetBucketRegion will attempt to get the region for a bucket using the
// client's configured region to determine which AWS partition to perform the query on.
//
// The request will not be signed, and will not use your AWS credentials.
// The request will not be signed.
//
// A BucketNotFound error will be returned if the bucket does not exist in the
// AWS partition the client region belongs to.
Expand Down Expand Up @@ -60,6 +60,14 @@ const bucketRegionHeader = "X-Amz-Bucket-Region"
// if err != nil {
// panic(err)
// }
//
// If buckets are public, you may use anonymous credential like so.
// manager.GetBucketRegion(ctx, s3.NewFromConfig(cfg), bucket, func(o *s3.Options) {
// o.Credentials = nil
// // Or
// o.Credentials = aws.AnonymousCredentials{}
// })
// Otherwise credentials would be required for private buckets.
func GetBucketRegion(ctx context.Context, client HeadBucketAPIClient, bucket string, optFns ...func(*s3.Options)) (string, error) {
var captureBucketRegion deserializeBucketRegion

Expand Down

0 comments on commit 6268101

Please sign in to comment.