Sha256: 042ccfc17d1bf4d395b1553552c3ba8f2c568f0a2703da85b869f4320156e92c
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
class Jets::Stack class Outputs include Jets::AwsServices def initialize(stack_subclass) @stack_subclass = stack_subclass end @@cache = {} def value(logical_id) logical_id = logical_id.to_s.camelize cache_key = "#{@stack_subclass}:#{logical_id}" return @@cache[cache_key] if @@cache[cache_key] child_stack_id = @stack_subclass.to_s.camelize stack_arn = shared_stack_arn(child_stack_id) resp = cfn.describe_stacks(stack_name: stack_arn) child = resp.stacks.first return unless child @@cache[cache_key] = output_value(child, logical_id) end # Shared child stack arn def shared_stack_arn(logical_id) parent_stack = Jets.project.namespace resp = cfn.describe_stacks(stack_name: parent_stack) parent = resp.stacks.first output_value(parent, logical_id) end def output_value(stack, key) key = key.to_s.camelize output = stack.outputs.find do |o| o.output_key == key end output&.output_value end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jets-6.0.5 | lib/jets/stack/outputs.rb |
jets-6.0.4 | lib/jets/stack/outputs.rb |
jets-6.0.3 | lib/jets/stack/outputs.rb |
jets-6.0.2 | lib/jets/stack/outputs.rb |