GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::Amazon::S3::Client(3) User Contributed Perl Documentation Net::Amazon::S3::Client(3)

Net::Amazon::S3::Client - An easy-to-use Amazon S3 client

version 0.99

        # Build Client instance
        my $client = Net::Amazon::S3::Client->new (
                # accepts all Net::Amazon::S3's arguments
                aws_access_key_id     => $aws_access_key_id,
                aws_secret_access_key => $aws_secret_access_key,
                retry                 => 1,
        );

        # or reuse an existing S3 connection
        my $client = Net::Amazon::S3::Client->new (s3 => $s3);

        # list all my buckets
        # returns a list of L<Net::Amazon::S3::Client::Bucket> objects
        my @buckets = $client->buckets;
        foreach my $bucket (@buckets) {
                print $bucket->name . "\n";
        }

        # create a new bucket
        # returns a L<Net::Amazon::S3::Client::Bucket> object
        my $bucket = $client->create_bucket(
                name                => $bucket_name,
                acl_short           => 'private',
                location_constraint => 'us-east-1',
        );

        # or use an existing bucket
        # returns a L<Net::Amazon::S3::Client::Bucket> object
        my $bucket = $client->bucket( name => $bucket_name );

The Net::Amazon::S3 module was written when the Amazon S3 service had just come out and it is a light wrapper around the APIs. Some bad API decisions were also made. The Net::Amazon::S3::Client, Net::Amazon::S3::Client::Bucket and Net::Amazon::S3::Client::Object classes are designed after years of usage to be easy to use for common tasks.

These classes throw an exception when a fatal error occurs. It also is very careful to pass an MD5 of the content when uploaded to S3 and check the resultant ETag.

WARNING: This is an early release of the Client classes, the APIs may change.

s3
Net::Amazon::S3 instance
error_handler_class
Error handler class name (package name), see Net::Amazon::S3::Error::Handler for more. Overrides one available in "s3".

Default: Net::Amazon::S3::Error::Handler::Confess

error_handler
Instance of error handler class.

Net::Amazon::S3::Client can be constructed two ways.

Historically it wraps S3 API instance

        use Net::Amazon::S3::Client;

        my $client = Net::Amazon::S3::Client->new (
                s3 => .... # Net::Amazon::S3 instance
        );

Since v0.92 explicit creation of S3 API instance is no longer necessary. Net::Amazon::S3::Client's constructor accepts same parameters as Net::Amazon::S3

        use Net::Amazon::S3::Client v0.92;

        my $client = Net::Amazon::S3::Client->new (
                aws_access_key_id     => ...,
                aws_secret_access_key => ...,
                ...,
        );

  # list all my buckets
  # returns a list of L<Net::Amazon::S3::Client::Bucket> objects
  my @buckets = $client->buckets;
  foreach my $bucket (@buckets) {
    print $bucket->name . "\n";
  }

  # create a new bucket
  # returns a L<Net::Amazon::S3::Client::Bucket> object
  my $bucket = $client->create_bucket(
    name                => $bucket_name,
    acl_short           => 'private',
    location_constraint => 'us-east-1',
  );

  # or use an existing bucket
  # returns a L<Net::Amazon::S3::Client::Bucket> object
  my $bucket = $client->bucket( name => $bucket_name );

  # returns string "Net::Amazon::S3::Client::Bucket"
  # subclasses will want to override this.
  my $bucket_class = $client->bucket_class

Branislav Zahradník <barney@cpan.org>

This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2021-12-05 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.