Branch Coverage

blib/lib/Amazon/Credentials.pm
Criterion Covered Total %
branch 139 264 52.6


line true false branch
112 123 26 unless $self->{'debug'}
131 13 5 ref $args[0] ? :
143 0 16 if ($self->get_passkey and $passkey) { }
0 16 elsif ($self->get_passkey) { }
144 0 0 unless ($self->get_no_passkey_warning)
157 0 0 unless ($self->get_no_passkey_warning)
171 2 14 if ($self->get_insecure)
178 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)
208 5 8 unless ($self->get_region)
235 0 0 if (not $renew) { }
241 0 0 if ($self->get_cache)
267 1 4 if ($self->get_source and $self->get_source eq "IAM")
272 1 0 if ($self->get_container) { }
279 1 0 ref $self ? :
284 0 1 if (not $self->get_container and $self->get_imdsv2_token)
294 0 1 unless $rsp->is_success
315 17 2 unless ($creds)
322 6 13 unless $creds->{'aws_secret_access_key'} and $creds->{'aws_access_key_id'}
335 5 14 if ($Amazon::Credentials::EVAL_ERROR and not $self->get_error)
341 3 16 if $self->get_error and $self->get_raise_error
344 2 14 if $self->get_error and $self->get_print_error
361 0 17 ref $args[0] ? :
363 0 17 if ($options->{'profile'})
367 0 17 if ($options->{'order'})
373 14 3 if ($self->get_profile) { }
3 0 elsif (ref $self->get_order and &reftype(scalar $self->get_order) eq 'ARRAY') { }
0 0 elsif (not ref $self->get_order) { }
406 17 0 if ($creds_getters{$location})
410 11 5 if $creds->{'source'}
415 24 44 if (not $k =~ /^aws|token/msx) { }
44 0 elsif ($self->can("set_$k")) { }
438 1 1 unless $ENV{'AWS_ACCESS_KEY_ID'} and $ENV{'AWS_SECRET_ACCESS_KEY'}
462 4 150 if $source =~ /env/i
478 1 1 unless open my $fh, "-|", $process
485 0 1 unless close $fh
491 1 1 if ($Amazon::Credentials::EVAL_ERROR or not $credentials)
516 32 1 -e $fullpath ? :
526 1 4 unless $config
534 4 0 if ($ini->{'default'})
554 0 28 if $creds->{'source'}
560 0 28 unless ($fullpath)
571 27 1 if ($ini->{'default'})
577 10 18 if ($ini->{$profile_name}) { }
2 16 elsif ($$ini{"profile $profile_name"}) { }
587 2 26 if ($process) { }
26 0 elsif ($section) { }
589 1 0 $section->{'region'} ? :
607 18 8 unless ($creds->{'aws_access_key_id'} and $creds->{'aws_secret_access_key'})
624 0 1 if ($ENV{'AWS_EC2_METADATA_DISABLED'} eq "true")
640 0 1 if ($self->get_imdsv2)
653 0 0 if ($rsp->is_success) { }
674 1 1 if ($role)
680 0 2 if ($self->get_imdsv2 and $self->get_imdsv2_token)
693 0 2 unless $rsp->is_success
695 1 1 if ($role) { }
705 0 1 unless $role
712 0 1 if (not $creds or $Amazon::Credentials::EVAL_ERROR)
728 0 1 unless ($uri)
757 1 0 if ($rsp->is_success) { }
794 0 45 unless ref $obj
798 3 42 if ($self->get_insecure and $self->get_insecure =~ /^2$/msx) { }
3 39 elsif ($self->get_insecure) { }
826 0 3 if ($self->get_insecure and $self->get_insecure =~ /^2$/msx) { }
0 3 elsif ($self->get_insecure) { }
833 0 0 if ($k =~ /content/msx) { }
865 4 0 if (defined $expiration_date)
875 0 4 if ($self->get_debug)
889 2 2 $seconds_left < 0 ? :
915 0 1 if ($self->get_container and $self->get_container eq 'ECS') { }
1 0 elsif ($self->get_role) { }
923 0 1 unless ref $creds and keys %{$creds;}
935 0 3 if (not $self->get_cache) { }
955 3 0 unless (defined $credential_keys{'AWS_SESSION_TOKEN'})
994 0 9 unless ($self->get__access_key_id)
1001 0 9 unless ($self->get_cache)
1013 1 6 unless ($self->get__secret_access_key)
1020 0 7 unless ($self->get_cache)
1032 0 5 if (not $self->get__session_token and $self->get_session_token_required)
1039 0 5 unless ($self->get_cache)
1053 24 0 if ($aws_access_key_id)
1067 24 0 if ($aws_secret_access_key)
1086 6 29 if ($session_token)
1102 0 21 if (ref $self->get_decrypt and &reftype(scalar $self->get_decrypt) eq 'CODE') { }
1115 0 54 if (ref $self->get_encrypt and &reftype(scalar $self->get_encrypt) eq 'CODE') { }
1134 0 0 if ($new_passkey and not ref $new_passkey) { }
1135 0 0 if ($self->get_cache)
1146 0 0 unless (ref $self->get_passkey)
1170 0 0 if ref $role_name
1186 0 0 if ($credentials)
1204 0 0 unless ($access_token)
1208 0 0 unless $access_token
1225 0 0 unless $rsp
1229 0 0 if $rsp and $rsp->content_type eq "application/json"
1233 0 0 unless $content
1238 0 0 if $rsp->is_success
1240 0 0 unless ref $content
1255 16 0 unless ($self->get_logger and ref $self->get_logger)
1271 0 18 defined $self->get_cache ? :
1273 18 0 unless ($self->get_user_agent)
1282 7 11 unless ($self->get_order)
1286 3 15 if (not ref $self->get_order) { }
1 14 elsif (ref $self->get_order and &reftype(scalar $self->get_order) ne 'ARRAY') { }
1295 1 37 unless &any(sub { /^$loc$/msx; } , @{$default_search_order;})
1298 2 14 if (not $self->get_profile and &any(sub { /file/msx; } , @{$self->get_order;}))
1339 0 92 if (ref $self->get_passkey and &reftype(scalar $self->get_passkey) eq 'CODE') { }
1358 0 16 if ($self->get_encrypt or $self->get_decrypt) { }
1359 0 0 if ref $self->get_encrypt ne "CODE"
1362 0 0 if ref $self->get_decrypt ne "CODE"
1373 16 0 if (not defined $self->get_encryption) { }
1375 0 16 $has_crypt_cbc ? :
1382 0 16 if ($self->get_encryption and not $self->get_cipher)
1388 0 16 if ($self->get_encryption and not $self->get_passkey)
1400 4 71 unless $str
1406 0 71 if ($self->get_encryption)
1416 17 54 if ($op eq 'decrypt') { }
1418 0 17 ref $cipher ? :
1421 0 54 ref $cipher ? :
1464 0 0 unless -d $cache_dir
1475 0 0 unless /[.]json$/msx
1479 0 0 unless open my $fh, "<", $File::Find::name
1486 0 0 if (ref $json and $json->{'accessToken'})
1541 3 0 defined $credentials->{$_} ? :
1556 0 0 unless (&GetOptions(\%options, "help", "env|e", "ec2|E", "profile|p=s", "role|r=s", "account|a=s"))
1565 0 0 if ($options{'help'})
1569 0 0 if ($options{'role'} and $options{'account'})
1580 0 0 if ($options{'env'}) { }
0 0 elsif ($options{'ec2'}) { }
0 0 elsif ($options{'profile'}) { }
1591 0 0 @order ? :