Net::Amazon::S3::Client::Bucket(3pm)

Net::Amazon::S3::Client::Bucket3pm

An easy-to-use amazon s3 client bucket

Usage

  # return the bucket name
  print $bucket->name . "\n";
  # return the bucket location constraint
  print "Bucket is in the " . $bucket->location_constraint . "\n";
  # return the ACL XML
  my $acl = $bucket->acl;
  # list objects in the bucket
  # this returns a L<Data::Stream::Bulk> object which returns a
  # stream of L<Net::Amazon::S3::Client::Object> objects, as it may
  # have to issue multiple API requests
  my $stream = $bucket->list;
  until ( $stream->is_done ) {
    foreach my $object ( $stream->items ) {
      ...
    }
  }
  # or list by a prefix
  my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
  # returns a L<Net::Amazon::S3::Client::Object>, which can then
  # be used to get or put
  my $object = $bucket->object( key => 'this is the key' );
  # delete the bucket (it must be empty)
  $bucket->delete;

Version

version 0.991

Overview

This module represents buckets.

Methods

acl

  # return the ACL XML
  my $acl = $bucket->acl;

add_tags

        $bucket->add_tags (
                tags => { tag1 => 'val1', ... },
        )

delete_tags

        $bucket->delete_tags;

delete

  # delete the bucket (it must be empty)
  $bucket->delete;

list

  # list objects in the bucket
  # this returns a L<Data::Stream::Bulk> object which returns a
  # stream of L<Net::Amazon::S3::Client::Object> objects, as it may
  # have to issue multiple API requests
  my $stream = $bucket->list;
  until ( $stream->is_done ) {
    foreach my $object ( $stream->items ) {
      ...
    }
  }
  # or list by a prefix
  my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
  # you can emulate folders by using prefix with delimiter
  # which shows only entries starting with the prefix but
  # not containing any more delimiter (thus no subfolders).
  my $folder_stream = $bucket->list( { prefix => 'logs/', delimiter => '/' } );

location_constraint

  # return the bucket location constraint
  print "Bucket is in the " . $bucket->location_constraint . "\n";

name

  # return the bucket name
  print $bucket->name . "\n";

object

  # returns a L<Net::Amazon::S3::Client::Object>, which can then
  # be used to get or put
  my $object = $bucket->object( key => 'this is the key' );

delete_multi_object

  # delete multiple objects using a multi object delete operation
  # Accepts a list of L<Net::Amazon::S3::Client::Object or String> objects.
  $bucket->delete_multi_object($object1, $object2)

object_class

  # returns string "Net::Amazon::S3::Client::Object"
  # allowing subclasses to add behavior.
  my $object_class = $bucket->object_class;

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 6 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12–13

Author

Branislav Zahradník <[email protected]>

From libnet-amazon-s3-perl 0.991-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.