Amazon-S3-Thin

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

- 1. bucket - a string with the bucket
- 2. key - a string with the key
- 3. headers (**optional**) - hashref with extra header information

**Returns**: an [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse) object for the request. Use the `content()`
method on the returned object to read the contents:

    my $res = $s3->get_object( 'my.bucket', 'my/key.ext' );

    if ($res->is_success) {
        my $content = $res->content;
    }

The GET operation retrieves an object from Amazon S3.

For more information, please refer to
[Amazon's documentation for GET](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html).

## head\_object( $bucket, $key )

**Arguments**:

- 1. bucket - a string with the bucket
- 2. key - a string with the key

**Returns**: an [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse) object for the request. Use the `header()`
method on the returned object to read the metadata:

    my $res = $s3->head_object( 'my.bucket', 'my/key.ext' );

    if ($res->is_success) {
        my $etag = $res->header('etag'); #=> `"fba9dede5f27731c9771645a39863328"`
    }

The HEAD operation retrieves metadata of an object from Amazon S3.

For more information, please refer to
[Amazon's documentation for HEAD](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html).

## delete\_object( $bucket, $key )

**Arguments**: a string with the bucket name, and a string with the key name.

**Returns**: an [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse) object for the request.

The DELETE operation removes the null version (if there is one) of an object
and inserts a delete marker, which becomes the current version of the
object. If there isn't a null version, Amazon S3 does not remove any objects.

Use the response object to see if it succeeded or not.

For more information, please refer to
[Amazon's documentation for DELETE](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html).

## copy\_object( $src\_bucket, $src\_key, $dst\_bucket, $dst\_key \[, $headers\] )

**Arguments**: a list with source (bucket, key) and destination (bucket, key), hashref with extra header information (**optional**).

**Returns**: an [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse) object for the request.

This method is a variation of the PUT operation as described by
Amazon's S3 API. It creates a copy of an object that is already stored
in Amazon S3. This "PUT copy" operation is the same as performing a GET
from the old bucket/key and then a PUT to the new bucket/key.

Note that the COPY request might return error response in 200 OK, but this method
will determine the error response and rewrite the status code to 500.

For more information, please refer to
[Amazon's documentation for COPY](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html).

## put\_object( $bucket, $key, $content \[, $headers\] )

**Arguments**:

- 1. bucket - a string with the destination bucket
- 2. key - a string with the destination key
- 3. content - a string with the content to be uploaded
- 4. headers (**optional**) - hashref with extra header information

**Returns**: an [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse) object for the request.

The PUT operation adds an object to a bucket. Amazon S3 never adds partial
objects; if you receive a success response, Amazon S3 added the entire
object to the bucket.

For more information, please refer to
[Amazon's documentation for PUT](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html).

## delete\_multiple\_objects( $bucket, @keys )

**Arguments**: a string with the bucket name, and an array with all the keys
to be deleted.

**Returns**: an [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse) object for the request.

The Multi-Object Delete operation enables you to delete multiple objects
(up to 1000) from a bucket using a single HTTP request. If you know the
object keys that you want to delete, then this operation provides a suitable
alternative to sending individual delete requests with `delete_object()`,
reducing per-request overhead.

For more information, please refer to
[Amazon's documentation for DELETE multiple objects](http://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html).

## list\_objects( $bucket \[, \\%options \] )

**Arguments**: a string with the bucket name, and (optionally) a hashref
with any of the following options:

- `prefix` (_string_) - only return keys that begin with the
specified prefix. You can use prefixes to separate a bucket into different
groupings of keys, the same way you'd use a folder in a file system.
- `delimiter` (_string_) - group keys that contain the same string
between the beginning of the key (or after the prefix, if specified) and the
first occurrence of the delimiter.
- `encoding-type` (_string_) - if set to "url", will encode keys
in the response (useful when the XML parser can't work unicode keys).
- `marker` (_string_) - specifies the key to start with when listing
objects. Amazon S3 returns object keys in alphabetical order, starting with
the key right after the marker, in order.
- `max-keys` (_string_) - Sets the maximum number of keys returned
in the response body. You can add this to your request if you want to
retrieve fewer than the default 1000 keys.

**Returns**: an [HTTP::Response](https://metacpan.org/pod/HTTP%3A%3AResponse) object for the request. Use the `content()`
method on the returned object to read the contents:

This method returns some or all (up to 1000) of the objects in a bucket. Note
that the response might contain fewer keys but will never contain more.
If there are additional keys that satisfy the search criteria but were not
returned because the limit (either 1000 or max-keys) was exceeded, the
response will contain `<IsTruncated>true</IsTruncated>`. To return the
additional keys, see `marker` above.

For more information, please refer to
[Amazon's documentation for REST Bucket GET](https://metacpan.org/pod/%20http%3A#docs.aws.amazon.com-AmazonS3-latest-API-RESTBucketGET.html).

## generate\_presigned\_post( $bucket, $key \[, $fields, $conditions, $expires\_in \] )

**Arguments**:

- 1. bucket (_string_) - a string with the destination bucket
- 2. key (_string_) - a string with the destination key
- 3. fields (_arrayref_) - an arrayref of key/value pairs to prefilled form fields to build on top of
- 4. conditions (_arrayref_) - an arrayref of condition (arrayref or hashref) to include in the policy
- 5. expires\_in (_number_) - a number of seconds from the current time before expiring presigned url



( run in 0.901 second using v1.01-cache-2.11-cpan-97f6503c9c8 )