Class: Humidifier::AwsAdapters::SDKV2

Inherits:
Base
  • Object
show all
Defined in:
lib/humidifier/aws_adapters/sdkv2.rb

Overview

The adapter for v2 of aws-sdk

Direct Known Subclasses

SDKV3

Instance Method Summary collapse

Methods inherited from Base

#create, #delete, #deploy, #update, #upload, #valid?

Instance Method Details

#create_change_set(payload) ⇒ Object

Create a change set in CFN



6
7
8
9
# File 'lib/humidifier/aws_adapters/sdkv2.rb', line 6

def create_change_set(payload)
  payload.merge(change_set_name: "changeset-#{Time.now.strftime('%Y-%m-%d-%H-%M-%S')}")
  try_valid { client.create_change_set(payload.create_change_set_params) }
end

#deploy_change_set(payload) ⇒ Object

Create a change set if the stack exists, otherwise create the stack



12
13
14
# File 'lib/humidifier/aws_adapters/sdkv2.rb', line 12

def deploy_change_set(payload)
  exists?(payload) ? create_change_set(payload) : create(payload)
end

#exists?(payload) ⇒ Boolean

True if the stack exists in CFN

Returns:

  • (Boolean)


17
18
19
# File 'lib/humidifier/aws_adapters/sdkv2.rb', line 17

def exists?(payload)
  base_module::CloudFormation::Stack.new(name: payload.identifier).exists?
end