1package VM::EC2::VPC::InternetGateway::Attachment;
2
3=head1 NAME
4
5VM::EC2::VPC::InternetGateway::Attachment -- Attachment of an internet gateway to a VPC
6
7=head1 SYNOPSIS
8
9 use VM::EC2;
10 my $ec2      = VM::EC2->new(...);
11 my $gw = $ec2->describe_internet_gateways('igw-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
20This object provides information about the attachment of a EC2 Virtual
21Private Cloud internet gateway to a VPC.
22
23=head1 METHODS
24
25These 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
31In 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
38When used in a string context, this object will be interpolated as the
39vpcId.
40
41=head1 SEE ALSO
42
43L<VM::EC2>
44L<VM::EC2::Generic>
45L<VM::EC2::VPC>
46L<VM::EC2::VPC::InternetGateway>
47
48=head1 AUTHOR
49
50Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>.
51
52Copyright (c) 2012 Ontario Institute for Cancer Research
53
54This package and its accompanying libraries is free software; you can
55redistribute it and/or modify it under the terms of the GPL (either
56version 1, or at your option, any later version) or the Artistic
57License 2.0.  Refer to LICENSE for the full license text. In addition,
58please see DISCLAIMER.txt for disclaimers of warranty.
59
60=cut
61
62use strict;
63use Carp 'croak';
64use base 'VM::EC2::Generic';
65
66sub valid_fields {
67    my $self  = shift;
68    return qw(vpcId state);
69}
70
71sub short_name { shift->vpcId }
72
73sub vpc {
74    my $self = shift;
75    my $vpcId = $self->vpcId or return;
76    return $self->aws->describe_vpcs($vpcId);
77}
78
791;
80
81