| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package AnyEvent::Net::Amazon::S3::Client::Bucket; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: An easy-to-use Amazon S3 client bucket |
|
4
|
|
|
|
|
|
|
our $VERSION = 'v0.03.0.60'; # VERSION |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
2102
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
64
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
58
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
|
|
12
|
use Module::AnyEvent::Helper::Filter -as => __PACKAGE__, -target => 'Net::Amazon::S3::Client::Bucket', |
|
10
|
|
|
|
|
|
|
-transformer => 'Net::Amazon::S3::Client::Bucket', |
|
11
|
|
|
|
|
|
|
-translate_func => [qw(_create delete acl location_constraint delete_multi_object)], |
|
12
|
|
|
|
|
|
|
-replace_func => [qw(_send_request _send_request_content _send_request_xpc)], |
|
13
|
|
|
|
|
|
|
-exclude_func => [qw(list)] |
|
14
|
1
|
|
|
1
|
|
5
|
; |
|
|
1
|
|
|
|
|
1
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
1; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__END__ |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=pod |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=encoding UTF-8 |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
AnyEvent::Net::Amazon::S3::Client::Bucket - An easy-to-use Amazon S3 client bucket |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 VERSION |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
version v0.03.0.60 |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# return the bucket name |
|
35
|
|
|
|
|
|
|
print $bucket->name . "\n"; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# return the bucket location constraint |
|
38
|
|
|
|
|
|
|
print "Bucket is in the " . $bucket->location_constraint . "\n"; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# return the ACL XML |
|
41
|
|
|
|
|
|
|
my $acl = $bucket->acl; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# list objects in the bucket |
|
44
|
|
|
|
|
|
|
# this returns a L<Data::Stream::Bulk> object which returns a |
|
45
|
|
|
|
|
|
|
# stream of L<AnyEvent::Net::Amazon::S3::Client::Object> objects, as it may |
|
46
|
|
|
|
|
|
|
# have to issue multiple API requests |
|
47
|
|
|
|
|
|
|
my $stream = $bucket->list; |
|
48
|
|
|
|
|
|
|
until ( $stream->is_done ) { |
|
49
|
|
|
|
|
|
|
foreach my $object ( $stream->items ) { |
|
50
|
|
|
|
|
|
|
... |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# or list by a prefix |
|
55
|
|
|
|
|
|
|
my $prefix_stream = $bucket->list( { prefix => 'logs/' } ); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# returns a L<AnyEvent::Net::Amazon::S3::Client::Object>, which can then |
|
58
|
|
|
|
|
|
|
# be used to get or put |
|
59
|
|
|
|
|
|
|
my $object = $bucket->object( key => 'this is the key' ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# delete the bucket (it must be empty) |
|
62
|
|
|
|
|
|
|
$bucket->delete; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This module represents buckets. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This module provides the same interface as L<Net::Amazon::S3::Client::Bucket>. |
|
69
|
|
|
|
|
|
|
In addition, some asynchronous methods returning AnyEvent condition variable are added. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=for test_synopsis no strict 'vars' |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
All L<Net::Amazon::S3::Client::Bucket> methods are available. |
|
76
|
|
|
|
|
|
|
In addition, there are the following asynchronous methods. |
|
77
|
|
|
|
|
|
|
Arguments of the methods are identical as original but return value becomes L<AnyEvent> condition variable. |
|
78
|
|
|
|
|
|
|
You can get actual return value by calling C<shift-E<gt>recv()>. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=over 4 |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item acl_async |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item delete_async |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item list_async |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item location_constraint_async |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item delete_multi_object_async |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 list |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
In addition to described in L<Net::Amazon::S3::Client::Bucket>, |
|
97
|
|
|
|
|
|
|
C<max_keys> and C<marker> options can be accepted. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=for Pod::Coverage object |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Yasutaka ATARASHI <yakex@cpan.org> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Yasutaka ATARASHI. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
110
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |