1Net::Amazon::S3::ClientU:s:eBrucCkoentt(r3i)buted Perl DNoectu:m:eAnmtaaztoino:n:S3::Client::Bucket(3)
2
3
4
6 Net::Amazon::S3::Client::Bucket - An easy-to-use Amazon S3 client
7 bucket
8
10 # return the bucket name
11 print $bucket->name . "\n";
12
13 # return the bucket location constraint
14 print "Bucket is in the " . $bucket->location_constraint . "\n";
15
16 # return the ACL XML
17 my $acl = $bucket->acl;
18
19 # list objects in the bucket
20 # this returns a L<Data::Stream::Bulk> object which returns a
21 # stream of L<Net::Amazon::S3::Client::Object> objects, as it may
22 # have to issue multiple API requests
23 my $stream = $bucket->list;
24 until ( $stream->is_done ) {
25 foreach my $object ( $stream->items ) {
26 ...
27 }
28 }
29
30 # or list by a prefix
31 my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
32
33 # returns a L<Net::Amazon::S3::Client::Object>, which can then
34 # be used to get or put
35 my $object = $bucket->object( key => 'this is the key' );
36
37 # delete the bucket (it must be empty)
38 $bucket->delete;
39
41 This module represents buckets.
42
44 acl
45 # return the ACL XML
46 my $acl = $bucket->acl;
47
48 delete
49 # delete the bucket (it must be empty)
50 $bucket->delete;
51
52 list
53 # list objects in the bucket
54 # this returns a L<Data::Stream::Bulk> object which returns a
55 # stream of L<Net::Amazon::S3::Client::Object> objects, as it may
56 # have to issue multiple API requests
57 my $stream = $bucket->list;
58 until ( $stream->is_done ) {
59 foreach my $object ( $stream->items ) {
60 ...
61 }
62 }
63
64 # or list by a prefix
65 my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
66
67 location_constraint
68 # return the bucket location constraint
69 print "Bucket is in the " . $bucket->location_constraint . "\n";
70
71 name
72 # return the bucket name
73 print $bucket->name . "\n";
74
75 object
76 # returns a L<Net::Amazon::S3::Client::Object>, which can then
77 # be used to get or put
78 my $object = $bucket->object( key => 'this is the key' );
79
80
81
82perl v5.12.3 2010-03-30Net::Amazon::S3::Client::Bucket(3)