line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Paws::Net::EC2Caller; |
2
|
7
|
|
|
7
|
|
5091
|
use Moose::Role; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
75
|
|
3
|
7
|
|
|
7
|
|
36775
|
use HTTP::Request::Common; |
|
7
|
|
|
|
|
30209
|
|
|
7
|
|
|
|
|
567
|
|
4
|
7
|
|
|
7
|
|
53
|
use POSIX qw(strftime); |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub array_flatten_string { |
7
|
11
|
|
|
11
|
0
|
15
|
my $self = shift; |
8
|
11
|
50
|
|
|
|
26
|
return ($self->flattened_arrays)?'%s.%d':'%s.member.%d'; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# converts the objects that represent the call into parameters that the API can understand |
12
|
|
|
|
|
|
|
sub _to_querycaller_params { |
13
|
28
|
|
|
28
|
|
73
|
my ($self, $params) = @_; |
14
|
28
|
|
|
|
|
44
|
my %p; |
15
|
28
|
|
|
|
|
122
|
foreach my $att (grep { $_ !~ m/^_/ } $params->meta->get_attribute_list) { |
|
169
|
|
|
|
|
1250
|
|
16
|
169
|
|
|
|
|
230
|
my $key; |
17
|
169
|
100
|
|
|
|
394
|
if ($params->meta->get_attribute($att)->does('Paws::API::Attribute::Trait::NameInRequest')){ |
18
|
156
|
|
|
|
|
36611
|
$key = $params->meta->get_attribute($att)->request_name; |
19
|
|
|
|
|
|
|
} else { |
20
|
13
|
|
|
|
|
1052
|
$key = $att; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# This is due to code found in serialize.py (EC2Serializer) |
24
|
169
|
|
|
|
|
494
|
substr($key,0,1) = uc(substr($key,0,1)); |
25
|
|
|
|
|
|
|
|
26
|
169
|
100
|
|
|
|
4246
|
if (defined $params->$att) { |
27
|
19
|
|
|
|
|
40
|
my $att_type = $params->meta->get_attribute($att)->type_constraint; |
28
|
|
|
|
|
|
|
|
29
|
19
|
100
|
|
|
|
980
|
if ($self->_is_internal_type($att_type)) { |
|
|
100
|
|
|
|
|
|
30
|
14
|
100
|
|
|
|
757
|
if ($att_type eq 'Bool') { |
31
|
1
|
50
|
|
|
|
31
|
$p{ $key } = ($params->{$att} == 1) ? 'true' : 'false'; |
32
|
|
|
|
|
|
|
} else { |
33
|
13
|
|
|
|
|
374
|
$p{ $key } = $params->{$att}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} elsif ($att_type =~ m/^ArrayRef\[(.*)\]/) { |
36
|
3
|
100
|
|
|
|
511
|
if ($self->_is_internal_type("$1")){ |
37
|
1
|
|
|
|
|
3
|
my $i = 1; |
38
|
1
|
|
|
|
|
62
|
foreach my $value (@{ $params->$att }){ |
|
1
|
|
|
|
|
35
|
|
39
|
2
|
|
|
|
|
5
|
$p{ sprintf($self->array_flatten_string, $key, $i) } = $value; |
40
|
2
|
|
|
|
|
5
|
$i++ |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} else { |
43
|
2
|
|
|
|
|
5
|
my $i = 1; |
44
|
2
|
|
|
|
|
13
|
foreach my $value (@{ $params->$att }){ |
|
2
|
|
|
|
|
52
|
|
45
|
4
|
|
|
|
|
23
|
my %complex_value = $self->_to_querycaller_params($value); |
46
|
4
|
|
|
|
|
12
|
map { $p{ sprintf($self->array_flatten_string . ".%s", $key, $i, $_) } = $complex_value{$_} } keys %complex_value; |
|
9
|
|
|
|
|
32
|
|
47
|
4
|
|
|
|
|
17
|
$i++ |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} else { |
51
|
2
|
|
|
|
|
368
|
my %complex_value = $self->_to_querycaller_params($params->$att); |
52
|
2
|
|
|
|
|
6
|
map { $p{ "$key.$_" } = $complex_value{$_} } keys %complex_value; |
|
2
|
|
|
|
|
13
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
28
|
|
|
|
|
704
|
return %p; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub generate_content_from_parameters { |
60
|
22
|
|
|
22
|
0
|
58
|
my ($self, $request) = @_; |
61
|
|
|
|
|
|
|
|
62
|
22
|
|
|
|
|
509
|
$request->headers->content_type('application/x-www-form-urlencoded'); |
63
|
22
|
|
|
|
|
448
|
my $url = URI->new('http:'); |
64
|
22
|
|
|
|
|
2154
|
$url->query_form($request->parameters); |
65
|
22
|
|
|
|
|
2705
|
my $content = $url->query; |
66
|
|
|
|
|
|
|
# HTML/4.01 says that line breaks are represented as "CR LF" pairs (i.e., `%0D%0A') |
67
|
22
|
50
|
|
|
|
230
|
$content =~ s/(?<!%0D)%0A/%0D%0A/g if (defined $content); |
68
|
22
|
|
|
|
|
658
|
return $content; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub prepare_request_for_call { |
72
|
22
|
|
|
22
|
0
|
96
|
my ($self, $call) = @_; |
73
|
|
|
|
|
|
|
|
74
|
22
|
|
|
|
|
310
|
my $request = Paws::Net::APIRequest->new(); |
75
|
|
|
|
|
|
|
|
76
|
22
|
|
|
|
|
14660
|
$request->url($self->_api_endpoint . '/'); |
77
|
22
|
|
|
|
|
490
|
$request->uri('/'); |
78
|
22
|
|
|
|
|
486
|
$request->method('POST'); |
79
|
|
|
|
|
|
|
|
80
|
22
|
|
|
|
|
589
|
$request->parameters({ Action => $call->_api_call, |
81
|
|
|
|
|
|
|
Version => $self->version, |
82
|
|
|
|
|
|
|
$self->_to_querycaller_params($call) |
83
|
|
|
|
|
|
|
}); |
84
|
|
|
|
|
|
|
|
85
|
22
|
|
|
|
|
94
|
$request->content($self->generate_content_from_parameters($request)); |
86
|
|
|
|
|
|
|
|
87
|
22
|
|
|
|
|
137
|
$self->sign($request); |
88
|
|
|
|
|
|
|
|
89
|
22
|
|
|
|
|
703
|
return $request; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
1; |