1Net::Amazon::S3::ClientU(s3e)r Contributed Perl DocumentaNteito:n:Amazon::S3::Client(3)
2
3
4
6 Net::Amazon::S3::Client - An easy-to-use Amazon S3 client
7
9 version 0.89
10
12 my $s3 = Net::Amazon::S3->new(
13 aws_access_key_id => $aws_access_key_id,
14 aws_secret_access_key => $aws_secret_access_key,
15 retry => 1,
16 );
17 my $client = Net::Amazon::S3::Client->new( s3 => $s3 );
18
19 # list all my buckets
20 # returns a list of L<Net::Amazon::S3::Client::Bucket> objects
21 my @buckets = $client->buckets;
22 foreach my $bucket (@buckets) {
23 print $bucket->name . "\n";
24 }
25
26 # create a new bucket
27 # returns a L<Net::Amazon::S3::Client::Bucket> object
28 my $bucket = $client->create_bucket(
29 name => $bucket_name,
30 acl_short => 'private',
31 location_constraint => 'us-east-1',
32 );
33
34 # or use an existing bucket
35 # returns a L<Net::Amazon::S3::Client::Bucket> object
36 my $bucket = $client->bucket( name => $bucket_name );
37
39 The Net::Amazon::S3 module was written when the Amazon S3 service had
40 just come out and it is a light wrapper around the APIs. Some bad API
41 decisions were also made. The Net::Amazon::S3::Client,
42 Net::Amazon::S3::Client::Bucket and Net::Amazon::S3::Client::Object
43 classes are designed after years of usage to be easy to use for common
44 tasks.
45
46 These classes throw an exception when a fatal error occurs. It also is
47 very careful to pass an MD5 of the content when uploaded to S3 and
48 check the resultant ETag.
49
50 WARNING: This is an early release of the Client classes, the APIs may
51 change.
52
54 buckets
55 # list all my buckets
56 # returns a list of L<Net::Amazon::S3::Client::Bucket> objects
57 my @buckets = $client->buckets;
58 foreach my $bucket (@buckets) {
59 print $bucket->name . "\n";
60 }
61
62 create_bucket
63 # create a new bucket
64 # returns a L<Net::Amazon::S3::Client::Bucket> object
65 my $bucket = $client->create_bucket(
66 name => $bucket_name,
67 acl_short => 'private',
68 location_constraint => 'us-east-1',
69 );
70
71 bucket
72 # or use an existing bucket
73 # returns a L<Net::Amazon::S3::Client::Bucket> object
74 my $bucket = $client->bucket( name => $bucket_name );
75
76 bucket_class
77 # returns string "Net::Amazon::S3::Client::Bucket"
78 # subclasses will want to override this.
79 my $bucket_class = $client->bucket_class
80
82 Leo Lapworth <llap@cpan.org>
83
85 This software is copyright (c) 2020 by Amazon Digital Services, Leon
86 Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover.
87
88 This is free software; you can redistribute it and/or modify it under
89 the same terms as the Perl 5 programming language system itself.
90
91
92
93perl v5.30.1 2020-02-12 Net::Amazon::S3::Client(3)