Sha256: 964eeb74b2c4cc5f4494da506099fd50b1fc99a70121a539de897b618f606546

Contents?: true

Size: 892 Bytes

Versions: 101

Compression:

Stored size: 892 Bytes

Contents

class Jets::Stack::Output
  class Lookup
    include Jets::AwsServices

    def initialize(stack_subclass)
      @stack_subclass = stack_subclass
    end

    def output(logical_id)
      child_stack_id = @stack_subclass.to_s.classify

      stack_arn = shared_stack_arn(child_stack_id)
      resp = cfn.describe_stacks(stack_name: stack_arn)
      child = resp.stacks.first
      return unless child

      output_value(child, logical_id)
    end

    # Shared child stack arn
    def shared_stack_arn(logical_id)
      parent_stack = Jets.config.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

101 entries across 101 versions & 2 rubygems

Version Path
jets-1.7.2 lib/jets/stack/output/lookup.rb
jets-1.7.1 lib/jets/stack/output/lookup.rb
jets-1.7.0 lib/jets/stack/output/lookup.rb
jets-fs-1.6.10 lib/jets/stack/output/lookup.rb
jets-1.6.9 lib/jets/stack/output/lookup.rb
jets-1.6.8 lib/jets/stack/output/lookup.rb
jets-1.6.7 lib/jets/stack/output/lookup.rb
jets-1.6.6 lib/jets/stack/output/lookup.rb
jets-1.6.5 lib/jets/stack/output/lookup.rb
jets-1.6.4 lib/jets/stack/output/lookup.rb
jets-1.6.3 lib/jets/stack/output/lookup.rb
jets-1.6.2 lib/jets/stack/output/lookup.rb
jets-1.6.1 lib/jets/stack/output/lookup.rb
jets-1.6.0 lib/jets/stack/output/lookup.rb
jets-1.5.10 lib/jets/stack/output/lookup.rb
jets-1.5.9 lib/jets/stack/output/lookup.rb
jets-1.5.8 lib/jets/stack/output/lookup.rb
jets-1.5.7 lib/jets/stack/output/lookup.rb
jets-1.5.6 lib/jets/stack/output/lookup.rb
jets-1.5.5 lib/jets/stack/output/lookup.rb