From fc8285903f8ad818d2a9086198ed4814797f3db9 Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 8 Jan 2014 14:50:45 -0600 Subject: [PATCH 1/2] Update network parser to add private ips to array Previously the network parser would overwrite the private ip addresses if there were more than one. These are now added to an array --- .../parsers/compute/network_interface_parser.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/fog/aws/parsers/compute/network_interface_parser.rb b/lib/fog/aws/parsers/compute/network_interface_parser.rb index 6f8f58f0b..96c89502a 100644 --- a/lib/fog/aws/parsers/compute/network_interface_parser.rb +++ b/lib/fog/aws/parsers/compute/network_interface_parser.rb @@ -11,6 +11,7 @@ module Fog @in_group_set = false @in_attachment = false @in_association = false + @in_private_ip_addresses = false end def reset @@ -32,6 +33,10 @@ module Fog when 'association' @in_association = true @association = {} + when 'privateIpAddressesSet' + @in_private_ip_addresses = true + @private_ip_addresses = [] + @private_ip_address = {} end end @@ -72,6 +77,17 @@ module Fog @nic['association'] = @association @in_association = false end + elsif @in_private_ip_addresses + case name + when 'item' + @private_ip_addresses << @private_ip_address + @private_ip_address = {} + when 'privateIpAddress', 'privateDnsName', 'primary' + @private_ip_address[name] = value + when 'privateIpAddressesSet' + @nic['privateIpAddresses'] = @private_ip_addresses + @in_private_ip_address = false + end else case name when 'networkInterfaceId', 'subnetId', 'vpcId', 'availabilityZone', 'description', 'ownerId', 'requesterId', From 10c6918ca14f89b6d26f6154cc17577f8e8f151f Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 8 Jan 2014 14:53:14 -0600 Subject: [PATCH 2/2] Update documentation of return values --- lib/fog/aws/requests/compute/describe_network_interfaces.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/fog/aws/requests/compute/describe_network_interfaces.rb b/lib/fog/aws/requests/compute/describe_network_interfaces.rb index 99dd1bbff..b3f6bbee7 100644 --- a/lib/fog/aws/requests/compute/describe_network_interfaces.rb +++ b/lib/fog/aws/requests/compute/describe_network_interfaces.rb @@ -47,6 +47,10 @@ module Fog # * 'tagSet'<~Array>: - Tags assigned to the resource. # * 'key'<~String> - Tag's key # * 'value'<~String> - Tag's value + # * 'privateIpAddresses' <~Array>: + # * 'privateIpAddress'<~String> - One of the additional private ip address + # * 'privateDnsName'<~String> - The private DNS associate to the ip address + # * 'primay'<~String> - Whether main ip associate with NIC true of false # # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/2012-03-01/APIReference/index.html?ApiReference-query-DescribeNetworkInterfaces.html] def describe_network_interfaces(filters = {})