Class: CloudFormation::Bridge::Resources::CloudFormationOutputs

Inherits:
Base
  • Object
show all
Defined in:
lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb

Constant Summary collapse

NAME =
'Name'

Instance Method Summary collapse

Methods inherited from Base

#require_fields, #wait_until

Instance Method Details

#create(request) ⇒ Object Also known as: update



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb', line 12

def create(request)
  require_fields(request, [NAME])

  stack_name = request.resource_properties[NAME]

  stack = stacks[stack_name]

  outputs = stack.outputs.inject({}) do |acc,output|
    acc[output.key] = output.value
    acc
  end

  {
    FIELDS::DATA => outputs,
    FIELDS::PHYSICAL_RESOURCE_ID => stack.stack_id,
  }
end

#delete(request) ⇒ Object



32
33
34
# File 'lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb', line 32

def delete(request)
  # no need to do anything here
end

#stacksObject



36
37
38
# File 'lib/cloud_formation/bridge/resources/cloud_formation_outputs.rb', line 36

def stacks
  @stacks ||= AWS::CloudFormation.new.stacks
end