Open taylor-sutton opened 10 months ago
Hi @taylor-sutton ,
Thanks for reaching out. If you did not know, all of the AWS SDKs are code generated from the API models of each AWS service. In this case, S3 did not specify this as an error type in their model as you can see here (linking v1 model since v2 model is in raw format):
"GetBucketTagging":{
"name":"GetBucketTagging",
"http":{
"method":"GET",
"requestUri":"/{Bucket}?tagging"
},
"input":{"shape":"GetBucketTaggingRequest"},
"output":{"shape":"GetBucketTaggingOutput"},
"documentationUrl":"http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGETtagging.html",
"staticContextParams":{
"UseS3ExpressControlEndpoint":{"value":true}
}
},
As seen in this operation definition, this is missing an errors
array containing all the possible errors an operation can return.
Here is an example of how a modeled error should look like:
"HeadBucket":{
"name":"HeadBucket",
"http":{
"method":"HEAD",
"requestUri":"/{Bucket}"
},
"input":{"shape":"HeadBucketRequest"},
"output":{"shape":"HeadBucketOutput"},
"errors":[
{"shape":"NoSuchBucket"}
],
"documentationUrl":"http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketHEAD.html"
},
Since the S3 team did not specify this as an error type in their API, the SDK will not generate a concrete type for it, and there is nothing we can do on the SDK side to introduce this without a model change. Here is a related issue on the JS SDK basically referring to the same problem with headBucket
not modeling other errors.
The S3 team is slow to introduce changes to their API model, so they supplement it by adding relevant documentation as seen in the doc string you linked.
Error code: NoSuchTagSet
Description: There is no tag set associated with the bucket.
So you could get around this by simply doing string comparison which should be safe.
if err != nil {
if strings.Contains(err.Error(), "NoSuchTagSet") {
fmt.Println("NoSuchTagSet error occurred")
}
}
Thanks, Ran~
Hi @RanVaknin , thanks for your response. Is there an appropriate place I can nudge (or add to an existing nudge) the S3 team to update their data model?
Since it sounds like there is nothing on the SDK side, feel free to close this issue.
Hi @taylor-sutton , Thanks for your patience.
I have created another internal ticket with the S3 team with very detailed instructions on what needs to change on their backend to make it as easy of a change as possible.
I just want to set your expectation that S3 is an enormous team both in terms of the size of the organization and the amount of work they handle, so it might take a while until this ticket makes it to the right person, and until it gets prioritzied.
One thing you can do is create your own internal ticket via the AWS developer console and refer to the ticket I have created P112680375
. This should help push this in the right direction.
Transferring to the cross-sdk repo for further tracking.
Thanks again, Ran~
Describe the bug
As per https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html - the GetBucketTagging operation can return with a code NoSuchTagSet. However in s3 types, there is no corresponding error type.
Expected Behavior
I am able to refer to a
types.NoSuchTagSet
to type-safely check for this error.Current Behavior
I get the following:
when showing the error via
fmt.Printf("%+v\n", err)
Reproduction Steps
I am not sure the best way to create an S3 bucket that doesn't have any associated tag set, as opposed to having an empty tag set associated. In my case I see this for the bucket
amazon-connect-1cc70ca065cd
:Output:
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
Complete go.mod:
Compiler and Version used
go version go1.21.3 darwin/arm64
Operating System and version
macOS 14.2.1