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 version 0.91
11
13 # return the bucket name
14 print $bucket->name . "\n";
15
16 # return the bucket location constraint
17 print "Bucket is in the " . $bucket->location_constraint . "\n";
18
19 # return the ACL XML
20 my $acl = $bucket->acl;
21
22 # list objects in the bucket
23 # this returns a L<Data::Stream::Bulk> object which returns a
24 # stream of L<Net::Amazon::S3::Client::Object> objects, as it may
25 # have to issue multiple API requests
26 my $stream = $bucket->list;
27 until ( $stream->is_done ) {
28 foreach my $object ( $stream->items ) {
29 ...
30 }
31 }
32
33 # or list by a prefix
34 my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
35
36 # returns a L<Net::Amazon::S3::Client::Object>, which can then
37 # be used to get or put
38 my $object = $bucket->object( key => 'this is the key' );
39
40 # delete the bucket (it must be empty)
41 $bucket->delete;
42
44 This module represents buckets.
45
47 acl
48 # return the ACL XML
49 my $acl = $bucket->acl;
50
51 delete
52 # delete the bucket (it must be empty)
53 $bucket->delete;
54
55 list
56 # list objects in the bucket
57 # this returns a L<Data::Stream::Bulk> object which returns a
58 # stream of L<Net::Amazon::S3::Client::Object> objects, as it may
59 # have to issue multiple API requests
60 my $stream = $bucket->list;
61 until ( $stream->is_done ) {
62 foreach my $object ( $stream->items ) {
63 ...
64 }
65 }
66
67 # or list by a prefix
68 my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
69
70 # you can emulate folders by using prefix with delimiter
71 # which shows only entries starting with the prefix but
72 # not containing any more delimiter (thus no subfolders).
73 my $folder_stream = $bucket->list( { prefix => 'logs/', delimiter => '/' } );
74
75 location_constraint
76 # return the bucket location constraint
77 print "Bucket is in the " . $bucket->location_constraint . "\n";
78
79 name
80 # return the bucket name
81 print $bucket->name . "\n";
82
83 object
84 # returns a L<Net::Amazon::S3::Client::Object>, which can then
85 # be used to get or put
86 my $object = $bucket->object( key => 'this is the key' );
87
88 delete_multi_object
89 # delete multiple objects using a multi object delete operation
90 # Accepts a list of L<Net::Amazon::S3::Client::Object or String> objects.
91 $bucket->delete_multi_object($object1, $object2)
92
93 object_class
94 # returns string "Net::Amazon::S3::Client::Object"
95 # allowing subclasses to add behavior.
96 my $object_class = $bucket->object_class;
97
99 Leo Lapworth <llap@cpan.org>
100
102 This software is copyright (c) 2020 by Amazon Digital Services, Leon
103 Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover.
104
105 This is free software; you can redistribute it and/or modify it under
106 the same terms as the Perl 5 programming language system itself.
107
108
109
110perl v5.32.0 2020-08-20Net::Amazon::S3::Client::Bucket(3)