Class: Stacker::Region

Inherits:
Object
  • Object
show all
Defined in:
lib/stacker/region.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, defaults, stacks, templates_path) ⇒ Region

Returns a new instance of Region.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/stacker/region.rb', line 9

def initialize(name, defaults, stacks, templates_path)
  @name = name
  @defaults = defaults
  @stacks = stacks.map do |options|
    begin
      Stack.new self, options.fetch('name'), options
    rescue KeyError => err
     Stacker.logger.fatal "Malformed YAML: #{err.message}"
     exit 1
    end
  end
  @templates_path = templates_path
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



7
8
9
# File 'lib/stacker/region.rb', line 7

def defaults
  @defaults
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/stacker/region.rb', line 7

def name
  @name
end

#stacksObject (readonly)

Returns the value of attribute stacks.



7
8
9
# File 'lib/stacker/region.rb', line 7

def stacks
  @stacks
end

#templates_pathObject (readonly)

Returns the value of attribute templates_path.



7
8
9
# File 'lib/stacker/region.rb', line 7

def templates_path
  @templates_path
end

Instance Method Details

#clientObject



23
24
25
# File 'lib/stacker/region.rb', line 23

def client
  @client ||= AWS::CloudFormation.new region: name
end

#stack(name) ⇒ Object



27
28
29
# File 'lib/stacker/region.rb', line 27

def stack name
  stacks.find { |s| s.name == name } || Stack.new(self, name)
end