| 1 | package VM::EC2::REST::network_acl; | ||||||||||||||||||||||||||||
| 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 | CreateNetworkAcl => 'fetch_one,networkAcl,VM::EC2::VPC::NetworkAcl', | ||||||||||||||||||||||||||||
| 9 | CreateNetworkAclEntry => 'boolean', | ||||||||||||||||||||||||||||
| 10 | DeleteNetworkAcl => 'boolean', | ||||||||||||||||||||||||||||
| 11 | DeleteNetworkAclEntry => 'boolean', | ||||||||||||||||||||||||||||
| 12 | DescribeNetworkAcls => 'fetch_items,networkAclSet,VM::EC2::VPC::NetworkAcl', | ||||||||||||||||||||||||||||
| 13 | 0 | ▶ | ReplaceNetworkAclAssociation => sub { shift->{newAssociationId} }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 14 | 1 | ReplaceNetworkAclEntry => 'boolean', | |||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | my $VEP = 'VM::EC2::ParmParser'; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | =head1 NAME VM::EC2::REST::network_acl | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | use VM::EC2 ':vpc' | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =head1 METHODS | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | These methods allow you to create and manipulate VPC Network Access | ||||||||||||||||||||||||||||
| 28 | Control Lists. | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | Implemented: | ||||||||||||||||||||||||||||
| 31 | CreateNetworkAcl | ||||||||||||||||||||||||||||
| 32 | CreateNetworkAclEntry | ||||||||||||||||||||||||||||
| 33 | DeleteNetworkAcl | ||||||||||||||||||||||||||||
| 34 | DeleteNetworkAclEntry | ||||||||||||||||||||||||||||
| 35 | DescribeNetworkAcls | ||||||||||||||||||||||||||||
| 36 | ReplaceNetworkAclAssociation | ||||||||||||||||||||||||||||
| 37 | ReplaceNetworkAclEntry | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | Unimplemented: | ||||||||||||||||||||||||||||
| 40 | (none) | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head2 @acls = $ec2->describe_network_acls(-network_acl_id=>\@ids, -filter=>\%filters) | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head2 @acls = $ec2->describe_network_acls(\@network_acl_ids) | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =head2 @acls = $ec2->describe_network_acls(%filters) | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | Provides information about network ACLs. | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | Returns a series of L<VM::EC2::VPC::NetworkAcl> objects. | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | Optional parameters are: | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | -network_acl_id -- ID of the network ACL(s) to return information on. | ||||||||||||||||||||||||||||
| 55 | This can be a string scalar, or an arrayref. | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | -filter -- Tags and other filters to apply. | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | The filter argument is a hashreference in which the keys are the | ||||||||||||||||||||||||||||
| 60 | filter names, and the values are the match strings. Some filters | ||||||||||||||||||||||||||||
| 61 | accept wildcards. | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | There are a number of filters, which are listed in full at | ||||||||||||||||||||||||||||
| 64 | http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeNetworkAcls.html | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | Here is a alpha-sorted list of filter names: | ||||||||||||||||||||||||||||
| 67 | association.association-id, association.network-acl-id, | ||||||||||||||||||||||||||||
| 68 | association.subnet-id, default, entry.cidr, entry.egress, | ||||||||||||||||||||||||||||
| 69 | entry.icmp.code, entry.icmp.type, entry.port-range.from, | ||||||||||||||||||||||||||||
| 70 | entry.port-range.to, entry.protocol, entry.rule-action, | ||||||||||||||||||||||||||||
| 71 | entry.rule-number, network-acl-id, tag-key, tag-value, | ||||||||||||||||||||||||||||
| 72 | tag:key, vpc-id | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =cut | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | sub describe_network_acls { | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
describe_network_acls: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | my %args = $VEP->args(-network_acl_id,@_); | |||||||||||||||||||||||||||
| 79 | 0 | my @params = $VEP->format_parms(\%args, | |||||||||||||||||||||||||||
| 80 | { | ||||||||||||||||||||||||||||
| 81 | list_parm => 'NetworkAclId', | ||||||||||||||||||||||||||||
| 82 | filter_parm => 'Filter', | ||||||||||||||||||||||||||||
| 83 | }); | ||||||||||||||||||||||||||||
| 84 | 0 | return $self->call('DescribeNetworkAcls',@params); | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head2 $acl = $ec2->create_network_acl(-vpc_id=>$vpc_id) | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =head2 $acl = $ec2->create_network_acl($vpc_id) | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | Creates a new network ACL in a VPC. Network ACLs provide an optional layer of | ||||||||||||||||||||||||||||
| 92 | security (on top of security groups) for the instances in a VPC. | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | Arguments: | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | -vpc_id -- The VPC ID to create the ACL in | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | Retuns a VM::EC2::VPC::NetworkAcl object on success. | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | =cut | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | sub create_network_acl { | ||||||||||||||||||||||||||||
| 103 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
create_network_acl: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 104 | 0 | my %args = $VEP->args(-vpc_id,@_); | |||||||||||||||||||||||||||
| 105 | $args{-vpc_id} or | ||||||||||||||||||||||||||||
| 106 | 0 | ▶ | croak "create_network_acl(): -vpc_id argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | 0 | my @params = $VEP->format_parms(\%args, | |||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||
| 109 | single_parm => 'VpcId', | ||||||||||||||||||||||||||||
| 110 | }); | ||||||||||||||||||||||||||||
| 111 | 0 | return $self->call('CreateNetworkAcl',@params); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =head2 $boolean = $ec2->delete_network_acl(-network_acl_id=>$id) | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =head2 $boolean = $ec2->delete_network_acl($id) | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | Deletes a network ACL from a VPC. The ACL must not have any subnets associated | ||||||||||||||||||||||||||||
| 119 | with it. The default network ACL cannot be deleted. | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | Arguments: | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | -network_acl_id -- The ID of the network ACL to delete | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | Returns true on successful deletion. | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | =cut | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | sub delete_network_acl { | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
delete_network_acl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 131 | 0 | my %args = $VEP->args(-network_acl_id,@_); | |||||||||||||||||||||||||||
| 132 | 0 | my @params = $VEP->format_parms(\%args, | |||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||
| 134 | single_parm => 'NetworkAclId', | ||||||||||||||||||||||||||||
| 135 | }); | ||||||||||||||||||||||||||||
| 136 | 0 | return $self->call('DeleteNetworkAcl',@params); | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | =head2 $boolean = $ec2->create_network_acl_entry(%args) | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | Creates an entry (i.e., rule) in a network ACL with the rule number you | ||||||||||||||||||||||||||||
| 142 | specified. Each network ACL has a set of numbered ingress rules and a | ||||||||||||||||||||||||||||
| 143 | separate set of numbered egress rules. When determining whether a packet | ||||||||||||||||||||||||||||
| 144 | should be allowed in or out of a subnet associated with the ACL, Amazon | ||||||||||||||||||||||||||||
| 145 | VPC processes the entries in the ACL according to the rule numbers, in | ||||||||||||||||||||||||||||
| 146 | ascending order. | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | Arguments: | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | -network_acl_id -- ID of the ACL where the entry will be created | ||||||||||||||||||||||||||||
| 151 | (Required) | ||||||||||||||||||||||||||||
| 152 | -rule_number -- Rule number to assign to the entry (e.g., 100). | ||||||||||||||||||||||||||||
| 153 | ACL entries are processed in ascending order by | ||||||||||||||||||||||||||||
| 154 | rule number. Positive integer from 1 to 32766. | ||||||||||||||||||||||||||||
| 155 | (Required) | ||||||||||||||||||||||||||||
| 156 | -protocol -- The IP protocol the rule applies to. You can use | ||||||||||||||||||||||||||||
| 157 | -1 to mean all protocols. See | ||||||||||||||||||||||||||||
| 158 | http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml | ||||||||||||||||||||||||||||
| 159 | for a list of protocol numbers. (Required) | ||||||||||||||||||||||||||||
| 160 | -rule_action -- Indicates whether to allow or deny traffic that | ||||||||||||||||||||||||||||
| 161 | matches the rule. allow | deny (Required) | ||||||||||||||||||||||||||||
| 162 | -egress -- Indicates whether this rule applies to egress | ||||||||||||||||||||||||||||
| 163 | traffic from the subnet (true) or ingress traffic | ||||||||||||||||||||||||||||
| 164 | to the subnet (false). Default is false. | ||||||||||||||||||||||||||||
| 165 | -cidr_block -- The CIDR range to allow or deny, in CIDR notation | ||||||||||||||||||||||||||||
| 166 | (e.g., 172.16.0.0/24). (Required) | ||||||||||||||||||||||||||||
| 167 | -icmp_code -- For the ICMP protocol, the ICMP code. You can use | ||||||||||||||||||||||||||||
| 168 | -1 to specify all ICMP codes for the given ICMP | ||||||||||||||||||||||||||||
| 169 | type. Required if specifying 1 (ICMP) for protocol. | ||||||||||||||||||||||||||||
| 170 | -icmp_type -- For the ICMP protocol, the ICMP type. You can use | ||||||||||||||||||||||||||||
| 171 | -1 to specify all ICMP types. Required if | ||||||||||||||||||||||||||||
| 172 | specifying 1 (ICMP) for the protocol | ||||||||||||||||||||||||||||
| 173 | -port_range_from -- The first port in the range. Required if specifying | ||||||||||||||||||||||||||||
| 174 | 6 (TCP) or 17 (UDP) for the protocol. | ||||||||||||||||||||||||||||
| 175 | -port_range_to -- The last port in the range. Required if specifying | ||||||||||||||||||||||||||||
| 176 | 6 (TCP) or 17 (UDP) for the protocol. | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | -port_from -- Alias for -port_range_from | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | -port_to -- Alias for -port_range_to | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | Returns true on successful creation. | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | sub create_network_acl_entry { | ||||||||||||||||||||||||||||
| 187 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
create_network_acl_entry: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 188 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 189 | $args{-network_acl_id} or | ||||||||||||||||||||||||||||
| 190 | 0 | ▶ | croak "create_network_acl_entry(): -network_acl_id argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | $args{-rule_number} or | ||||||||||||||||||||||||||||
| 192 | 0 | ▶ | croak "create_network_acl_entry(): -rule_number argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | defined $args{-protocol} or | ||||||||||||||||||||||||||||
| 194 | 0 | ▶ | croak "create_network_acl_entry(): -protocol argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 195 | $args{-rule_action} or | ||||||||||||||||||||||||||||
| 196 | 0 | ▶ | croak "create_network_acl_entry(): -rule_action argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | $args{-cidr_block} or | ||||||||||||||||||||||||||||
| 198 | 0 | ▶ | croak "create_network_acl_entry(): -cidr_block argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $args{-port_range_from} ||= $args{-port_from}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$args{"-port_range_from"} ||= $args{"-port_from"}
MC/DC0%0/2
$args{"-port_range_from"} ||= $args{"-port_from"}
$args{"-port_range_from"}
$args{"-port_from"}
Truth table0%0/3
A ||= B
A= $args{"-port_range_from"}B= $args{"-port_from"}
| |||||||||||||||||||||||||||||
| 200 | 0 | ▶ | $args{-port_range_to} ||= $args{-port_to}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$args{"-port_range_to"} ||= $args{"-port_to"}
MC/DC0%0/2
$args{"-port_range_to"} ||= $args{"-port_to"}
$args{"-port_range_to"}
$args{"-port_to"}
Truth table0%0/3
A ||= B
A= $args{"-port_range_to"}B= $args{"-port_to"}
| |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if ($args{-protocol} == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 202 | defined $args{-icmp_type} && defined $args{-icmp_code} or | ||||||||||||||||||||||||||||
| 203 | 0 | ▶ | croak "create_network_acl_entry(): -icmp_type or -icmp_code argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $args{"-icmp_type"} and defined $args{"-icmp_code"}
MC/DC0%0/2
defined $args{"-icmp_type"} and defined $args{"-icmp_code"}
defined $args{"-icmp_type"}
defined $args{"-icmp_code"}
Truth table0%0/3
A and B
A= defined $args{"-icmp_type"}B= defined $args{"-icmp_code"}
| |||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | ▶ | elsif ($args{-protocol} == 6 || $args{-protocol} == 17) { | |||||||||||||||||||||||||||
|
Condition0%0/3
$args{"-protocol"} == 6 or $args{"-protocol"} == 17
MC/DC0%0/2
$args{"-protocol"} == 6 or $args{"-protocol"} == 17
$args{"-protocol"} == 6
$args{"-protocol"} == 17
Truth table0%0/3
A or B
A= $args{"-protocol"} == 6B= $args{"-protocol"} == 17
| |||||||||||||||||||||||||||||
| 206 | defined $args{-port_range_from} or | ||||||||||||||||||||||||||||
| 207 | 0 | ▶ | croak "create_network_acl_entry(): -port_range_from argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 0 | ▶ | $args{-port_range_to} = $args{-port_range_from} if ! defined $args{-port_range_to}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | 0 | ▶ | $args{-egress} ||= $args{-egress} ? 'true' : 'false'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"-egress"} ||= $args{"-egress"} ? "true" : "false"
MC/DC0%0/2
$args{"-egress"} ||= $args{"-egress"} ? "true" : "false"
$args{"-egress"}
$args{"-egress"} ? "true" : "false"
Truth table0%0/3
A ||= B
A= $args{"-egress"}B= $args{"-egress"} ? "true" : "false"
| |||||||||||||||||||||||||||||
| 211 | 0 | my @params = $VEP->format_parms(\%args, | |||||||||||||||||||||||||||
| 212 | { | ||||||||||||||||||||||||||||
| 213 | single_parm => [qw(NetworkAclId RuleNumber Protocol | ||||||||||||||||||||||||||||
| 214 | RuleAction Egress CidrBlock Icmp.Code | ||||||||||||||||||||||||||||
| 215 | Icmp.Type PortRange.From PortRange.To)], | ||||||||||||||||||||||||||||
| 216 | }); | ||||||||||||||||||||||||||||
| 217 | 0 | return $self->call('CreateNetworkAclEntry',@params); | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | =head2 $success = $ec2->delete_network_acl_entry(-network_acl_id=>$id, | ||||||||||||||||||||||||||||
| 221 | -rule_number =>$int, | ||||||||||||||||||||||||||||
| 222 | -egress =>$bool) | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | Deletes an ingress or egress entry (i.e., rule) from a network ACL. | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | Arguments: | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | -network_acl_id -- ID of the ACL where the entry will be created | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | -rule_number -- Rule number of the entry (e.g., 100). | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | Optional arguments: | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | -egress -- Whether the rule to delete is an egress rule (true) or ingress | ||||||||||||||||||||||||||||
| 235 | rule (false). Default is false. | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | Returns true on successful deletion. | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | =cut | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | sub delete_network_acl_entry { | ||||||||||||||||||||||||||||
| 242 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
delete_network_acl_entry: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 243 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 244 | $args{-network_acl_id} or | ||||||||||||||||||||||||||||
| 245 | 0 | ▶ | croak "delete_network_acl_entry(): -network_acl_id argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | $args{-rule_number} or | ||||||||||||||||||||||||||||
| 247 | 0 | ▶ | croak "delete_network_acl_entry(): -rule_number argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | 0 | my @params = $VEP->format_parms(\%args, | |||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||
| 250 | single_parm => [qw(NetworkAclId RuleNumber Egress)], | ||||||||||||||||||||||||||||
| 251 | }); | ||||||||||||||||||||||||||||
| 252 | 0 | return $self->call('DeleteNetworkAclEntry',@params); | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | =head2 $assoc_id = $ec2->replace_network_acl_association(-association_id=>$assoc_id, | ||||||||||||||||||||||||||||
| 256 | -network_acl_id=>$id) | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | Changes which network ACL a subnet is associated with. By default when you | ||||||||||||||||||||||||||||
| 259 | create a subnet, it's automatically associated with the default network ACL. | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | Arguments: | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | -association_id -- The ID of the association to replace | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | -network_acl_id -- The ID of the network ACL to associated the subnet with | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | Returns the new association ID. | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | =cut | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | sub replace_network_acl_association { | ||||||||||||||||||||||||||||
| 272 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
replace_network_acl_association: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 273 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 274 | $args{-association_id} or | ||||||||||||||||||||||||||||
| 275 | 0 | ▶ | croak "replace_network_acl_association(): -association_id argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | $args{-network_acl_id} or | ||||||||||||||||||||||||||||
| 277 | 0 | ▶ | croak "replace_network_acl_association(): -network_acl_id argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 278 | 0 | my @params = $VEP->format_parms(\%args, | |||||||||||||||||||||||||||
| 279 | { | ||||||||||||||||||||||||||||
| 280 | single_parm => [qw(AssociationId NetworkAclId)], | ||||||||||||||||||||||||||||
| 281 | }); | ||||||||||||||||||||||||||||
| 282 | 0 | return $self->call('ReplaceNetworkAclAssociation',@params); | |||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =head2 $success = $ec2->replace_network_acl_entry(%args) | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | Replaces an entry (i.e., rule) in a network ACL. | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | Arguments: | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | -network_acl_id -- ID of the ACL where the entry will be created | ||||||||||||||||||||||||||||
| 292 | (Required) | ||||||||||||||||||||||||||||
| 293 | -rule_number -- Rule number of the entry to replace. (Required) | ||||||||||||||||||||||||||||
| 294 | -protocol -- The IP protocol the rule applies to. You can use | ||||||||||||||||||||||||||||
| 295 | -1 to mean all protocols. See | ||||||||||||||||||||||||||||
| 296 | http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml | ||||||||||||||||||||||||||||
| 297 | for a list of protocol numbers. (Required) | ||||||||||||||||||||||||||||
| 298 | -rule_action -- Indicates whether to allow or deny traffic that | ||||||||||||||||||||||||||||
| 299 | matches the rule. allow | deny (Required) | ||||||||||||||||||||||||||||
| 300 | -egress -- Indicates whether this rule applies to egress | ||||||||||||||||||||||||||||
| 301 | traffic from the subnet (true) or ingress traffic | ||||||||||||||||||||||||||||
| 302 | to the subnet (false). Default is false. | ||||||||||||||||||||||||||||
| 303 | -cidr_block -- The CIDR range to allow or deny, in CIDR notation | ||||||||||||||||||||||||||||
| 304 | (e.g., 172.16.0.0/24). (Required) | ||||||||||||||||||||||||||||
| 305 | -icmp_code -- For the ICMP protocol, the ICMP code. You can use | ||||||||||||||||||||||||||||
| 306 | -1 to specify all ICMP codes for the given ICMP | ||||||||||||||||||||||||||||
| 307 | type. Required if specifying 1 (ICMP) for protocol. | ||||||||||||||||||||||||||||
| 308 | -icmp_type -- For the ICMP protocol, the ICMP type. You can use | ||||||||||||||||||||||||||||
| 309 | -1 to specify all ICMP types. Required if | ||||||||||||||||||||||||||||
| 310 | specifying 1 (ICMP) for the protocol | ||||||||||||||||||||||||||||
| 311 | -port_range_from -- The first port in the range. Required if specifying | ||||||||||||||||||||||||||||
| 312 | 6 (TCP) or 17 (UDP) for the protocol. | ||||||||||||||||||||||||||||
| 313 | -port_range_to -- The last port in the range. Only required if | ||||||||||||||||||||||||||||
| 314 | specifying 6 (TCP) or 17 (UDP) for the protocol and | ||||||||||||||||||||||||||||
| 315 | is a different port than -port_range_from. | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | -port_from -- Alias for -port_range_from | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | -port_to -- Alias for -port_range_from | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | Returns true on successful replacement. | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | =cut | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | sub replace_network_acl_entry { | ||||||||||||||||||||||||||||
| 326 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
replace_network_acl_entry: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 327 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 328 | $args{-network_acl_id} or | ||||||||||||||||||||||||||||
| 329 | 0 | ▶ | croak "replace_network_acl_entry(): -network_acl_id argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 330 | $args{-rule_number} or | ||||||||||||||||||||||||||||
| 331 | 0 | ▶ | croak "replace_network_acl_entry(): -rule_number argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | $args{-protocol} or | ||||||||||||||||||||||||||||
| 333 | 0 | ▶ | croak "replace_network_acl_entry(): -protocol argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 334 | $args{-rule_action} or | ||||||||||||||||||||||||||||
| 335 | 0 | ▶ | croak "replace_network_acl_entry(): -rule_action argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 336 | 0 | ▶ | $args{-port_range_from} ||= $args{-port_from}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$args{"-port_range_from"} ||= $args{"-port_from"}
MC/DC0%0/2
$args{"-port_range_from"} ||= $args{"-port_from"}
$args{"-port_range_from"}
$args{"-port_from"}
Truth table0%0/3
A ||= B
A= $args{"-port_range_from"}B= $args{"-port_from"}
| |||||||||||||||||||||||||||||
| 337 | 0 | ▶ | $args{-port_range_to} ||= $args{-port_to}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$args{"-port_range_to"} ||= $args{"-port_to"}
MC/DC0%0/2
$args{"-port_range_to"} ||= $args{"-port_to"}
$args{"-port_range_to"}
$args{"-port_to"}
Truth table0%0/3
A ||= B
A= $args{"-port_range_to"}B= $args{"-port_to"}
| |||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if ($args{-protocol} == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 339 | defined $args{-icmp_type} && defined $args{-icmp_code} or | ||||||||||||||||||||||||||||
| 340 | 0 | ▶ | croak "replace_network_acl_entry(): -icmp_type or -icmp_code argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $args{"-icmp_type"} and defined $args{"-icmp_code"}
MC/DC0%0/2
defined $args{"-icmp_type"} and defined $args{"-icmp_code"}
defined $args{"-icmp_type"}
defined $args{"-icmp_code"}
Truth table0%0/3
A and B
A= defined $args{"-icmp_type"}B= defined $args{"-icmp_code"}
| |||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | ▶ | elsif ($args{-protocol} == 6 || $args{-protocol} == 17) { | |||||||||||||||||||||||||||
|
Condition0%0/3
$args{"-protocol"} == 6 or $args{"-protocol"} == 17
MC/DC0%0/2
$args{"-protocol"} == 6 or $args{"-protocol"} == 17
$args{"-protocol"} == 6
$args{"-protocol"} == 17
Truth table0%0/3
A or B
A= $args{"-protocol"} == 6B= $args{"-protocol"} == 17
| |||||||||||||||||||||||||||||
| 343 | defined $args{-port_range_from} or | ||||||||||||||||||||||||||||
| 344 | 0 | ▶ | croak "create_network_acl_entry(): -port_range_from argument missing"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 345 | 0 | ▶ | $args{-port_range_to} = $args{-port_range_from} if ! defined $args{-port_range_to}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||
| 347 | 0 | my @params = $VEP->format_parms(\%args, | |||||||||||||||||||||||||||
| 348 | { | ||||||||||||||||||||||||||||
| 349 | single_parm => [qw(NetworkAclId RuleNumber Protocol | ||||||||||||||||||||||||||||
| 350 | RuleAction Egress CidrBlock Icmp.Code | ||||||||||||||||||||||||||||
| 351 | Icmp.Type PortRange.From PortRange.To)], | ||||||||||||||||||||||||||||
| 352 | }); | ||||||||||||||||||||||||||||
| 353 | 0 | return $self->call('ReplaceNetworkAclEntry',@params); | |||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | L<VM::EC2> | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>. | ||||||||||||||||||||||||||||
| 363 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | Copyright (c) 2012 Loyalty Methods, Inc. | ||||||||||||||||||||||||||||
| 366 | Copyright (c) 2012 Ontario Institute for Cancer Research | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | This package and its accompanying libraries is free software; you can | ||||||||||||||||||||||||||||
| 369 | redistribute it and/or modify it under the terms of the GPL (either | ||||||||||||||||||||||||||||
| 370 | version 1, or at your option, any later version) or the Artistic | ||||||||||||||||||||||||||||
| 371 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||||||||||||||||||||||||||||
| 372 | please see DISCLAIMER.txt for disclaimers of warranty. | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | =cut | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | 1 | 1; | |||||||||||||||||||||||||||