Class: Stackit::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/stackit/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Template

Returns a new instance of Template.



9
10
11
12
13
# File 'lib/stackit/template.rb', line 9

def initialize(options = {})
  @cloudformation = options[:cloudformation] || Stackit.cloudformation
  @template_path = options[:template_path]
  @options = {}
end

Instance Attribute Details

#cloudformationObject

Returns the value of attribute cloudformation.



4
5
6
# File 'lib/stackit/template.rb', line 4

def cloudformation
  @cloudformation
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/stackit/template.rb', line 6

def options
  @options
end

#parsed_parametersObject

Returns the value of attribute parsed_parameters.



7
8
9
# File 'lib/stackit/template.rb', line 7

def parsed_parameters
  @parsed_parameters
end

#template_pathObject

Returns the value of attribute template_path.



5
6
7
# File 'lib/stackit/template.rb', line 5

def template_path
  @template_path
end

Instance Method Details

#needs_iam_capability?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/stackit/template.rb', line 32

def needs_iam_capability?
  body =~ /AWS::IAM::AccessKey|AWS::IAM::Group|AWS::IAM::InstanceProfile|AWS::IAM::Policy|AWS::IAM::Role|AWS::IAM::User|AWS::IAM::UserToGroupAddition/ ? true : false
end

#parse!Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/stackit/template.rb', line 15

def parse!
  Stackit.logger.info "Parsing cloudformation template: #{template_path}"
  if @template_path =~ /^http/
    @options[:template_url] = @template_path
  else
    @options[:template_body] = body
  end
  @options[:parameters] = validate
  self
end