Amazon-S3-Thin
view release on metacpan or search on metacpan
**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:
lib/Amazon/S3/Thin.pm view on Meta::CPAN
=item * C<prefix> (I<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.
=item * C<delimiter> (I<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.
=item * C<encoding-type> (I<string>) - if set to "url", will encode keys
in the response (useful when the XML parser can't work unicode keys).
=item * C<marker> (I<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.
=item * C<max-keys> (I<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.
=back
t/02_signer_v2.t view on Meta::CPAN
is(
$signer->string_to_sign($verb,$path,$hdr),
$string_to_sign,
'string to sign'
);
my $sig = $signer->calculate_signature($verb, $path, $hdr);
is $sig, 'qGdzdERIC03wnaRNKh6OqZehG9s=', "puppy list buckets (GET)";
}
{
diag "test Amazon example unicode keys";
my $verb = "GET";
my $date = "Wed, 28 Mar 2007 01:49:49 +0000";
my $path = "dictionary/fran%C3%A7ais/pr%c3%a9f%c3%a8re";
my $string_to_sign = "$verb\n\n\n$date\n/$path";
my $signer = Amazon::S3::Thin::Signer::V2->new($credentials);
my $hdr = HTTP::Headers->new;
$hdr->header("Date", $date);
is(
$signer->string_to_sign($verb,$path,$hdr),
$string_to_sign,
'string to sign'
);
my $sig = $signer->calculate_signature($verb, $path, $hdr);
is $sig, 'DNEZGsoieTZ92F3bUfSPQcbGmlM=', "puppy unicode keys";
}
{
diag "test sign";
my $request = HTTP::Request->new(GET => 'https://mybucket.s3.amazonaws.com/myfile.txt');
$request->header('Date' => 'Wed, 28 Mar 2007 01:49:49 +0000');
my $credentials = Amazon::S3::Thin::Credentials->new('accesskey', 'secretkey');
my $signer = Amazon::S3::Thin::Signer::V2->new($credentials, 's3.amazonaws.com');
$signer->sign($request);
( run in 1.309 second using v1.01-cache-2.11-cpan-88abd93f124 )