Class: RightAws::Ec2::QEc2DescribeImagesParser

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

Overview


PARSERS: Images

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



328
329
330
# File 'lib/ec2/right_ec2_images.rb', line 328

def reset
  @result = []
end

#tagend(name) ⇒ Object



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/ec2/right_ec2_images.rb', line 292

def tagend(name)
  case name
  when 'imageId'         then @item[:aws_id]            = @text
  when 'imageLocation'   then @item[:aws_location]      = @text
  when 'imageState'      then @item[:aws_state]         = @text
  when 'imageOwnerId'    then @item[:aws_owner]         = @text
  when 'isPublic'        then @item[:aws_is_public]     = @text == 'true' ? true : false
  when 'productCode'     then (@item[:aws_product_codes] ||= []) << @text
  when 'architecture'    then @item[:aws_architecture]  = @text
  when 'imageType'       then @item[:aws_image_type]    = @text
  when 'kernelId'        then @item[:aws_kernel_id]     = @text
  when 'ramdiskId'       then @item[:aws_ramdisk_id]    = @text
  when 'platform'        then @item[:aws_platform]      = @text
  when 'imageOwnerAlias' then @item[:image_owner_alias] = @text
  when 'name'            then @item[:name]              = @text
  when 'description'     then @item[:description]       = @text
  when 'rootDeviceType'  then @item[:root_device_type]  = @text
  when 'rootDeviceName'  then @item[:root_device_name]  = @text
  when 'imageClass'      then @item[:image_class]       = @text
  else
    case full_tag_name
    when %r{/stateReason/code$}    then @item[:state_reason_code]    = @text.to_i
    when %r{/stateReason/message$} then @item[:state_reason_message] = @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 'volumeSize'          then @block_device_mapping[:ebs_volume_size]            = @text.to_i
      when 'snapshotId'          then @block_device_mapping[:ebs_snapshot_id]            = @text
      when 'deleteOnTermination' then @block_device_mapping[:ebs_delete_on_termination]  = @text == 'true' ? true : false
      when 'item'                then @item[:block_device_mappings]                    << @block_device_mapping
      end
    when %r{/imagesSet/item$}    then @result << @item
    end
  end
end

#tagstart(name, attributes) ⇒ Object

:nodoc:



284
285
286
287
288
289
290
291
# File 'lib/ec2/right_ec2_images.rb', line 284

def tagstart(name, attributes)
  case full_tag_name
  when %r{/imagesSet/item$}          then @item = {}
  when %r{/blockDeviceMapping/item$}
    @item[:block_device_mappings] ||= []
    @block_device_mapping = {}
  end
end