POE::Component::Amazon::S3 is a Perl module to work with Amazon S3 using POE.
SYNOPSIS
use POE qw(Component::Amazon::S3);
POE::Component::Amazon::S3->spawn(
alias => 's3',
aws_access_key_id => 'your S3 id',
aws_secret_access_key => 'your S3 key',
);
### Methods for working with buckets
# List buckets, posts back to buckets_done with the result
$kernel->post(
s3 => 'buckets', 'buckets_done',
);
# Add a bucket
$kernel->post(
s3 => 'add_bucket', 'add_bucket_done',
{
bucket => 'my-bucket',
}
);
# Delete a bucket, must be empty of all keys
$kernel->post(
s3 => 'delete_bucket', 'delete_bucket_done',
{
bucket => 'my-bucket',
}
);
# Set access control on a bucket, see below for more info about ACL
$kernel->post(
s3 => 'set_acl', 'set_acl_done',
{
bucket => 'my-bucket',
acl_short => 'public-read',
}
);
# Get the access control list for a bucket
$kernel->post(
s3 => 'get_acl', 'get_acl_done',
{
bucket => 'my-bucket',
}
);
### Methods for working with keys
# Add a key with inline data
$kernel->post(
s3 => 'add_key', 'add_key_done',
{
bucket => 'my-bucket,
key => 'my-inline-key',
data => 'testing 123',
}
);
# Add a key with data from a file
$kernel->post(
s3 => 'add_key', 'add_key_done',
{
bucket => 'my-bucket,
key => 'my-file-key',
file => '/path/to/large_file',
}
);
# List some keys, used for pagination
$kernel->post(
s3 => 'list_bucket', 'list_bucket_done',
{
bucket => 'my-bucket',
'max-keys' => 10,
},
);
# List all keys, may make multiple calls internally to list_bucket
$kernel->post(
s3 => 'list_bucket_all', 'list_bucket_all_done',
{
bucket => 'my-bucket',
},
);
# Get a key, saving the contents in memory
$kernel->post(
s3 => 'get_key', 'get_key_done',
{
bucket => 'my-bucket'
key => 'my-inline-key',
},
);
# Get a key, saving directly to a file
$kernel->post(
s3 => 'get_key', 'get_key_done',
{
bucket => 'my-bucket'
key => 'my-file-key',
file => '/tmp/my-file-key',
},
);
# Get only the headers for a key
$kernel->post(
s3 => 'head_key', 'head_key_done',
{
bucket => 'my-bucket',
key => 'my-inline-key',
},
);
# Delete a key
$kernel->post(
s3 => 'delete_key', 'delete_key_done',
{
bucket => 'my-bucket',
key => 'my-inline-key',
},
);
# Set access control on a key, see below for more info about ACL
$kernel->post(
s3 => 'set_acl', 'set_acl_done',
{
bucket => 'my-bucket',
key => 'my-inline-key',
acl_short => 'public-read',
}
);
# Get the access control list for a key
$kernel->post(
s3 => 'get_acl', 'get_acl_done',
{
bucket => 'my-bucket',
key => 'my-inline-key',
}
);
### Return values
# All methods post back to the given state with the same parameters,
# return and response. Example:
sub add_bucket_done {
my ( $kernel, $return, $response ) = @_[ KERNEL, ARG0, ARG1 ];
# $return contains only the results of the call
# $response contains the full HTTP::Response object from the call
# See individual method documentation below for details on $return
}
Product's homepage
Requirements:
· Perl