blib/lib/VM/EC2/VPC/VpnGateway.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 41 CC 2 SCAR 10.3
CC
2
Cov
0%
availabilityZone
6.0
primary_id
2.0
valid_fields
2.0
CRAP 2.8
1 package VM::EC2::VPC::VpnGateway;
2  
3 =head1 NAME
4  
5 VM::EC2::VPC::VpnGateway - Virtual Private Cloud VPN gateway
6  
7 =head1 SYNOPSIS
8  
9 use VM::EC2;
10  
11 my $ec2 = VM::EC2->new(...);
12 my $gtwy = $ec2->describe_vpn_gateways(-vpn_gatway_id=>'vgw-12345678');
13 my $state = $gtwy->state;
14  
15 =head1 DESCRIPTION
16  
17 This object represents an Amazon EC2 VPC route, and is returned by
18 VM::EC2->describe_internet_gateways() and ->create_internet_gateway()
19  
20 =head1 METHODS
21  
22 These object methods are supported:
23  
24 vpnGatewayId -- The ID of the VPN gateway.
25 state -- The current state of the virtual private gateway.
26 Valid values: pending | available | deleting | deleted
27 type -- The type of VPN connection the virtual private gateway
28 supports (ipsec.1)
29 availabilityZone -- The Availability Zone where the virtual private gateway
30 was created as a L<VM::EC2::AvailabilityZone> object.
31 attachments -- A list of VPCs attached to the VPN gateway.
32 tagSet -- Tags assigned to the resource.
33 zone -- Alias for availabilityZone.
34  
35 The following convenience methods are supported:
36  
37 attachments -- Returns a series of L<VM::EC2::VPC::VpnGateway::Attachment>
38 objects
39  
40 The object also supports the tags() method described in
41 L<VM::EC2::Generic>:
42  
43 =head1 STRING OVERLOADING
44  
45 When used in a string context, this object will interpolate the
46 vpnGatewayId.
47  
48 =head1 SEE ALSO
49  
50 L<VM::EC2>
51 L<VM::EC2::Generic>
52 L<VM::EC2::Tag>
53 L<VM::EC2::VPC>
54 L<VM::EC2::VPC::VpnGateway::Attachment>
55  
56 =head1 AUTHOR
57  
58 Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>.
59  
60 Copyright (c) 2012 Loyalty Methods, Inc.
61  
62 This package and its accompanying libraries is free software; you can
63 redistribute it and/or modify it under the terms of the GPL (either
64 version 1, or at your option, any later version) or the Artistic
65 License 2.0. Refer to LICENSE for the full license text. In addition,
66 please see DISCLAIMER.txt for disclaimers of warranty.
67  
68 =cut
69  
70 use strict;
71 use base 'VM::EC2::Generic';
72 use VM::EC2::VPC::VpnGateway::Attachment;
73 use Carp 'croak';
74  
75 sub primary_id { shift->vpnGatewayId }
76  
77 sub valid_fields {
78 my $self = shift;
79 return qw(vpnGatewayId state type availabilityZone attachments tagSet);
80 }
81  
82 sub attachments {
83 my $self = shift;
84 my $attach = $self->SUPER::attachments;
85 return map { VM::EC2::VPC::VpnGateway::Attachment->new($_,$self->aws) } @{$attach->{item}};
86 }
87  
88 sub availabilityZone {
89 my $self = shift;
90 my $zone = $self->SUPER::availabilityZone;
91 return $self->aws->describe_availability_zones($zone) if $zone;
92 return $self->aws->describe_availability_zones();
93 }
94  
95 sub zone { shift->availabilityZone }
96  
97 1;
98