| 1 | package VM::EC2::VPC::VpnGateway::Attachment; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::VPC::VpnGateway::Attachment -- Attachment of a vpn gateway to a VPC | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | my $ec2 = VM::EC2->new(...); | ||
| 11 | my $gw = $ec2->describe_vpn_gateways('vpn-12345678'); | ||
| 12 | my @attachments = $gw->attachments; | ||
| 13 | for my $a (@attachments) { | ||
| 14 | print $a->vpcId,"\n", | ||
| 15 | $a->state,"\n"; | ||
| 16 | } | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | This object provides information about the attachment of a EC2 Virtual | ||
| 21 | Private Cloud internet gateway to a VPC. | ||
| 22 | |||
| 23 | =head1 METHODS | ||
| 24 | |||
| 25 | These object methods are supported: | ||
| 26 | |||
| 27 | vpcId -- the ID of the VPC | ||
| 28 | state -- the state of the attachment; one of "attaching", "attached", | ||
| 29 | "detaching" and "detached" | ||
| 30 | |||
| 31 | In addition, this object supports the following convenience method: | ||
| 32 | |||
| 33 | vpc -- Return the VM::EC2::VPC object corresponding to the attachment. | ||
| 34 | check for changes in attachment state. | ||
| 35 | |||
| 36 | =head1 STRING OVERLOADING | ||
| 37 | |||
| 38 | When used in a string context, this object will be interpolated as the | ||
| 39 | vpcId. | ||
| 40 | |||
| 41 | =head1 SEE ALSO | ||
| 42 | |||
| 43 | L<VM::EC2> | ||
| 44 | L<VM::EC2::Generic> | ||
| 45 | L<VM::EC2::VPC> | ||
| 46 | L<VM::EC2::VPC::VpnGateway> | ||
| 47 | |||
| 48 | =head1 AUTHOR | ||
| 49 | |||
| 50 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 51 | |||
| 52 | Copyright (c) 2012 Ontario Institute for Cancer Research | ||
| 53 | |||
| 54 | This package and its accompanying libraries is free software; you can | ||
| 55 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 56 | version 1, or at your option, any later version) or the Artistic | ||
| 57 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 58 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 59 | |||
| 60 | =cut | ||
| 61 | |||
| 62 | use strict; | ||
| 63 | use Carp 'croak'; | ||
| 64 | use base 'VM::EC2::Generic'; | ||
| 65 | |||
| 66 | sub valid_fields { | ||
| 67 | my $self = shift; | ||
| 68 | return qw(vpcId state); | ||
| 69 | } | ||
| 70 | |||
| 71 | sub short_name { shift->vpcId } | ||
| 72 | |||
| 73 | sub vpc { | ||
| 74 | my $self = shift; | ||
| 75 | my $vpcId = $self->vpcId or return; | ||
| 76 | return $self->aws->describe_vpcs($vpcId); | ||
| 77 | } | ||
| 78 | |||
| 79 | 1; | ||
| 80 |