Class: CfnFlow::CachedStack
- Inherits:
-
Object
- Object
- CfnFlow::CachedStack
- Defined in:
- lib/cfn_flow/cached_stack.rb
Defined Under Namespace
Classes: MissingOutput
Instance Attribute Summary collapse
-
#stack_name ⇒ Object
readonly
Returns the value of attribute stack_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(stack_name) ⇒ CachedStack
constructor
A new instance of CachedStack.
- #output(name) ⇒ Object
- #stack_cache ⇒ Object
Constructor Details
#initialize(stack_name) ⇒ CachedStack
Returns a new instance of CachedStack.
16 17 18 |
# File 'lib/cfn_flow/cached_stack.rb', line 16 def initialize(stack_name) @stack_name = stack_name end |
Instance Attribute Details
#stack_name ⇒ Object (readonly)
Returns the value of attribute stack_name.
14 15 16 |
# File 'lib/cfn_flow/cached_stack.rb', line 14 def stack_name @stack_name end |
Class Method Details
.get_output(stack:, output:) ⇒ Object
10 11 12 |
# File 'lib/cfn_flow/cached_stack.rb', line 10 def self.get_output(stack:, output:) new(stack).output(output) end |
.stack_cache ⇒ Object
6 7 8 |
# File 'lib/cfn_flow/cached_stack.rb', line 6 def self.stack_cache @stack_cache ||= {} end |
Instance Method Details
#output(name) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cfn_flow/cached_stack.rb', line 20 def output(name) output = stack_cache.outputs.detect{|out| out.output_key == name } unless output raise MissingOutput.new("Can't find outpout #{name} for stack #{stack_name}") end output.output_value end |
#stack_cache ⇒ Object
28 29 30 |
# File 'lib/cfn_flow/cached_stack.rb', line 28 def stack_cache self.class.stack_cache[stack_name] ||= CfnFlow.cfn_resource.stack(stack_name).load end |