.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Amazon::S3 3pm" .TH Amazon::S3 3pm "2023-02-10" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Amazon::S3 \- A portable client library for working with and managing Amazon S3 buckets and keys. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& #!/usr/bin/perl \& use warnings; \& use strict; \& \& use Amazon::S3; \& \& use vars qw/$OWNER_ID $OWNER_DISPLAYNAME/; \& \& my $aws_access_key_id = "Fill me in!"; \& my $aws_secret_access_key = "Fill me in too!"; \& \& my $s3 = Amazon::S3\->new( \& { aws_access_key_id => $aws_access_key_id, \& aws_secret_access_key => $aws_secret_access_key, \& retry => 1 \& } \& ); \& \& my $response = $s3\->buckets; \& \& # create a bucket \& my $bucket_name = $aws_access_key_id . \*(Aq\-net\-amazon\-s3\-test\*(Aq; \& my $bucket = $s3\->add_bucket( { bucket => $bucket_name } ) \& or die $s3\->err . ": " . $s3\->errstr; \& \& # store a key with a content\-type and some optional metadata \& my $keyname = \*(Aqtesting.txt\*(Aq; \& my $value = \*(AqT\*(Aq; \& $bucket\->add_key( \& $keyname, $value, \& { content_type => \*(Aqtext/plain\*(Aq, \& \*(Aqx\-amz\-meta\-colour\*(Aq => \*(Aqorange\*(Aq, \& } \& ); \& \& # copy an object \& $bucket\->copy_object( \& source => $source, \& key => $new_keyname \& ); \& \& # list keys in the bucket \& $response = $bucket\->list \& or die $s3\->err . ": " . $s3\->errstr; \& print $response\->{bucket}."\en"; \& for my $key (@{ $response\->{keys} }) { \& print "\et".$key\->{key}."\en"; \& } \& \& # delete key from bucket \& $bucket\->delete_key($keyname); \& \& # delete bucket \& $bucket\->delete_bucket; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Amazon::S3\*(C'\fR provides a portable client interface to Amazon Simple Storage System (S3). .PP \&\fIThis module is rather dated. For a much more robust and modern implementation of an S3 interface try \f(CI\*(C`Net::Amazon::S3\*(C'\fI. \&\f(CI\*(C`Amazon::S3\*(C'\fI ostensibly was intended to be a drop-in replacement for \&\f(CI\*(C`Net:Amazon::S3\*(C'\fI that \*(L"traded some performance in return for portability\*(R". That statement is no longer accurate as \&\f(CI\*(C`Net::Amazon::S3\*(C'\fI implements much more of the S3 \s-1API\s0 and may have changed the interface in ways that might break your applications. However, \f(CI\*(C`Net::Amazon::S3\*(C'\fI is today dependent on \&\f(CI\*(C`Moose\*(C'\fI which may in fact level the playing field in terms of performance penalties that may have been introduced by recent updates to \f(CI\*(C`Amazon::S3\*(C'\fI. \s-1YMMV,\s0 however, this module may still appeal to some that favor simplicity of the interface and a lower number of dependencies. Below is the original description of the module.\fR .Sp .RS 10 Amazon S3 is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits on to developers. .Sp To sign up for an Amazon Web Services account, required to use this library and the S3 service, please visit the Amazon Web Services web site at http://www.amazonaws.com/. .Sp You will be billed accordingly by Amazon when you use this module and must be responsible for these costs. .Sp To learn more about Amazon's S3 service, please visit: http://s3.amazonaws.com/. .Sp The need for this module arose from some work that needed to work with S3 and would be distributed, installed and used on many various environments where compiled dependencies may not be an option. Net::Amazon::S3 used XML::LibXML tying it to that specific and often difficult to install option. In order to remove this potential barrier to entry, this module is forked and then modified to use \s-1XML::SAX\s0 via XML::Simple. .RE .SH "LIMITATIONS AND DIFFERENCES WITH EARLIER VERSIONS" .IX Header "LIMITATIONS AND DIFFERENCES WITH EARLIER VERSIONS" As noted, this module is no longer a \fIdrop-in\fR replacement for \&\f(CW\*(C`Net::Amazon::S3\*(C'\fR and has limitations and differences that may make the use of this module in your applications questionable. Additionally, one of the original intents of this fork of \f(CW\*(C`Net::Amazon::S3\*(C'\fR was to reduce the dependencies and make it \&\fIeasy to install\fR. Recent changes to this module have introduced new dependencies in order to improve the maintainability and provide additional features. Installing \s-1CPAN\s0 modules is never easy, especially when the dependencies of the dependencies are impossible to control and include \s-1XS\s0 modules. .IP "\s-1MINIMUM PERL\s0" 5 .IX Item "MINIMUM PERL" Technically, this module should run on versions 5.10 and above, however some of the dependencies may require higher versions of \&\f(CW\*(C`perl\*(C'\fR or some versions of the dependencies that conflict with other versions of dependencies...it's a crapshoot when dealing with older \f(CW\*(C`perl\*(C'\fR versions and \s-1CPAN\s0 modules. .Sp You may however, be able to build this module by installing older versions of those dependencies and take your chances that those older versions provide enough working features to support \f(CW\*(C`Amazon::S3\*(C'\fR. It is likely they do...and this module has recently been tested on version 5.10.0 \f(CW\*(C`perl\*(C'\fR using some older \s-1CPAN\s0 modules to resolve dependency issues. .Sp To build this module on an earlier version of \f(CW\*(C`perl\*(C'\fR you may need to downgrade some modules. In particular I have found this recipe to work for building and testing on 5.10.0. .Sp In this order install: .Sp .Vb 3 \& HTML::HeadParser 2.14 \& LWP 6.13 \& Amazon::S3 0.55 .Ve .Sp \&...other versions \fImay\fR work...YMMV. .IP "\s-1API\s0 Signing" 5 .IX Item "API Signing" Making calls to \s-1AWS\s0 APIs requires that the calls be signed. Amazon has added a new signing method (Signature Version 4) to increase security around their APIs. This module no longer utilizes Signature Version V2. .Sp \&\fBNew regions after January 30, 2014 will only support Signature Version 4.\fR .Sp See \*(L"Signature Version V4\*(R" below for important details.> .RS 5 .IP "Signature Version 4" 10 .IX Item "Signature Version 4" .Sp \&\fI\s-1IMPORTANT NOTE:\s0\fR .Sp Unlike Signature Version 2, Version 4 requires a regional parameter. This implies that you need to supply the bucket's region when signing requests for any \s-1API\s0 call that involves a specific bucket. Starting with version 0.55 of this module, \&\f(CW\*(C`Amazon::S3::Bucket\*(C'\fR provides a new method (\f(CW\*(C`region()\*(C'\fR and accepts in the constructor a \f(CW\*(C`region\*(C'\fR parameter. If a region is not supplied, the region for the bucket will be set to the region set in the \f(CW\*(C`account\*(C'\fR object (\f(CW\*(C`Amazon::S3\*(C'\fR) that you passed to the bucket's new constructor. Alternatively, you can request that the bucket's new constructor determine the bucket's region for you by calling the \&\f(CW\*(C`get_location_constraint()\*(C'\fR method. .Sp When signing \s-1API\s0 calls, the region for the specific bucket will be used. For calls that are not regional (\f(CW\*(C`buckets()\*(C'\fR, e.g.) the default region ('us\-east\-1') will be used. .IP "Signature Version 2" 10 .IX Item "Signature Version 2" .RE .RS 5 .RE .IP "New APIs" 5 .IX Item "New APIs" This module does not support some of the newer \s-1API\s0 method calls for S3 added after the initial creation of this interface. .IP "Multipart Upload Support" 5 .IX Item "Multipart Upload Support" There is limited testing for multipart uploads. .Sp For more information regarding multi-part uploads visit the link below. .Sp .SH "METHODS AND SUBROUTINES" .IX Header "METHODS AND SUBROUTINES" .SS "new" .IX Subsection "new" Create a new S3 client object. Takes some arguments: .IP "credentials (optional)" 4 .IX Item "credentials (optional)" Reference to a class (like \f(CW\*(C`Amazon::Credentials\*(C'\fR) that can provide credentials via the methods: .Sp .Vb 3 \& get_aws_access_key_id() \& get_aws_secret_access_key() \& get_token() .Ve .Sp If you do not provide a credential class you must provide the keys when you instantiate the object. See below. .Sp \&\fIYou are strongly encourage to use a class that provides getters. If you choose to provide your credentials to this class then they will be stored in this object. If you dump the class you will likely expose those credentials.\fR .IP "aws_access_key_id" 4 .IX Item "aws_access_key_id" Use your Access Key \s-1ID\s0 as the value of the AWSAccessKeyId parameter in requests you send to Amazon Web Services (when required). Your Access Key \s-1ID\s0 identifies you as the party responsible for the request. .IP "aws_secret_access_key" 4 .IX Item "aws_secret_access_key" Since your Access Key \s-1ID\s0 is not encrypted in requests to \s-1AWS,\s0 it could be discovered and used by anyone. Services that are not free require you to provide additional information, a request signature, to verify that a request containing your unique Access Key \s-1ID\s0 could only have come from you. .Sp \&\fB\s-1DO NOT INCLUDE THIS IN SCRIPTS OR APPLICATIONS YOU DISTRIBUTE. YOU\s0'\s-1LL BE SORRY.\s0\fR .Sp \&\fIConsider using a credential class as described above to provide credentials, otherwise this class will store your credentials for signing the requests. If you dump this object to logs your credentials could be discovered.\fR .IP "token" 4 .IX Item "token" An optional temporary token that will be inserted in the request along with your access and secret key. A token is used in conjunction with temporary credentials when your \s-1EC2\s0 instance has assumed a role and you've scraped the temporary credentials from \&\fIhttp://169.254.169.254/latest/meta\-data/iam/security\-credentials\fR .IP "secure" 4 .IX Item "secure" Set this to a true value if you want to use SSL-encrypted connections when connecting to S3. Starting in version 0.49, the default is true. .Sp default: true .IP "timeout" 4 .IX Item "timeout" Defines the time, in seconds, your script should wait or a response before bailing. .Sp default: 30s .IP "retry" 4 .IX Item "retry" Enables or disables the library to retry upon errors. This uses exponential backoff with retries after 1, 2, 4, 8, 16, 32 seconds, as recommended by Amazon. .Sp default: off .IP "host" 4 .IX Item "host" Defines the S3 host endpoint to use. .Sp default: s3.amazonaws.com .Sp Note that requests are made to domain buckets when possible. You can prevent that behavior if either the bucket name does conform to \s-1DNS\s0 bucket naming conventions or you preface the bucket name with '/'. .Sp If you set a region then the host name will be modified accordingly if it is an Amazon endpoint. .IP "region" 4 .IX Item "region" The \s-1AWS\s0 region you where your bucket is located. .Sp default: us\-east\-1 .IP "buffer_size" 4 .IX Item "buffer_size" The default buffer size when reading or writing files. .Sp default: 4096 .SS "signer" .IX Subsection "signer" Sets or retrieves the signer object. \s-1API\s0 calls must be signed using your \s-1AWS\s0 credentials. By default, starting with version 0.54 the module will use Net::Amazon::Signature::V4 as the signer and instantiate a signer object in the constructor. Note however, that signers need your credentials and they \fIwill\fR get stored by that class, making them susceptible to inadvertant exfiltration. You have a few options here: .IP "1. Use your own signer." 5 .IX Item "1. Use your own signer." You may have noticed that you can also provide your own credentials object forcing this module to use your object for retrieving credentials. Likewise, you can use your own signer so that this module's signer never sees or stores those credentials. .ie n .IP "2. Pass the credentials object and set ""cache_signer"" to a false value." 5 .el .IP "2. Pass the credentials object and set \f(CWcache_signer\fR to a false value." 5 .IX Item "2. Pass the credentials object and set cache_signer to a false value." If you pass a credentials object and set \f(CW\*(C`cache_signer\*(C'\fR to a false value, the module will use the credentials object to retrieve credentials and create a new signer each time an \s-1API\s0 call is made that requires signing. This prevents your credentials from being stored inside of the signer class. .Sp \&\fINote that using your own credentials object that stores your credentials in plaintext is also going to expose your credentials when someone dumps the class.\fR .ie n .IP "3. Pass credentials, set ""cache_signer"" to a false value." 5 .el .IP "3. Pass credentials, set \f(CWcache_signer\fR to a false value." 5 .IX Item "3. Pass credentials, set cache_signer to a false value." Unfortunately, while this will prevent Net::Amazon::Signature::V4 from hanging on to your credentials, you credentials will be stored in the Amazon::S3 object. .Sp Starting with version 0.55 of this module, if you have installed Crypt::CBC and Crypt::Blowfish, your credentials will be encrypted using a random key created when the class is instantiated. While this is more secure than leaving them in plaintext, if the key is discovered (the key however is not stored in the object's hash) and the object is dumped, your \fIencrypted\fR credentials can be exposed. .IP "4. Use very granular credentials for bucket access only." 5 .IX Item "4. Use very granular credentials for bucket access only." Use credentials that only allow access to a bucket or portions of a bucket required for your application. This will at least limit the \&\fIblast radius\fR of any potential security breach. .IP "5. Do nothing...send the credentials, use the default signer." 5 .IX Item "5. Do nothing...send the credentials, use the default signer." In this case, both the Amazon::S3 class and the Net::Amazon::Signature::V4 have your credentials. Caveat Emptor. .Sp See Also Amazon::Credentials for more information about safely storing your credentials and preventing exfiltration. .SS "region" .IX Subsection "region" Sets the region for the for the \s-1API\s0 calls. This will also be the default when instantiating the bucket object unless you pass the region parameter in the \f(CW\*(C`bucket\*(C'\fR method or use the \f(CW\*(C`verify_region\*(C'\fR flag that will \fIalways\fR verify the region of the bucket using the \&\f(CW\*(C`get_location_constraint\*(C'\fR method. .PP default: us\-east\-1 .SS "buckets" .IX Subsection "buckets" .Vb 1 \& buckets([verify\-region]) .Ve .IP "verify-region (optional)" 4 .IX Item "verify-region (optional)" \&\f(CW\*(C`verify\-region\*(C'\fR is a boolean value that indicates if the bucket's region should be verified when the bucket object is instantiated. .Sp If set to true, this method will call the \f(CW\*(C`bucket\*(C'\fR method with \&\f(CW\*(C`verify_region\*(C'\fR set to true causing the constructor to call the \&\f(CW\*(C`get_location_constraint\*(C'\fR for each bucket to set the bucket's region. This will cause a significant decrease in the peformance of the \f(CW\*(C`buckets()\*(C'\fR method. Setting the region for each bucket is necessary since \s-1API\s0 operations on buckets require the region of the bucket when signing \s-1API\s0 requests. If all of your buckets are in the same region and you have passed a region parameter to your S3 object, then that region will be used when calling the constructor of your bucket objects. .Sp default: false .PP Returns a \s-1HASHREF\s0 containing the metadata for all of the buckets owned by the accout or (see below) or \f(CW\*(C`undef\*(C'\fR on error. .IP "owner_id" 4 .IX Item "owner_id" The owner \s-1ID\s0 of the bucket's owner. .IP "owner_display_name" 4 .IX Item "owner_display_name" The name of the owner account. .IP "buckets" 4 .IX Item "buckets" Any \s-1ARRAYREF\s0 of Amazon::S3::Bucket objects for the account. .SS "add_bucket" .IX Subsection "add_bucket" .Vb 1 \& add_bucket(bucket\-configuration) .Ve .PP \&\f(CW\*(C`bucket\-configuration\*(C'\fR is a reference to a hash with bucket configuration parameters. .IP "bucket" 4 .IX Item "bucket" The name of the bucket. See Bucket name rules for more details on bucket naming rules. .IP "acl_short (optional)" 4 .IX Item "acl_short (optional)" See the set_acl subroutine for documentation on the acl_short options .IP "location_constraint" 4 .IX Item "location_constraint" .PD 0 .IP "region" 4 .IX Item "region" .PD The region the bucket is to be created in. .PP Returns a Amazon::S3::Bucket object on success or \f(CW\*(C`undef\*(C'\fR on failure. .SS "bucket" .IX Subsection "bucket" .Vb 1 \& bucket(bucket, [region]) \& \& bucket({ bucket => bucket\-name, verify_region => boolean, region => region }); .Ve .PP Takes a scalar argument or refernce to a hash of arguments. .PP You can pass the region or set \f(CW\*(C`verify_region\*(C'\fR indicating that you want the bucket constructor to detemine the bucket region. .PP If you do not pass the region or set the \f(CW\*(C`verify_region\*(C'\fR value, the region will be set to the default region set in your \f(CW\*(C`Amazon::S3\*(C'\fR object. .PP See Amazon::S3::Bucket for a complete description of the \f(CW\*(C`bucket\*(C'\fR method. .SS "delete_bucket" .IX Subsection "delete_bucket" Takes either a Amazon::S3::Bucket object or a \s-1HASHREF\s0 containing: .IP "bucket" 4 .IX Item "bucket" The name of the bucket to remove .IP "region" 4 .IX Item "region" Region the bucket is located in. If not provided, the method will determine the bucket's region by calling \f(CW\*(C`get_bucket_location\*(C'\fR. .PP Returns a boolean indicating the success of failure of the \s-1API\s0 call. Check \f(CW\*(C`err\*(C'\fR or \f(CW\*(C`errstr\*(C'\fR for error messages. .PP Note from the Amazon's documentation .Sp .RS 10 If a bucket is empty, you can delete it. After a bucket is deleted, the name becomes available for reuse. However, after you delete the bucket, you might not be able to reuse the name for various reasons. .Sp For example, when you delete the bucket and the name becomes available for reuse, another \s-1AWS\s0 account might create a bucket with that name. In addition, \fBsome time might pass before you can reuse the name of a deleted bucket\fR. If you want to use the same bucket name, we recommend that you don't delete the bucket. .RE .SS "dns_bucket_names" .IX Subsection "dns_bucket_names" Set or get a boolean that indicates whether to use \s-1DNS\s0 bucket names. .PP default: true .SS "list_bucket, list_bucket_v2" .IX Subsection "list_bucket, list_bucket_v2" List all keys in this bucket. .PP Takes a \s-1HASHREF\s0 of arguments: .IP "bucket" 4 .IX Item "bucket" \&\s-1REQUIRED.\s0 The name of the bucket you want to list keys on. .IP "prefix" 4 .IX Item "prefix" Restricts the response to only contain results that begin with the specified prefix. If you omit this optional argument, the value of prefix for your query will be the empty string. In other words, the results will be not be restricted by prefix. .IP "delimiter" 4 .IX Item "delimiter" If this optional, Unicode string parameter is included with your request, then keys that contain the same string between the prefix and the first occurrence of the delimiter will be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response. For example, with prefix=\*(L"\s-1USA/\*(R"\s0 and delimiter=\*(L"/\*(R", the matching keys \&\*(L"USA/Oregon/Salem\*(R" and \*(L"USA/Oregon/Portland\*(R" would be summarized in the response as a single \*(L"USA/Oregon\*(R" element in the CommonPrefixes collection. If an otherwise matching key does not contain the delimiter after the prefix, it appears in the Contents collection. .Sp Each element in the CommonPrefixes collection counts as one against the MaxKeys limit. The rolled-up keys represented by each CommonPrefixes element do not. If the Delimiter parameter is not present in your request, keys in the result set will not be rolled-up and neither the CommonPrefixes collection nor the NextMarker element will be present in the response. .Sp \&\s-1NOTE:\s0 CommonPrefixes isn't currently supported by Amazon::S3. .IP "max-keys" 4 .IX Item "max-keys" This optional argument limits the number of results returned in response to your query. Amazon S3 will return no more than this number of results, but possibly less. Even if max-keys is not specified, Amazon S3 will limit the number of results in the response. Check the IsTruncated flag to see if your results are incomplete. If so, use the Marker parameter to request the next page of results. For the purpose of counting max-keys, a 'result' is either a key in the 'Contents' collection, or a delimited prefix in the \&'CommonPrefixes' collection. So for delimiter requests, max-keys limits the total number of list results, not just the number of keys. .IP "marker" 4 .IX Item "marker" This optional parameter enables pagination of large result sets. \&\f(CW\*(C`marker\*(C'\fR specifies where in the result set to resume listing. It restricts the response to only contain results that occur alphabetically after the value of marker. To retrieve the next page of results, use the last key from the current page of results as the marker in your next request. .Sp See also \f(CW\*(C`next_marker\*(C'\fR, below. .Sp If \f(CW\*(C`marker\*(C'\fR is omitted,the first page of results is returned. .PP Returns \f(CW\*(C`undef\*(C'\fR on error and a \s-1HASHREF\s0 of data on success: .PP The \s-1HASHREF\s0 looks like this: .PP .Vb 9 \& { \& bucket => $bucket_name, \& prefix => $bucket_prefix, \& marker => $bucket_marker, \& next_marker => $bucket_next_available_marker, \& max_keys => $bucket_max_keys, \& is_truncated => $bucket_is_truncated_boolean \& keys => [$key1,$key2,...] \& } .Ve .PP Explanation of bits of that: .IP "is_truncated" 4 .IX Item "is_truncated" B flag that indicates whether or not all results of your query were returned in this response. If your results were truncated, you can make a follow-up paginated request using the Marker parameter to retrieve the rest of the results. .IP "next_marker" 4 .IX Item "next_marker" A convenience element, useful when paginating with delimiters. The value of \f(CW\*(C`next_marker\*(C'\fR, if present, is the largest (alphabetically) of all key names and all CommonPrefixes prefixes in the response. If the \f(CW\*(C`is_truncated\*(C'\fR flag is set, request the next page of results by setting \f(CW\*(C`marker\*(C'\fR to the value of \f(CW\*(C`next_marker\*(C'\fR. This element is only present in the response if the \f(CW\*(C`delimiter\*(C'\fR parameter was sent with the request. .PP Each key is a \s-1HASHREF\s0 that looks like this: .PP .Vb 9 \& { \& key => $key, \& last_modified => $last_mod_date, \& etag => $etag, # An MD5 sum of the stored content. \& size => $size, # Bytes \& storage_class => $storage_class # Doc? \& owner_id => $owner_id, \& owner_displayname => $owner_name \& } .Ve .SS "get_bucket_location" .IX Subsection "get_bucket_location" .Vb 2 \& get_bucket_location(bucket\-name) \& get_bucket_locaiton(bucket\-obj) .Ve .PP This is a convenience routines for the \f(CW\*(C`get_location_constraint()\*(C'\fR of the bucket object. This method will, however return the default region of 'us\-east\-1' when \f(CW\*(C`get_location_constraint()\*(C'\fR returns a null value. .PP .Vb 1 \& my $region = $s3\->get_bucket_location(\*(Aqmy\-bucket\*(Aq); .Ve .PP Starting with version 0.55, \f(CW\*(C`Amazon::S3::Bucket\*(C'\fR will call this \&\f(CW\*(C`get_location_constraint()\*(C'\fR to determine the region for the bucket. You can get the region for the bucket by using the \f(CW\*(C`region()\*(C'\fR method of the bucket object. .PP .Vb 2 \& my $bucket = $s3\->bucket(\*(Aqmy\-bucket\*(Aq); \& my $bucket_region = $bucket\->region; .Ve .SS "get_logger" .IX Subsection "get_logger" Returns the logger object. If you did not set a logger when you created the object then the an instance of \f(CW\*(C`Amazon::S3::Logger\*(C'\fR is returned. You can log to \s-1STDERR\s0 using this logger. For example: .PP .Vb 1 \& $s3\->get_logger\->debug(\*(Aqthis is a debug message\*(Aq); \& \& $s3\->get_logger\->trace(sub { return Dumper([$response]) }); .Ve .SS "list_bucket_all, list_bucket_all_v2" .IX Subsection "list_bucket_all, list_bucket_all_v2" List all keys in this bucket without having to worry about \&'marker'. This is a convenience method, but may make multiple requests to S3 under the hood. .PP Takes the same arguments as list_bucket. .PP \&\fIYou are encouraged to use the newer \f(CI\*(C`list_bucket_all_v2\*(C'\fI method.\fR .SS "err" .IX Subsection "err" The S3 error code for the last error encountered. .SS "errstr" .IX Subsection "errstr" A human readable error string for the last error encountered. .SS "error" .IX Subsection "error" The decoded \s-1XML\s0 string as a hash object of the last error. .SS "last_response" .IX Subsection "last_response" Returns the last HTTP::Response object. .SS "last_request" .IX Subsection "last_request" Returns the last HTTP::Request object. .SS "level" .IX Subsection "level" Set the logging level. .PP default: error .SS "turn_on_special_retry" .IX Subsection "turn_on_special_retry" Called to add extra retry codes if retry has been set .SS "turn_off_special_retry" .IX Subsection "turn_off_special_retry" Called to turn off special retry codes when we are deliberately triggering them .SH "ABOUT" .IX Header "ABOUT" This module contains code modified from Amazon that contains the following notice: .PP .Vb 8 \& # This software code is made available "AS IS" without warranties of any \& # kind. You may copy, display, modify and redistribute the software \& # code either by itself or as incorporated into your code; provided that \& # you do not remove any proprietary notices. Your use of this software \& # code is at your own risk and you waive any claim against Amazon \& # Digital Services, Inc. or its affiliates with respect to your use of \& # this software code. (c) 2006 Amazon Digital Services, Inc. or its \& # affiliates. .Ve .SH "TESTING" .IX Header "TESTING" Testing S3 is a tricky thing. Amazon wants to charge you a bit of money each time you use their service. And yes, testing counts as using. Because of this, the application's test suite skips anything approaching a real test unless you set these environment variables: .PP For more on testing this module see \s-1README\-TESTING\s0.md .IP "\s-1AMAZON_S3_EXPENSIVE_TESTS\s0" 4 .IX Item "AMAZON_S3_EXPENSIVE_TESTS" Doesn't matter what you set it to. Just has to be set .IP "\s-1AMAZON_S3_HOST\s0" 4 .IX Item "AMAZON_S3_HOST" Sets the host to use for the \s-1API\s0 service. .Sp default: s3.amazonaws.com .Sp Note that if this value is set, \s-1DNS\s0 bucket name usage will be disabled for testing. Most likely, if you set this variable, you are using a mocking service and your bucket names are probably not resolvable. You can override this behavior by setting \f(CW\*(C`AWS_S3_DNS_BUCKET_NAMES\*(C'\fR to any value. .IP "\s-1AWS_S3_DSN_BUCKET_NAMES\s0" 4 .IX Item "AWS_S3_DSN_BUCKET_NAMES" Set this to any value to override the default behavior of disabling \&\s-1DNS\s0 bucket names during testing. .IP "\s-1AWS_ACCESS_KEY_ID\s0" 4 .IX Item "AWS_ACCESS_KEY_ID" Your \s-1AWS\s0 access key .IP "\s-1AWS_ACCESS_KEY_SECRET\s0" 4 .IX Item "AWS_ACCESS_KEY_SECRET" Your \s-1AWS\s0 sekkr1t passkey. Be forewarned that setting this environment variable on a shared system might leak that information to another user. Be careful. .IP "\s-1AMAZON_S3_SKIP_ACL_TESTS\s0" 4 .IX Item "AMAZON_S3_SKIP_ACL_TESTS" Doesn't matter what you set it to. Just has to be set if you want to skip ACLs tests. .IP "\s-1AMAZON_S3_SKIP_REGION_CONSTRAINT_TEST\s0" 4 .IX Item "AMAZON_S3_SKIP_REGION_CONSTRAINT_TEST" Doesn't matter what you set it to. Just has to be set if you want to skip region constraint test. .IP "\s-1AMAZON_S3_MINIO\s0" 4 .IX Item "AMAZON_S3_MINIO" Doesn't matter what you set it to. Just has to be set if you want to skip tests that would fail on minio. .IP "\s-1AMAZON_S3_LOCALSTACK\s0" 4 .IX Item "AMAZON_S3_LOCALSTACK" Doesn't matter what you set it to. Just has to be set if you want to skip tests that would fail on LocalStack. .IP "\s-1AMAZON_S3_REGIONS\s0" 4 .IX Item "AMAZON_S3_REGIONS" A comma delimited list of regions to use for testing. The default will only test creating a bucket in the local region. .PP \&\fIConsider using an S3 mocking service like \f(CI\*(C`minio\*(C'\fI or \f(CI\*(C`LocalStack\*(C'\fI if you want to create real tests for your applications or this module.\fR .SH "ADDITIONAL INFORMATION" .IX Header "ADDITIONAL INFORMATION" .SS "\s-1LOGGING AND DEBUGGING\s0" .IX Subsection "LOGGING AND DEBUGGING" Additional debugging information can be output to \s-1STDERR\s0 by setting the \f(CW\*(C`level\*(C'\fR option when you instantiate the \f(CW\*(C`Amazon::S3\*(C'\fR object. Levels are represented as a string. The valid levels are: .PP .Vb 6 \& fatal \& error \& warn \& info \& debug \& trace .Ve .PP You can set an optionally pass in a logger that implements a subset of the \f(CW\*(C`Log::Log4perl\*(C'\fR interface. Your logger should support at least these method calls. If you do not supply a logger the default logger (\f(CW\*(C`Amazon::S3::Logger\*(C'\fR) will be used. .PP .Vb 8 \& get_logger() \& fatal() \& error() \& warn() \& info() \& debug() \& trace() \& level() .Ve .PP At the \f(CW\*(C`trace\*(C'\fR level, every \s-1HTTP\s0 request and response will be output to \s-1STDERR.\s0 At the \f(CW\*(C`debug\*(C'\fR level information regarding the higher level methods will be output to \s-1STDERR.\s0 There currently is no additional information logged at lower levels. .SS "S3 \s-1LINKS OF INTEREST\s0" .IX Subsection "S3 LINKS OF INTEREST" .IP "Bucket restrictions and limitations " 5 .IX Item "Bucket restrictions and limitations " .PD 0 .IP "Bucket naming rules " 5 .IX Item "Bucket naming rules " .IP "Amazon S3 \s-1REST API\s0 " 5 .IX Item "Amazon S3 REST API " .IP "Authenticating Requests (\s-1AWS\s0 Signature Version 4) " 5 .IX Item "Authenticating Requests (AWS Signature Version 4) " .IP "Authenticating Requests (\s-1AWS\s0 Signature Version 2) " 5 .IX Item "Authenticating Requests (AWS Signature Version 2) " .PD .SH "SUPPORT" .IX Header "SUPPORT" Bugs should be reported via the \s-1CPAN\s0 bug tracker at .PP .PP For other issues, contact the author. .SH "REPOSITORY" .IX Header "REPOSITORY" .SH "AUTHOR" .IX Header "AUTHOR" Original author: Timothy Appnel .PP Current maintainer: Rob Lauer .SH "SEE ALSO" .IX Header "SEE ALSO" Amazon::S3::Bucket, Net::Amazon::S3 .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" This module was initially based on Net::Amazon::S3 0.41, by Leon Brocard. Net::Amazon::S3 was based on example code from Amazon with this notice: .PP \&\fIThis software code is made available \*(L"\s-1AS IS\*(R"\s0 without warranties of any kind. You may copy, display, modify and redistribute the software code either by itself or as incorporated into your code; provided that you do not remove any proprietary notices. Your use of this software code is at your own risk and you waive any claim against Amazon Digital Services, Inc. or its affiliates with respect to your use of this software code. (c) 2006 Amazon Digital Services, Inc. or its affiliates.\fR .PP The software is released under the Artistic License. The terms of the Artistic License are described at http://www.perl.com/language/misc/Artistic.html. Except where otherwise noted, \f(CW\*(C`Amazon::S3\*(C'\fR is Copyright 2008, Timothy Appnel, tima@cpan.org. All rights reserved.