blib/lib/Amazon/Credentials/Provider/Config.pm

filter: Statementstmt 96.9% 32 / 33 Branchbran 80.0% 8 / 10 Conditioncond 63.6% 7 / 11 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 84.0% 58 / 69 CC 10 SCAR 19.6
CC
10
Cov
87%
new
10.8
BEGIN
1.0
BEGIN
1.0
CRAP 7.1
« blib/lib/Amazon/Credentials/Provider/InstanceRole.pm ↑ Summary blib/lib/Amazon/Credentials/Provider/Env.pm »
1 package Amazon::Credentials::Provider::Config;
2  
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 10 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 ▶use parent qw(Amazon::Credentials::Provider);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 10 with 'Amazon::Credentials::Role::File';
14  
15 ########################################################################
16 18 ▶sub new {
Subroutine new: called CC=10 SCAR=23.8
Pod documented
17 ########################################################################
18 18 my ( $class, @args ) = @_;
19  
20 0 ▶ my $options = ref $args[0] ? { %{ $args[0] } } : {@args};
Branch: 1 branch
BranchTrueFalseTotal
ref $args[0] ? : 0 18 18
21  
22 18 ▶ my $profile = $options->{profile} || 'default';
Condition100%2/2
$options->{'profile'} || 'default'
l!l
171
MC/DC100%1/1
$options->{'profile'} || 'default'
$options->{'profile'}
Truth table100%2/2
A
A= $options->{'profile'}
Aresult
11
00
23  
24 18 my $self = bless {}, $class;
25  
26 18 my $config = $self->_get_profile($profile);
27  
28 return
29 18 ▶ if !$config;
Branch: 1 branch
BranchTrueFalseTotal
unless $config 1 17 18
30  
31 17 my $access_key = $config->{aws_access_key_id};
32 17 my $secret_key = $config->{aws_secret_access_key};
33  
34 return
35 17 ▶ if !$access_key && !$secret_key;
Branch: 1 branch
BranchTrueFalseTotal
unless $access_key or $secret_key 1 16 17
Condition66%2/3
$access_key or $secret_key
l!l&&r!l&&!r
1601
MC/DC50%1/2
$access_key or $secret_key
$access_key $secret_key
Truth table66%2/3
A or B
A= $access_keyB= $secret_key
ABresult
1X1
011
000
36  
37 16 ▶ croak "profile '$profile' contains aws_access_key_id but no aws_secret_access_key"
Branch: 1 branch
BranchTrueFalseTotal
if $access_key and not $secret_key 1 15 16
Condition66%2/3
$access_key and not $secret_key
!ll&&!rl&&r
0151
MC/DC50%1/2
$access_key and not $secret_key
$access_key not $secret_key
Truth table66%2/3
A and not(B)
A= $access_keyB= not $secret_key
ABresult
0X0
100
111
38 if $access_key && !$secret_key;
39  
40 15 ▶ croak "profile '$profile' contains aws_secret_access_key but no aws_access_key_id"
Branch: 1 branch
BranchTrueFalseTotal
if not $access_key and $secret_key 0 15 15
Condition33%1/3
not $access_key and $secret_key
!ll&&!rl&&r
1500
MC/DC0%0/2
not $access_key and $secret_key
not $access_key $secret_key
Truth table33%1/3
not(A) and B
A= not $access_keyB= $secret_key
ABresult
0X0
100
111
41 if !$access_key && $secret_key;
42  
43 return $class->SUPER::new(
44 15 %{$options},
45 aws_access_key_id => $access_key,
46 aws_secret_access_key => $secret_key,
47 region => $config->{region},
48 source => 'config',
49 token => $config->{aws_session_token},
50 15 );
51 }
52  
53 10 1;
« blib/lib/Amazon/Credentials/Provider/InstanceRole.pm ↑ Summary blib/lib/Amazon/Credentials/Provider/Env.pm »