Class: Fog::Parsers::AWS::AutoScaling::DescribeLaunchConfigurations

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

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



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
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
# File 'lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb', line 36

def end_element(name)
  case name
  when 'member'
    if @in_block_device_mappings
      @launch_configuration['BlockDeviceMappings'] << @block_device_mapping
      reset_block_device_mapping
    elsif @in_security_groups
      @launch_configuration['SecurityGroups'] << value
    else
      @results['LaunchConfigurations'] << @launch_configuration
      reset_launch_configuration
    end

  when 'DeviceName', 'VirtualName'
    @block_device_mapping[name] = value

  when 'SnapshotId', 'VolumeSize'
    @ebs[name] = value
  when 'Ebs'
    @block_device_mapping[name] = @ebs
    reset_ebs

  when 'Enabled'
    @launch_configuration['InstanceMonitoring'][name] = (value == 'true')

  when 'CreatedTime'
    @launch_configuration[name] = Time.parse(value)
  when 'ImageId', 'InstanceType', 'KeyName'
    @launch_configuration[name] = value
  when 'LaunchConfigurationARN', 'LaunchConfigurationName'
    @launch_configuration[name] = value
  when 'KernelId', 'RamdiskId', 'UserData'
    @launch_configuration[name] = value
  when 'IamInstanceProfile'
    @launch_configuration[name] = value
  when 'SpotPrice'
    @launch_configuration[name] = value.to_f

  when 'AssociatePublicIpAddress'
    @in_associate_public_ip = false
  when 'BlockDeviceMappings'
    @in_block_device_mappings = false
  when 'LaunchConfigurations'
    @in_launch_configurations = false
  when 'SecurityGroups'
    @in_security_groups = false

  when 'NextToken'
    @results[name] = value

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

  when 'DescribeLaunchConfigurationsResponse'
    @response['DescribeLaunchConfigurationsResult'] = @results
  end
end

#resetObject



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

def reset
  reset_launch_configuration
  reset_block_device_mapping
  reset_ebs
  @results = { 'LaunchConfigurations' => [] }
  @response = { 'DescribeLaunchConfigurationsResult' => {}, 'ResponseMetadata' => {} }
end

#reset_block_device_mappingObject



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

def reset_block_device_mapping
  @block_device_mapping = {}
end

#reset_ebsObject



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

def reset_ebs
  @ebs = {}
end

#reset_launch_configurationObject



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

def reset_launch_configuration
  @launch_configuration = { 'BlockDeviceMappings' => [], 'InstanceMonitoring' => {}, 'SecurityGroups' => [] }
end

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



26
27
28
29
30
31
32
33
34
# File 'lib/fog/aws/parsers/auto_scaling/describe_launch_configurations.rb', line 26

def start_element(name, attrs = [])
  super
  case name
  when 'BlockDeviceMappings'
    @in_block_device_mappings = true
  when 'SecurityGroups'
    @in_security_groups = true
  end
end