« 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
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 18 | ▶ | my $profile = $options->{profile} || 'default'; | ||||||||||||||||||||||||||
|
Condition100%2/2
$options->{'profile'} || 'default'
MC/DC100%1/1
$options->{'profile'} || 'default'
$options->{'profile'}
Truth table100%2/2
A
A= $options->{'profile'}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$access_key or $secret_key
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
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 16 | ▶ | croak "profile '$profile' contains aws_access_key_id but no aws_secret_access_key" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$access_key and not $secret_key
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
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
not $access_key and $secret_key
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
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||