line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Paws::API::Caller; |
2
|
20
|
|
|
20
|
|
728351
|
use Moose::Role; |
|
20
|
|
|
|
|
44
|
|
|
20
|
|
|
|
|
161
|
|
3
|
20
|
|
|
20
|
|
93891
|
use Carp; |
|
20
|
|
|
|
|
43
|
|
|
20
|
|
|
|
|
1317
|
|
4
|
20
|
|
|
20
|
|
7216
|
use Paws::Net::APIRequest; |
|
20
|
|
|
|
|
66
|
|
|
20
|
|
|
|
|
874
|
|
5
|
20
|
|
|
20
|
|
9907
|
use Paws::API::Response; |
|
20
|
|
|
|
|
59
|
|
|
20
|
|
|
|
|
20074
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has caller => (is => 'ro', required => 1); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has credentials => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
does => 'Paws::Credential', |
12
|
|
|
|
|
|
|
required => 1, |
13
|
|
|
|
|
|
|
handles => [ 'access_key', 'secret_key', 'session_token' ], |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
requires 'new_from_result_struct'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# converts the params the user passed to the call into objects that represent the call |
19
|
|
|
|
|
|
|
sub new_with_coercions { |
20
|
610
|
|
|
610
|
0
|
44356
|
my ($self, $class, %params) = @_; |
21
|
|
|
|
|
|
|
|
22
|
610
|
|
|
|
|
3133
|
Paws->load_class($class); |
23
|
610
|
|
|
|
|
1255
|
my %p; |
24
|
|
|
|
|
|
|
|
25
|
610
|
100
|
|
|
|
3977
|
if ($class->does('Paws::API::StrToObjMapParser')) { |
|
|
100
|
|
|
|
|
|
26
|
14
|
|
|
|
|
2975
|
my ($subtype) = ($class->meta->find_attribute_by_name('Map')->type_constraint =~ m/^HashRef\[(.*?)\]$/); |
27
|
14
|
100
|
|
|
|
1838
|
if (my ($array_of) = ($subtype =~ m/^ArrayRef\[(.*?)\]$/)){ |
28
|
1
|
|
|
|
|
4
|
$p{ Map } = { map { $_ => [ map { $self->new_with_coercions("$array_of", %$_) } @{ $params{ $_ } } ] } keys %params }; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
3
|
|
29
|
|
|
|
|
|
|
} else { |
30
|
13
|
|
|
|
|
59
|
$p{ Map } = { map { $_ => $self->new_with_coercions("$subtype", %{ $params{ $_ } }) } keys %params }; |
|
14
|
|
|
|
|
7023
|
|
|
14
|
|
|
|
|
84
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} elsif ($class->does('Paws::API::StrToNativeMapParser')) { |
33
|
5
|
|
|
|
|
2301
|
$p{ Map } = { %params }; |
34
|
|
|
|
|
|
|
} else { |
35
|
591
|
|
|
|
|
254021
|
foreach my $att (keys %params){ |
36
|
797
|
|
|
|
|
29505
|
my $att_meta = $class->meta->find_attribute_by_name($att); |
37
|
|
|
|
|
|
|
|
38
|
797
|
50
|
|
|
|
40063
|
croak "$class doesn't have an $att" if (not defined $att_meta); |
39
|
797
|
|
|
|
|
23411
|
my $type = $att_meta->type_constraint; |
40
|
|
|
|
|
|
|
|
41
|
797
|
100
|
66
|
|
|
7184
|
if ($type eq 'Bool') { |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
42
|
4
|
100
|
|
|
|
142
|
$p{ $att } = ($params{ $att } == 1)?1:0; |
43
|
|
|
|
|
|
|
} elsif ($type eq 'Str' or $type eq 'Num' or $type eq 'Int') { |
44
|
688
|
|
|
|
|
50690
|
$p{ $att } = $params{ $att }; |
45
|
|
|
|
|
|
|
} elsif ($type =~ m/^ArrayRef\[(.*?)\]$/){ |
46
|
59
|
|
|
|
|
9008
|
my $subtype = "$1"; |
47
|
59
|
100
|
66
|
|
|
685
|
if ($subtype eq 'Str' or $subtype eq 'Str|Undef' or $subtype eq 'Num' or $subtype eq 'Int' or $subtype eq 'Bool') { |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
48
|
32
|
|
|
|
|
138
|
$p{ $att } = $params{ $att }; |
49
|
|
|
|
|
|
|
} else { |
50
|
27
|
|
|
|
|
56
|
$p{ $att } = [ map { $self->new_with_coercions("$subtype", %{ $_ }) } @{ $params{ $att } } ]; |
|
37
|
|
|
|
|
9219
|
|
|
37
|
|
|
|
|
202
|
|
|
27
|
|
|
|
|
80
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} elsif ($type->isa('Moose::Meta::TypeConstraint::Enum')){ |
53
|
0
|
|
|
|
|
0
|
$p{ $att } = $params{ $att }; |
54
|
|
|
|
|
|
|
} else { |
55
|
46
|
|
|
|
|
7255
|
$p{ $att } = $self->new_with_coercions("$type", %{ $params{ $att } }); |
|
46
|
|
|
|
|
1575
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
610
|
|
|
|
|
45059
|
return $class->new(%p); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _is_internal_type { |
63
|
310
|
|
|
310
|
|
6766
|
my ($self, $att_type) = @_; |
64
|
310
|
|
66
|
|
|
891
|
return ($att_type eq 'Str' or $att_type eq 'Str|Undef' or $att_type eq 'Int' or $att_type eq 'Bool' or $att_type eq 'Num'); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub to_hash { |
68
|
98
|
|
|
98
|
0
|
228
|
my ($self, $params) = @_; |
69
|
98
|
|
|
|
|
195
|
my $refHash = {}; |
70
|
|
|
|
|
|
|
|
71
|
98
|
50
|
|
|
|
321
|
if ($params->does('Paws::API::StrToNativeMapParser')) { |
|
|
50
|
|
|
|
|
|
72
|
0
|
|
|
|
|
0
|
return $params->Map; |
73
|
|
|
|
|
|
|
} elsif ($params->does('Paws::API::StrToObjMapParser')) { |
74
|
0
|
|
|
|
|
0
|
return { map { ($_ => $self->to_hash($params->Map->{$_})) } keys %{ $params->Map } }; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
98
|
|
|
|
|
39731
|
foreach my $att (grep { $_ !~ m/^_/ } $params->meta->get_attribute_list) { |
|
489
|
|
|
|
|
3117
|
|
78
|
489
|
|
|
|
|
673
|
my $key = $att; |
79
|
489
|
100
|
|
|
|
11295
|
if (defined $params->$att) { |
80
|
162
|
|
|
|
|
404
|
my $att_type = $params->meta->get_attribute($att)->type_constraint; |
81
|
162
|
50
|
|
|
|
8224
|
if ($att_type eq 'Bool') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
0
|
$refHash->{ $key } = ($params->$att)?1:0; |
83
|
|
|
|
|
|
|
} elsif ($self->_is_internal_type($att_type)) { |
84
|
157
|
|
|
|
|
10143
|
$refHash->{ $key } = $params->$att; |
85
|
|
|
|
|
|
|
} elsif ($att_type =~ m/^ArrayRef\[(.*)\]/) { |
86
|
5
|
100
|
|
|
|
854
|
if ($self->_is_internal_type("$1")){ |
87
|
1
|
|
|
|
|
27
|
$refHash->{ $key } = $params->$att; |
88
|
|
|
|
|
|
|
} else { |
89
|
4
|
|
|
|
|
9
|
$refHash->{ $key } = [ map { $self->to_hash($_) } @{ $params->$att } ]; |
|
8
|
|
|
|
|
23
|
|
|
4
|
|
|
|
|
98
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} elsif ($att_type->isa('Moose::Meta::TypeConstraint::Enum')) { |
92
|
0
|
|
|
|
|
0
|
$refHash->{ $key } = $params->$att; |
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
0
|
$refHash->{ $key } = $self->to_hash($params->$att); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
98
|
|
|
|
|
1230
|
return $refHash; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub response_to_object { |
102
|
386
|
|
|
386
|
0
|
1463
|
my ($self, $call_object, $http_status, $content, $headers) = @_; |
103
|
|
|
|
|
|
|
|
104
|
386
|
|
|
|
|
1829
|
$call_object = $call_object->meta->name; |
105
|
|
|
|
|
|
|
|
106
|
386
|
|
66
|
|
|
20478
|
my $returns = (defined $call_object->_returns) && ($call_object->_returns ne 'Paws::API::Response'); |
107
|
386
|
100
|
|
|
|
10186
|
my $ret_class = $returns ? $call_object->_returns : 'Paws::API::Response'; |
108
|
386
|
|
|
|
|
2726
|
Paws->load_class($ret_class); |
109
|
|
|
|
|
|
|
|
110
|
386
|
|
|
|
|
915
|
my $unserialized_struct; |
111
|
|
|
|
|
|
|
|
112
|
386
|
100
|
|
|
|
4641
|
if ($ret_class->can('_stream_param')) { |
113
|
2
|
|
|
|
|
7
|
$unserialized_struct = {} |
114
|
|
|
|
|
|
|
} else { |
115
|
384
|
100
|
100
|
|
|
3008
|
if (not defined $content or $content eq '') { |
116
|
27
|
|
|
|
|
73
|
$unserialized_struct = {} |
117
|
|
|
|
|
|
|
} else { |
118
|
357
|
100
|
|
|
|
2599
|
if ($ret_class->can('_payload')) { |
119
|
1
|
|
|
|
|
27
|
$unserialized_struct = {$ret_class->_payload => $content}; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
else { |
122
|
356
|
|
|
|
|
738
|
$unserialized_struct = eval { $self->unserialize_response( $content ) }; |
|
356
|
|
|
|
|
2068
|
|
123
|
|
|
|
|
|
|
} |
124
|
357
|
100
|
|
|
|
16201573
|
if ($@){ |
125
|
6
|
|
|
|
|
159
|
return Paws::Exception->new( |
126
|
|
|
|
|
|
|
message => $@, |
127
|
|
|
|
|
|
|
code => 'InvalidContent', |
128
|
|
|
|
|
|
|
request_id => '', #$request_id, |
129
|
|
|
|
|
|
|
http_status => $http_status, |
130
|
|
|
|
|
|
|
); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
my $request_id = $headers->{'x-amz-request-id'} |
136
|
|
|
|
|
|
|
|| $headers->{'x-amzn-requestid'} |
137
|
|
|
|
|
|
|
|| $unserialized_struct->{'requestId'} |
138
|
|
|
|
|
|
|
|| $unserialized_struct->{'RequestId'} |
139
|
|
|
|
|
|
|
|| $unserialized_struct->{'RequestID'} |
140
|
380
|
|
66
|
|
|
5056
|
|| $unserialized_struct->{ ResponseMetadata }->{ RequestId }; |
141
|
|
|
|
|
|
|
|
142
|
380
|
100
|
|
|
|
16147
|
if ($call_object->_result_key){ |
143
|
155
|
|
|
|
|
4197
|
$unserialized_struct = $unserialized_struct->{ $call_object->_result_key }; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
380
|
|
|
|
|
1633
|
$unserialized_struct->{ _request_id } = $request_id; |
147
|
|
|
|
|
|
|
|
148
|
380
|
100
|
|
|
|
1338
|
if ($returns){ |
149
|
350
|
100
|
|
|
|
2742
|
if ($ret_class->can('_stream_param')) { |
150
|
2
|
|
|
|
|
49
|
$unserialized_struct->{ $ret_class->_stream_param } = $content |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
350
|
|
|
|
|
1622
|
foreach my $key (keys %$headers){ |
154
|
529
|
|
|
|
|
1361
|
$unserialized_struct->{lc $key} = $headers->{$key}; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
350
|
|
|
|
|
9694
|
my $o_result = $self->new_from_result_struct($call_object->_returns, $unserialized_struct); |
158
|
344
|
|
|
|
|
464637
|
return $o_result; |
159
|
|
|
|
|
|
|
} else { |
160
|
30
|
|
|
|
|
205
|
return Paws::API::Response->new( |
161
|
|
|
|
|
|
|
_request_id => $request_id, |
162
|
|
|
|
|
|
|
); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |