line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: used for testing and as example |
2
|
|
|
|
|
|
|
$Shared::Examples::Net::Amazon::S3::API::VERSION = '0.991'; |
3
|
|
|
|
|
|
|
use strict; |
4
|
90
|
|
|
90
|
|
94770
|
use warnings; |
|
90
|
|
|
|
|
217
|
|
|
90
|
|
|
|
|
2602
|
|
5
|
90
|
|
|
90
|
|
480
|
|
|
90
|
|
|
|
|
208
|
|
|
90
|
|
|
|
|
2630
|
|
6
|
|
|
|
|
|
|
use parent qw[ Exporter::Tiny ]; |
7
|
90
|
|
|
90
|
|
465
|
|
|
90
|
|
|
|
|
187
|
|
|
90
|
|
|
|
|
649
|
|
8
|
|
|
|
|
|
|
use Hash::Util; |
9
|
90
|
|
|
90
|
|
8535
|
use Test::Deep; |
|
90
|
|
|
|
|
2955
|
|
|
90
|
|
|
|
|
656
|
|
10
|
90
|
|
|
90
|
|
3910
|
use Test::More; |
|
90
|
|
|
|
|
191
|
|
|
90
|
|
|
|
|
744
|
|
11
|
90
|
|
|
90
|
|
24256
|
|
|
90
|
|
|
|
|
241
|
|
|
90
|
|
|
|
|
927
|
|
12
|
|
|
|
|
|
|
use Net::Amazon::S3; |
13
|
90
|
|
|
90
|
|
25143
|
use Shared::Examples::Net::Amazon::S3; |
|
90
|
|
|
|
|
250
|
|
|
90
|
|
|
|
|
2035
|
|
14
|
90
|
|
|
90
|
|
998
|
|
|
90
|
|
|
|
|
228
|
|
|
90
|
|
|
|
|
1030
|
|
15
|
|
|
|
|
|
|
our @EXPORT_OK = ( |
16
|
|
|
|
|
|
|
qw[ expect_signed_uri ], |
17
|
|
|
|
|
|
|
qw[ expect_api_list_all_my_buckets ], |
18
|
|
|
|
|
|
|
qw[ expect_api_bucket_acl_get ], |
19
|
|
|
|
|
|
|
qw[ expect_api_bucket_acl_set ], |
20
|
|
|
|
|
|
|
qw[ expect_api_bucket_create ], |
21
|
|
|
|
|
|
|
qw[ expect_api_bucket_delete ], |
22
|
|
|
|
|
|
|
qw[ expect_api_bucket_objects_delete ], |
23
|
|
|
|
|
|
|
qw[ expect_api_bucket_objects_list ], |
24
|
|
|
|
|
|
|
qw[ expect_api_bucket_tags_add ], |
25
|
|
|
|
|
|
|
qw[ expect_api_bucket_tags_delete ], |
26
|
|
|
|
|
|
|
qw[ expect_api_object_acl_get ], |
27
|
|
|
|
|
|
|
qw[ expect_api_object_acl_set ], |
28
|
|
|
|
|
|
|
qw[ expect_api_object_create ], |
29
|
|
|
|
|
|
|
qw[ expect_api_object_delete ], |
30
|
|
|
|
|
|
|
qw[ expect_api_object_fetch ], |
31
|
|
|
|
|
|
|
qw[ expect_api_object_head ], |
32
|
|
|
|
|
|
|
qw[ expect_api_object_tags_add ], |
33
|
|
|
|
|
|
|
qw[ expect_api_object_tags_delete ], |
34
|
|
|
|
|
|
|
qw[ with_fixture ], |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
*with_fixture = *Shared::Examples::Net::Amazon::S3::with_fixture; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my ($self, $name, $args, $globals) = @_; |
40
|
|
|
|
|
|
|
|
41
|
20
|
|
|
20
|
|
16742
|
my $s3_operation = $name; |
42
|
|
|
|
|
|
|
$s3_operation =~ s/_api_/_operation_/; |
43
|
20
|
|
|
|
|
45
|
|
44
|
20
|
|
|
|
|
89
|
return +( $name => eval <<"GEN_SUB" ); |
45
|
|
|
|
|
|
|
sub { |
46
|
20
|
|
|
107
|
|
1477
|
push \@_, -shared_examples => __PACKAGE__; |
|
107
|
|
|
|
|
58976
|
|
|
107
|
|
|
|
|
2123
|
|
47
|
|
|
|
|
|
|
goto \\& Shared::Examples::Net::Amazon::S3::$s3_operation; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
GEN_SUB |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my ($self, $params) = @_; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$params->{with_s3} ||= Shared::Examples::Net::Amazon::S3::s3_api_with_signature_2 (); |
55
|
187
|
|
|
187
|
|
104262
|
} |
56
|
|
|
|
|
|
|
|
57
|
187
|
|
66
|
|
|
953
|
my (undef, $api, %params) = @_; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Shared::Examples::Net::Amazon::S3->s3_api_mock_http_response ( |
60
|
|
|
|
|
|
|
$api, |
61
|
107
|
|
|
107
|
|
565
|
%params, |
62
|
|
|
|
|
|
|
) |
63
|
107
|
|
|
|
|
732
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my ($title, %params) = @_; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Hash::Util::lock_keys %params, |
70
|
4
|
|
|
4
|
0
|
19
|
qw[ with_s3 ], |
71
|
|
|
|
|
|
|
qw[ with_bucket ], |
72
|
4
|
|
|
|
|
11
|
qw[ with_region ], |
73
|
|
|
|
|
|
|
qw[ with_key ], |
74
|
4
|
|
|
|
|
20
|
qw[ with_expire_at ], |
75
|
|
|
|
|
|
|
qw[ with_method ], |
76
|
|
|
|
|
|
|
qw[ expect_uri ], |
77
|
|
|
|
|
|
|
; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $got = Net::Amazon::S3::Bucket |
80
|
|
|
|
|
|
|
->new ({ |
81
|
|
|
|
|
|
|
account => $params{with_s3}, |
82
|
|
|
|
|
|
|
bucket => $params{with_bucket}, |
83
|
|
|
|
|
|
|
region => $params{with_region}, |
84
|
|
|
|
|
|
|
}) |
85
|
|
|
|
|
|
|
->query_string_authentication_uri ( |
86
|
|
|
|
|
|
|
$params{with_key}, |
87
|
|
|
|
|
|
|
$params{with_expire_at}, |
88
|
|
|
|
|
|
|
(method => $params{with_method}) x!! exists $params{with_method}, |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
cmp_deeply $got, $params{expect_uri}, $title; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
4
|
|
|
|
|
411
|
my ($self, %params) = @_; |
95
|
|
|
|
|
|
|
|
96
|
4
|
|
|
|
|
115
|
$self->buckets; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my ($self, %params) = @_; |
100
|
4
|
|
|
4
|
0
|
18
|
|
101
|
|
|
|
|
|
|
$self |
102
|
4
|
|
|
|
|
20
|
->bucket ($params{with_bucket}) |
103
|
|
|
|
|
|
|
->get_acl |
104
|
|
|
|
|
|
|
; |
105
|
|
|
|
|
|
|
} |
106
|
4
|
|
|
4
|
0
|
23
|
|
107
|
|
|
|
|
|
|
my ($self, %params) = @_; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$self |
110
|
4
|
|
|
|
|
28
|
->bucket ($params{with_bucket}) |
111
|
|
|
|
|
|
|
->set_acl ({ |
112
|
|
|
|
|
|
|
(acl => $params{with_acl}) x!! exists $params{with_acl}, |
113
|
|
|
|
|
|
|
(acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, |
114
|
|
|
|
|
|
|
(acl_xml => $params{with_acl_xml}) x!! exists $params{with_acl_xml}, |
115
|
9
|
|
|
9
|
0
|
40
|
}) |
116
|
|
|
|
|
|
|
; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my ($self, %params) = @_; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$self |
122
|
|
|
|
|
|
|
->add_bucket ({ |
123
|
|
|
|
|
|
|
bucket => $params{with_bucket}, |
124
|
9
|
|
|
|
|
44
|
(acl => $params{with_acl}) x!! exists $params{with_acl}, |
125
|
|
|
|
|
|
|
(acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, |
126
|
|
|
|
|
|
|
(location_constraint => $params{with_region}) x!! exists $params{with_region}, |
127
|
|
|
|
|
|
|
(region => $params{with_region}) x!! exists $params{with_region}, |
128
|
15
|
|
|
15
|
0
|
64
|
}) |
129
|
|
|
|
|
|
|
; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my ($self, %params) = @_; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$self |
135
|
|
|
|
|
|
|
->delete_bucket ({ |
136
|
|
|
|
|
|
|
bucket => $params{with_bucket}, |
137
|
|
|
|
|
|
|
}) |
138
|
15
|
|
|
|
|
122
|
; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
my ($self, %params) = @_; |
142
|
5
|
|
|
5
|
0
|
23
|
|
143
|
|
|
|
|
|
|
$self |
144
|
|
|
|
|
|
|
->list_bucket ({ |
145
|
|
|
|
|
|
|
bucket => $params{with_bucket}, |
146
|
|
|
|
|
|
|
delimiter => $params{with_delimiter}, |
147
|
|
|
|
|
|
|
max_keys => $params{with_max_keys}, |
148
|
5
|
|
|
|
|
27
|
marker => $params{with_marker}, |
149
|
|
|
|
|
|
|
prefix => $params{with_prefix}, |
150
|
|
|
|
|
|
|
}) |
151
|
|
|
|
|
|
|
; |
152
|
8
|
|
|
8
|
0
|
40
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
my ($self, %params) = @_; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
$self |
157
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
158
|
|
|
|
|
|
|
->delete_multi_object (@{ $params{with_keys} }) |
159
|
|
|
|
|
|
|
; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
8
|
|
|
|
|
62
|
my ($self, %params) = @_; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
$self |
165
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
166
|
4
|
|
|
4
|
0
|
20
|
->get_acl ($params{with_key}) |
167
|
|
|
|
|
|
|
; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
4
|
|
|
|
|
20
|
my ($self, %params) = @_; |
|
4
|
|
|
|
|
21
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
$self |
173
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
174
|
|
|
|
|
|
|
->set_acl ({ |
175
|
5
|
|
|
5
|
0
|
20
|
key => $params{with_key}, |
176
|
|
|
|
|
|
|
(acl => $params{with_acl}) x!! exists $params{with_acl}, |
177
|
|
|
|
|
|
|
(acl_short => $params{with_acl_short}) x!! exists $params{with_acl_short}, |
178
|
|
|
|
|
|
|
(acl_xml => $params{with_acl_xml}) x!! exists $params{with_acl_xml}, |
179
|
|
|
|
|
|
|
}) |
180
|
5
|
|
|
|
|
20
|
; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
my ($self, %params) = @_; |
184
|
9
|
|
|
9
|
0
|
56
|
|
185
|
|
|
|
|
|
|
my $headers = { %{ $params{with_headers} || {} } }; |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
$headers->{$_} = $params{"with_$_"} |
188
|
|
|
|
|
|
|
for grep exists $params{"with_$_"}, |
189
|
|
|
|
|
|
|
qw[ cache_control ], |
190
|
|
|
|
|
|
|
qw[ content_disposition ], |
191
|
|
|
|
|
|
|
qw[ content_encoding ], |
192
|
|
|
|
|
|
|
qw[ content_type ], |
193
|
|
|
|
|
|
|
qw[ encryption ], |
194
|
9
|
|
|
|
|
64
|
qw[ expires ], |
195
|
|
|
|
|
|
|
qw[ acl_short ], |
196
|
|
|
|
|
|
|
qw[ acl ], |
197
|
|
|
|
|
|
|
; |
198
|
10
|
|
|
10
|
0
|
45
|
|
199
|
|
|
|
|
|
|
$headers->{x_amz_storage_class} = $params{with_storage_class} |
200
|
10
|
50
|
|
|
|
21
|
if $params{with_storage_class}; |
|
10
|
|
|
|
|
47
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
$headers->{"x_amz_meta_\L$_"} = $params{with_user_metadata}{$_} |
203
|
10
|
|
|
|
|
77
|
for keys %{ $params{with_user_metadata} || {} }; |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$self |
206
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
207
|
|
|
|
|
|
|
->add_key ( |
208
|
|
|
|
|
|
|
$params{with_key}, |
209
|
|
|
|
|
|
|
$params{with_value}, |
210
|
|
|
|
|
|
|
$headers, |
211
|
|
|
|
|
|
|
) |
212
|
|
|
|
|
|
|
; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
10
|
100
|
|
|
|
26
|
my ($self, %params) = @_; |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
$self |
218
|
10
|
100
|
|
|
|
16
|
->bucket ($params{with_bucket}) |
|
10
|
|
|
|
|
39
|
|
219
|
|
|
|
|
|
|
->delete_key ($params{with_key}) |
220
|
|
|
|
|
|
|
; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
my ($self, %params) = @_; |
224
|
|
|
|
|
|
|
|
225
|
10
|
|
|
|
|
43
|
$self |
226
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
227
|
|
|
|
|
|
|
->get_key ( |
228
|
|
|
|
|
|
|
$params{with_key}, |
229
|
|
|
|
|
|
|
'GET', |
230
|
|
|
|
|
|
|
({ range => $params{with_range} }) x exists $params{with_range}, |
231
|
5
|
|
|
5
|
0
|
19
|
) |
232
|
|
|
|
|
|
|
; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
my ($self, %params) = @_; |
236
|
5
|
|
|
|
|
20
|
|
237
|
|
|
|
|
|
|
$self |
238
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
239
|
|
|
|
|
|
|
->head_key ($params{with_key}) |
240
|
7
|
|
|
7
|
0
|
28
|
; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
my ($self, %params) = @_; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
$self |
246
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
247
|
|
|
|
|
|
|
->add_tags ({ |
248
|
|
|
|
|
|
|
tags => $params{with_tags}, |
249
|
7
|
|
|
|
|
25
|
}) |
250
|
|
|
|
|
|
|
; |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
5
|
|
|
5
|
0
|
23
|
my ($self, %params) = @_; |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
$self |
256
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
257
|
|
|
|
|
|
|
->add_tags ({ |
258
|
5
|
|
|
|
|
28
|
key => $params{with_key}, |
259
|
|
|
|
|
|
|
tags => $params{with_tags}, |
260
|
|
|
|
|
|
|
(version_id => $params{with_version_id}) x!! defined $params{with_version_id}, |
261
|
|
|
|
|
|
|
}) |
262
|
4
|
|
|
4
|
0
|
23
|
; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
my ($self, %params) = @_; |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
$self |
268
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
269
|
4
|
|
|
|
|
21
|
->delete_tags |
270
|
|
|
|
|
|
|
; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
4
|
|
|
4
|
0
|
20
|
my ($self, %params) = @_; |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
$self |
276
|
|
|
|
|
|
|
->bucket ($params{with_bucket}) |
277
|
|
|
|
|
|
|
->delete_tags ({ |
278
|
|
|
|
|
|
|
key => $params{with_key}, |
279
|
|
|
|
|
|
|
(version_id => $params{with_version_id}) x!! defined $params{with_version_id}, |
280
|
|
|
|
|
|
|
}) |
281
|
|
|
|
|
|
|
; |
282
|
4
|
|
|
|
|
21
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
1; |
285
|
|
|
|
|
|
|
|
286
|
4
|
|
|
4
|
0
|
18
|
|
287
|
|
|
|
|
|
|
=pod |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=encoding UTF-8 |
290
|
4
|
|
|
|
|
19
|
|
291
|
|
|
|
|
|
|
=head1 NAME |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Shared::Examples::Net::Amazon::S3::API - used for testing and as example |
294
|
|
|
|
|
|
|
|
295
|
5
|
|
|
5
|
0
|
21
|
=head1 VERSION |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
version 0.991 |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head1 AUTHOR |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
Branislav Zahradník <barney@cpan.org> |
302
|
|
|
|
|
|
|
|
303
|
5
|
|
|
|
|
20
|
=head1 COPYRIGHT AND LICENSE |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník. |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
308
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=cut |