Allow functions to calculate dependencies

Change-Id: Ic58f54612d3707abc8727a65a28b9c4502eae31a
Add a ResourceDefinition class

Change-Id: I183114596863fbe0c0ff7cd22134b37493ed0dd9
Use ResourceTemplate for creating Resources

Change-Id: I23d183d986ab1d771407502ec926e736d1f48d79
Get the dependency graph directly from functions

Change-Id: I592ac2074a600a44578ce97309def1280c72e61d
Avoid double-initialisation of Resources

If a __new__ method returns an instance of it's own class (including
subclasses), Python automatically calls the __init__ method on the instance
before returning it to the caller. Therefore, explicitly constructing a
subclass inside __new__ and returning it was resulting in __init__ being
called a second time. Instead, call object.__new__(), passing the subclass
that we want to instantiate.

Change-Id: I5f891fd97e4cabc6d4c39c5312a0185649702e75
Unit tests: Create resources with ResourceDefinition

Stop creating Resources with dicts that are snippets of templates, and
instead always use ResourceDefinition objects to create Resources.

Change-Id: I1587f1edf9b04f06bd435857d7c1ea2c1cc26058
Use ResourceDefinition in autoscaling

Change-Id: I3bb8bcd2ff54a699a901aac435a56b537d99e992
Handle HOT when converting Outputs to Attributes

When converting the Outputs of a provider template into Attributes of its
facade resource use the Template object (which translates the template into
a consistent, cfn-like format) instead of the raw template data, so that
HOT also works.

Also fixed an outdated (and therefore now misleading) comment.

Change-Id: Iba44ba56be3e1d756cdc01a2b6f4fba171a02057
Support passing a Template object to StackResource

The create_with_template() and update_with_template() methods of the
StackResource class previously took raw template data as an argument; this
change allows them to accept Template objects also.

Change-Id: I7af5d516d4d0c4085144ed53c962cfc6ca3c69bb
Allow a resource to be added to a template

Add a method that allows a ResourceDefinition to be inserted into an
existing template.

Change-Id: Ia418127d72d26a77d731f93cc0eb3a45d983cc82
Use add_resource() to build autoscaling templates

Instead of building nested templates for Autoscaling manually, use the
Template.add_resource() method to build them up programmatically.

Change-Id: Ie4d6a869355cf0ddb6fce0edc6c7d49b8a2b7e75
Use ResourceDefinition when updating Load Balancer

Use a ResourceDefinition object to define the Load Balancer configuration
when Autoscaling updates it. This makes it consistent with the regular
stack update code, which now passed a ResourceDefinition instead of a
template snippet.

Change-Id: I717559257b01bd0eaf0f3da48fb64bf60dcb2f8d
Unit tests: Always use ResourceDefinition for updates

Change-Id: I85ab9d0a3ed824020c7a38f7a814e7755a437b1a
Unit tests: always use ResourceDefinition for handle_update()

Change-Id: Ib243d6d1f4ff41c83fddcd0a3741cc28ff954448
Unit tests: Name resources the same as in template

We were creating a bunch of resources with a different name from their
definition in the template. This makes the data consistent.

Change-Id: Ibfaaea5077a4a97dc45b84d4d25bbba6a78425bf
Use ResourceDefinition to generate Properties

Change-Id: I30e9b38f79bbcf5532ca35724ef4af8131c06c3c
Unit tests: use ResourceDefinition to test facades

Change-Id: Ied4b3df4e15d165100eb5b059ac605879c6b9b5e
Use ResourceDefinition to generate UpdatePolicy

Change-Id: I08cedd0fb9c7b804a4bf9dd5233f7b9060337a71
Get deletion policy from ResourceDefinition

Change-Id: I5e402e3ed02b9e09d3f78ef3c910c4c3d2f90fc0
Get the resource type from ResourceDefinition

Change-Id: Ie34a39a9d6d11bdbd2601e2c4be01b5411c2ac5a