Class: Fog::Parsers::AWS::AutoScaling::DescribePolicies

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

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary (collapse)

Methods inherited from Base

#attr_value, #characters, #end_element_namespace, #initialize, #start_element_namespace, #value

Constructor Details

This class inherits a constructor from Fog::Parsers::Base

Instance Method Details

- (Object) end_element(name)



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
58
59
60
# File 'lib/fog/aws/parsers/auto_scaling/describe_policies.rb', line 30

def end_element(name)
  case name
  when 'AlarmARN', 'AlarmName'
    @alarm[name] = value

  when 'AdjustmentType', 'AutoScalingGroupName', 'PolicyARN', 'PolicyName'
    @scaling_policy[name] = value
  when 'Cooldown', 'MinAdjustmentStep', 'ScalingAdjustment'
    @scaling_policy[name] = value.to_i

  when 'NextToken'
    @results[name] = value

  when 'RequestId'
    @response['ResponseMetadata'][name] = value

  when 'DescribePoliciesResponse'
    @response['DescribePoliciesResult'] = @results

  when 'Alarms'
    @in_alarms = false
  when 'member'
    if @in_alarms
      @scaling_policy['Alarms'] << @alarm
      reset_alarm
    else
      @results['ScalingPolicies'] << @scaling_policy
      reset_scaling_policy
    end
  end
end

- (Object) reset



6
7
8
9
10
11
12
# File 'lib/fog/aws/parsers/auto_scaling/describe_policies.rb', line 6

def reset
  reset_scaling_policy
  reset_alarm
  @results = { 'ScalingPolicies' => [] }
  @response = { 'DescribePoliciesResult' => {}, 'ResponseMetadata' => {} }
  @in_alarms = false
end

- (Object) reset_alarm



18
19
20
# File 'lib/fog/aws/parsers/auto_scaling/describe_policies.rb', line 18

def reset_alarm
  @alarm = {}
end

- (Object) reset_scaling_policy



14
15
16
# File 'lib/fog/aws/parsers/auto_scaling/describe_policies.rb', line 14

def reset_scaling_policy
  @scaling_policy = { 'Alarms' => [] }
end

- (Object) start_element(name, attrs = [])



22
23
24
25
26
27
28
# File 'lib/fog/aws/parsers/auto_scaling/describe_policies.rb', line 22

def start_element(name, attrs = [])
  super
  case name
  when 'Alarms'
    @in_alarms = true
  end
end