line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Paws::API::Caller; |
2
|
20
|
|
|
20
|
|
684029
|
use Moose::Role; |
|
20
|
|
|
|
|
44
|
|
|
20
|
|
|
|
|
160
|
|
3
|
20
|
|
|
20
|
|
94446
|
use Carp; |
|
20
|
|
|
|
|
43
|
|
|
20
|
|
|
|
|
1298
|
|
4
|
20
|
|
|
20
|
|
7876
|
use Paws::Net::APIRequest; |
|
20
|
|
|
|
|
63
|
|
|
20
|
|
|
|
|
838
|
|
5
|
20
|
|
|
20
|
|
9737
|
use Paws::API::Response; |
|
20
|
|
|
|
|
57
|
|
|
20
|
|
|
|
|
20050
|
|
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
|
605
|
|
|
605
|
0
|
45421
|
my ($self, $class, %params) = @_; |
21
|
|
|
|
|
|
|
|
22
|
605
|
|
|
|
|
2886
|
Paws->load_class($class); |
23
|
605
|
|
|
|
|
1388
|
my %p; |
24
|
|
|
|
|
|
|
|
25
|
605
|
100
|
|
|
|
3988
|
if ($class->does('Paws::API::StrToObjMapParser')) { |
|
|
100
|
|
|
|
|
|
26
|
14
|
|
|
|
|
2762
|
my ($subtype) = ($class->meta->find_attribute_by_name('Map')->type_constraint =~ m/^HashRef\[(.*?)\]$/); |
27
|
14
|
100
|
|
|
|
1678
|
if (my ($array_of) = ($subtype =~ m/^ArrayRef\[(.*?)\]$/)){ |
28
|
1
|
|
|
|
|
5
|
$p{ Map } = { map { $_ => [ map { $self->new_with_coercions("$array_of", %$_) } @{ $params{ $_ } } ] } keys %params }; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
3
|
|
29
|
|
|
|
|
|
|
} else { |
30
|
13
|
|
|
|
|
55
|
$p{ Map } = { map { $_ => $self->new_with_coercions("$subtype", %{ $params{ $_ } }) } keys %params }; |
|
14
|
|
|
|
|
7584
|
|
|
14
|
|
|
|
|
87
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} elsif ($class->does('Paws::API::StrToNativeMapParser')) { |
33
|
4
|
|
|
|
|
1926
|
$p{ Map } = { %params }; |
34
|
|
|
|
|
|
|
} else { |
35
|
587
|
|
|
|
|
245320
|
foreach my $att (keys %params){ |
36
|
785
|
|
|
|
|
37587
|
my $att_meta = $class->meta->find_attribute_by_name($att); |
37
|
|
|
|
|
|
|
|
38
|
785
|
50
|
|
|
|
37553
|
croak "$class doesn't have an $att" if (not defined $att_meta); |
39
|
785
|
|
|
|
|
22331
|
my $type = $att_meta->type_constraint; |
40
|
|
|
|
|
|
|
|
41
|
785
|
100
|
66
|
|
|
6491
|
if ($type eq 'Bool') { |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
42
|
4
|
100
|
|
|
|
132
|
$p{ $att } = ($params{ $att } == 1)?1:0; |
43
|
|
|
|
|
|
|
} elsif ($type eq 'Str' or $type eq 'Num' or $type eq 'Int') { |
44
|
678
|
|
|
|
|
48584
|
$p{ $att } = $params{ $att }; |
45
|
|
|
|
|
|
|
} elsif ($type =~ m/^ArrayRef\[(.*?)\]$/){ |
46
|
58
|
|
|
|
|
8633
|
my $subtype = "$1"; |
47
|
58
|
100
|
66
|
|
|
652
|
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
|
|
|
|
|
134
|
$p{ $att } = $params{ $att }; |
49
|
|
|
|
|
|
|
} else { |
50
|
26
|
|
|
|
|
61
|
$p{ $att } = [ map { $self->new_with_coercions("$subtype", %{ $_ }) } @{ $params{ $att } } ]; |
|
36
|
|
|
|
|
9176
|
|
|
36
|
|
|
|
|
213
|
|
|
26
|
|
|
|
|
67
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} elsif ($type->isa('Moose::Meta::TypeConstraint::Enum')){ |
53
|
0
|
|
|
|
|
0
|
$p{ $att } = $params{ $att }; |
54
|
|
|
|
|
|
|
} else { |
55
|
45
|
|
|
|
|
6877
|
$p{ $att } = $self->new_with_coercions("$type", %{ $params{ $att } }); |
|
45
|
|
|
|
|
1478
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
605
|
|
|
|
|
36270
|
return $class->new(%p); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _is_internal_type { |
63
|
301
|
|
|
301
|
|
6679
|
my ($self, $att_type) = @_; |
64
|
301
|
|
66
|
|
|
923
|
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
|
245
|
my ($self, $params) = @_; |
69
|
98
|
|
|
|
|
191
|
my $refHash = {}; |
70
|
|
|
|
|
|
|
|
71
|
98
|
50
|
|
|
|
356
|
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
|
|
|
|
|
40632
|
foreach my $att (grep { $_ !~ m/^_/ } $params->meta->get_attribute_list) { |
|
489
|
|
|
|
|
3220
|
|
78
|
489
|
|
|
|
|
674
|
my $key = $att; |
79
|
489
|
100
|
|
|
|
11685
|
if (defined $params->$att) { |
80
|
162
|
|
|
|
|
402
|
my $att_type = $params->meta->get_attribute($att)->type_constraint; |
81
|
162
|
50
|
|
|
|
8365
|
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
|
|
|
|
|
10207
|
$refHash->{ $key } = $params->$att; |
85
|
|
|
|
|
|
|
} elsif ($att_type =~ m/^ArrayRef\[(.*)\]/) { |
86
|
5
|
100
|
|
|
|
844
|
if ($self->_is_internal_type("$1")){ |
87
|
1
|
|
|
|
|
35
|
$refHash->{ $key } = $params->$att; |
88
|
|
|
|
|
|
|
} else { |
89
|
4
|
|
|
|
|
9
|
$refHash->{ $key } = [ map { $self->to_hash($_) } @{ $params->$att } ]; |
|
8
|
|
|
|
|
23
|
|
|
4
|
|
|
|
|
95
|
|
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
|
|
|
|
|
1256
|
return $refHash; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub response_to_object { |
102
|
386
|
|
|
386
|
0
|
1412
|
my ($self, $call_object, $http_status, $content, $headers) = @_; |
103
|
|
|
|
|
|
|
|
104
|
386
|
|
|
|
|
1590
|
$call_object = $call_object->meta->name; |
105
|
|
|
|
|
|
|
|
106
|
386
|
|
66
|
|
|
19746
|
my $returns = (defined $call_object->_returns) && ($call_object->_returns ne 'Paws::API::Response'); |
107
|
386
|
100
|
|
|
|
10227
|
my $ret_class = $returns ? $call_object->_returns : 'Paws::API::Response'; |
108
|
386
|
|
|
|
|
2468
|
Paws->load_class($ret_class); |
109
|
|
|
|
|
|
|
|
110
|
386
|
|
|
|
|
944
|
my $unserialized_struct; |
111
|
|
|
|
|
|
|
|
112
|
386
|
100
|
|
|
|
4447
|
if ($ret_class->can('_stream_param')) { |
113
|
2
|
|
|
|
|
5
|
$unserialized_struct = {} |
114
|
|
|
|
|
|
|
} else { |
115
|
384
|
100
|
100
|
|
|
2794
|
if (not defined $content or $content eq '') { |
116
|
27
|
|
|
|
|
66
|
$unserialized_struct = {} |
117
|
|
|
|
|
|
|
} else { |
118
|
357
|
100
|
|
|
|
2356
|
if ($ret_class->can('_payload')) { |
119
|
1
|
|
|
|
|
24
|
$unserialized_struct = {$ret_class->_payload => $content}; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
else { |
122
|
356
|
|
|
|
|
943
|
$unserialized_struct = eval { $self->unserialize_response( $content ) }; |
|
356
|
|
|
|
|
1810
|
|
123
|
|
|
|
|
|
|
} |
124
|
357
|
100
|
|
|
|
16210637
|
if ($@){ |
125
|
6
|
|
|
|
|
115
|
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
|
|
|
4838
|
|| $unserialized_struct->{ ResponseMetadata }->{ RequestId }; |
141
|
|
|
|
|
|
|
|
142
|
380
|
100
|
|
|
|
15056
|
if ($call_object->_result_key){ |
143
|
155
|
|
|
|
|
3972
|
$unserialized_struct = $unserialized_struct->{ $call_object->_result_key }; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
380
|
|
|
|
|
1595
|
$unserialized_struct->{ _request_id } = $request_id; |
147
|
|
|
|
|
|
|
|
148
|
380
|
100
|
|
|
|
1248
|
if ($returns){ |
149
|
350
|
100
|
|
|
|
2921
|
if ($ret_class->can('_stream_param')) { |
150
|
2
|
|
|
|
|
71
|
$unserialized_struct->{ $ret_class->_stream_param } = $content |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
350
|
|
|
|
|
1483
|
foreach my $key (keys %$headers){ |
154
|
529
|
|
|
|
|
1341
|
$unserialized_struct->{lc $key} = $headers->{$key}; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
350
|
|
|
|
|
9314
|
my $o_result = $self->new_from_result_struct($call_object->_returns, $unserialized_struct); |
158
|
344
|
|
|
|
|
448030
|
return $o_result; |
159
|
|
|
|
|
|
|
} else { |
160
|
30
|
|
|
|
|
183
|
return Paws::API::Response->new( |
161
|
|
|
|
|
|
|
_request_id => $request_id, |
162
|
|
|
|
|
|
|
); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |