« lib/Amazon/SQS/QueueHandler.pm
↑ Summary
lib/auto/share/dist/Amazon-SQS-Client/SetQueueAttributes.pm »
| 1 | #!@perlrun@ | ||
| 2 | ################################################################################ | ||
| 3 | # Copyright 2008 Amazon Technologies, Inc. | ||
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | # | ||
| 6 | # You may not use this file except in compliance with the License. | ||
| 7 | # You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 | ||
| 8 | # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
| 9 | # CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| 10 | # specific language governing permissions and limitations under the License. | ||
| 11 | ################################################################################ | ||
| 12 | # __ _ _ ___ | ||
| 13 | # ( )( \/\/ )/ __) | ||
| 14 | # /__\ \ / \__ \ | ||
| 15 | # (_)(_) \/\/ (___/ | ||
| 16 | # | ||
| 17 | # Amazon SQS Perl Library | ||
| 18 | # API Version: 2009-02-01 | ||
| 19 | # Generated: Thu Apr 09 01:13:11 PDT 2009 | ||
| 20 | # | ||
| 21 | |||
| 22 | # | ||
| 23 | # Change Message Visibility Sample | ||
| 24 | # | ||
| 25 | |||
| 26 | use strict; | ||
| 27 | use Carp qw( carp croak ); | ||
| 28 | |||
| 29 | #*********************************************************************** | ||
| 30 | # Access Key ID and Secret Acess Key ID, obtained from: | ||
| 31 | # http://aws.amazon.com | ||
| 32 | #**********************************************************************/ | ||
| 33 | |||
| 34 | require Amazon::SQS::Config; | ||
| 35 | |||
| 36 | my $config = new Amazon::SQS::Config( '@aws_sqsdir@/aws-sqs.ini' ); | ||
| 37 | |||
| 38 | my $AWS_ACCESS_KEY_ID = $config->aws_access_key_id; | ||
| 39 | my $AWS_SECRET_ACCESS_KEY = $config->aws_secret_access_key; | ||
| 40 | |||
| 41 | #*********************************************************************** | ||
| 42 | # Instantiate Http Client Implementation of SQS | ||
| 43 | #**********************************************************************/ | ||
| 44 | use Amazon::SQS::Client; | ||
| 45 | my $service = Amazon::SQS::Client->new($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY); | ||
| 46 | |||
| 47 | #************************************************************************ | ||
| 48 | # Uncomment to try out Mock Service that simulates Amazon::SQS | ||
| 49 | # responses without calling Amazon::SQS service. | ||
| 50 | # | ||
| 51 | # Responses are loaded from local XML files. You can tweak XML files to | ||
| 52 | # experiment with various outputs during development | ||
| 53 | # | ||
| 54 | # XML files available under Amazon/SQS/Mock tree | ||
| 55 | # | ||
| 56 | #**********************************************************************/ | ||
| 57 | # use Amazon::SQS::Mock; | ||
| 58 | # my $service = Amazon::SQS::Mock->new; | ||
| 59 | |||
| 60 | #************************************************************************ | ||
| 61 | # Setup request parameters and uncomment invoke to try out | ||
| 62 | # sample for Change Message Visibility Action | ||
| 63 | #**********************************************************************/ | ||
| 64 | use Amazon::SQS::Model::ChangeMessageVisibilityRequest; | ||
| 65 | # @TODO: set request. Action can be passed as Amazon::SQS::Model::ChangeMessageVisibilityRequest | ||
| 66 | # object or hash of parameters | ||
| 67 | # invokeChangeMessageVisibility($service, $request); | ||
| 68 | |||
| 69 | |||
| 70 | # | ||
| 71 | # Change Message Visibility Action Sample | ||
| 72 | # | ||
| 73 | sub invokeChangeMessageVisibility { | ||
| 74 | my ($service, $request) = @_; | ||
| 75 | eval { | ||
| 76 | my $response = $service->changeMessageVisibility($request); | ||
| 77 | |||
| 78 | print ("Service Response\n"); | ||
| 79 | print ("=============================================================================\n"); | ||
| 80 | |||
| 81 | print(" ChangeMessageVisibilityResponse\n"); | ||
| 82 | if ($response->isSetResponseMetadata()) { | ||
| 83 | print(" ResponseMetadata\n"); | ||
| 84 | my $responseMetadata = $response->getResponseMetadata(); | ||
| 85 | if ($responseMetadata->isSetRequestId()) | ||
| 86 | { | ||
| 87 | print(" RequestId\n"); | ||
| 88 | print(" " . $responseMetadata->getRequestId() . "\n"); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | }; | ||
| 94 | my $ex = $@; | ||
| 95 | if ($ex) { | ||
| 96 | require Amazon::SQS::Exception; | ||
| 97 | if (ref $ex eq "Amazon::SQS::Exception") { | ||
| 98 | print("Caught Exception: " . $ex->getMessage() . "\n"); | ||
| 99 | print("Response Status Code: " . $ex->getStatusCode() . "\n"); | ||
| 100 | print("Error Code: " . $ex->getErrorCode() . "\n"); | ||
| 101 | print("Error Type: " . $ex->getErrorType() . "\n"); | ||
| 102 | print("Request ID: " . $ex->getRequestId() . "\n"); | ||
| 103 | print("XML: " . $ex->getXML() . "\n"); | ||
| 104 | } else { | ||
| 105 | croak $@; | ||
| 106 | } | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 |