Skip to content

cv-library/WebService-S3-Tiny

Repository files navigation

NAME

WebService::S3::Tiny - Perl module for using S3 or compatible APIs

SYNOPSIS

use WebService::S3::Tiny;

my $s3 = WebService::S3::Tiny->new(
    access_key => 'foo',
    host       => 'http://localhost:1337',
    secret_key => 'bar',
);

METHODS

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).

new

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
);

delete_bucket

$s3->delete_bucket($bucket);
$s3->delete_bucket($bucket, \%headers);

get_bucket

$s3->get_bucket($bucket);
$s3->get_bucket($bucket, \%headers);
$s3->get_bucket($bucket, \%headers, \%parameters);

head_bucket

$s3->head_bucket($bucket);
$s3->head_bucket($bucket, \%headers);

put_bucket

$s3->put_bucket($bucket);
$s3->put_bucket($bucket, \%headers);

delete_object

$s3->delete_object($bucket, $object);
$s3->delete_object($bucket, $object, \%headers);

get_object

$s3->get_object($bucket, $object);
$s3->get_object($bucket, $object, \%headers);
$s3->get_object($bucket, $object, \%headers, \%parameters);

head_object

$s3->head_object($bucket, $object);
$s3->head_object($bucket, $object, \%headers);

put_object

$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' });

request

$s3->request($method, $bucket, $object, $content, \%headers, \%parameters);

delete_bucket_url

$s3->delete_bucket_url($bucket, $expires);
$s3->delete_bucket_url($bucket, $expires, \%headers);

get_bucket_url

$s3->get_bucket_url($bucket, $expires);
$s3->get_bucket_url($bucket, $expires, \%headers);
$s3->get_bucket_url($bucket, $expires, \%headers, \%parameters);

head_bucket_url

$s3->head_bucket_url($bucket, $expires);
$s3->head_bucket_url($bucket, $expires, \%headers);

put_bucket_url

$s3->put_bucket_url($bucket, $expires);
$s3->put_bucket_url($bucket, $expires, \%headers);

delete_object_url

$s3->delete_object_url($bucket, $object, $expires);
$s3->delete_object_url($bucket, $object, $expires, \%headers);

get_object_url

$s3->get_object_url($bucket, $object, $expires);
$s3->get_object_url($bucket, $object, $expires, \%headers);
$s3->get_object_url($bucket, $object, $expires, \%headers, \%parameters);

head_object_url

$s3->head_object_url($bucket, $object, $expires);
$s3->head_object_url($bucket, $object, $expires, \%headers);

put_object_url

$s3->put_object_url($bucket, $object, $expires);
$s3->put_object_url($bucket, $object, $expires, \%headers);

signed_url

$s3->signed_url($method, $bucket, $object, $expires, \%headers, \%parameters );

COPYRIGHT AND LICENSE

Copyright © 2018 CV-Library Ltd.

This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

About

Perl module for using S3 or compatible APIs

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •