Class: Fog::Parsers::AWS::Compute::DescribeImageAttribute

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

Instance Method Summary collapse

Instance Method Details

#end_element(name) ⇒ Object



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
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
# File 'lib/fog/aws/parsers/compute/describe_image_attribute.rb', line 51

def end_element(name)
  if @in_description
    case name
    when 'value'
      @response['description'] = value
    when 'description'
      @in_description= false
    end
  elsif @in_kernel
    case name
    when 'value'
      @response['kernelId'] = value
    when 'kernel'
      @in_kernelId = false
    end
  elsif @in_ramdisk
    case name
    when 'value'
      @response['ramdiskId'] = value
    when 'ramdisk'
      @in_ramdiskId = false
    end
  elsif @in_launchPermission
    case name
    when 'group', 'userId'
      @response['launchPermission'] << value
    when 'launchPermission'
      @in_launchPermission = false
    end
  elsif @in_blockDeviceMapping
    case name
    when 'item'
      @response["blockDeviceMapping"] << @block_device_mapping
      @block_device_mapping = {}
    when 'volumeId', 'status', 'deviceName'
      @block_device_mapping[name] = value
    when 'attachTime'
      @block_device_mapping['attachTime'] = Time.parse(value)
    when 'deleteOnTermination'
      @block_device_mapping['deleteOnTermination'] = (value == 'true')
    when 'blockDeviceMapping'
      @in_blockDeviceMapping = false
    end
  elsif @in_productCodes
    case name
    when 'item'
      @response['productCodes'] << @product_codes
      @product_codes = {}
    when 'productCode', 'type'
      @product_codes[name] = value
    when 'productCodes'
      @in_productCodes = false
    end
  elsif @in_sriovNetSupport
    case name
    when 'value'
      @response["sriovNetSupport"] = value
    when "sriovNetSupport"
      @in_sriovNetSupport = false
    end
  else
    case name
    when 'requestId', 'imageId'
      @response[name] = value
    end
  end
end

#resetObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/aws/parsers/compute/describe_image_attribute.rb', line 6

def reset
  @response                             = { }
  @in_description                       = false
  @in_kernelId                          = false
  @in_ramdiskId                         = false
  @in_launchPermission                  = false
  @in_productCodes                      = false
  @in_blockDeviceMapping                = false
  @in_sriovNetSupport                   = false
end

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



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fog/aws/parsers/compute/describe_image_attribute.rb', line 17

def start_element(name, attrs = [])
  super
  case name
  when 'description'
    @in_description = true
  when 'kernel'
    @in_kernel = true
  when 'ramdisk'
    @in_ramdisk = true
  when 'launchPermission'
    @in_launchPermission= true
    unless @response.key?('launchPermission')
      @response['launchPermission'] = []
    end
  when 'productCodes'
    @in_productCodes = true
    @product_codes = {}
    unless @response.key?('productCodes')
      @response['productCodes'] = []
    end
  when 'blockDeviceMapping'
    @in_blockDeviceMapping = true
    @block_device_mapping = {}
    unless @response.key?('blockDeviceMapping')
      @response['blockDeviceMapping'] = []
    end
  when 'sriovNetSupport'
    unless @response.key?('sriovNetSupport')
      @response['sriovNetSupport'] = 'false'
    end
    @in_sriovNetSupport = true
  end
end