line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: used for testing and as example |
2
|
|
|
|
|
|
|
$Shared::Examples::Net::Amazon::S3::Client::VERSION = '0.991'; |
3
|
|
|
|
|
|
|
use strict; |
4
|
90
|
|
|
90
|
|
1800649
|
use warnings; |
|
90
|
|
|
|
|
281
|
|
|
90
|
|
|
|
|
2390
|
|
5
|
90
|
|
|
90
|
|
467
|
|
|
90
|
|
|
|
|
169
|
|
|
90
|
|
|
|
|
2208
|
|
6
|
|
|
|
|
|
|
use parent qw[ Exporter::Tiny ]; |
7
|
90
|
|
|
90
|
|
435
|
|
|
90
|
|
|
|
|
189
|
|
|
90
|
|
|
|
|
508
|
|
8
|
|
|
|
|
|
|
use Hash::Util; |
9
|
90
|
|
|
90
|
|
127499
|
use HTTP::Response; |
|
90
|
|
|
|
|
84672
|
|
|
90
|
|
|
|
|
494
|
|
10
|
90
|
|
|
90
|
|
17041
|
use HTTP::Status; |
|
90
|
|
|
|
|
629701
|
|
|
90
|
|
|
|
|
2156
|
|
11
|
90
|
|
|
90
|
|
531
|
use Sub::Override; |
|
90
|
|
|
|
|
190
|
|
|
90
|
|
|
|
|
25208
|
|
12
|
90
|
|
|
90
|
|
25153
|
use Test::Deep; |
|
90
|
|
|
|
|
57440
|
|
|
90
|
|
|
|
|
2162
|
|
13
|
90
|
|
|
90
|
|
513
|
use Test::More; |
|
90
|
|
|
|
|
233
|
|
|
90
|
|
|
|
|
604
|
|
14
|
90
|
|
|
90
|
|
20247
|
|
|
90
|
|
|
|
|
204
|
|
|
90
|
|
|
|
|
569
|
|
15
|
|
|
|
|
|
|
use Net::Amazon::S3::Client; |
16
|
90
|
|
|
90
|
|
35320
|
use Shared::Examples::Net::Amazon::S3; |
|
90
|
|
|
|
|
271
|
|
|
90
|
|
|
|
|
2476
|
|
17
|
90
|
|
|
90
|
|
17186
|
|
|
90
|
|
|
|
|
250
|
|
|
90
|
|
|
|
|
585
|
|
18
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
19
|
|
|
|
|
|
|
qw[ expect_signed_uri ], |
20
|
|
|
|
|
|
|
qw[ expect_client_list_all_my_buckets ], |
21
|
|
|
|
|
|
|
qw[ expect_client_bucket_acl_get ], |
22
|
|
|
|
|
|
|
qw[ expect_client_bucket_acl_set ], |
23
|
|
|
|
|
|
|
qw[ expect_client_bucket_create ], |
24
|
|
|
|
|
|
|
qw[ expect_client_bucket_delete ], |
25
|
|
|
|
|
|
|
qw[ expect_client_bucket_objects_delete ], |
26
|
|
|
|
|
|
|
qw[ expect_client_bucket_objects_list ], |
27
|
|
|
|
|
|
|
qw[ expect_client_bucket_tags_add ], |
28
|
|
|
|
|
|
|
qw[ expect_client_bucket_tags_delete ], |
29
|
|
|
|
|
|
|
qw[ expect_client_object_acl_set ], |
30
|
|
|
|
|
|
|
qw[ expect_client_object_create ], |
31
|
|
|
|
|
|
|
qw[ expect_client_object_delete ], |
32
|
|
|
|
|
|
|
qw[ expect_client_object_fetch ], |
33
|
|
|
|
|
|
|
qw[ expect_client_object_head ], |
34
|
|
|
|
|
|
|
qw[ expect_client_object_tags_add], |
35
|
|
|
|
|
|
|
qw[ expect_client_object_tags_delete], |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
*with_fixture = *Shared::Examples::Net::Amazon::S3::with_fixture; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my ($self, $name, $args, $globals) = @_; |
41
|
|
|
|
|
|
|
|
42
|
90
|
|
|
90
|
|
25187
|
my $s3_operation = $name; |
43
|
|
|
|
|
|
|
$s3_operation =~ s/_client_/_operation_/; |
44
|
90
|
|
|
|
|
173
|
|
45
|
90
|
|
|
|
|
242
|
return +( $name => eval <<"GEN_SUB" ); |
46
|
|
|
|
|
|
|
sub { |
47
|
90
|
|
|
97
|
|
6339
|
push \@_, -shared_examples => __PACKAGE__; |
|
97
|
|
|
|
|
92758
|
|
|
97
|
|
|
|
|
1496
|
|
|
120
|
|
|
|
|
120606
|
|
|
120
|
|
|
|
|
1128
|
|
48
|
|
|
|
|
|
|
goto \\& Shared::Examples::Net::Amazon::S3::$s3_operation; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
GEN_SUB |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my ($self, $params) = @_; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$params->{with_client} ||= Net::Amazon::S3::Client->new ( |
56
|
197
|
|
|
144
|
|
79413
|
s3 => Shared::Examples::Net::Amazon::S3::s3_api_with_signature_2 () |
57
|
|
|
|
|
|
|
); |
58
|
197
|
|
66
|
|
|
1544
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my ($self, $api, %params) = @_; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Shared::Examples::Net::Amazon::S3->s3_api_mock_http_response ( |
63
|
|
|
|
|
|
|
$api->s3, |
64
|
103
|
|
|
103
|
|
539
|
%params, |
65
|
|
|
|
|
|
|
) |
66
|
103
|
|
|
|
|
2696
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my ($title, %params) = @_; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Hash::Util::lock_keys %params, |
71
|
|
|
|
|
|
|
qw[ with_client ], |
72
|
|
|
|
|
|
|
qw[ with_bucket ], |
73
|
4
|
|
|
4
|
0
|
19
|
qw[ with_region ], |
74
|
|
|
|
|
|
|
qw[ with_key ], |
75
|
4
|
|
|
|
|
25
|
qw[ with_expire_at ], |
76
|
|
|
|
|
|
|
qw[ with_method ], |
77
|
|
|
|
|
|
|
qw[ expect_uri ], |
78
|
|
|
|
|
|
|
; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $guard = Sub::Override->new ( |
81
|
|
|
|
|
|
|
'Net::Amazon::S3::Bucket::region' => sub { $params{with_region } }, |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $got = $params{with_client} |
85
|
|
|
|
|
|
|
->bucket ( |
86
|
3
|
|
|
3
|
|
68
|
name => $params{with_bucket}, |
87
|
4
|
|
|
|
|
285
|
) |
88
|
|
|
|
|
|
|
->object ( |
89
|
|
|
|
|
|
|
key => $params{with_key}, |
90
|
|
|
|
|
|
|
expires => $params{with_expire_at}, |
91
|
|
|
|
|
|
|
) |
92
|
|
|
|
|
|
|
->query_string_authentication_uri_for_method ( |
93
|
|
|
|
|
|
|
$params{with_method} || 'GET', |
94
|
|
|
|
|
|
|
) |
95
|
|
|
|
|
|
|
; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
cmp_deeply $got, $params{expect_uri}, $title; |
98
|
4
|
|
100
|
|
|
216
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my ($self, %params) = @_; |
101
|
|
|
|
|
|
|
|
102
|
4
|
|
|
|
|
124
|
[ $_[0]->buckets ]; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
my ($self, %params) = @_; |
106
|
4
|
|
|
4
|
0
|
39
|
|
107
|
|
|
|
|
|
|
$self |
108
|
4
|
|
|
|
|
19
|
->bucket (name => $params{with_bucket}) |
109
|
|
|
|
|
|
|
->acl |
110
|
|
|
|
|
|
|
; |
111
|
|
|
|
|
|
|
} |
112
|
4
|
|
|
4
|
0
|
17
|
|
113
|
|
|
|
|
|
|
my ($self, %params) = @_; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
$self->create_bucket( |
116
|
4
|
|
|
|
|
20
|
name => $params{with_bucket}, |
117
|
|
|
|
|
|
|
(acl => $params{with_acl}) x!! exists $params{with_acl}, |
118
|
|
|
|
|
|
|
(acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, |
119
|
|
|
|
|
|
|
(location_constraint => $params{with_region}) x!! exists $params{with_region}, |
120
|
|
|
|
|
|
|
); |
121
|
14
|
|
|
14
|
0
|
64
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
my ($self, %params) = @_; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
$self |
126
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
127
|
|
|
|
|
|
|
->delete |
128
|
14
|
|
|
|
|
100
|
; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my ($self, %params) = @_; |
132
|
5
|
|
|
5
|
0
|
21
|
|
133
|
|
|
|
|
|
|
$self |
134
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
135
|
|
|
|
|
|
|
->list ({ |
136
|
5
|
|
|
|
|
19
|
bucket => $params{with_bucket}, |
137
|
|
|
|
|
|
|
delimiter => $params{with_delimiter}, |
138
|
|
|
|
|
|
|
max_keys => $params{with_max_keys}, |
139
|
|
|
|
|
|
|
marker => $params{with_marker}, |
140
|
|
|
|
|
|
|
prefix => $params{with_prefix}, |
141
|
7
|
|
|
7
|
0
|
33
|
}) |
142
|
|
|
|
|
|
|
; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
my ($self, %params) = @_; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
$self |
148
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
149
|
|
|
|
|
|
|
->delete_multi_object (@{ $params{with_keys} }) |
150
|
|
|
|
|
|
|
; |
151
|
|
|
|
|
|
|
} |
152
|
7
|
|
|
|
|
29
|
|
153
|
|
|
|
|
|
|
my ($self, %params) = @_; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$self |
156
|
4
|
|
|
4
|
0
|
25
|
->bucket (name => $params{with_bucket}) |
157
|
|
|
|
|
|
|
->object ( |
158
|
|
|
|
|
|
|
key => $params{with_key}, |
159
|
|
|
|
|
|
|
map +($_ => $params{"with_$_"}), |
160
|
4
|
|
|
|
|
18
|
grep exists $params{"with_$_"}, ( |
|
4
|
|
|
|
|
18
|
|
161
|
|
|
|
|
|
|
qw[ cache_control ], |
162
|
|
|
|
|
|
|
qw[ content_disposition ], |
163
|
|
|
|
|
|
|
qw[ content_encoding ], |
164
|
|
|
|
|
|
|
qw[ content_type ], |
165
|
10
|
|
|
10
|
0
|
53
|
qw[ encryption ], |
166
|
|
|
|
|
|
|
qw[ expires ], |
167
|
|
|
|
|
|
|
qw[ storage_class ], |
168
|
|
|
|
|
|
|
qw[ user_metadata ], |
169
|
|
|
|
|
|
|
qw[ acl ], |
170
|
|
|
|
|
|
|
qw[ acl_short ], |
171
|
|
|
|
|
|
|
) |
172
|
|
|
|
|
|
|
) |
173
|
|
|
|
|
|
|
->${\ (ref $params{with_value} ? 'put_filename' : 'put' ) } ( |
174
|
|
|
|
|
|
|
ref $params{with_value} ? ${ $params{with_value} } : $params{with_value} |
175
|
|
|
|
|
|
|
) |
176
|
|
|
|
|
|
|
; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
my ($self, %params) = @_; |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
$self |
182
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
183
|
|
|
|
|
|
|
->object (key => $params{with_key}) |
184
|
|
|
|
|
|
|
->delete |
185
|
10
|
50
|
|
|
|
53
|
; |
186
|
0
|
|
|
|
|
0
|
} |
187
|
|
|
|
|
|
|
|
188
|
10
|
50
|
|
|
|
52
|
my ($self, %params) = @_; |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my $object = $self |
191
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
192
|
5
|
|
|
5
|
0
|
24
|
->object (key => $params{with_key}) |
193
|
|
|
|
|
|
|
; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
$object = $object->range ($params{with_range}) |
196
|
|
|
|
|
|
|
if $params{with_range}; |
197
|
5
|
|
|
|
|
24
|
|
198
|
|
|
|
|
|
|
$object->get; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
my ($self, %params) = @_; |
202
|
6
|
|
|
6
|
0
|
26
|
|
203
|
|
|
|
|
|
|
my $method = $params{-method} // 'exists'; |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$self |
206
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
207
|
6
|
|
|
|
|
26
|
->object (key => $params{with_key}) |
208
|
|
|
|
|
|
|
->$method |
209
|
|
|
|
|
|
|
; |
210
|
6
|
100
|
|
|
|
21
|
} |
211
|
|
|
|
|
|
|
|
212
|
6
|
|
|
|
|
837
|
my ($self, %params) = @_; |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
$self |
215
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
216
|
10
|
|
|
10
|
0
|
51
|
->set_acl ( |
217
|
|
|
|
|
|
|
(acl => $params{with_acl}) x!! exists $params{with_acl}, |
218
|
10
|
|
50
|
|
|
34
|
(acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, |
219
|
|
|
|
|
|
|
(acl_xml => $params{with_acl_xml}) x!! exists $params{with_acl_xml}, |
220
|
|
|
|
|
|
|
) |
221
|
|
|
|
|
|
|
; |
222
|
|
|
|
|
|
|
} |
223
|
10
|
|
|
|
|
45
|
|
224
|
|
|
|
|
|
|
my ($self, %params) = @_; |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
$self |
227
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
228
|
8
|
|
|
8
|
0
|
40
|
->object (key => $params{with_key}) |
229
|
|
|
|
|
|
|
->set_acl ( |
230
|
|
|
|
|
|
|
(acl => $params{with_acl}) x!! exists $params{with_acl}, |
231
|
|
|
|
|
|
|
(acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, |
232
|
|
|
|
|
|
|
(acl_xml => $params{with_acl_xml}) x!! exists $params{with_acl_xml}, |
233
|
|
|
|
|
|
|
) |
234
|
|
|
|
|
|
|
; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
8
|
|
|
|
|
35
|
my ($self, %params) = @_; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
$self |
240
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
241
|
9
|
|
|
9
|
0
|
47
|
->add_tags ( |
242
|
|
|
|
|
|
|
tags => $params{with_tags}, |
243
|
|
|
|
|
|
|
) |
244
|
|
|
|
|
|
|
; |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
my ($self, %params) = @_; |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
$self |
250
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
251
|
9
|
|
|
|
|
40
|
->object (key => $params{with_key}) |
252
|
|
|
|
|
|
|
->add_tags ( |
253
|
|
|
|
|
|
|
tags => $params{with_tags}, |
254
|
|
|
|
|
|
|
(version_id => $params{with_version_id}) x!! defined $params{with_version_id}, |
255
|
4
|
|
|
4
|
0
|
19
|
) |
256
|
|
|
|
|
|
|
; |
257
|
|
|
|
|
|
|
} |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
my ($self, %params) = @_; |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
$self |
262
|
4
|
|
|
|
|
25
|
->bucket (name => $params{with_bucket}) |
263
|
|
|
|
|
|
|
->delete_tags |
264
|
|
|
|
|
|
|
; |
265
|
|
|
|
|
|
|
} |
266
|
4
|
|
|
4
|
0
|
19
|
|
267
|
|
|
|
|
|
|
my ($self, %params) = @_; |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
$self |
270
|
|
|
|
|
|
|
->bucket (name => $params{with_bucket}) |
271
|
|
|
|
|
|
|
->object (key => $params{with_key}) |
272
|
|
|
|
|
|
|
->delete_tags ( |
273
|
|
|
|
|
|
|
(version_id => $params{with_version_id}) x!! defined $params{with_version_id}, |
274
|
|
|
|
|
|
|
) |
275
|
4
|
|
|
|
|
20
|
; |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
1; |
279
|
4
|
|
|
4
|
0
|
21
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=pod |
282
|
|
|
|
|
|
|
|
283
|
4
|
|
|
|
|
26
|
=encoding UTF-8 |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head1 NAME |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Shared::Examples::Net::Amazon::S3::Client - used for testing and as example |
288
|
5
|
|
|
5
|
0
|
24
|
|
289
|
|
|
|
|
|
|
=head1 VERSION |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
version 0.991 |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head1 AUTHOR |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Branislav Zahradník <barney@cpan.org> |
296
|
5
|
|
|
|
|
29
|
|
297
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník. |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
302
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=cut |