class Stacker::Region

Attributes

defaults[R]
name[R]
options[R]
stacks[R]
templates_path[R]

Public Class Methods

new(name, defaults, stacks, templates_path, options={}) click to toggle source
# File lib/stacker/region.rb, line 10
def initialize(name, defaults, stacks, templates_path, options={})
  @name = name
  @defaults = defaults
  stack_prefix = options.fetch(:stack_prefix, '')
  @stacks = stacks.map do |options|
    begin
      options['template_name'] ||= options['name']
      options['name'] = stack_prefix + options['name']
      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
  @options = options
end

Public Instance Methods

client() click to toggle source
# File lib/stacker/region.rb, line 28
def client
  @client ||= Aws::CloudFormation::Client.new region: name
end
stack(name) click to toggle source
# 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