lib/VM/EC2/REST/vpn_gateway.pm

filter: Statementstmt 22.0% 11 / 50 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 20.0% 2 / 10 Podpod 0.0% 0 / 7 totaltotal 14.7% 13 / 88 CC 11 SCAR 21.6
CC
11
Cov
16%
attach_vpn_gateway
12.0
detach_vpn_gateway
12.0
enable_vgw_route_propagation
12.0
CRAP 8.7
« blib/lib/VM/EC2/REST/relational_database_service.pm ↑ Summary lib/VM/EC2/REST/elastic_ip.pm »
1 package VM::EC2::REST::vpn_gateway;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use VM::EC2 ''; # important not to import anything!
Subroutine BEGIN: called CC=1 SCAR=0.0
5 package VM::EC2; # add methods to VM::EC2
6  
7 VM::EC2::Dispatch->register(
8 0 ▶ AttachVpnGateway => sub { shift->{attachment}{state} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
9 1 CreateVpnGateway => 'fetch_one,vpnGateway,VM::EC2::VPC::VpnGateway',
10 DeleteVpnGateway => 'boolean',
11 DescribeVpnGateways => 'fetch_items,vpnGatewaySet,VM::EC2::VPC::VpnGateway',
12 DetachVpnGateway => 'boolean',
13 DisableVgwRoutePropagation => 'boolean',
14 EnableVgwRoutePropagation => 'boolean',
15 );
16  
17 1 my $VEP = 'VM::EC2::ParmParser';
18  
19 =head1 NAME VM::EC2::REST::vpn_gateway
20  
21 =head1 SYNOPSIS
22  
23 use VM::EC2 ':vpc';
24  
25 =head1 METHODS
26  
27 These methods create and manage Virtual Private Network Gateways (VGW).
28  
29 Implemented:
30 AttachVpnGateway
31 CreateVpnGateway
32 DeleteVpnGateway
33 DescribeVpnGateways
34 DisableVgwRoutePropagation
35 EnableVgwRoutePropagation
36  
37 Unimplemented:
38 (none)
39  
40 =head2 @gtwys = $ec2->describe_vpn_gateways(-vpn_gateway_id=>\@ids,
41 -filter =>\%filters)
42  
43 =head2 @gtwys = $ec2->describe_vpn_gateways(@vpn_gateway_ids)
44  
45 =head2 @gtwys = $ec2->describe_vpn_gateways(%filters)
46  
47 Provides information on VPN gateways.
48  
49 Return a series of VM::EC2::VPC::VpnGateway objects. When called with no
50 arguments, returns all VPN gateways. Pass a list of VPN gateway IDs or
51 use the assorted filters to restrict the search.
52  
53 Optional parameters are:
54  
55 -vpn_gateway_id ID of the gateway(s) to return information on.
56 This can be a string scalar, or an arrayref.
57  
58 -filter Tags and other filters to apply.
59  
60 The filter argument is a hashreference in which the keys are the
61 filter names, and the values are the match strings. Some filters
62 accept wildcards.
63  
64 There are a number of filters, which are listed in full at
65 http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVpnGateways.html
66  
67 Here is a alpha-sorted list of filter names: attachment.state,
68 attachment.vpc-id, availability-zone, state, tag-key, tag-value, tag:key, type,
69 vpn-gateway-id
70  
71 =cut
72  
73 sub describe_vpn_gateways {
74 0 ▶ my $self = shift;
Subroutine describe_vpn_gateways: not called CC=1 SCAR=6.9
Pod undocumented
75 0 my %args = $VEP->args(-vpn_gateway_id,@_);
76 0 my @params = $VEP->format_parms(\%args,
77 {
78 list_parm => 'VpnGatewayId',
79 filter_parm => 'Filter',
80 });
81 0 return $self->call('DescribeVpnGateways',@params);
82 }
83  
84 =head2 $vpn_gateway = $ec2->create_vpn_gateway(-type=>$type)
85  
86 =head2 $vpn_gateway = $ec2->create_vpn_gateway($type)
87  
88 =head2 $vpn_gateway = $ec2->create_vpn_gateway
89  
90 Creates a new virtual private gateway. A virtual private gateway is the
91 VPC-side endpoint for a VPN connection. You can create a virtual private
92 gateway before creating the VPC itself.
93  
94 -type switch is optional as there is only one type as of API 2012-06-15
95  
96 Returns a VM::EC2::VPC::VpnGateway object on success
97  
98 =cut
99  
100 sub create_vpn_gateway {
101 0 ▶ my $self = shift;
Subroutine create_vpn_gateway: not called CC=2 SCAR=17.9
Pod undocumented
102 0 my %args = $VEP->args(-type,@_);
103 0 ▶ $args{-type} ||= 'ipsec.1';
Condition0%0/2
$args{"-type"} ||= "ipsec.1"
l!l
00
MC/DC0%0/1
$args{"-type"} ||= "ipsec.1"
$args{"-type"}
Truth table0%0/2
A
A= $args{"-type"}
Aresult
11
00
104 0 my @params = $VEP->format_parms(\%args,
105 {
106 list_parm => 'Type',
107 });
108 0 return $self->call('CreateVpnGateway',@params);
109 }
110  
111 =head2 $success = $ec2->delete_vpn_gateway(-vpn_gateway_id=>$id);
112  
113 =head2 $success = $ec2->delete_vpn_gateway($id);
114  
115 Deletes a virtual private gateway. Use this when a VPC and all its associated
116 components are no longer needed. It is recommended that before deleting a
117 virtual private gateway, detach it from the VPC and delete the VPN connection.
118 Note that it is not necessary to delete the virtual private gateway if the VPN
119 connection between the VPC and data center needs to be recreated.
120  
121 Arguments:
122  
123 -vpn_gateway_id -- The ID of the VPN gateway to delete.
124  
125 Returns true on successful deletion
126  
127 =cut
128  
129 sub delete_vpn_gateway {
130 0 ▶ my $self = shift;
Subroutine delete_vpn_gateway: not called CC=2 SCAR=17.9
Pod undocumented
131 0 my %args = $VEP->args(-vpn_gateway_id,@_);
132 $args{-vpn_gateway_id} or
133 0 ▶ croak "delete_vpn_gateway(): -vpn_gateway_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-vpn_gateway_id"} or croak("delete_vpn_gateway(): -vpn_gateway_id argument missing") 0 0 0
134 0 my @params = $VEP->format_parms(\%args,
135 {
136 single_parm => 'VpnGatewayId',
137 });
138 0 return $self->call('DeleteVpnGateway',@params);
139 }
140  
141 =head2 $state = $ec2->attach_vpn_gateway(-vpn_gateway_id=>$vpn_gtwy_id,
142 -vpc_id =>$vpc_id)
143  
144 Attaches a virtual private gateway to a VPC.
145  
146 Arguments:
147  
148 -vpc_id -- The ID of the VPC to attach the VPN gateway to
149  
150 -vpn_gateway_id -- The ID of the VPN gateway to attach
151  
152 Returns the state of the attachment, one of:
153 attaching | attached | detaching | detached
154  
155 =cut
156  
157 sub attach_vpn_gateway {
158 0 ▶ my $self = shift;
Subroutine attach_vpn_gateway: not called CC=3 SCAR=24.8
Pod undocumented
159 0 my %args = @_;
160 $args{-vpn_gateway_id} or
161 0 ▶ croak "attach_vpn_gateway(): -vpn_gateway_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-vpn_gateway_id"} or croak("attach_vpn_gateway(): -vpn_gateway_id argument missing") 0 0 0
162 $args{-vpc_id} or
163 0 ▶ croak "attach_vpn_gateway(): -vpc_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-vpc_id"} or croak("attach_vpn_gateway(): -vpc_id argument missing") 0 0 0
164 0 my @params = $VEP->format_parms(\%args,
165 {
166 single_parm => [qw(VpnGatewayId VpcId)],
167 });
168 0 return $self->call('AttachVpnGateway',@params);
169 }
170  
171 =head2 $success = $ec2->detach_vpn_gateway(-vpn_gateway_id=>$vpn_gtwy_id,
172 -vpc_id =>$vpc_id)
173  
174 Detaches a virtual private gateway from a VPC. You do this if you're
175 planning to turn off the VPC and not use it anymore. You can confirm
176 a virtual private gateway has been completely detached from a VPC by
177 describing the virtual private gateway (any attachments to the
178 virtual private gateway are also described).
179  
180 You must wait for the attachment's state to switch to detached
181 before you can delete the VPC or attach a different VPC to the
182 virtual private gateway.
183  
184 Arguments:
185  
186 -vpc_id -- The ID of the VPC to detach the VPN gateway from
187  
188 -vpn_gateway_id -- The ID of the VPN gateway to detach
189  
190 Returns true on successful detachment.
191  
192 =cut
193  
194 sub detach_vpn_gateway {
195 0 ▶ my $self = shift;
Subroutine detach_vpn_gateway: not called CC=3 SCAR=24.8
Pod undocumented
196 0 my %args = @_;
197 $args{-vpn_gateway_id} or
198 0 ▶ croak "detach_vpn_gateway(): -vpn_gateway_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-vpn_gateway_id"} or croak("detach_vpn_gateway(): -vpn_gateway_id argument missing") 0 0 0
199 $args{-vpc_id} or
200 0 ▶ croak "detach_vpn_gateway(): -vpc_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-vpc_id"} or croak("detach_vpn_gateway(): -vpc_id argument missing") 0 0 0
201 0 my @params = $VEP->format_parms(\%args,
202 {
203 single_parm => [qw(VpnGatewayId VpcId)],
204 });
205 0 return $self->call('DetachVpnGateway',@params);
206 }
207  
208 =head2 $success = $ec2->enable_vgw_route_propagation(-route_table_id=>$rt_id,
209 -gateway_id =>$gtwy_id)
210  
211 Enables a virtual private gateway (VGW) to propagate routes to the routing
212 tables of an Amazon VPC.
213  
214 Arguments:
215  
216 -route_table_id -- The ID of the routing table.
217  
218 -gateway_id -- The ID of the virtual private gateway.
219  
220 Returns true on successful enablement.
221  
222 =cut
223  
224 sub enable_vgw_route_propagation {
225 0 ▶ my $self = shift;
Subroutine enable_vgw_route_propagation: not called CC=3 SCAR=24.8
Pod undocumented
226 0 my %args = @_;
227 $args{-route_table_id} or
228 0 ▶ croak "enable_vgw_route_propagation(): -route_table_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-route_table_id"} or croak("enable_vgw_route_propagation(): -route_table_id argument missing") 0 0 0
229 $args{-gateway_id} or
230 0 ▶ croak "enable_vgw_route_propagation(): -gateway_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-gateway_id"} or croak("enable_vgw_route_propagation(): -gateway_id argument missing") 0 0 0
231 0 my @params = $VEP->format_parms(\%args,
232 {
233 single_parm => [qw(RouteTableId GatewayId)],
234 });
235 0 return $self->call('EnableVgwRoutePropagation',@params);
236 }
237  
238 =head2 $success = $ec2->disable_vgw_route_propagation(-route_table_id=>$rt_id,
239 -gateway_id =>$gtwy_id)
240  
241 Disables a virtual private gateway (VGW) from propagating routes to the routing
242 tables of an Amazon VPC.
243  
244 Arguments:
245  
246 -route_table_id -- The ID of the routing table.
247  
248 -gateway_id -- The ID of the virtual private gateway.
249  
250 Returns true on successful disablement.
251  
252 =cut
253  
254 sub disable_vgw_route_propagation {
255 0 ▶ my $self = shift;
Subroutine disable_vgw_route_propagation: not called CC=3 SCAR=24.8
Pod undocumented
256 0 my %args = @_;
257 $args{-route_table_id} or
258 0 ▶ croak "disable_vgw_route_propagation(): -route_table_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-route_table_id"} or croak("disable_vgw_route_propagation(): -route_table_id argument missing") 0 0 0
259 $args{-gateway_id} or
260 0 ▶ croak "disable_vgw_route_propagation(): -gateway_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-gateway_id"} or croak("disable_vgw_route_propagation(): -gateway_id argument missing") 0 0 0
261 0 my @params = $VEP->format_parms(\%args,
262 {
263 single_parm => [qw(RouteTableId GatewayId)],
264 });
265 0 return $self->call('DisableVgwRoutePropagation',@params);
266 }
267  
268 # aliases for backward compatibility to a typo
269 1 *enable_vgw_route_propogation = \&enable_vgw_route_propagation;
270 1 *disable_vgw_route_propogation = \&dispable_vgw_route_propagation;
271  
272 =head1 SEE ALSO
273  
274 L<VM::EC2>
275  
276 =head1 AUTHOR
277  
278 Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>.
279 Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>.
280  
281 Copyright (c) 2012 Loyalty Methods, Inc.
282 Copyright (c) 2012 Ontario Institute for Cancer Research
283  
284 This package and its accompanying libraries is free software; you can
285 redistribute it and/or modify it under the terms of the GPL (either
286 version 1, or at your option, any later version) or the Artistic
287 License 2.0. Refer to LICENSE for the full license text. In addition,
288 please see DISCLAIMER.txt for disclaimers of warranty.
289  
290 =cut
291  
292  
293 1 1;
« blib/lib/VM/EC2/REST/relational_database_service.pm ↑ Summary lib/VM/EC2/REST/elastic_ip.pm »