| 1 | package VM::EC2::NetworkInterface::Association; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::NetworkInterface::Association -- Object representing an association of a network interface with an elastic public IP address | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | my $ec2 = VM::EC2->new(...); | ||
| 11 | my $interface = $ec2->describe_network_interfaces('eni-12345'); | ||
| 12 | my $association = $interface->association; | ||
| 13 | my $id = $association->associationId; | ||
| 14 | my $public_ip = $association->ipOwnerId; | ||
| 15 | my $address = $association->address; | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | This object provides access to an elastic address association object, | ||
| 20 | which reversibly associates an elastic public IP address with an | ||
| 21 | elastic network interface (ENI). | ||
| 22 | |||
| 23 | Please see L<VM::EC2::Generic> for methods shared by all VM::EC2 | ||
| 24 | objects. | ||
| 25 | |||
| 26 | =head1 METHODS | ||
| 27 | |||
| 28 | These object methods are supported: | ||
| 29 | |||
| 30 | associationId | ||
| 31 | publicIp | ||
| 32 | publicDnsName | ||
| 33 | ipOwnerId | ||
| 34 | allocationId | ||
| 35 | |||
| 36 | In addition, this object supports the following convenience method: | ||
| 37 | |||
| 38 | address() -- Returns the VM::EC2::Address object involved in the | ||
| 39 | association. | ||
| 40 | |||
| 41 | =head1 STRING OVERLOADING | ||
| 42 | |||
| 43 | When used in a string context, this object will be interpolated as the | ||
| 44 | public IP address. | ||
| 45 | |||
| 46 | =head1 SEE ALSO | ||
| 47 | |||
| 48 | L<VM::EC2> | ||
| 49 | L<VM::EC2::Generic> | ||
| 50 | |||
| 51 | =head1 AUTHOR | ||
| 52 | |||
| 53 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 54 | |||
| 55 | Copyright (c) 2012 Ontario Institute for Cancer Research | ||
| 56 | |||
| 57 | This package and its accompanying libraries is free software; you can | ||
| 58 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 59 | version 1, or at your option, any later version) or the Artistic | ||
| 60 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 61 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 62 | |||
| 63 | =cut | ||
| 64 | |||
| 65 | use strict; | ||
| 66 | use base 'VM::EC2::Generic'; | ||
| 67 | |||
| 68 | sub valid_fields { | ||
| 69 | my $self = shift; | ||
| 70 | return qw(associationId publicIp publicDnsName ipOwnerId allocationId); | ||
| 71 | } | ||
| 72 | |||
| 73 | sub address { | ||
| 74 | my $self = shift; | ||
| 75 | return $self->aws->describe_addresses($self->publicIp); | ||
| 76 | } | ||
| 77 | |||
| 78 | sub short_name { shift->publicIp} | ||
| 79 | |||
| 80 | 1; | ||
| 81 |