Class: Fog::Parsers::AWS::AutoScaling::DescribeAutoScalingGroups

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

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Base

#attr_value, #characters, #initialize, #value

Constructor Details

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

Instance Method Details

#end_element(name) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
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
# File 'lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb', line 52

def end_element(name)
  case name
  when 'member'
    if @in_availability_zones
      @auto_scaling_group['AvailabilityZones'] << value
    elsif @in_enabled_metrics
      @auto_scaling_group['EnabledMetrics'] << @enabled_metric
      reset_enabled_metric
    elsif @in_instances
      @auto_scaling_group['Instances'] << @instance
      reset_instance
    elsif @in_load_balancer_names
      @auto_scaling_group['LoadBalancerNames'] << value
    elsif @in_suspended_processes
      @auto_scaling_group['SuspendedProcesses'] << @suspended_process
      reset_suspended_process
    elsif @in_termination_policies
      @auto_scaling_group['TerminationPolicies'] << value
    elsif !@in_instances && !@in_policies
      @results['AutoScalingGroups'] << @auto_scaling_group
      reset_auto_scaling_group
    end

  when 'AvailabilityZones'
    @in_availability_zones = false
    
  when 'Granularity', 'Metric'
    @enabled_metric[name] = value
  when 'EnabledMetrics'
    @in_enabled_metrics = false

  when 'LaunchConfigurationName'
    if @in_instances
      @instance[name] = value
    else
      @auto_scaling_group[name] = value
    end
  when 'TerminationPolicies'
    @in_termination_policies = false

  when 'AvailabilityZone', 'HealthStatus', 'InstanceId', 'LifecycleState'
    @instance[name] = value
  when 'Instances'
    @in_instances = false

  when 'LoadBalancerNames'
    @in_load_balancer_names = false

  when 'ProcessName', 'SuspensionReason'
    @suspended_process[name] = value
  when 'SuspendedProcesses'
    @in_suspended_processes = false

  when 'AutoScalingGroupARN', 'AutoScalingGroupName'
    @auto_scaling_group[name] = value
  when 'CreatedTime'
    @auto_scaling_group[name] = Time.parse(value)
  when 'DefaultCooldown', 'DesiredCapacity', 'HealthCheckGracePeriod'
    @auto_scaling_group[name] = value.to_i
  when 'HealthCheckType'
    @auto_scaling_group[name] = value
  when 'MaxSize', 'MinSize'
    @auto_scaling_group[name] = value.to_i
  when 'PlacementGroup', 'VPCZoneIdentifier'
    @auto_scaling_group[name] = value

  when 'NextToken'
    @results[name] = value

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

  when 'DescribeAutoScalingGroupsResponse'
    @response['DescribeAutoScalingGroupsResult'] = @results
  end
end

#resetObject



8
9
10
11
12
13
14
15
# File 'lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb', line 8

def reset
  reset_auto_scaling_group
  reset_enabled_metric
  reset_instance
  reset_suspended_process
  @results = { 'AutoScalingGroups' => [] }
  @response = { 'DescribeAutoScalingGroupsResult' => {}, 'ResponseMetadata' => {} }
end

#reset_auto_scaling_groupObject



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

def reset_auto_scaling_group
  @auto_scaling_group = { 'AvailabilityZones' => [], 'EnabledMetrics' => [], 'Instances' => [], 
                        'LoadBalancerNames' => [], 'SuspendedProcesses' => [], 'TerminationPolicies' => [] }
end

#reset_enabled_metricObject



22
23
24
# File 'lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb', line 22

def reset_enabled_metric
  @enabled_metric = {}
end

#reset_instanceObject



26
27
28
# File 'lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb', line 26

def reset_instance
  @instance = {}
end

#reset_suspended_processObject



30
31
32
# File 'lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb', line 30

def reset_suspended_process
  @suspended_process = {}
end

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



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb', line 34

def start_element(name, attrs = [])
  super
  case name
  when 'AvailabilityZones'
    @in_availability_zones = true
  when 'EnabledMetrics'
    @in_enabled_metrics = true
  when 'Instances'
    @in_instances = true
  when 'LoadBalancerNames'
    @in_load_balancer_names = true
  when 'SuspendedProcesses'
    @in_suspended_processes = true
  when 'TerminationPolicies'
    @in_termination_policies = true
  end
end