Branch Coverage

blib/lib/Amazon/Credentials.pm
Criterion Covered Total %
branch 140 266 52.6


line true false branch
113 122 26 unless $self->{'debug'}
132 13 5 ref $args[0] ? :
144 0 16 if ($self->get_passkey and $passkey) { }
0 16 elsif ($self->get_passkey) { }
145 0 0 unless ($self->get_no_passkey_warning)
158 0 0 unless ($self->get_no_passkey_warning)
172 2 14 if ($self->get_insecure)
179 0 16 if ($self->get_sso_role_name and $self->get_sso_account_id)
189 16 0 if (not $options->{'aws_secret_access_key'} && $options->{'aws_access_key_id'}) { }
193 2 11 if ($self->get__session_token)
197 0 13 unless ($self->get_cache)
207 5 8 unless ($self->get_region)
233 0 0 if (not $renew) { }
239 0 0 if ($self->get_cache)
265 1 4 if ($self->get_source and $self->get_source eq "IAM")
270 1 0 if ($self->get_container) { }
277 1 0 ref $self ? :
282 0 1 if (not $self->get_container and $self->get_imdsv2_token)
292 0 1 unless $rsp->is_success
313 17 2 unless ($creds)
320 6 13 unless $creds->{'aws_secret_access_key'} and $creds->{'aws_access_key_id'}
333 5 14 if ($Amazon::Credentials::EVAL_ERROR and not $self->get_error)
339 3 16 if $self->get_error and $self->get_raise_error
342 2 14 if $self->get_error and $self->get_print_error
359 0 17 ref $args[0] ? :
361 0 17 if ($options->{'profile'})
365 0 17 if ($options->{'order'})
371 14 3 if ($self->get_profile) { }
3 0 elsif (ref $self->get_order and builtin::reftype($self->get_order) eq 'ARRAY') { }
0 0 elsif (not ref $self->get_order) { }
404 17 0 if ($creds_getters{$location})
408 11 5 if $creds->{'source'}
413 24 44 if (not $k =~ /^aws|token/msx) { }
44 0 elsif ($self->can("set_$k")) { }
436 1 1 unless $ENV{'AWS_ACCESS_KEY_ID'} and $ENV{'AWS_SECRET_ACCESS_KEY'}
460 4 150 if $source =~ /env/i
476 1 1 unless open my $fh, "-|", $process
483 0 1 unless close $fh
489 1 1 if ($Amazon::Credentials::EVAL_ERROR or not $credentials)
514 32 1 -e $fullpath ? :
524 1 4 unless $config
532 4 0 if ($ini->{'default'})
552 0 28 if $creds->{'source'}
558 0 28 unless ($fullpath)
569 27 1 if ($ini->{'default'})
575 10 18 if ($ini->{$profile_name}) { }
2 16 elsif ($$ini{"profile $profile_name"}) { }
584 2 26 if ($process) { }
26 0 elsif ($section) { }
586 1 0 $section->{'region'} ? :
604 18 8 unless ($creds->{'aws_access_key_id'} and $creds->{'aws_secret_access_key'})
622 0 1 if ($aws_ec2_metadata_disabled eq "true")
637 0 1 if ($self->get_imdsv2)
650 0 0 if ($rsp->is_success) { }
671 1 1 if ($role)
677 0 2 if ($self->get_imdsv2 and $self->get_imdsv2_token)
690 0 2 unless $rsp->is_success
692 1 1 if ($role) { }
702 0 1 unless $role
709 0 1 if (not $creds or $Amazon::Credentials::EVAL_ERROR)
725 0 1 unless ($uri)
753 1 0 if ($rsp->is_success) { }
778 0 1 if $creds->{'error'}
792 0 45 unless ref $obj
796 3 42 if ($self->get_insecure and $self->get_insecure =~ /^2$/msx) { }
3 39 elsif ($self->get_insecure) { }
822 0 3 if ($self->get_insecure and $self->get_insecure =~ /^2$/msx) { }
0 3 elsif ($self->get_insecure) { }
829 0 0 if ($k =~ /content/msx) { }
860 4 0 if (defined $expiration_date)
870 0 4 if ($self->get_debug)
881 2 2 $seconds_left < 0 ? :
907 0 1 if ($self->get_container and $self->get_container eq 'ECS') { }
1 0 elsif ($self->get_role) { }
915 0 1 unless ref $creds and keys %{$creds;}
927 0 3 if (not $self->get_cache) { }
947 3 0 unless (defined $credential_keys{'AWS_SESSION_TOKEN'})
985 0 9 unless ($self->get__access_key_id)
991 0 9 unless ($self->get_cache)
1003 1 6 unless ($self->get__secret_access_key)
1009 0 7 unless ($self->get_cache)
1021 0 5 if (not $self->get__session_token and $self->get_session_token_required)
1028 0 5 unless ($self->get_cache)
1042 24 0 if ($aws_access_key_id)
1056 24 0 if ($aws_secret_access_key)
1075 6 29 if ($session_token)
1091 0 21 if (ref $self->get_decrypt and builtin::reftype($self->get_decrypt) eq 'CODE') { }
1104 0 54 if (ref $self->get_encrypt and builtin::reftype($self->get_encrypt) eq 'CODE') { }
1123 0 0 if ($new_passkey and not ref $new_passkey) { }
1124 0 0 if ($self->get_cache)
1133 0 0 unless (ref $self->get_passkey)
1157 0 0 if ref $role_name
1173 0 0 if ($credentials)
1190 0 0 unless ($access_token)
1194 0 0 unless $access_token
1210 0 0 unless $rsp
1213 0 0 if $rsp and $rsp->content_type eq "application/json"
1215 0 0 unless $content
1219 0 0 if $rsp->is_success
1221 0 0 unless ref $content
1236 16 0 unless ($self->get_logger and ref $self->get_logger)
1252 0 18 defined $self->get_cache ? :
1254 18 0 unless ($self->get_user_agent)
1261 7 11 unless ($self->get_order)
1265 3 15 if (not ref $self->get_order) { }
1 14 elsif (ref $self->get_order and builtin::reftype($self->get_order) ne 'ARRAY') { }
1274 1 37 unless &any(sub { /^$loc$/msx; } , @{$default_search_order;})
1277 2 14 if (not $self->get_profile and &any(sub { /file/msx; } , @{$self->get_order;}))
1318 0 92 if (ref $self->get_passkey and builtin::reftype($self->get_passkey) eq 'CODE') { }
1337 0 16 if ($self->get_encrypt or $self->get_decrypt) { }
1338 0 0 if ref $self->get_encrypt ne "CODE"
1341 0 0 if ref $self->get_decrypt ne "CODE"
1352 16 0 if (not defined $self->get_encryption) { }
1354 0 16 $has_crypt_cbc ? :
1361 0 16 if ($self->get_encryption and not $self->get_cipher)
1367 0 16 if ($self->get_encryption and not $self->get_passkey)
1379 4 71 unless $str
1385 0 71 if ($self->get_encryption)
1395 17 54 if ($op eq 'decrypt') { }
1397 0 17 ref $cipher ? :
1400 0 54 ref $cipher ? :
1443 0 0 unless -d $cache_dir
1454 0 0 unless /[.]json$/msx
1458 0 0 unless open my $fh, "<", $File::Find::name
1465 0 0 if (ref $json and $json->{'accessToken'})
1486 0 0 unless ($options->{'version'})
1528 3 0 defined $credentials->{$_} ? :
1553 0 0 if (not &GetOptions(\%options, @option_specs) or $options{'help'} or $options{'version'})
1559 0 0 if ($options{'role'} and $options{'account'})
1569 0 0 if $options{'env'}
1572 0 0 if $options{'ec2'}
1575 0 0 if $options{'container'}
1578 0 0 if $options{'profile'}