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
10 11 12 13 14 15 16 |
# File 'lib/humidifier/aws_adapters/base.rb', line 10 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
19 20 21 22 |
# File 'lib/humidifier/aws_adapters/base.rb', line 19 def delete(payload) client.delete_stack(payload.delete_params) true end |
#deploy(payload) ⇒ Object
Update a CFN stack if it exists, otherwise create it
25 26 27 |
# File 'lib/humidifier/aws_adapters/base.rb', line 25 def deploy(payload) exists?(payload) ? update(payload) : create(payload) end |
#update(payload) ⇒ Object
Update a CFN stack
30 31 32 |
# File 'lib/humidifier/aws_adapters/base.rb', line 30 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
35 36 37 38 |
# File 'lib/humidifier/aws_adapters/base.rb', line 35 def upload(payload) Humidifier.config.ensure_upload_configured!(payload) upload_object(payload, "#{Humidifier.config.s3_prefix}#{payload.identifier}.json") 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 |