line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Amazon::SQS::Lite; |
2
|
18
|
|
|
18
|
|
8260
|
use 5.008001; |
|
18
|
|
|
|
|
45
|
|
3
|
18
|
|
|
18
|
|
60
|
use strict; |
|
18
|
|
|
|
|
21
|
|
|
18
|
|
|
|
|
294
|
|
4
|
18
|
|
|
18
|
|
65
|
use warnings; |
|
18
|
|
|
|
|
14
|
|
|
18
|
|
|
|
|
634
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
7
|
|
|
|
|
|
|
|
8
|
18
|
|
|
18
|
|
69
|
use Carp; |
|
18
|
|
|
|
|
24
|
|
|
18
|
|
|
|
|
1214
|
|
9
|
18
|
|
|
18
|
|
9573
|
use Encode qw(decode); |
|
18
|
|
|
|
|
139409
|
|
|
18
|
|
|
|
|
1197
|
|
10
|
18
|
|
|
18
|
|
7353
|
use Furl; |
|
18
|
|
|
|
|
396571
|
|
|
18
|
|
|
|
|
564
|
|
11
|
18
|
|
|
18
|
|
8478
|
use HTTP::Request::Common; |
|
18
|
|
|
|
|
302458
|
|
|
18
|
|
|
|
|
1156
|
|
12
|
18
|
|
|
18
|
|
8788
|
use Moo; |
|
18
|
|
|
|
|
175137
|
|
|
18
|
|
|
|
|
87
|
|
13
|
18
|
|
|
18
|
|
28357
|
use POSIX qw(setlocale LC_TIME strftime); |
|
18
|
|
|
|
|
79275
|
|
|
18
|
|
|
|
|
140
|
|
14
|
18
|
|
|
18
|
|
23708
|
use Time::Piece; |
|
18
|
|
|
|
|
133326
|
|
|
18
|
|
|
|
|
70
|
|
15
|
18
|
|
|
18
|
|
1018
|
use URI; |
|
18
|
|
|
|
|
23
|
|
|
18
|
|
|
|
|
380
|
|
16
|
18
|
|
|
18
|
|
9322
|
use URI::QueryParam; |
|
18
|
|
|
|
|
8778
|
|
|
18
|
|
|
|
|
432
|
|
17
|
18
|
|
|
18
|
|
8280
|
use WebService::Amazon::Signature::v4; |
|
18
|
|
|
|
|
459270
|
|
|
18
|
|
|
|
|
537
|
|
18
|
18
|
|
|
18
|
|
13622
|
use XML::Simple; |
|
18
|
|
|
|
|
111277
|
|
|
18
|
|
|
|
|
117
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has signature => ( |
21
|
|
|
|
|
|
|
is => 'lazy', |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has scope => ( |
25
|
|
|
|
|
|
|
is => 'lazy', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has ua => ( |
29
|
|
|
|
|
|
|
is => 'lazy', |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has uri => ( |
33
|
|
|
|
|
|
|
is => 'lazy', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has access_key => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has secret_key => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has region => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has ca_path => ( |
49
|
|
|
|
|
|
|
is => 'rw', |
50
|
|
|
|
|
|
|
default => sub { |
51
|
|
|
|
|
|
|
'/etc/ssl/certs', |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has connection_timeout => ( |
56
|
|
|
|
|
|
|
is => 'rw', |
57
|
|
|
|
|
|
|
default => sub { |
58
|
|
|
|
|
|
|
1, |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
has version => ( |
63
|
|
|
|
|
|
|
is => 'rw', |
64
|
|
|
|
|
|
|
default => sub { |
65
|
|
|
|
|
|
|
'2012-11-05' |
66
|
|
|
|
|
|
|
}, |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has xml_decoder => ( |
70
|
|
|
|
|
|
|
is => 'rw', |
71
|
|
|
|
|
|
|
default => sub { |
72
|
|
|
|
|
|
|
XML::Simple->new; |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _build_signature { |
77
|
13
|
|
|
13
|
|
4211
|
my ($self) = @_; |
78
|
13
|
|
|
|
|
54
|
my $locale = setlocale(LC_TIME); |
79
|
13
|
|
|
|
|
47
|
setlocale(LC_TIME, "C"); |
80
|
13
|
|
|
|
|
52
|
my $v4 = WebService::Amazon::Signature::v4->new( |
81
|
|
|
|
|
|
|
scope => $self->scope, |
82
|
|
|
|
|
|
|
access_key => $self->access_key, |
83
|
|
|
|
|
|
|
secret_key => $self->secret_key, |
84
|
|
|
|
|
|
|
); |
85
|
13
|
|
|
|
|
925
|
setlocale(LC_TIME, $locale); |
86
|
13
|
|
|
|
|
75
|
$v4; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub _build_scope { |
90
|
13
|
|
|
13
|
|
4135
|
my ($self) = @_; |
91
|
13
|
|
|
|
|
55
|
join '/', strftime('%Y%m%d', gmtime), $self->region, qw(sqs aws4_request); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub _build_ua { |
95
|
13
|
|
|
13
|
|
4207
|
my ($self) = @_; |
96
|
|
|
|
|
|
|
|
97
|
13
|
|
|
|
|
190
|
my $ua = Furl->new( |
98
|
|
|
|
|
|
|
agent => 'Net::Amazon::SQS::Lite v0.01', |
99
|
|
|
|
|
|
|
timeout => $self->connection_timeout, |
100
|
|
|
|
|
|
|
ssl_opts => { |
101
|
|
|
|
|
|
|
SSL_ca_path => $self->ca_path, |
102
|
|
|
|
|
|
|
}, |
103
|
|
|
|
|
|
|
); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub _build_uri { |
107
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
108
|
0
|
|
|
|
|
0
|
URI->new('http://sqs.' . $self->region . '.amazonaws.com/'); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub make_request { |
112
|
13
|
|
|
13
|
0
|
18
|
my ($self, $content) = @_; |
113
|
|
|
|
|
|
|
|
114
|
13
|
|
|
|
|
49
|
my $req = POST($self->uri, $content); |
115
|
13
|
|
|
|
|
10070
|
my $locale = setlocale(LC_TIME); |
116
|
13
|
|
|
|
|
73
|
setlocale(LC_TIME, "C"); |
117
|
13
|
|
|
|
|
257
|
$req->header(host => $self->uri->host); |
118
|
13
|
|
|
|
|
1242
|
my $http_date = strftime('%a, %d %b %Y %H:%M:%S %Z', localtime); |
119
|
13
|
|
|
|
|
1656
|
my $amz_date = strftime('%Y%m%dT%H%M%SZ', gmtime); |
120
|
13
|
|
|
|
|
583
|
$req->header(Date => $http_date); |
121
|
13
|
|
|
|
|
463
|
$req->header('x-amz-date' => $amz_date); |
122
|
13
|
|
|
|
|
542
|
$req->header('content-type' => 'application/x-www-form-urlencoded'); |
123
|
13
|
|
|
|
|
372
|
$self->signature->from_http_request($req); |
124
|
13
|
|
|
|
|
2006
|
$req->header(Authorization => $self->signature->calculate_signature); |
125
|
13
|
|
|
|
|
7206
|
setlocale(LC_TIME, $locale); |
126
|
13
|
|
|
|
|
23
|
return $req; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub _request { |
130
|
13
|
|
|
13
|
|
20
|
my ($self, $req_param) = @_; |
131
|
13
|
|
|
|
|
41
|
my $req = $self->make_request($req_param); |
132
|
13
|
|
|
|
|
59
|
my $res = $self->ua->request($req); |
133
|
13
|
|
|
|
|
18141
|
my $decoded = $self->xml_decoder->XMLin($res->content); |
134
|
0
|
0
|
|
|
|
0
|
if ($res->is_success) { |
135
|
0
|
|
|
|
|
0
|
return $decoded; |
136
|
|
|
|
|
|
|
} else { |
137
|
0
|
|
|
|
|
0
|
Carp::croak $decoded; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub add_permission { |
142
|
0
|
|
|
0
|
1
|
0
|
my ($self, $param) = @_; |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
0
|
my $account_id_valid = 0; |
145
|
0
|
|
|
|
|
0
|
my $action_name_valid = 0; |
146
|
0
|
|
|
|
|
0
|
for my $key (keys %{$param}) { |
|
0
|
|
|
|
|
0
|
|
147
|
0
|
0
|
|
|
|
0
|
$account_id_valid = 1 if $key =~ /AWSAccountId\.\d/; |
148
|
0
|
0
|
|
|
|
0
|
$action_name_valid = 1 if $key =~ /ActionName\.\d/; |
149
|
|
|
|
|
|
|
} |
150
|
0
|
0
|
|
|
|
0
|
Carp::croak "AWSAccountId.[num] is required." unless $account_id_valid; |
151
|
0
|
0
|
|
|
|
0
|
Carp::croak "ActionName.[num] is required." unless $action_name_valid; |
152
|
0
|
0
|
|
|
|
0
|
Carp::croak "Label is required." unless $param->{Label}; |
153
|
0
|
0
|
|
|
|
0
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
154
|
|
|
|
|
|
|
my $req_param = { |
155
|
|
|
|
|
|
|
'Action' => 'AddPermission', |
156
|
|
|
|
|
|
|
'Version' => $self->version, |
157
|
0
|
|
|
|
|
0
|
%{$param} |
|
0
|
|
|
|
|
0
|
|
158
|
|
|
|
|
|
|
}; |
159
|
0
|
|
|
|
|
0
|
$self->_request($req_param); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub change_message_visibility { |
163
|
0
|
|
|
0
|
1
|
0
|
my ($self, $param) = @_; |
164
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
0
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
166
|
0
|
0
|
|
|
|
0
|
Carp::croak "ReceiptHandle is required." unless $param->{ReceiptHandle}; |
167
|
0
|
0
|
|
|
|
0
|
Carp::croak "VisibilityTimeout is required." unless $param->{VisibilityTimeout}; |
168
|
|
|
|
|
|
|
my $req_param = { |
169
|
|
|
|
|
|
|
'Action' => 'ChangeMessageVisibility', |
170
|
|
|
|
|
|
|
'Version' => $self->version, |
171
|
0
|
|
|
|
|
0
|
%{$param} |
|
0
|
|
|
|
|
0
|
|
172
|
|
|
|
|
|
|
}; |
173
|
0
|
|
|
|
|
0
|
$self->_request($req_param); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub change_message_visibility_batch { |
177
|
0
|
|
|
0
|
0
|
0
|
my ($self, $param) = @_; |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
0
|
my $batch_request_entry = 0; |
180
|
0
|
|
|
|
|
0
|
for my $key (keys %{$param}) { |
|
0
|
|
|
|
|
0
|
|
181
|
0
|
0
|
|
|
|
0
|
$batch_request_entry = 1 if $key =~ /ChangeMessageVisibilityBatchRequestEntry\.\d/; |
182
|
|
|
|
|
|
|
} |
183
|
0
|
0
|
|
|
|
0
|
Carp::croak "ChangeMessageVisibilityBatchRequestEntry.[num] is required." unless $batch_request_entry; |
184
|
0
|
0
|
|
|
|
0
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
185
|
|
|
|
|
|
|
my $req_param = { |
186
|
|
|
|
|
|
|
'Action' => 'ChangeMessageVisibilityBatch', |
187
|
|
|
|
|
|
|
'Version' => $self->version, |
188
|
0
|
|
|
|
|
0
|
%{$param} |
|
0
|
|
|
|
|
0
|
|
189
|
|
|
|
|
|
|
}; |
190
|
0
|
|
|
|
|
0
|
$self->_request($req_param); |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub list_queues { |
194
|
13
|
|
|
13
|
1
|
1001
|
my ($self, $param) = @_; |
195
|
|
|
|
|
|
|
|
196
|
13
|
|
|
|
|
207
|
my $req_param = { |
197
|
|
|
|
|
|
|
'Action' => 'ListQueues', |
198
|
|
|
|
|
|
|
'Version' => $self->version, |
199
|
|
|
|
|
|
|
}; |
200
|
13
|
50
|
|
|
|
58
|
$req_param->{QueueNamePrefix} = $param->{QueueNamePrefix} if $param->{QueueNamePrefix}; |
201
|
13
|
|
|
|
|
47
|
$self->_request($req_param); |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub create_queue { |
205
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
206
|
|
|
|
|
|
|
|
207
|
0
|
0
|
|
|
|
|
Carp::croak "QueueName is required." unless $param->{QueueName}; |
208
|
|
|
|
|
|
|
my $req_param = { |
209
|
|
|
|
|
|
|
'Action' => 'CreateQueue', |
210
|
|
|
|
|
|
|
'Version' => $self->version, |
211
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
}; |
213
|
0
|
|
|
|
|
|
$self->_request($req_param); |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub delete_message { |
217
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
218
|
|
|
|
|
|
|
|
219
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
220
|
0
|
0
|
|
|
|
|
Carp::croak "ReceiptHandle is required." unless $param->{ReceiptHandle}; |
221
|
|
|
|
|
|
|
my $req_param = { |
222
|
|
|
|
|
|
|
'Action' => 'DeleteMessage', |
223
|
|
|
|
|
|
|
'Version' => $self->version, |
224
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
}; |
226
|
0
|
|
|
|
|
|
$self->_request($req_param); |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub delete_message_batch { |
230
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
231
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
|
my $batch_request_entry = 0; |
233
|
0
|
|
|
|
|
|
for my $key (keys %{$param}) { |
|
0
|
|
|
|
|
|
|
234
|
0
|
0
|
|
|
|
|
$batch_request_entry = 1 if $key =~ /DeleteMessageBatchRequestEntry\.\d/; |
235
|
|
|
|
|
|
|
} |
236
|
0
|
0
|
|
|
|
|
Carp::croak "DeleteMessageBatchRequestEntry.[num] is required." unless $batch_request_entry; |
237
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
238
|
|
|
|
|
|
|
my $req_param = { |
239
|
|
|
|
|
|
|
'Action' => 'DeleteMessageBatch', |
240
|
|
|
|
|
|
|
'Version' => $self->version, |
241
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
}; |
243
|
0
|
|
|
|
|
|
$self->_request($req_param); |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
sub delete_queue { |
247
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
248
|
|
|
|
|
|
|
|
249
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
250
|
|
|
|
|
|
|
my $req_param = { |
251
|
|
|
|
|
|
|
'Action' => 'DeleteQueue', |
252
|
|
|
|
|
|
|
'Version' => $self->version, |
253
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
}; |
255
|
0
|
|
|
|
|
|
$self->_request($req_param); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub get_queue_attributes { |
259
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
260
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
my $attributes = 0; |
262
|
0
|
|
|
|
|
|
for my $key (keys %{$param}) { |
|
0
|
|
|
|
|
|
|
263
|
0
|
0
|
|
|
|
|
$attributes = 1 if $key =~ /AttributeName\.\d/; |
264
|
|
|
|
|
|
|
} |
265
|
0
|
0
|
|
|
|
|
Carp::croak "AttributeName.[num] is required." unless $attributes; |
266
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
267
|
|
|
|
|
|
|
my $req_param = { |
268
|
|
|
|
|
|
|
'Action' => 'GetQueueAttributes', |
269
|
|
|
|
|
|
|
'Version' => $self->version, |
270
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
}; |
272
|
0
|
|
|
|
|
|
$self->_request($req_param); |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub get_queue_url { |
276
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
277
|
|
|
|
|
|
|
|
278
|
0
|
0
|
|
|
|
|
Carp::croak "QueueName is required." unless $param->{QueueName}; |
279
|
|
|
|
|
|
|
my $req_param = { |
280
|
|
|
|
|
|
|
'Action' => 'GetQueueUrl', |
281
|
|
|
|
|
|
|
'Version' => $self->version, |
282
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
}; |
284
|
0
|
|
|
|
|
|
$self->_request($req_param); |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub list_dead_letter_source_queues { |
288
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
289
|
|
|
|
|
|
|
|
290
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
291
|
|
|
|
|
|
|
my $req_param = { |
292
|
|
|
|
|
|
|
'Action' => 'ListDeadLetterSourceQueues', |
293
|
|
|
|
|
|
|
'Version' => $self->version, |
294
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
}; |
296
|
0
|
|
|
|
|
|
$self->_request($req_param); |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub purge_queue { |
300
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
301
|
|
|
|
|
|
|
|
302
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
303
|
|
|
|
|
|
|
my $req_param = { |
304
|
|
|
|
|
|
|
'Action' => 'PurgeQueue', |
305
|
|
|
|
|
|
|
'Version' => $self->version, |
306
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
}; |
308
|
0
|
|
|
|
|
|
$self->_request($req_param); |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub receive_message { |
312
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
313
|
|
|
|
|
|
|
|
314
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
315
|
|
|
|
|
|
|
my $req_param = { |
316
|
|
|
|
|
|
|
'Action' => 'ReceiveMessage', |
317
|
|
|
|
|
|
|
'Version' => $self->version, |
318
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
}; |
320
|
0
|
|
|
|
|
|
$self->_request($req_param); |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
sub remove_permission { |
324
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
325
|
|
|
|
|
|
|
|
326
|
0
|
0
|
|
|
|
|
Carp::croak "Label is required." unless $param->{Label}; |
327
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
328
|
|
|
|
|
|
|
my $req_param = { |
329
|
|
|
|
|
|
|
'Action' => 'RemovePermission', |
330
|
|
|
|
|
|
|
'Version' => $self->version, |
331
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
}; |
333
|
0
|
|
|
|
|
|
$self->_request($req_param); |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
sub send_message { |
337
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
338
|
|
|
|
|
|
|
|
339
|
0
|
0
|
|
|
|
|
Carp::croak "MessageBody is required." unless $param->{MessageBody}; |
340
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
341
|
|
|
|
|
|
|
my $req_param = { |
342
|
|
|
|
|
|
|
'Action' => 'SendMessage', |
343
|
|
|
|
|
|
|
'Version' => $self->version, |
344
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
}; |
346
|
0
|
|
|
|
|
|
$self->_request($req_param); |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
sub send_message_batch { |
350
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
351
|
|
|
|
|
|
|
|
352
|
0
|
|
|
|
|
|
my $request_entry = 0; |
353
|
0
|
|
|
|
|
|
for my $key (keys %{$param}) { |
|
0
|
|
|
|
|
|
|
354
|
0
|
0
|
|
|
|
|
$request_entry = 1 if $key =~ /SendMessageBatchRequestEntry\.\d/; |
355
|
|
|
|
|
|
|
} |
356
|
0
|
0
|
|
|
|
|
Carp::croak "SendMessageBatchRequestEntry.[num] is required." unless $request_entry; |
357
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
358
|
|
|
|
|
|
|
my $req_param = { |
359
|
|
|
|
|
|
|
'Action' => 'SendMessageBatch', |
360
|
|
|
|
|
|
|
'Version' => $self->version, |
361
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
}; |
363
|
0
|
|
|
|
|
|
$self->_request($req_param); |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
sub set_queue_attributes { |
367
|
0
|
|
|
0
|
1
|
|
my ($self, $param) = @_; |
368
|
|
|
|
|
|
|
|
369
|
0
|
|
|
|
|
|
my $attributes = 0; |
370
|
0
|
|
|
|
|
|
for my $key (keys %{$param}) { |
|
0
|
|
|
|
|
|
|
371
|
0
|
0
|
|
|
|
|
$attributes = 1 if $key =~ /Attribute\./; |
372
|
|
|
|
|
|
|
} |
373
|
0
|
0
|
|
|
|
|
Carp::croak "Attribute.[entry] is required." unless $attributes; |
374
|
0
|
0
|
|
|
|
|
Carp::croak "QueueUrl is required." unless $param->{QueueUrl}; |
375
|
|
|
|
|
|
|
my $req_param = { |
376
|
|
|
|
|
|
|
'Action' => 'SetQueueAttributes', |
377
|
|
|
|
|
|
|
'Version' => $self->version, |
378
|
0
|
|
|
|
|
|
%{$param} |
|
0
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
}; |
380
|
0
|
|
|
|
|
|
$self->_request($req_param); |
381
|
|
|
|
|
|
|
} |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
1; |
384
|
|
|
|
|
|
|
__END__ |