Class: AwsStack::CloudFormation

Inherits:
Object
  • Object
show all
Defined in:
lib/awsstack/cloudformation.rb

Overview

AWS Session creation with profile

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CloudFormation

Returns a new instance of CloudFormation.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/awsstack/cloudformation.rb', line 7

def initialize(options)
  @credentials = options[:credentials]
  create_cfn_client
  @operation = options[:operation].to_sym
  @stackname = options[:stackname]
  @templatefile = options[:templatefile]
  @paramfile = options[:paramfile]
  @environment = options[:environment]
  @debug = options[:debug]

  if public_methods.include?(@operation)
    public_send @operation
  else
    puts "Requested operation '#{@operation}' is not a public method."
  end
end

Instance Method Details

#checkObject



24
25
26
27
# File 'lib/awsstack/cloudformation.rb', line 24

def check
  raise unless validate_template
  puts "Template '#{@templatefile}' validated! OK."
end

#createObject



29
30
31
32
33
# File 'lib/awsstack/cloudformation.rb', line 29

def create
  check
  @params = read_param_file
  pp create_stack
end

#deleteObject



41
42
43
44
# File 'lib/awsstack/cloudformation.rb', line 41

def delete
  delete_stack
  puts 'Delete started...'
end

#operation_namesObject



46
47
48
# File 'lib/awsstack/cloudformation.rb', line 46

def operation_names
  pp @cfn.operation_names
end

#updateObject



35
36
37
38
39
# File 'lib/awsstack/cloudformation.rb', line 35

def update
  check
  @params = read_param_file
  update_stack
end