Class: ElasticBeans::Aws::CloudformationStack

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_beans/aws/cloudformation_stack.rb

Defined Under Namespace

Classes: MissingOutputError, MissingStackError

Constant Summary collapse

STACK_STATUSES =
%w(CREATE_COMPLETE UPDATE_COMPLETE UPDATE_IN_PROGRESS UPDATE_ROLLBACK_COMPLETE)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, cloudformation:) ⇒ CloudformationStack

Returns a new instance of CloudformationStack.



14
15
16
17
# File 'lib/elastic_beans/aws/cloudformation_stack.rb', line 14

def initialize(name, cloudformation:)
  @name = name
  @cloudformation = cloudformation
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/elastic_beans/aws/cloudformation_stack.rb', line 12

def name
  @name
end

Instance Method Details

#stack_output(output_key) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/elastic_beans/aws/cloudformation_stack.rb', line 19

def stack_output(output_key)
  output = stack.outputs.find { |o| o.output_key == output_key }
  unless output
    raise MissingOutputError.new(stack_name: name, output_key: output_key)
  end
  output.output_value
end

#stack_outputsObject



27
28
29
# File 'lib/elastic_beans/aws/cloudformation_stack.rb', line 27

def stack_outputs
  stack.outputs.reduce({}) { |a, e| a.merge(e.output_key => e.output_value) }
end