WebService::S3::Tiny - Perl module for using S3 or compatible APIs
use WebService::S3::Tiny;
my $s3 = WebService::S3::Tiny->new(
access_key => 'foo',
host => 'http://localhost:1337',
secret_key => 'bar',
);
All the request methods of the form {get,put,delete,head}_{bucket,object} can also be called with the _url
suffix to generate a pre-signed URL for the corresponding call.
These URL methods take almost the same arguments as their request counterparts, with the difference that they take an optional argument to indicate the lifetime of the URL in seconds. This argument always comes after the bucket and object, and before the header and parameter references. This value cannot be greater than 604800 (= one week).
WebService::S3::Tiny->new(
access_key => ..., # required
host => ..., # required
region => ..., # optional, defaults to "us-east-1"
secret_key => ..., # required
service => ..., # optional, defaults to "s3"
ua => ..., # optional, defaults to HTTP::Tiny->new
);
$s3->delete_bucket($bucket);
$s3->delete_bucket($bucket, \%headers);
$s3->get_bucket($bucket);
$s3->get_bucket($bucket, \%headers);
$s3->get_bucket($bucket, \%headers, \%parameters);
$s3->head_bucket($bucket);
$s3->head_bucket($bucket, \%headers);
$s3->put_bucket($bucket);
$s3->put_bucket($bucket, \%headers);
$s3->delete_object($bucket, $object);
$s3->delete_object($bucket, $object, \%headers);
$s3->get_object($bucket, $object);
$s3->get_object($bucket, $object, \%headers);
$s3->get_object($bucket, $object, \%headers, \%parameters);
$s3->head_object($bucket, $object);
$s3->head_object($bucket, $object, \%headers);
$s3->put_object($bucket, $object, $content);
$s3->put_object($bucket, $object, $content, \%headers);
# Set foo/bar to "qux"
$s3->put_object('foo', 'bar', 'qux');
# Copy foo/bar to foo/baz
$3->put_object('foo', 'baz', undef, { 'x-amz-copy-source' => 'foo/bar' });
$s3->request($method, $bucket, $object, $content, \%headers, \%parameters);
$s3->delete_bucket_url($bucket, $expires);
$s3->delete_bucket_url($bucket, $expires, \%headers);
$s3->get_bucket_url($bucket, $expires);
$s3->get_bucket_url($bucket, $expires, \%headers);
$s3->get_bucket_url($bucket, $expires, \%headers, \%parameters);
$s3->head_bucket_url($bucket, $expires);
$s3->head_bucket_url($bucket, $expires, \%headers);
$s3->put_bucket_url($bucket, $expires);
$s3->put_bucket_url($bucket, $expires, \%headers);
$s3->delete_object_url($bucket, $object, $expires);
$s3->delete_object_url($bucket, $object, $expires, \%headers);
$s3->get_object_url($bucket, $object, $expires);
$s3->get_object_url($bucket, $object, $expires, \%headers);
$s3->get_object_url($bucket, $object, $expires, \%headers, \%parameters);
$s3->head_object_url($bucket, $object, $expires);
$s3->head_object_url($bucket, $object, $expires, \%headers);
$s3->put_object_url($bucket, $object, $expires);
$s3->put_object_url($bucket, $object, $expires, \%headers);
$s3->signed_url($method, $bucket, $object, $expires, \%headers, \%parameters );
Copyright © 2018 CV-Library Ltd.
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.