blib/lib/VM/EC2/VPC/RouteTable/Association.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran n/a Conditioncond 0.0% 0 / 4 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 36 CC 1 SCAR 6.9
CC
1
Cov
0%
valid_fields
2.0
short_name
2.0
route_table
2.0
CRAP 2.0
1 package VM::EC2::VPC::RouteTable::Association;
2  
3 =head1 NAME
4  
5 VM::EC2::VPC::RouteTable::Association -- The association between a route table and a subnet
6  
7 =head1 SYNOPSIS
8  
9 use VM::EC2;
10 my $ec2 = VM::EC2->new(...);
11 my $table = $ec2->describe_route_tables('rtb-123456');
12 my @associations = $table->associations;
13  
14 foreach my $a (@associations) {
15 print $a->routeTableAssociationId,"\n",
16 $a->routeTableId,"\n",
17 $a->subnetid,"\n",
18 $a->main,"\n";
19 }
20  
21 =head1 DESCRIPTION
22  
23 This object describes the association between a EC2 Virtual Private
24 Cloud routing table and a particular subnet. The special "main" route
25 table, which is assigned to newly-created subnets by default, is
26 designated by an association that returns a true value for the main()
27 method.
28  
29 =head1 METHODS
30  
31 These object methods are supported:
32
33 routeTableAssociationId -- An identifier representing this association.
34 routeTableId -- The ID of the associated route table.
35 subnetId -- The ID of the associated subnet.
36 main -- Returns true if the associated route table is
37 the VPC's main table.
38  
39 In addition, the following convenience methods are provided:
40  
41 route_table -- Return the VM::EC2::VPC::RouteTable object.
42  
43 subnet -- Return the VM::EC2::VPC::Subnet object.
44  
45 =head1 STRING OVERLOADING
46  
47 When used in a string context, this object will be interpolated as the
48 routeTableAssociationId.
49  
50 =head1 SEE ALSO
51  
52 L<VM::EC2>
53 L<VM::EC2::Generic>
54 L<VM::EC2::VPC::RouteTable>
55 L<VM::EC2::VPC::Subnet>
56  
57 =head1 AUTHOR
58  
59 Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>.
60  
61 Copyright (c) 2012 Ontario Institute for Cancer Research
62  
63 This package and its accompanying libraries is free software; you can
64 redistribute it and/or modify it under the terms of the GPL (either
65 version 1, or at your option, any later version) or the Artistic
66 License 2.0. Refer to LICENSE for the full license text. In addition,
67 please see DISCLAIMER.txt for disclaimers of warranty.
68  
69 =cut
70  
71 use strict;
72 use Carp 'croak';
73 use base 'VM::EC2::Generic';
74  
75 sub valid_fields {
76 my $self = shift;
77 return qw(routeTableAssociationId routeTableId subnetId main);
78 }
79  
80 sub short_name { shift->routeTableAssociationId }
81  
82 sub route_table {
83 my $self = shift;
84 my $rt = $self->routeTableId or return;
85 return $self->aws->describe_route_tables($rt);
86 }
87  
88 sub subnet {
89 my $self = shift;
90 my $sn = $self->subnetId or return;
91 return $self->aws->describe_subnets($sn);
92 }
93  
94 sub main { shift->SUPER::main eq 'true' }
95  
96 1;
97