Amazon-S3
view release on metacpan or search on metacpan
lib/Amazon/S3/Bucket.pm view on Meta::CPAN
=head2 get_key hashref
Takes a key and optional arguments and returns the hash of metatdata
which includes the contents of the S3 object.
Example:
$bucket->get_key(
key => 'foo',
uri_params => { versionId => $version },
headers => { Range => 'bytes=0-9' }
);
=over 5
=item key
Key name
=item method
HTTP method (GET or HEAD)
default: GET
=item headers
A hashref of additional headers to send with the request
=item uri-params
A hashref containing key/value pairs representing the URI parameters
you want to include in the request. Possible parameters are shown below.
See L<https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html#API_GetObject_RequestSyntax>
=over 10
=item partNumber
=item response-cache-control
=item response-content-disposition
=item response-content-encoding
=item response-content-language
=item response-content-type
=item response-expires
=item versionId
=back
=back
The method returns C<undef> if the key does not exist in the
bucket and throws an exception (dies) on server errors.
On success, the method returns a HASHREF containing:
=over
=item content_type
=item etag
=item value
=item @meta
=item content_range
=item last_modified
=back
I<Note that the C<etag> for ranged gets is the MD5 value for the entire file.>
=head2 get_key_filename $key_name, [$method, $filename, $headers, $uri_params]
=head2 get_key_filename $args
Pass a list of arguments or a hash of key value/pairs.
This method works like C<get_key>, but takes an added
filename that the S3 resource will be written to.
If C<filename> is undefined or an empty string, the a file with the
key name will be created.
=over 5
=item key (required)
=item method
default: GET
=item filename
default: name of the key
=item headers
A hashref of additional headers to send with the request
=item uri-params
A hashref containing key/value pairs representing the URI parameters
you want to include in the request. See L</get_key> for possible parameters.
See L<https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html#API_GetObject_RequestSyntax>
=back
=head2 list
lib/Amazon/S3/Bucket.pm view on Meta::CPAN
=item * Maximum number of parts 10,000
=item * Part numbers 1 to 10,000 (inclusive)
=item * Part size 5MB to 5GB. There is no limit on the last part of your multipart upload.
=item * Maximum nubmer of parts returned for a list parts request - 1000
=item * Maximum number of multipart uploads returned in a list multipart uploads request - 1000
=back
A multipart upload begins by calling
C<initiate_multipart_upload()>. This will return an identifier that is
used in subsequent calls.
my $bucket = $s3->bucket('my-bucket');
my $id = $bucket->initiate_multipart_upload('some-big-object');
my $part_list = {};
my $part = 1;
my $etag = $bucket->upload_part_of_multipart_upload('my-bucket', $id, $part, $data, length $data);
$part_list{$part++} = $etag;
$bucket->complete_multipart_upload('my-bucket', $id, $part_list);
=heads upload_multipart_object
upload_multipart_object( ... )
Convenience routine C<upload_multipart_object> that encapsulates the
multipart upload process. Accepts a hash or hash reference of
arguments. If successful, a reference to a hash that contains the part
numbers and etags of the uploaded parts.
You can pass a data object, callback routine or a file handle.
=over 5
=item key
Name of the key to create.
=item data
Scalar object that contains the data to write to S3.
=item callback
Optionally provided a callback routine that will be called until you
pass a buffer with a length of 0. Your callback will receive no
arguments but should return a tuple consisting of a B<reference> to a
scalar object that contains the data to write and a scalar that
represents the length of data. Once you return a zero length buffer
the multipart process will be completed.
=item fh
File handle of an open file. The file must be greater than the minimum
chunk size for multipart uploads otherwise the method will throw an
exception.
=item abort_on_error
Indicates whether the multipart upload should be aborted if an error
is encountered. Amazon will charge you for the storage of parts that
have been uploaded unless you abort the upload.
default: true
=back
=head2 abort_multipart_upload
abort_multipart_upload(key, multpart-upload-id)
Abort a multipart upload
=head2 complete_multipart_upload
complete_multipart_upload(key, multpart-upload-id, parts)
Signal completion of a multipart upload. C<parts> is a reference to a
hash of part numbers and etags.
=head2 initiate_multipart_upload
initiate_multipart_upload(key, headers)
Initiate a multipart upload. Returns an id used in subsequent call to
C<upload_part_of_multipart_upload()>.
=head2 list_multipart_upload_parts
List all the uploaded parts of a multipart upload
=head2 list_multipart_uploads
List multipart uploads in progress
=head2 upload_part_of_multipart_upload
upload_part_of_multipart_upload(key, id, part, data, length)
Upload a portion of a multipart upload
=over 5
=item key
Name of the key in the bucket to create.
=item id
The multipart-upload id return in the C<initiate_multipart_upload> call.
=item part
The next part number (part numbers start at 1).
( run in 0.663 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )