Net/Amazon/S3/Authorization/IAM.pm

filter: Statementstmt 69.5% 16 / 23 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod n/a totaltotal 55.8% 19 / 34 CC 3 SCAR 16.1
CC
3
Cov
59%
_build_credentials
12.0
__ANON__
2.0
__ANON__
2.0
CRAP 5.0
« Net/Amazon/S3/Request/Role/XML/Content.pm ↑ Summary Net/Amazon/S3/ACL/Set.pm »
1 package Net::Amazon::S3::Authorization::IAM;
2 1 $Net::Amazon::S3::Authorization::IAM::VERSION = '0.992';
3 # ABSTRACT: IAM authorization information
4  
5 1 ▶use Moose 0.85;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use MooseX::StrictConstructor 0.16;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 extends 'Net::Amazon::S3::Authorization::Basic';
9  
10 has '+aws_access_key_id' => (
11 lazy => 1,
12 0 ▶ default => sub { $_[0]->_credentials->accessKeyId },
Subroutine __ANON__: not called CC=1 SCAR=6.9
13 1 );
14  
15 has '+aws_secret_access_key' => (
16 lazy => 1,
17 0 ▶ default => sub { $_[0]->_credentials->secretAccessKey },
Subroutine __ANON__: not called CC=1 SCAR=6.9
18 1 );
19  
20 has aws_session_token => (
21 is => 'ro',
22 lazy => 1,
23 0 ▶ default => sub { $_[0]->_credentials->sessionToken },
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 1 );
25  
26 1 has _credentials => (
27 is => 'ro',
28 init_arg => undef,
29 lazy => 1,
30 builder => '_build_credentials',
31 );
32  
33 0 ▶sub _build_credentials {
Subroutine _build_credentials: not called CC=3 SCAR=24.8
34 0 ▶ eval "require VM::EC2::Security::CredentialCache" or die $@;
Branch: 1 branch
BranchTrueFalseTotal
eval "require VM::EC2::Security::CredentialCache" or die $@ 0 0 0
35 0 my $creds = VM::EC2::Security::CredentialCache->get();
36 0 ▶ defined($creds) || die("Unable to retrieve IAM role credentials");
Branch: 1 branch
BranchTrueFalseTotal
defined $creds or die "Unable to retrieve IAM role credentials" 0 0 0
37  
38 0 return $creds;
39 }
40  
41 1 ▶around authorization_headers => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
42 1 my ($orig, $self) = @_;
43  
44 return +(
45 1 $self->$orig,
46 'x-amz-security-token' => $self->aws_session_token,
47 );
48 1 };
49  
50 1 1;
51  
52 __END__
« Net/Amazon/S3/Request/Role/XML/Content.pm ↑ Summary Net/Amazon/S3/ACL/Set.pm »