Amazon-SQS-Simple

 view release on metacpan or  search on metacpan

lib/Amazon/SQS/Simple.pm  view on Meta::CPAN


=head1 CONSTRUCTOR

=over 2

=item new($access_key, $secret_key, [%opts])

Constructs a new Amazon::SQS::Simple object

C<$access_key> is your Amazon Web Services access key. C<$secret_key> is your Amazon Web
Services secret key. If you don't have either of these credentials, visit
L<http://aws.amazon.com/>.

Options for new:

=over 4

=item Timeout => SECONDS

Set the HTTP user agent's timeout (default is 180 seconds)

lib/Amazon/SQS/Simple/Base.pm  view on Meta::CPAN

        my $http_date = strftime('%Y%m%dT%H%M%SZ', gmtime($now));
        my $date = strftime('%Y%m%d', gmtime($now));
        
        $req->protocol('HTTP/1.1');
        $req->header('Date' => $http_date);
        $req->header('x-amz-target', 'AmazonSQSv20121105.' . $params->{Action});
        $req->header('content-type' => 'application/x-www-form-urlencoded;charset=utf-8');

        if ($self->{UseIAMRole}) {
            my $creds = VM::EC2::Security::CredentialCache->get();
            defined($creds) || die("Unable to retrieve IAM role credentials");
            $self->{AWSAccessKeyId} = $creds->accessKeyId;
            $self->{SecretKey} = $creds->secretAccessKey;
            $req->header('x-amz-security-token' => $creds->sessionToken);
        }

        $params->{AWSAccessKeyId} = $self->{AWSAccessKeyId};

        my $escaped_params = $self->_escape_params($params);
        my $payload = join('&', map { $_ . '=' . $escaped_params->{$_} } keys %$escaped_params);
        $req->content($payload);



( run in 0.391 second using v1.01-cache-2.11-cpan-4d50c553e7e )