| 1 | package Paws::Net::V4Signature; | ||||||||||||||||||||
| 2 | 21 | ▶ | use Moose::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 21 | ▶ | use Net::Amazon::Signature::V4; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | #requires 'region'; | ||||||||||||||||||||
| 5 | 21 | requires 'service'; | |||||||||||||||||||
| 6 | 21 | ▶ | use POSIX qw(strftime); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 495 | ▶ | sub BUILD { | ||||||||||||||||||
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 9 | 495 | my $self = shift; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | # These calls are here so that when you construct | ||||||||||||||||||||
| 12 | # the object the endpoint information and the _region_for_signature | ||||||||||||||||||||
| 13 | # are calculated during construction. This is to avoid the fact that | ||||||||||||||||||||
| 14 | # these attributes are lazy (because they depend on other attributes) | ||||||||||||||||||||
| 15 | # and they don't get used until the first method is called, so if | ||||||||||||||||||||
| 16 | # they are incorrect, they don't throw until the first method is called. | ||||||||||||||||||||
| 17 | # It's much better to have them throw when $paws->service('...') is called | ||||||||||||||||||||
| 18 | # as this is the point where the user had specified "incorrect" information, | ||||||||||||||||||||
| 19 | # instead of the problem happening in the first method call. | ||||||||||||||||||||
| 20 | 495 | $self->endpoint; | |||||||||||||||||||
| 21 | 495 | $self->_region_for_signature; | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 158 | ▶ | sub sign { | ||||||||||||||||||
|
Subroutine
sign: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||
| 25 | 158 | my ($self, $request) = @_; | |||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 158 | ▶ | $request->header( Date => $request->header('X-Amz-Date') // strftime( '%Y%m%dT%H%M%SZ', gmtime ) ); | ||||||||||||||||||
|
Condition66%2/3
$request->header("X-Amz-Date") // strftime("%Y%m%dT%H%M%SZ", gmtime)
MC/DC0%0/2
$request->header("X-Amz-Date") // strftime("%Y%m%dT%H%M%SZ", gmtime)
$request->header("X-Amz-Date")
strftime("%Y%m%dT%H%M%SZ", gmtime)
Truth table66%2/3
A // B
A= $request->header("X-Amz-Date")B= strftime("%Y%m%dT%H%M%SZ", gmtime)
| |||||||||||||||||||||
| 28 | 158 | ▶ | $request->header( | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 'Host' => $self->endpoint->default_port == $self->endpoint->port | ||||||||||||||||||||
| 30 | ? $self->endpoint->host | ||||||||||||||||||||
| 31 | : $self->endpoint->host_port); | ||||||||||||||||||||
| 32 | 158 | ▶ | if ($self->session_token) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | 0 | $request->header( 'X-Amz-Security-Token' => $self->session_token ); | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 158 | ▶ | my $name = $self->can('signing_name') ? $self->signing_name : $self->service; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 37 | 158 | my $sig = Net::Amazon::Signature::V4->new( $self->access_key, $self->secret_key, $self->_region_for_signature, $name ); | |||||||||||||||||||
| 38 | 158 | $sig->sign( $request ); | |||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | 21 | 1; | |||||||||||||||||||