Class: AWS::CloudFormation::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/pryaws/cloud-formation.rb

Instance Method Summary collapse

Instance Method Details

#infoObject



14
15
16
17
# File 'lib/pryaws/cloud-formation.rb', line 14

def info
  sr = status_reason()
  "#{name()} (#{status()}#{sr.nil? ? '' : ' :' + sr})"
end

#save_template(path) ⇒ Object



19
20
21
# File 'lib/pryaws/cloud-formation.rb', line 19

def save_template(path)
  File.open(path, 'w'){|f| f.write JSON.pretty_generate(JSON.parse(template()))}
end

#set_param(key, value) ⇒ Object



23
24
25
# File 'lib/pryaws/cloud-formation.rb', line 23

def set_param(key, value)
  set_params({key => value})
end

#set_params(hash) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/pryaws/cloud-formation.rb', line 27

def set_params(hash)
  p = parameters()
  hash.each do |key,val|
    raise "Invalid param '#{key}'." if p[key].nil?
  end
  p = p.merge(hash)
  p = Hash[*p.map{|k,v| [k, v || ""]}.flatten]
  update :template => template, :parameters => p, :capabilities => ['CAPABILITY_IAM']
end