Class: Fog::Parsers::AWS::EC2::DescribeImages

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

Instance Attribute Summary

Attributes inherited from Base

#response

Instance Method Summary collapse

Methods inherited from Base

#characters, #initialize

Constructor Details

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

Instance Method Details

#end_element(name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fog/aws/parsers/ec2/describe_images.rb', line 20

def end_element(name)
  case name
  when 'architecture',  'imageId', 'imageLocation', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'platform', 'ramdiskId'
    @image[name] = @value
  when 'isPublic'
    if @value == 'true'
      @image[name] = true
    else
      @image[name] = false
    end
  when 'item'
    unless @in_product_codes
      @response['imagesSet'] << @image
      @image = { 'productCodes' => [] }
    end
  when 'productCode'
    @image['productCodes'] << @value
  when 'productCodes'
    @in_product_codes = false
  when 'requestId'
    @response[name] = @value
  end
end

#resetObject



8
9
10
11
# File 'lib/fog/aws/parsers/ec2/describe_images.rb', line 8

def reset
  @image = { 'productCodes' => [] }
  @response = { 'imagesSet' => [] }
end

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



13
14
15
16
17
18
# File 'lib/fog/aws/parsers/ec2/describe_images.rb', line 13

def start_element(name, attrs = [])
  if name == 'productCodes'
    @in_product_codes = true
  end
  @value = ''
end