Class: RightAws::Ec2::QEc2DescribeImageAttributeParser

Inherits:
RightAWSParser
  • Object
show all
Defined in:
lib/ec2/right_ec2_images.rb

Overview


PARSERS: Image Attribute

Constant Summary

Constants inherited from RightAWSParser

RightAWSParser::DEFAULT_XML_LIBRARY

Instance Attribute Summary

Attributes inherited from RightAWSParser

#full_tag_name, #result, #tag, #xml_lib, #xmlpath

Instance Method Summary collapse

Methods inherited from RightAWSParser

#initialize, #method_missing, #parse, #tag_end, #tag_start, #tagtext, #text, xml_lib, xml_lib=

Constructor Details

This class inherits a constructor from RightAws::RightAWSParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightAws::RightAWSParser

Instance Method Details

#resetObject



406
407
408
# File 'lib/ec2/right_ec2_images.rb', line 406

def reset
  @result = {}
end

#tagend(name) ⇒ Object



393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/ec2/right_ec2_images.rb', line 393

def tagend(name)
    # right now only 'launchPermission' is supported by Amazon.
    # But nobody know what will they xml later as attribute. That is why we
    # check for 'group' and 'userId' inside of 'launchPermission/item'
  case name
    when 'imageId'            then @result[:aws_id] = @text
    when 'group'              then @result[:groups] << @text if @xmlpath == 'DescribeImageAttributeResponse/launchPermission/item'
    when 'userId'             then @result[:users]  << @text if @xmlpath == 'DescribeImageAttributeResponse/launchPermission/item'
    when 'productCode'        then @result[:aws_product_codes] << @text
    when 'kernel'             then @result[:aws_kernel]  = @text
    when 'ramdisk'            then @result[:aws_ramdisk] = @text
  end
end

#tagstart(name, attributes) ⇒ Object

:nodoc:



384
385
386
387
388
389
390
391
392
# File 'lib/ec2/right_ec2_images.rb', line 384

def tagstart(name, attributes)
  case name
    when 'launchPermission'
      @result[:groups] = []
      @result[:users]  = []
    when 'productCodes'
      @result[:aws_product_codes] = []
  end
end