Pedro Figueiredo > Net-Amazon-S3-0.58 > Net::Amazon::S3::Client::Bucket

Download:
Net-Amazon-S3-0.58.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.58   Source   Latest Release: Net-Amazon-S3-0.60

NAME ^

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

VERSION ^

version 0.58

SYNOPSIS ^

  # 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;

DESCRIPTION ^

This module represents buckets.

METHODS ^

acl

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

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/' } );

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> objects.
  # Limited to a maximum of 1000 objects in one operation
  $bucket->delete_multi_object($object1, $object2)

AUTHOR ^

Pedro Figueiredo <me@pedrofigueiredo.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo.

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

syntax highlighting: