| 1 | package App::WafV2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use File::Temp qw(tempfile); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use CLI::Simple::Constants qw(:booleans); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Scalar::Util qw(reftype); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Role::Tiny::With; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | with 'App::AWS'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use parent qw(App::Command); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | __PACKAGE__->follow_best_practice; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | __PACKAGE__->mk_accessors(qw(profile region scope)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub list_web_acls { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_web_acls: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my ( $scope, $query ) = @args{qw(scope query)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | $scope //= $self->get_scope // 'REGIONAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$scope //= $self->get_scope // "REGIONAL"
$self->get_scope // "REGIONAL"
MC/DC0%0/1
$scope //= $self->get_scope // "REGIONAL"
$scope
Truth table0%0/2
A
A= $scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | return $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 'list-web-acls' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | '--scope' => $scope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | $query ? ( '--query' => $query ) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | sub list_regex_pattern_sets { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_regex_pattern_sets: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my ( $scope, $name, $query ) = @args{qw(scope name query limit)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | $scope //= $self->get_scope // 'REGIONAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$scope //= $self->get_scope // "REGIONAL"
$self->get_scope // "REGIONAL"
MC/DC0%0/1
$scope //= $self->get_scope // "REGIONAL"
$scope
Truth table0%0/2
A
A= $scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ($name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $query = sprintf '{RegexPatternSets: RegexPatternSets[?contains(Name, `%s`)], NextMarker: NextMarker}', $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $next_marker; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my @pattern_sets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | while ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | my $result = $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 'list-regex-pattern-sets' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | '--scope' => $scope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | $query ? ( '--query' => $query ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | $next_marker ? ( '--next-marker' => $next_marker ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->check_result( message => 'ERROR: cannot list regex pattern set for: [%s]', $scope ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | last if !@{ $result->{RegexPatternSets} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | push @pattern_sets, @{ $result->{RegexPatternSets} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $next_marker = $result->{NextMarker}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return \@pattern_sets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub get_regex_pattern_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_regex_pattern_set: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my ( $scope, $name, $id, $query ) = @args{qw(scope name id query)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | $scope //= $self->get_scope // 'REGIONAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$scope //= $self->get_scope // "REGIONAL"
$self->get_scope // "REGIONAL"
MC/DC0%0/1
$scope //= $self->get_scope // "REGIONAL"
$scope
Truth table0%0/2
A
A= $scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | return $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 'get-regex-pattern-set' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | '--name' => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | '--id' => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | '--scope' => $scope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | $query ? ( '--query' => $query ) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub update_regex_pattern_set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_regex_pattern_set: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my ( $name, $id, $query, $patterns, $description, $scope ) = @args{qw(name id query patterns description scope)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | $scope //= $self->get_scope // 'REGIONAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$scope //= $self->get_scope // "REGIONAL"
$self->get_scope // "REGIONAL"
MC/DC0%0/1
$scope //= $self->get_scope // "REGIONAL"
$scope
Truth table0%0/2
A
A= $scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | die "usage: update_regex_pattern_set(name => name, scope => scope, id => id, patterns => patterns);\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$name and $scope and $id and $patterns
$name and $scope and $id
$name and $scope
MC/DC0%0/4
$name and $scope and $id and $patterns
$name
$scope
$id
$patterns
Truth table0%0/5
A and B and C and D
A= $nameB= $scopeC= $idD= $patterns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | if !( $name && $scope && $id && $patterns ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | die "ERROR: patterns must be an arrray\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $patterns and builtin::reftype($patterns) eq "ARRAY"
MC/DC0%0/2
ref $patterns and builtin::reftype($patterns) eq "ARRAY"
ref $patterns
builtin::reftype($patterns) eq "ARRAY"
Truth table0%0/3
A and B
A= ref $patternsB= builtin::reftype($patterns) eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | if !( ref($patterns) && reftype($patterns) eq 'ARRAY' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $pattern_set = $self->get_regex_pattern_set( name => $name, scope => $scope, id => $id ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $self->check_result( message => 'ERROR: Could not retrieve regex pattern set for: [%s]', $name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my @current_list = @{ $pattern_set->{RegexPatternSet}->{RegularExpressionList} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | push @current_list, map { { RegexString => $_ } } @{$patterns}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $pattern_set->{RegexPatternSet}->{RegexExpressionList} = \@current_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $lock_token = $pattern_set->{LockToken}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $regex_list = $pattern_set->{RegexPatternSet}->{RegexExpressionList}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | return $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 'update-regex-pattern-set' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | '--name' => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | '--id' => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | '--scope' => $scope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | '--lock-token' => $lock_token, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | $description ? ( '--description' => $description ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | '--cli-input-json' => encode_json( { RegularExpressionList => $regex_list } ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | $query ? ( '--query' => $query ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | sub check_rules { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_rules: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my ($rules) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | die "ERROR: no such file [%s]\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $rules or -s $rules
MC/DC0%0/2
ref $rules or -s $rules
ref $rules
-s $rules
Truth table0%0/3
A or B
A= ref $rulesB= -s $rules
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | if !ref $rules && !-s $rules; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | return $rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | if !ref $rules; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | die sprintf "unknown rules object: %s\n", Dumper( [ rules => $rules ] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | if reftype($rules) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my ( $fh, $filename ) = tempfile( 'rulesXXXX', UNLINK => $ENV{NO_UNLINK} ? $FALSE : $TRUE ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | print {$fh} JSON->new->pretty->encode($rules); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return $filename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | sub create_web_acl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_web_acl: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | my ( $scope, $name, $rules, $default_action, $visibility_config, $description, $query, $metric_name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | = @args{qw(scope name rules default_action visibility_config description query metric_name)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | $scope //= 'REGIONAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$scope //= "REGIONAL"
MC/DC0%0/1
$scope //= "REGIONAL"
$scope
Truth table0%0/2
A
A= $scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | $default_action //= 'Allow={}'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$default_action //= "Allow={}"
MC/DC0%0/1
$default_action //= "Allow={}"
$default_action
Truth table0%0/2
A
A= $default_action
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $rules_file = check_rules($rules); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | $description //= sprintf 'Web acl %s', $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$description //= sprintf('Web acl %s', $name)
MC/DC0%0/1
$description //= sprintf('Web acl %s', $name)
$description
Truth table0%0/2
A
A= $description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $metric_name //= 'app-FargateStack'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$metric_name //= "app-FargateStack"
MC/DC0%0/1
$metric_name //= "app-FargateStack"
$metric_name
Truth table0%0/2
A
A= $metric_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | $visibility_config //= sprintf 'SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=%s', $metric_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$visibility_config //= sprintf('SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=%s', $metric_name)
MC/DC0%0/1
$visibility_config //= sprintf('SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=%s', $metric_name)
$visibility_config
Truth table0%0/2
A
A= $visibility_config
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | return $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 'create-web-acl' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | $query ? ( '--query' => $query ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | '--name' => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | '--scope' => $scope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | '--default-action' => $default_action, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | '--visibility-config' => $visibility_config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | '--description' => $description, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | '--rules' => sprintf( 'file://%s', $rules_file ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # TBD: refactor to use guts of create_web_acl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | sub update_web_acl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_web_acl: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | my ( $id, $scope, $name, $rules, $default_action, $visibility_config, $description, $lock_token, $query, $metric_name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | = @args{qw(id scope name rules default_action visibility_config description lock_token query metric_name)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | $scope //= 'REGIONAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$scope //= "REGIONAL"
MC/DC0%0/1
$scope //= "REGIONAL"
$scope
Truth table0%0/2
A
A= $scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $default_action //= 'Allow={}'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$default_action //= "Allow={}"
MC/DC0%0/1
$default_action //= "Allow={}"
$default_action
Truth table0%0/2
A
A= $default_action
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $rules_file = check_rules($rules); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $description //= sprintf 'Web acl %s', $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$description //= sprintf('Web acl %s', $name)
MC/DC0%0/1
$description //= sprintf('Web acl %s', $name)
$description
Truth table0%0/2
A
A= $description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | $metric_name //= 'app-FargateStack'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$metric_name //= "app-FargateStack"
MC/DC0%0/1
$metric_name //= "app-FargateStack"
$metric_name
Truth table0%0/2
A
A= $metric_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | $visibility_config //= sprintf 'SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=%s', $metric_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$visibility_config //= sprintf('SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=%s', $metric_name)
MC/DC0%0/1
$visibility_config //= sprintf('SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=%s', $metric_name)
$visibility_config
Truth table0%0/2
A
A= $visibility_config
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | return $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 'update-web-acl' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | $query ? ( '--query' => $query ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | '--name' => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | '--id' => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | '--scope' => $scope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | '--default-action' => $default_action, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | '--visibility-config' => $visibility_config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | '--description' => $description, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | '--lock-token' => $lock_token, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | '--rules' => sprintf( 'file://%s', $rules_file ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | sub get_web_acl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_web_acl: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my ( $scope, $name, $id, $query ) = @args{qw(scope name id query)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $scope //= 'REGIONAL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$scope //= "REGIONAL"
MC/DC0%0/1
$scope //= "REGIONAL"
$scope
Truth table0%0/2
A
A= $scope
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | return $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 'get-web-acl' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | $query ? ( '--query' => $query ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | '--id' => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | '--name' => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | '--scope' => $scope, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | sub associate_web_acl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
associate_web_acl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my ( $self, $web_acl_arn, $resource_arn ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | return $self->command( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 'associate-web-acl' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | '--web-acl-arn' => $web_acl_arn, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | '--resource-arn' => $resource_arn, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub list_resources_for_web_acl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_resources_for_web_acl: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my ( $self, $web_acl_arn, $query ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | return $self->command( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 'list-resources-for-web-acl' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | '--web-acl-arn' => $web_acl_arn, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | $query ? ( '--query' => $query ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||