-
I'm trying to write some idempotent code to delete a bucket:
However this doesn't work as expected. Apparently DeleteBucket returns a
which gave:
It doesn't seem like there's a way to determine if it's a NoSuchBucket error just by unwrapping. The best way I could think of is to get the Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Suggests to use something like
|
Beta Was this translation helpful? Give feedback.
-
In contrast, CreateBucket returns
|
Beta Was this translation helpful? Give feedback.
-
Hi @zchenyu , The S3 API model is the source of truth for this kind of information. "com.amazonaws.s3#DeleteBucket": {
"type": "operation",
"input": {
"target": "com.amazonaws.s3#DeleteBucketRequest"
},
"output": {
"target": "smithy.api#Unit"
},
}
"com.amazonaws.s3#CreateBucket": {
"type": "operation",
"input": {
"target": "com.amazonaws.s3#CreateBucketRequest"
},
"output": {
"target": "com.amazonaws.s3#CreateBucketOutput"
},
"errors": [
{
"target": "com.amazonaws.s3#BucketAlreadyExists"
},
{
"target": "com.amazonaws.s3#BucketAlreadyOwnedByYou"
}
],
} This really is an S3 API design choice and the SDK team can't really do anything about it since the SDK itself is code generated from that same model file. Not entirely sure what you are trying to build, but if I understand your use case, you can use Let me know if that helps, |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @zchenyu ,
The S3 API model is the source of truth for this kind of information.
DeleteBucket
has no typed errors associated with that particular operation, thus the SDK will not map the response to a typed error:CreateBucket
does have 2 typed errors associated with it: