Class: Stacker::Region
- Inherits:
-
Object
- Object
- Stacker::Region
- Defined in:
- lib/stacker/region.rb
Instance Attribute Summary collapse
-
#defaults ⇒ Object
readonly
Returns the value of attribute defaults.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#stacks ⇒ Object
readonly
Returns the value of attribute stacks.
-
#templates_path ⇒ Object
readonly
Returns the value of attribute templates_path.
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize(name, defaults, stacks, templates_path, options = {}) ⇒ Region
constructor
A new instance of Region.
- #stack(name) ⇒ Object
Constructor Details
#initialize(name, defaults, stacks, templates_path, options = {}) ⇒ Region
Returns a new instance of Region.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/stacker/region.rb', line 10 def initialize(name, defaults, stacks, templates_path, ={}) @name = name @defaults = defaults stack_prefix = .fetch(:stack_prefix, '') @stacks = stacks.map do || begin ['template_name'] ||= ['name'] ['name'] = stack_prefix + ['name'] Stack.new self, .fetch('name'), rescue KeyError => err Stacker.logger.fatal "Malformed YAML: #{err.}" exit 1 end end @templates_path = templates_path @options = end |
Instance Attribute Details
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
8 9 10 |
# File 'lib/stacker/region.rb', line 8 def defaults @defaults end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/stacker/region.rb', line 8 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/stacker/region.rb', line 8 def @options end |
#stacks ⇒ Object (readonly)
Returns the value of attribute stacks.
8 9 10 |
# File 'lib/stacker/region.rb', line 8 def stacks @stacks end |
#templates_path ⇒ Object (readonly)
Returns the value of attribute templates_path.
8 9 10 |
# File 'lib/stacker/region.rb', line 8 def templates_path @templates_path end |
Instance Method Details
#client ⇒ Object
28 29 30 |
# File 'lib/stacker/region.rb', line 28 def client @client ||= Aws::CloudFormation::Client.new region: name end |
#stack(name) ⇒ Object
32 33 34 35 36 |
# File 'lib/stacker/region.rb', line 32 def stack name stacks.find { |s| s.name == name }.tap do |stk| raise Stack::StackUndeclared.new name unless stk end end |