aws/aws-sdk-core-ruby — pull request #127 by ktheory (2014-10-02 01:22:31+00:00)
Title: CloudFormation Resources

I took a stab at adding resources and a waiter for AWS CloudFormation.

(Modeling all these APIs as *data* instead of *code* is awesome, btw. :cake: :+1: )

Here's what this PR adds:

```ruby
cfn = Aws::CloudFormation::Resource.new
stacks = cfn.stacks.to_a # List your stacks

# Create a new stack
# try launching https://s3-us-west-2.amazonaws.com/cloudformation-templates-us-west-2/SQS_With_CloudWatch_Alarms.template
# as a template that only creates free resources

stack = cfn.create_stack(stack_name: '...', template_url: '...')

# Wait for it to be ready
stack.wait_until_complete

# List the stack events
stack.events

# List the stack resources
stack.stack_resources

# Modify the stack
stack.update(template_url: '...', parameters: [...])

# And wait until that's done
stack.wait_until_complete

# Shut it down
stack.delete
```

## Questions/comments/gotchas

I closely copied other `*.resources.json*` files as examples to figure out how resources work.

#### What is a subResource?

I wasn't sure how subResources differed from `hasOne` or `hasMany` resources, or just a resource `action` that returns structs.

#### How to initialize resources with more attributes than their identifiers?

StackResources are populated by the `DescribeStackResources` API call, which returns an array of fully hydrated StackResources. But I could only figure out how to pass the identifiers to the StackResources collection. So each StackResource makes a redundant API call to `load` the rest of it's attributes. Any way to avoid that?

#### Tests???

I'd like to add some unit tests for the features I added. But I don't see any specs/integration tests for any resources. :grimacing: Did I miss them?