1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #2549 from jsmapr1/master

Return Private IPs in an array using AWS Describe Network Interface
This commit is contained in:
Wesley Beary 2014-01-09 08:02:59 -08:00
commit a5d8347887
2 changed files with 20 additions and 0 deletions

View file

@ -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',

View file

@ -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 = {})