Aws.service()
or is there more to it? I am driving some operations that definitely need waiters and I would rather get them into the SDK than implement the semantics myself by hand.
Aws::Waiters::Errors::NoSuchWaiterError: no such waiter :instance_profile_available; valid waiter names are:
no matter what. Link: harvard-dce/aws-sdk-ruby@bd9510c
This is great for determining the underlying resource ID name. However CloudFormation.resources.json looks like this:
"Stack": {
"identifiers": [
{ "name": "Name" }
],
There's no memberName
to reveal the underlying name (e.g. "StackName"). Which example is the standard, and what is the best way to determine the underlying resource ID name?
KeyNames
vs. key_names
EC2 is a special case. Every other AWS service uses a consistent case (upper or lower camel case typically). EC2 uses Upper camel case for most input values and lower camel case for most outputs. That said, there is still a desire to share the structures between input and output as their only difference is the serialized format of their member names.
To work around this, EC2 is not marked as a “query” protocol, instead it is marked as “ec2”. The made-up-by-the-sdk-team “ec2” protocol is defined a query with modifications. Most of the deltas are on how to marshal input. One of those being how to case them as they are sent, but other differences exist. Some of these are all lists are “flattened” on input (no .member prefix on list members) and there is an extra “queryName” that overrides the typical “locationName” (location name is inflected to UpperCamelCase, where queryName is taken as is).
I have some internal documentation I might be able to scrounge up that documents the differences.
#terminate
on an instance or #terminate
on a batch of instances:ec2 = Aws::EC2::Resource.new
# single instance terminate
ec2.isntance(‘id’).terminate
# batch terminate
ec2.instances(filters: […]).terminate
With regard to Instances, would you be opposed to exposing a "Delete" action on the Instance resource to also map to "TerminateInstances", in addition to the existing "Terminate" action that maps to "TerminateInstances"?
It just seems more CRUD-like and consistent that resources have both a CreateResource and a Delete, rather than instances having "CreateInstances" and "TerminateInstances".
For example, here: https://github.com/aws/aws-sdk-ruby/blob/master/aws-sdk-core/apis/EC2.resources.json#L14-L23
CreateInstances gets mapped to RunInstances. Just seems like having the complement for Delete would be nice. Something like this in the actions for an Instance resource:
"Delete": {
"request": {
"operation": "TerminateInstances",
"params": [
{ "target": "InstanceIds[0]", "source": "identifier", "name": "Id" }
]
}
}
If you're not opposed, I could submit a PR. If you are opposed, no worries, just thought we'd throw that idea out there. :)
wait_until
to be run after the process was complete, and that's how I've seen other async waiters implemented.