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.98
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 add_tags
52 $bucket->add_tags (
53 tags => { tag1 => 'val1', ... },
54 )
55
56 delete_tags
57 $bucket->delete_tags;
58
59 delete
60 # delete the bucket (it must be empty)
61 $bucket->delete;
62
63 list
64 # list objects in the bucket
65 # this returns a L<Data::Stream::Bulk> object which returns a
66 # stream of L<Net::Amazon::S3::Client::Object> objects, as it may
67 # have to issue multiple API requests
68 my $stream = $bucket->list;
69 until ( $stream->is_done ) {
70 foreach my $object ( $stream->items ) {
71 ...
72 }
73 }
74
75 # or list by a prefix
76 my $prefix_stream = $bucket->list( { prefix => 'logs/' } );
77
78 # you can emulate folders by using prefix with delimiter
79 # which shows only entries starting with the prefix but
80 # not containing any more delimiter (thus no subfolders).
81 my $folder_stream = $bucket->list( { prefix => 'logs/', delimiter => '/' } );
82
83 location_constraint
84 # return the bucket location constraint
85 print "Bucket is in the " . $bucket->location_constraint . "\n";
86
87 name
88 # return the bucket name
89 print $bucket->name . "\n";
90
91 object
92 # returns a L<Net::Amazon::S3::Client::Object>, which can then
93 # be used to get or put
94 my $object = $bucket->object( key => 'this is the key' );
95
96 delete_multi_object
97 # delete multiple objects using a multi object delete operation
98 # Accepts a list of L<Net::Amazon::S3::Client::Object or String> objects.
99 $bucket->delete_multi_object($object1, $object2)
100
101 object_class
102 # returns string "Net::Amazon::S3::Client::Object"
103 # allowing subclasses to add behavior.
104 my $object_class = $bucket->object_class;
105
107 Branislav ZahradnĂk <barney@cpan.org>
108
110 This software is copyright (c) 2021 by Amazon Digital Services, Leon
111 Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav
112 ZahradnĂk.
113
114 This is free software; you can redistribute it and/or modify it under
115 the same terms as the Perl 5 programming language system itself.
116
117
118
119perl v5.34.0 2021-07-22Net::Amazon::S3::Client::Bucket(3)