Class: Humidifier::AwsAdapters::Base
- Inherits:
-
Object
- Object
- Humidifier::AwsAdapters::Base
- Defined in:
- lib/humidifier/aws_adapters/base.rb
Overview
The parent class for the adapters for both versions of the SDK
Instance Method Summary collapse
-
#create(payload) ⇒ Object
Create a CFN stack.
-
#delete(payload) ⇒ Object
Delete a CFN stack.
-
#deploy(payload) ⇒ Object
Update a CFN stack if it exists, otherwise create it.
-
#update(payload) ⇒ Object
Update a CFN stack.
-
#upload(payload) ⇒ Object
Upload a CFN stack to S3 so that it can be referenced via template_url.
-
#valid?(payload) ⇒ Boolean
Validate a template in CFN.
Instance Method Details
#create(payload) ⇒ Object
Create a CFN stack
9 10 11 12 13 14 15 |
# File 'lib/humidifier/aws_adapters/base.rb', line 9 def create(payload) try_valid do response = client.create_stack(payload.create_params) payload.id = response.stack_id response end end |
#delete(payload) ⇒ Object
Delete a CFN stack
18 19 20 21 |
# File 'lib/humidifier/aws_adapters/base.rb', line 18 def delete(payload) client.delete_stack(payload.delete_params) true end |
#deploy(payload) ⇒ Object
Update a CFN stack if it exists, otherwise create it
24 25 26 |
# File 'lib/humidifier/aws_adapters/base.rb', line 24 def deploy(payload) exists?(payload) ? update(payload) : create(payload) end |
#update(payload) ⇒ Object
Update a CFN stack
29 30 31 |
# File 'lib/humidifier/aws_adapters/base.rb', line 29 def update(payload) try_valid { client.update_stack(payload.update_params) } end |
#upload(payload) ⇒ Object
Upload a CFN stack to S3 so that it can be referenced via template_url
34 35 36 37 38 |
# File 'lib/humidifier/aws_adapters/base.rb', line 34 def upload(payload) Humidifier.config.ensure_upload_configured!(payload) filename = "#{Humidifier.config.s3_prefix}#{payload.identifier}.json" upload_object(payload, filename) end |
#valid?(payload) ⇒ Boolean
Validate a template in CFN
41 42 43 |
# File 'lib/humidifier/aws_adapters/base.rb', line 41 def valid?(payload) try_valid { client.validate_template(payload.validate_params) } end |