lib/VM/EC2/REST/customer_gateway.pm

filter: Statementstmt 34.6% 9 / 26 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 40.0% 2 / 5 Podpod 0.0% 0 / 3 totaltotal 22.9% 11 / 48 CC 6 SCAR 28.1
CC
6
Cov
24%
create_customer_gateway
30.0
delete_customer_gateway
6.0
describe_customer_gateways
2.0
CRAP 16.6
« lib/VM/EC2/REST/reserved_instance.pm ↑ Summary blib/lib/VM/EC2/REST/route_table.pm »
1 package VM::EC2::REST::customer_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 1 VM::EC2::Dispatch->register(
8 DescribeCustomerGateways => 'fetch_items,customerGatewaySet,VM::EC2::VPC::CustomerGateway',
9 CreateCustomerGateway => 'fetch_one,customerGateway,VM::EC2::VPC::CustomerGateway',
10 DeleteCustomerGateway => 'boolean',
11 );
12  
13 1 my $VEP = 'VM::EC2::ParmParser';
14  
15 =head1 NAME VM::EC2::REST::customer_gateway
16  
17 =head1 SYNOPSIS
18  
19 use VM::EC2 ':vpc';
20  
21 =head1 METHODS
22  
23 These methods control customer gateways for AWS VPNs.
24  
25 Implemented:
26 CreateCustomerGateway
27 DeleteCustomerGateway
28 DescribeCustomerGateways
29  
30 Unimplemented:
31 (none)
32  
33 =head2 @gtwys = $ec2->describe_customer_gateways(-customer_gateway_id=>\@ids,
34 -filter =>\%filters)
35  
36 =head2 @gtwys = $ec2->describe_customer_gateways(\@customer_gateway_ids)
37  
38 =head2 @gtwys = $ec2->describe_customer_gateways(%filters)
39  
40 Provides information on VPN customer gateways.
41  
42 Returns a series of VM::EC2::VPC::CustomerGateway objects.
43  
44 Optional parameters are:
45  
46 -customer_gateway_id ID of the gateway(s) to return information on.
47 This can be a string scalar, or an arrayref.
48  
49 -filter Tags and other filters to apply.
50  
51 The filter argument is a hashreference in which the keys are the filter names,
52 and the values are the match strings. Some filters accept wildcards.
53  
54 There are a number of filters, which are listed in full at
55 http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeCustomerGateways.html
56  
57 Here is a alpha-sorted list of filter names: bgp-asn, customer-gateway-id,
58 ip-address, state, type, tag-key, tag-value, tag:key
59  
60 =cut
61  
62 sub describe_customer_gateways {
63 0 ▶ my $self = shift;
Subroutine describe_customer_gateways: not called CC=1 SCAR=6.9
Pod undocumented
64 0 my %args = $VEP->args(-customer_gateway_id,@_);
65 0 my @params = $VEP->format_parms(\%args,
66 {
67 list_parm => 'CustomerGatewayId',
68 filter_parm => 'Filter',
69 });
70 0 return $self->call('DescribeCustomerGateways',@params);
71 }
72  
73 =head2 $cust_gtwy = $ec2->create_customer_gateway(-type =>$type,
74 -ip_address=>$ip,
75 -bgp_asn =>$asn)
76  
77 Provides information to AWS about a VPN customer gateway device. The customer
78 gateway is the appliance at the customer end of the VPN connection (compared
79 to the virtual private gateway, which is the device at the AWS side of the
80 VPN connection).
81  
82 Arguments:
83  
84 -ip_address -- The IP address of the customer gateway appliance
85  
86 -bgp_asn -- The Border Gateway Protocol (BGP) Autonomous System Number
87 (ASN) of the customer gateway
88  
89 -type -- Optional as there is only currently (2012-06-15 API) only
90 one type (ipsec.1)
91  
92 -ip -- Alias for -ip_address
93  
94 Returns a L<VM::EC2::VPC::CustomerGateway> object on success.
95  
96 =cut
97  
98 sub create_customer_gateway {
99 0 ▶ my $self = shift;
Subroutine create_customer_gateway: not called CC=5 SCAR=34.0
Pod undocumented
100 0 my %args = @_;
101 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
102 0 ▶ $args{-ip_address} ||= $args{-ip};
Condition0%0/3
$args{"-ip_address"} ||= $args{"-ip"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{"-ip_address"} ||= $args{"-ip"}
$args{"-ip_address"} $args{"-ip"}
Truth table0%0/3
A ||= B
A= $args{"-ip_address"}B= $args{"-ip"}
ABresult
1X1
011
000
103 $args{-ip_address} or
104 0 ▶ croak "create_customer_gateway(): -ip_address argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-ip_address"} or croak("create_customer_gateway(): -ip_address argument missing") 0 0 0
105 $args{-bgp_asn} or
106 0 ▶ croak "create_customer_gateway(): -bgp_asn argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-bgp_asn"} or croak("create_customer_gateway(): -bgp_asn argument missing") 0 0 0
107 0 my @params = $VEP->format_parms(\%args,
108 {
109 single_parm => [qw(Type IpAddress BgpAsn)],
110 });
111 0 return $self->call('CreateCustomerGateway',@params);
112 }
113  
114 =head2 $success = $ec2->delete_customer_gateway(-customer_gateway_id=>$id)
115  
116 =head2 $success = $ec2->delete_customer_gateway($id)
117  
118 Deletes a VPN customer gateway. You must delete the VPN connection before
119 deleting the customer gateway.
120  
121 Arguments:
122  
123 -customer_gateway_id -- The ID of the customer gateway to delete
124  
125 Returns true on successful deletion.
126  
127 =cut
128  
129 sub delete_customer_gateway {
130 0 ▶ my $self = shift;
Subroutine delete_customer_gateway: not called CC=2 SCAR=17.9
Pod undocumented
131 0 my %args = $VEP->args(-customer_gateway_id,@_);
132 $args{-customer_gateway_id} or
133 0 ▶ croak "delete_customer_gateway(): -customer_gateway_id argument missing";
Branch: 1 branch
BranchTrueFalseTotal
$args{"-customer_gateway_id"} or croak("delete_customer_gateway(): -customer_gateway_id argument missing") 0 0 0
134 0 my @params = $VEP->format_parms(\%args,
135 {
136 single_parm => 'CustomerGatewayId',
137 });
138 0 return $self->call('DeleteCustomerGateway',@params);
139 }
140  
141 =head1 SEE ALSO
142  
143 L<VM::EC2>
144  
145 =head1 AUTHOR
146  
147 Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>.
148  
149 Copyright (c) 2011 Ontario Institute for Cancer Research
150  
151 This package and its accompanying libraries is free software; you can
152 redistribute it and/or modify it under the terms of the GPL (either
153 version 1, or at your option, any later version) or the Artistic
154 License 2.0. Refer to LICENSE for the full license text. In addition,
155 please see DISCLAIMER.txt for disclaimers of warranty.
156  
157 =cut
158  
159  
160 1 1;
« lib/VM/EC2/REST/reserved_instance.pm ↑ Summary blib/lib/VM/EC2/REST/route_table.pm »