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



437
438
439
# File 'lib/ec2/right_ec2_images.rb', line 437

def reset
  @result = nil
end

#tagend(name) ⇒ Object



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/ec2/right_ec2_images.rb', line 417

def tagend(name)
  case full_tag_name
  when %r{/kernel/value$}                then @result = @text
  when %r{/ramdisk/value$}               then @result = @text
  when %r{/description/value$}           then @result = @text
  when %r{/productCode$}                 then @result << @text
  when %r{launchPermission/item/group$}  then (@result[:groups]  ||=[])   << @text
  when %r{launchPermission/item/userId$} then (@result[:user_ids]||=[]) << @text
  when %r{/blockDeviceMapping/item} # no trailing $
    case name
    when 'deviceName'          then @block_device_mapping[:device_name]                = @text
    when 'virtualName'         then @block_device_mapping[:virtual_name]               = @text
    when 'noDevice'            then @block_device_mapping[:no_device]                  = @text
    when 'snapshotId'          then @block_device_mapping[:ebs_snapshot_id]            = @text
    when 'volumeSize'          then @block_device_mapping[:ebs_volume_size]            = @text
    when 'deleteOnTermination' then @block_device_mapping[:ebs_delete_on_termination]  = @text == 'true' ? true : false
    when 'item'                then @result                                           << @block_device_mapping
    end
  end
end

#tagstart(name, attributes) ⇒ Object

:nodoc:



409
410
411
412
413
414
415
416
# File 'lib/ec2/right_ec2_images.rb', line 409

def tagstart(name, attributes)
  case full_tag_name
  when %r{launchPermission$}        then @result = {}
  when %r{productCodes$}            then @result = []
  when %r{blockDeviceMapping$}      then @result = []
  when %r{blockDeviceMapping/item$} then @block_device_mapping = {}
  end
end