Class: Fog::Parsers::AWS::CloudFormation::GetTemplateSummary

Inherits:
Base
  • Object
show all
Defined in:
lib/fog/aws/parsers/cloud_formation/get_template_summary.rb

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object

[View source]

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fog/aws/parsers/cloud_formation/get_template_summary.rb', line 27

def end_element(name)
  case name
  when 'member'
    if @in_capabilities
      @response['Capabilities'] << value
    elsif @in_resource_types
      @response['ResourceTypes'] << value
    elsif @in_parameters
      @response['Parameters'] << @parameter
      reset_parameter
    end
  when 'DefaultValue', 'NoEcho', 'ParameterKey', 'ParameterType', 'ParameterType'
    @parameter[name] = value if @in_parameters
  when 'Description'
    if @in_parameters
      @parameter[name] = value
    else
      @response[name] = value
    end
  when 'ParameterConstraints'
    @parameter['AllowedValues'] << value  if @in_parameters
  when 'RequestId'
    @response[name] = value
  when 'Parameters'
    @in_parameters = false
  when 'ResourceTypes'
    @in_resource_types = false
  when 'Capabilities'
    @in_capabilities = false
  end
end

#resetObject

[View source]

6
7
8
9
# File 'lib/fog/aws/parsers/cloud_formation/get_template_summary.rb', line 6

def reset
  reset_parameter
  @response = {'Capabilities' => [],'ResourceTypes' => '','Parameters' => []  }
end

#reset_parameterObject

[View source]

11
12
13
# File 'lib/fog/aws/parsers/cloud_formation/get_template_summary.rb', line 11

def reset_parameter
  @parameter = {'AllowedValues' => []}
end

#start_element(name, attrs = []) ⇒ Object

[View source]

15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/aws/parsers/cloud_formation/get_template_summary.rb', line 15

def start_element(name, attrs=[])
  super
  case name
  when 'Capabilities'
    @in_capabilities = true
  when 'Parameters'
    @in_parameters = true
  when 'ResourceTypes'
    @in_resource_types = true
  end
end