Discuss you're experiences and questions with the Developer Preview AWS SDK for Go v2
jasdel on main
Release 2021-04-14 (compare)
jasdel on main
Update AWS API models (#1227) … (compare)
credentials.Credentials
value with that provider. v2 simplifies this by only having@kaihendry sorry missed your earlier request sorry, does the
cfg, err := external.LoadDefaultAWSConfig()
bucket := "my-bucket"
region, err := s3manager.GetBucketRegion(ctx, cfg, bucket, "us-west-2")
if err != nil {
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "NotFound" {
fmt.Fprintf(os.Stderr, "unable to find bucket %s's region not found\n", bucket)
}
return err
}
fmt.Printf("Bucket %s is in %s region\n", bucket, region)
example not work for you?
ListObjects
APIs.
Feedback
button in the bottom right corner.
ctx := aws.BackgroundContext()
<--- whatever that means
@kaihendry thanks for sharing. Minor feedback i'd have is the suggestion of instead of using two different endpoints /listhtml
and /listjson
use the same endpoint e.g. /list
and either use the Accept-Encoding
request header to determine the requested format, or use an extension on the resource like /list.json
. Mainly this suggestion is just for simplicity of the API given the two endpoints really do the same thing just output formatted differently.
Here is a common example, https://reddit.com/r/aws
will return HTML whereas https://reddit.com/r/aws.json
will return json data. Reddit only supports the ".json" extension method, though. But would be nice to support at least one of the two patterns.