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
632 633 634 |
# File 'lib/ec2/right_ec2_instances.rb', line 632 def reset @result = [] end |
#tagend(name) ⇒ Object
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 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
# File 'lib/ec2/right_ec2_instances.rb', line 560 def tagend(name) case name when 'reservationId' then @reservation[:aws_reservation_id] = @text when 'ownerId' then @reservation[:aws_owner] = @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 when 'virtualizationType' then @item[:virtualization_type] = @text when 'clientToken' then @item[:client_token] = @text when 'sourceDestCheck' then @item[:source_dest_check] = @text == 'true' ? true : false when 'tenancy' then @item[:placement_tenancy] = @text when 'hypervisor' then @item[:hypervisor] = @text else case full_tag_name # EC2 Groups when %r{(RunInstancesResponse|/reservationSet/item)/groupSet/item/groupId$} then @group[:group_id] = @text when %r{(RunInstancesResponse|/reservationSet/item)/groupSet/item/groupName$} then @group[:group_name] = @text when %r{(RunInstancesResponse|/reservationSet/item)/groupSet/item$} then @reservation[:aws_groups] << @group # VPC Groups # KD: It seems that these groups are always present when the groups above present for non VPC instances only when %r{/instancesSet/item/groupSet/item/groupId$} then @group[:group_id] = @text when %r{/instancesSet/item/groupSet/item/groupName$} then @group[:group_name] = @text when %r{/instancesSet/item/groupSet/item$} then @item[:groups] << @group # Placement Group Name when %r{/placement/groupName$} then @group[:placement_group_name]= @text # Codes 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{/license/pool$} then @item[:license_pool] = @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 %r{/tagSet/item/key$} then @aws_tag[:key] = @text when %r{/tagSet/item/value$} then @aws_tag[:value] = @text when %r{/tagSet/item$} then @item[:tags][@aws_tag[:key]] = @aws_tag[:value] when %r{(RunInstancesResponse|DescribeInstancesResponse/reservationSet/item)$} then @result << @reservation end end end |
#tagstart(name, attributes) ⇒ Object
:nodoc:
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
# File 'lib/ec2/right_ec2_instances.rb', line 541 def (name, attributes) case full_tag_name when %r{(RunInstancesResponse|DescribeInstancesResponse/reservationSet/item)$} @reservation = { :aws_groups => [], :instances_set => [] } when %r{(/groupSet/item|instancesSet/item/placement)$} @group = {} when %r{instancesSet/item$} # the optional params (sometimes are missing and we dont want them to be nil) @item = { :aws_product_codes => [], :groups => [], :tags => {} } when %r{blockDeviceMapping/item$} @item[:block_device_mappings] ||= [] @block_device_mapping = {} when %r{/tagSet/item$} @aws_tag = {} end end |