-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing "exists" method? #696
Comments
I'd also be interested in knowing the best way to handle this case. It's especially useful when looking at CloudFormation stacks since it means you don't have to iterate over the entire stack collection. |
Adding For the v1 SDK, the exists methods were all hand-coded and used different logic for each scenario. For example, with Amazon S3 buckets, the exists method would make a For v2, I'm inclined to solve this using waiter methods. By adding a waiter for "BucketExists" and CloudFormation "StackExists" we can share the logic. The exists method would simply poll the waiter exactly once, and not keep waiting. |
I was very surprised when I went looking for the |
The `#exists?` method works by polling the exists wait for the resource exactly once. If the waiter is successful, then `true` is returned, if it fails, then `false` is returned. To add additional `#exists?` methods, a waiter must be added to the resource class as `Exists` and that waiter must be defined in the *.waiters.json document for that service. See #696
The `#exists?` method works by polling the exists wait for the resource exactly once. If the waiter is successful, then `true` is returned, if it fails, then `false` is returned. To add additional `#exists?` methods, a waiter must be added to the resource class as `Exists` and that waiter must be defined in the *.waiters.json document for that service. See #696
Against the v1 gem I had some code like this:
However, the
#exists?
method isn't there any more and I can't see an equivalent.What's the recommended method of implementing the same behaviour? The alternatives I've been able to spot don't seem like they would be recommended:
Aws::S3::Client#head_bucket
Aws::S3::Resource#create_bucket
Aws::S3::Resource#buckets
Similarly there's not an
#exists?
onAws::S3::Object
so guidance in that case would likely be useful too (though it doesn't affect me).The text was updated successfully, but these errors were encountered: