Amazon-S3

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

    # create a bucket
    my $bucket_name = $aws_access_key_id . '-net-amazon-s3-test';

    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 = 'testing.txt';

    my $value   = 'T';

    $bucket->add_key(
        $keyname, $value,
        {   content_type        => 'text/plain',
            'x-amz-meta-colour' => 'orange',
        }
    );

    # 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}."\n";

    for my $key (@{ $response->{keys} }) {
          print "\t".$key->{key}."\n";  
    }

    # delete key from bucket
    $bucket->delete_key($keyname);

    # delete multiple keys from bucket
    $bucket->delete_keys([$key1, $key2, $key3]);
    
    # delete bucket
    $bucket->delete_bucket;

# DESCRIPTION

This documentation refers to version 2.0.2.

`Amazon::S3` provides a portable client interface to Amazon Simple
Storage System (S3).

This module is rather dated, however with some help from a few
contributors it has had some recent updates. Recent changes include
implementations of:

- ListObjectsV2
- CopyObject
- DeleteObjects
- ListObjectVersions

Additionally, this module now implements Signature Version 4 signing,
unit tests have been updated and more documentation has been added or
corrected. Credentials are encrypted if you have encryption modules installed.

_NEW!_

The `Amazon::S3` modules have been heavily refactored over the last
few releases to increase maintainability and to add new features. New
features include:

- [Amazon::S3::BucketV2](https://metacpan.org/pod/Amazon%3A%3AS3%3A%3ABucketV2)

    This new module implements a mechanism to invoke _almost_ all of the
    S3 APIs using a standard calling method.

    The module will format your Perl objects as XML payloads and enable
    you to provide all of the parameters required to make an API
    call. Headers and URI parameters can also be passed to the
    methods. [Amazon::S3::BucketV2](https://metacpan.org/pod/Amazon%3A%3AS3%3A%3ABucketV2) is a subclass of
    [Amazon::S3::Bucket](https://metacpan.org/pod/Amazon%3A%3AS3%3A%3ABucket), meaning you can still invoke all of the same
    methods found there.

    See [Amazon::S3::BucketV2](https://metacpan.org/pod/Amazon%3A%3AS3%3A%3ABucketV2) for more details.

- Limited Support for Directory Buckets

    This version include limited support for directory buckets.

    You can create and list directory buckets.

    _Directory buckets use the S3 Express One Zone storage class, which
    is recommended if your application is performance sensitive and
    benefits from single-digit millisecond PUT and GET latencies._ -
    [https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html)

    - list\_directory\_buckets

        List the directory buckets. Note this only returns a list of you
        directory buckets, not their contents. In order to list the contents
        of a directory bucket you must first create a session that establishes
        temporary credentials used to acces the Zonal endpoints. You then use
        those credentials for signing requests using the ListObjectV2 API.

        This process is currently **not supported** by this class.

        [https://docs.aws.amazon.com/AmazonS3/latest/API/API\_CreateSession.html](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateSession.html)

        <Lhttps://docs.aws.amazon.com/AmazonS3/latest/API/API\_ListObjectsV2.html>

    - add\_bucket

        You can add a regin and availability zone to this call in order to
        create a directory bucket.

            $bucket->add_bucket({ bucket => $bucket_name, availability_zone => 'use1-az5' });

        Note that your bucket name must conform to the naming conventions for
        directory buckets. -
        [https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html#directory-buckets-name](https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-overview.html#directory-buckets-name)

- Addition of version parameter for `delete_key`



( run in 1.212 second using v1.01-cache-2.11-cpan-d8267643d1d )