Class: RightAws::Ec2::QEc2DescribeInstancesParser
- Inherits:
-
RightAWSParser
- Object
- RightAWSParser
- RightAws::Ec2::QEc2DescribeInstancesParser
- Defined in:
- lib/ec2/right_ec2_instances.rb
Overview
PARSERS: Instances
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
#reset ⇒ Object
608 609 610 |
# File 'lib/ec2/right_ec2_instances.rb', line 608 def reset @result = [] end |
#tagend(name) ⇒ Object
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# File 'lib/ec2/right_ec2_instances.rb', line 554 def tagend(name) case name when 'reservationId' then @reservation[:aws_reservation_id] = @text when 'ownerId' then @reservation[:aws_owner] = @text when 'groupId' then @reservation[:aws_groups] << @text when 'instanceId' then @item[:aws_instance_id] = @text when 'imageId' then @item[:aws_image_id] = @text when 'privateDnsName' then @item[:private_dns_name] = @text when 'dnsName' then @item[:dns_name] = @text when 'reason' then @item[:aws_reason] = @text when 'keyName' then @item[:ssh_key_name] = @text when 'amiLaunchIndex' then @item[:ami_launch_index] = @text when 'productCode' then @item[:aws_product_codes] << @text when 'instanceType' then @item[:aws_instance_type] = @text when 'launchTime' then @item[:aws_launch_time] = @text when 'availabilityZone' then @item[:aws_availability_zone] = @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 'subnetId' then @item[:subnet_id] = @text when 'vpcId' then @item[:vpc_id] = @text when 'privateIpAddress' then @item[:private_ip_address] = @text when 'ipAddress' then @item[:ip_address] = @text when 'architecture' then @item[:architecture] = @text when 'rootDeviceType' then @item[:root_device_type] = @text when 'rootDeviceName' then @item[:root_device_name] = @text when 'instanceClass' then @item[:instance_class] = @text when 'instanceLifecycle' then @item[:instance_lifecycle] = @text when 'spotInstanceRequestId' then @item[:spot_instance_request_id] = @text when 'requesterId' then @item[:requester_id] = @text else case full_tag_name when %r{/stateReason/code$} then @item[:state_reason_code] = @text when %r{/stateReason/message$} then @item[:state_reason_message] = @text when %r{/instanceState/code$} then @item[:aws_state_code] = @text.to_i when %r{/instanceState/name$} then @item[:aws_state] = @text when %r{/monitoring/state$} then @item[:monitoring_state] = @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 'volumeId' then @block_device_mapping[:ebs_volume_id] = @text when 'status' then @block_device_mapping[:ebs_status] = @text when 'attachTime' then @block_device_mapping[:ebs_attach_time] = @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{/instancesSet/item$} then @reservation[:instances_set] << @item when 'DescribeInstancesResponse/reservationSet/item', 'RunInstancesResponse' @result << @reservation end end end |
#tagstart(name, attributes) ⇒ Object
:nodoc:
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
# File 'lib/ec2/right_ec2_instances.rb', line 533 def (name, attributes) # DescribeInstances property case full_tag_name when 'DescribeInstancesResponse/reservationSet/item', 'RunInstancesResponse' @reservation = { :aws_groups => [], :instances_set => [] } when %r{instancesSet/item$} # the optional params (sometimes are missing and we dont want them to be nil) @item = { :aws_reason => '', :dns_name => '', :private_dns_name => '', :ami_launch_index => '', :ssh_key_name => '', :aws_state => '', :aws_product_codes => [] } when %r{blockDeviceMapping/item$} @item[:block_device_mappings] ||= [] @block_device_mapping = {} end end |