The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SimpleDB::Class::HTTP - The network interface to the SimpleDB service.

VERSION

version 1.0103

SYNOPSIS

 use SimpleDB::Class::HTTP;

 my $http = SimpleDB::Class::HTTP->new(secret_key=>'abc', access_key=>'123');
 my $hashref = $http->send_request('CreateDomain', {DomainName => 'my_new_domain'});

DESCRIPTION

This class will let you quickly and easily inteface with AWS SimpleDB. It throws exceptions from SimpleDB::Class::Exception, but other than that doesn't rely on any of the other modules in the SimpleDB::Class system, which means it's very light weight. Although we haven't run any benchmarks, it should outperform any of the other Perl modules that exist today.

METHODS

The following methods are available from this class.

new ( params )

params

A hash containing the parameters to pass in to this method.

access_key

The access key given to you from Amazon when you sign up for the SimpleDB service at this URL: http://aws.amazon.com/simpledb/

secret_key

The secret access key given to you from Amazon.

simpledb_uri

The constructor that SimpleDB::Class will connect to. Defaults to:

 URI->new('https://sdb.amazonaws.com/')

access_key ( )

Returns the access key passed to the constructor.

secret_key ( )

Returns the secret key passed to the constructor.

simpledb_uri ( )

Returns the URI object passed into the constructor that SimpleDB::Class will connect to. Defaults to:

 URI->new('https://sdb.amazonaws.com/')

user_agent ( )

Returns the LWP::UserAgent object that is used to connect to SimpleDB. It's cached here so it doesn't have to be created each time.

construct_request ( action, [ params ] )

Returns a string that contains the HTTP post data ready to make a request to SimpleDB. Normally this is only called by send_request(), but if you want to debug a SimpleDB interaction, then having access to this method is critical.

action

The action to perform on SimpleDB. See the "Operations" section of the guide located at http://docs.amazonwebservices.com/AmazonSimpleDB/2009-04-15/DeveloperGuide/.

params

Any extra prameters required by the operation. The normal parameters of Action, AWSAccessKeyId, Version, Timestamp, SignatureMethod, SignatureVersion, and Signature are all automatically provided by this method.

send_request ( action, [ params ] )

Creates a request, and then sends it to SimpleDB. The response is returned as a hash reference of the raw XML document returned by SimpleDB. Automatically attempts 5 cascading retries on connection failure.

Throws SimpleDB::Class::Exception::Response and SimpleDB::Class::Exception::Connection.

action

See create_request() for details.

params

See create_request() for details.

handle_response ( body, headers )

Returns a hashref containing the response from SimpleDB.

Throws SimpleDB::Class::Exception::Response.

body

The XML returned by SimpleDB.

headers

The HTTP headers.

LEGAL

SimpleDB::Class is Copyright 2009-2010 Plain Black Corporation (http://www.plainblack.com/) and is licensed under the same terms as Perl itself.