Class: RightAws::Ec2::QEc2DescribeSpotInstanceParser

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

Overview

:nodoc:

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



359
360
361
# File 'lib/ec2/right_ec2_spot_instances.rb', line 359

def reset
  @result = []
end

#tagend(name) ⇒ Object



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/ec2/right_ec2_spot_instances.rb', line 315

def tagend(name)
  case name
  when 'spotInstanceRequestId' then @item[:spot_instance_request_id]= @text
  when 'spotPrice'             then @item[:spot_price]              = @text.to_f
  when 'type'                  then @item[:type]                    = @text
  when 'state'                 then @item[:state]                   = @text
  when 'code'                  then @item[:fault_code]              = @text
  when 'message'               then @item[:fault_message]           = @text
  when 'validFrom'             then @item[:valid_from]              = @text
  when 'validUntil'            then @item[:valid_until]             = @text
  when 'launchGroup'           then @item[:launch_group]            = @text
  when 'availabilityZoneGroup' then @item[:availability_zone_group] = @text
  when 'imageId'               then @item[:image_id]                = @text
  when 'keyName'               then @item[:key_name]                = @text
  when 'userData'              then @item[:userData]                = @text
  when 'data'                  then @item[:data]                    = @text
  when 'addressingType'        then @item[:addressing_type]         = @text
  when 'instanceType'          then @item[:instance_type]           = @text
  when 'availabilityZone'      then @item[:availability_zone]       = @text
  when 'kernelId'              then @item[:kernel_id]               = @text
  when 'ramdiskId'             then @item[:ramdisk_id]              = @text
  when 'subnetId'              then @item[:subnet_id]               = @text
  when 'instanceId'            then @item[:instance_id]             = @text
  when 'createTime'            then @item[:create_time]             = @text
  when 'productDescription'    then @item[:product_description]     = @text
  when 'groupId'               then (@item[:groups] ||= [])        << @text
  else
    case full_tag_name
    when %r{monitoring/enabled$}
      @item[:monitoring_enabled] = @text == 'true'
    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{spotInstanceRequestSet/item$}
      @result << @item
    end
  end
end

#tagstart(name, attributes) ⇒ Object



306
307
308
309
310
311
312
313
314
# File 'lib/ec2/right_ec2_spot_instances.rb', line 306

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