57
if ($self->_api_version() eq +SQS_VERSION_2007_05_01) {
58
if (defined $href->{Message}) {
59
foreach (@{$href->{Message}}) {
60
push @messages, new Amazon::SQS::Simple::Message(
68
# default to most recent version
69
if (defined $href->{ReceiveMessageResult}{Message}) {
70
foreach (@{$href->{ReceiveMessageResult}{Message}}) {
71
push @messages, new Amazon::SQS::Simple::Message(
49
# default to most recent version
50
if (defined $href->{ReceiveMessageResult}{Message}) {
51
foreach (@{$href->{ReceiveMessageResult}{Message}}) {
52
push @messages, new Amazon::SQS::Simple::Message(
89
69
my ($self, $receipt_handle, %params) = @_;
91
71
$params{Action} = 'DeleteMessage';
92
if ($self->_api_version() eq +SQS_VERSION_2007_05_01) {
93
$params{MessageId} = $receipt_handle;
96
# default to the current version
97
$params{ReceiptHandle} = $receipt_handle;
72
$params{ReceiptHandle} = $receipt_handle;
100
74
my $href = $self->_dispatch(\%params);
77
sub ChangeMessageVisibility {
78
my ($self, $receipt_handle, $timeout, %params) = @_;
80
if ($self->_api_version eq +SQS_VERSION_2008_01_01) {
81
carp "ChangeMessageVisibility not supported in this API version";
84
if (!defined($timeout) || $timeout =~ /\D/ || $timeout < 0 || $timeout > 43200) {
85
croak "timeout must be specified and in range 0..43200";
88
$params{Action} = 'ChangeMessageVisibility';
89
$params{ReceiptHandle} = $receipt_handle;
90
$params{VisibilityTimeout} = $timeout;
92
my $href = $self->_dispatch(\%params);
96
our %valid_permission_actions = map { $_ => 1 } qw(* SendMessage ReceiveMessage DeleteMessage ChangeMessageVisibility GetQueueAttributes);
99
my ($self, $label, $account_actions, %params) = @_;
101
if ($self->_api_version eq +SQS_VERSION_2008_01_01) {
102
carp "AddPermission not supported in this API version";
105
$params{Action} = 'AddPermission';
106
$params{Label} = $label;
108
foreach my $account_id (keys %$account_actions) {
109
$account_id =~ /^\d{12}$/ or croak "Account IDs passed to AddPermission should be 12 digit AWS account numbers, no hyphens";
110
my $actions = $account_actions->{$account_id};
112
if (UNIVERSAL::isa($actions, 'ARRAY')) {
113
@actions = @$actions;
115
@actions = ($actions);
117
foreach my $action (@actions) {
118
exists $valid_permission_actions{$action}
119
or croak "Action passed to AddPermission must be one of "
120
. join(', ', sort keys %valid_permission_actions);
122
$params{"AWSAccountId.$i"} = $account_id;
123
$params{"ActionName.$i"} = $action;
127
my $href = $self->_dispatch(\%params);
131
sub RemovePermission {
132
my ($self, $label, %params) = @_;
134
if ($self->_api_version eq +SQS_VERSION_2008_01_01) {
135
carp "RemovePermission not supported in this API version";
138
$params{Action} = 'RemovePermission';
139
$params{Label} = $label;
140
my $href = $self->_dispatch(\%params);
103
144
sub GetAttributes {
104
145
my ($self, %params) = @_;
106
$params{Action} = 'GetQueueAttributes';
147
$params{Action} = 'GetQueueAttributes';
109
if ($self->_api_version() eq +SQS_VERSION_2007_05_01) {
110
$params{Attribute} ||= 'All';
112
my $href = $self->_dispatch(\%params, [ 'AttributedValue' ]);
114
if ($href->{'AttributedValue'}) {
115
foreach my $attr (@{$href->{'AttributedValue'}}) {
116
$result{$attr->{Attribute}} = $attr->{Value};
121
# default to the current version
122
$params{AttributeName} ||= 'All';
124
my $href = $self->_dispatch(\%params, [ 'Attribute' ]);
126
if ($href->{GetQueueAttributesResult}) {
127
foreach my $attr (@{$href->{GetQueueAttributesResult}{Attribute}}) {
128
$result{$attr->{Name}} = $attr->{Value};
150
# default to the current version
151
$params{AttributeName} ||= 'All';
153
my $href = $self->_dispatch(\%params, [ 'Attribute' ]);
155
if ($href->{GetQueueAttributesResult}) {
156
foreach my $attr (@{$href->{GetQueueAttributesResult}{Attribute}}) {
157
$result{$attr->{Name}} = $attr->{Value};
137
164
my ($self, $key, $value, %params) = @_;
139
166
$params{Action} = 'SetQueueAttributes';
140
if ($self->_api_version() eq +SQS_VERSION_2007_05_01) {
141
$params{Attribute} = $key;
142
$params{Value} = $value;
145
# default to the current version
146
$params{'Attribute.Name'} = $key;
147
$params{'Attribute.Value'} = $value;
167
$params{'Attribute.Name'} = $key;
168
$params{'Attribute.Value'} = $value;
150
170
my $href = $self->_dispatch(\%params);
232
252
Delete the message with the specified receipt handle from the queue
254
=item B<ChangeMessageVisibility($receipt_handle, $timeout, [%opts])>
256
NOT SUPPORTED IN APIs EARLIER THAN 2009-01-01
258
Changes the visibility of the message with the specified receipt handle to
259
C<$timeout> seconds. C<$timeout> must be in the range 0..43200.
261
=item B<AddPermission($label, $account_actions, [%opts])>
263
NOT SUPPORTED IN APIs EARLIER THAN 2009-01-01
265
Sets a permissions policy with the specified label. C<$account_actions>
266
is a reference to a hash mapping 12-digit AWS account numbers to the action(s)
267
you want to permit for those account IDs. The hash value for each key can
268
be a string (e.g. "ReceiveMessage") or a reference to an array of strings
269
(e.g. ["ReceiveMessage", "DeleteMessage"])
271
=item B<RemovePermission($label, [%opts])>
273
NOT SUPPORTED IN APIs EARLIER THAN 2009-01-01
275
Removes the permissions policy with the specified label.
234
277
=item B<GetAttributes([%opts])>
236
279
Get the attributes for the queue. Returns a reference to a hash