line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Paws::Net::JsonCaller; |
2
|
12
|
|
|
12
|
|
6267
|
use Moose::Role; |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
90
|
|
3
|
12
|
|
|
12
|
|
54911
|
use JSON::MaybeXS; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
688
|
|
4
|
12
|
|
|
12
|
|
67
|
use POSIX qw(strftime); |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
69
|
|
5
|
|
|
|
|
|
|
requires 'json_version'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# converts the objects that represent the call into parameters that the API can understand |
8
|
|
|
|
|
|
|
sub _to_jsoncaller_params { |
9
|
36
|
|
|
36
|
|
74
|
my ($self, $params) = @_; |
10
|
|
|
|
|
|
|
|
11
|
36
|
100
|
|
|
|
99
|
if ($params->does('Paws::API::StrToNativeMapParser')){ |
|
|
100
|
|
|
|
|
|
12
|
2
|
|
|
|
|
326
|
return { %{ $params->Map } }; |
|
2
|
|
|
|
|
46
|
|
13
|
|
|
|
|
|
|
} elsif ($params->does('Paws::API::StrToObjMapParser')){ |
14
|
9
|
|
|
|
|
3710
|
my $type = $params->meta->get_attribute('Map')->type_constraint; |
15
|
9
|
100
|
|
|
|
499
|
if (my ($inner) = ("$type" =~ m/^HashRef\[ArrayRef\[(.*?)\]/)) { |
16
|
1
|
|
|
|
|
64
|
return { map { my $k = $_; ( $k => [ map { $self->_to_jsoncaller_params($_) } @{$params->Map->{$_} } ] ) } keys %{ $params->Map } }; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
31
|
|
17
|
|
|
|
|
|
|
} else { |
18
|
8
|
|
|
|
|
289
|
return { map { $_ => $self->_to_jsoncaller_params($params->Map->{$_}) } keys %{ $params->Map } }; |
|
13
|
|
|
|
|
338
|
|
|
8
|
|
|
|
|
206
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} else { |
21
|
25
|
|
|
|
|
10263
|
my %p; |
22
|
25
|
|
|
|
|
87
|
foreach my $att (grep { $_ !~ m/^_/ } $params->meta->get_attribute_list) { |
|
206
|
|
|
|
|
941
|
|
23
|
206
|
50
|
|
|
|
475
|
my $key = $params->meta->get_attribute($att)->does('Paws::API::Attribute::Trait::NameInRequest')?$params->meta->get_attribute($att)->request_name:$att; |
24
|
206
|
100
|
|
|
|
22775
|
if (defined $params->$att) { |
25
|
34
|
|
|
|
|
105
|
my $att_type = $params->meta->get_attribute($att)->type_constraint; |
26
|
34
|
50
|
|
|
|
1885
|
if ($att_type eq 'Bool') { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
0
|
$p{ $key } = ($params->$att)?\1:\0; |
28
|
|
|
|
|
|
|
} elsif ($att_type eq 'Int') { |
29
|
0
|
|
|
|
|
0
|
$p{ $key } = int($params->$att); |
30
|
|
|
|
|
|
|
} elsif ($att_type eq 'Str') { |
31
|
|
|
|
|
|
|
# concatenate an empty string so numbers get transmitted as strings |
32
|
21
|
|
|
|
|
2257
|
$p{ $key } = "" . $params->$att; |
33
|
|
|
|
|
|
|
} elsif ($self->_is_internal_type($att_type)) { |
34
|
0
|
|
|
|
|
0
|
$p{ $key } = $params->$att; |
35
|
|
|
|
|
|
|
} elsif ($att_type =~ m/^ArrayRef\[(.*)\]/) { |
36
|
3
|
100
|
|
|
|
507
|
if ($self->_is_internal_type("$1")){ |
37
|
1
|
|
|
|
|
24
|
$p{ $key } = $params->$att; |
38
|
|
|
|
|
|
|
} else { |
39
|
2
|
|
|
|
|
6
|
$p{ $key } = [ map { $self->_to_jsoncaller_params($_) } @{ $params->$att } ]; |
|
5
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
48
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} elsif ($att_type->isa('Moose::Meta::TypeConstraint::Enum')) { |
42
|
0
|
|
|
|
|
0
|
$p{ $key } = $params->$att; |
43
|
|
|
|
|
|
|
} elsif ($params->$att->does('Paws::API::StrToNativeMapParser')){ |
44
|
2
|
|
|
|
|
456
|
$p{ $key } = $self->_to_jsoncaller_params($params->$att); |
45
|
|
|
|
|
|
|
} elsif ($params->$att->does('Paws::API::StrToObjMapParser')){ |
46
|
7
|
|
|
|
|
1370
|
$p{ $key } = $self->_to_jsoncaller_params($params->$att); |
47
|
|
|
|
|
|
|
} else { |
48
|
1
|
|
|
|
|
203
|
$p{ $key } = $self->_to_jsoncaller_params($params->$att); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
25
|
|
|
|
|
151
|
return \%p; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub prepare_request_for_call { |
57
|
7
|
|
|
7
|
0
|
81
|
my ($self, $call) = @_; |
58
|
|
|
|
|
|
|
|
59
|
7
|
|
|
|
|
70
|
my $request = Paws::Net::APIRequest->new(); |
60
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
4881
|
$request->url($self->_api_endpoint . '/'); |
62
|
7
|
|
|
|
|
175
|
$request->uri('/'); |
63
|
7
|
|
|
|
|
166
|
$request->method('POST'); |
64
|
|
|
|
|
|
|
|
65
|
7
|
|
|
|
|
54
|
my @time = gmtime; |
66
|
7
|
|
|
|
|
217
|
$request->parameters({ Action => $call->_api_call, |
67
|
|
|
|
|
|
|
Version => $self->version, |
68
|
|
|
|
|
|
|
AWSAccessKeyId => $self->access_key, |
69
|
|
|
|
|
|
|
Timestamp => strftime("%Y-%m-%dT%H:%M:%SZ",@time), |
70
|
|
|
|
|
|
|
}); |
71
|
7
|
|
|
|
|
44
|
$request->header('X-Amz-Target', sprintf('%s.%s', $self->target_prefix, $call->_api_call)); |
72
|
|
|
|
|
|
|
|
73
|
7
|
|
|
|
|
263
|
my $j_version = $self->json_version; |
74
|
7
|
|
|
|
|
204
|
$request->headers->content_type("application/x-amz-json-$j_version"); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#$request->header('Content-Encoding', 'amz-1.0'); |
77
|
7
|
|
|
|
|
252
|
$request->header( 'X-Amz-Date' => strftime( '%Y%m%dT%H%M%SZ', @time ) ); |
78
|
7
|
|
|
|
|
356
|
$request->header( Host => $self->endpoint_host ); |
79
|
|
|
|
|
|
|
|
80
|
7
|
|
|
|
|
256
|
my $data = $self->_to_jsoncaller_params($call); |
81
|
7
|
|
|
|
|
323
|
$request->content(encode_json($data)); |
82
|
|
|
|
|
|
|
|
83
|
7
|
|
|
|
|
52
|
$self->sign($request); |
84
|
|
|
|
|
|
|
|
85
|
7
|
|
|
|
|
278
|
return $request; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
1; |