Class: Fog::Parsers::AWS::CloudFormation::DescribeChangeSet

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

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 63

def end_element(name)
  case name
  when 'ChangeSetId', 'ChangeSetName', 'Description', 'ExecutionStatus', 'StackId', 'StackName', 'StatusReason', 'Status'
    @response[name] = value
  when 'CreationTime'
    @response[name] = Time.parse(value)
  when 'member'
    if @in_capabilities
      @response['Capabilities'] << value
    elsif @in_scope
      @resource_change['Scope'] << value
    elsif @in_notification_arns
      @response['NotificationARNs'] << value
    elsif @in_parameters
      @response['Parameters'] << @parameter
      reset_parameter
    elsif @in_tags
      @response['Tags'] << @tag
      reset_tag
    elsif @in_details
      @resource_change['Details'] << @resource_change_detail
      reset_resource_change_detail
    elsif @in_changes
      @response['Changes'] << @change
      reset_change
    end
  when 'ParameterValue', 'ParameterKey'
    @parameter[name] = value if @in_parameters
  when 'Parameters'
    @in_parameters = false
  when 'Value', 'Key'
    @tag[name] = value if @in_tags
  when 'Tags'
    @in_tags = false
  when 'Capabilities'
    @in_capabilities = false
  when 'Scope'
    @in_scope = false
  when 'NotificationARNs'
    @in_notification_arns = false
  when 'Type'
    @change[name] = value if @in_changes
  when 'Changes'
    @in_changes = false
  when 'ResourceChange'
    if @in_resource_change
      @change[name] = @resource_change
      @in_resource_change = false
    end
  when 'Action','LogicalResourceId','PhysicalResourceId','Replacement','ResourceType'
    @resource_change[name] = value  if @in_resource_change
  when 'Details'
    @in_details = false
  when 'CausingEntity','ChangeSource','Evaluation'
    if @in_details
      @resource_change_detail[name] = value
    end
  when 'Attribute','Name','RequiresRecreation'
    if @in_target
      @resource_target_definition[name] = value
    end
  when 'Target'
    if @in_target
      @resource_change_detail[name] = @resource_target_definition
      @in_target = false
    end
  end
end

#fresh_change_setObject



35
36
37
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 35

def fresh_change_set
  {'Capabilities' => [], 'Changes' => [], 'NotificationARNs' => [], 'Parameters' => [], 'Tags' => []}
end

#resetObject



6
7
8
9
10
11
12
13
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 6

def reset
  @response = fresh_change_set
  reset_parameter
  reset_change
  reset_resource_change
  reset_resource_change_detail
  reset_resource_target_definition
end

#reset_changeObject



19
20
21
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 19

def reset_change
  @change = {}
end

#reset_parameterObject



15
16
17
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 15

def reset_parameter
  @parameter = {}
end

#reset_resource_changeObject



23
24
25
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 23

def reset_resource_change
  @resource_change = {'Details' => [], 'Scope' => [] }
end

#reset_resource_change_detailObject



27
28
29
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 27

def reset_resource_change_detail
  @resource_change_detail = {}
end

#reset_resource_target_definitionObject



31
32
33
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 31

def reset_resource_target_definition
  @resource_target_definition = {}
end

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



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fog/aws/parsers/cloud_formation/describe_change_set.rb', line 39

def start_element(name, attrs=[])
  super
  case name
  when 'Capabilities'
    @in_capabilities = true
  when 'Changes'
    @in_changes = true
  when 'ResourceChange'
    @in_resource_change = true
  when 'Scope'
    @in_scope = true
  when 'Details'
    @in_details = true
  when 'Target'
    @in_target = true
  when 'NotificationARNs'
    @in_notification_arns = true
  when 'Parameters'
    @in_parameters = true
  when 'Tags'
    @in_tags = true
  end
end