qingstor-sdk 1.9.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -48
- data/lib/qingstor/sdk/general/config.rb +0 -17
- data/lib/qingstor/sdk/general/default/config.yaml +5 -8
- data/lib/qingstor/sdk/general/error.rb +1 -11
- data/lib/qingstor/sdk/request/preprocessor.rb +3 -44
- data/lib/qingstor/sdk/request/request.rb +17 -9
- data/lib/qingstor/sdk/request/signer.rb +15 -8
- data/lib/qingstor/sdk/service/bucket.rb +116 -234
- data/lib/qingstor/sdk/service/object.rb +246 -218
- data/lib/qingstor/sdk/service/qingstor.rb +6 -11
- data/lib/qingstor/sdk/version.rb +1 -1
- metadata +13 -27
@@ -23,19 +23,12 @@ module QingStor
|
|
23
23
|
|
24
24
|
# abort_multipart_upload: Abort multipart upload.
|
25
25
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/abort_multipart_upload.html
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
# * +:upload_id+ - Object multipart upload ID
|
30
|
-
#
|
31
|
-
def abort_multipart_upload(object_key, options = {})
|
32
|
-
options.deep_stringify_keys!
|
33
|
-
request = abort_multipart_upload_request object_key, options
|
26
|
+
def abort_multipart_upload(object_key, upload_id: '')
|
27
|
+
request = abort_multipart_upload_request object_key, upload_id: upload_id
|
34
28
|
request.send
|
35
29
|
end
|
36
30
|
|
37
|
-
def abort_multipart_upload_request(object_key,
|
38
|
-
options.deep_stringify_keys!
|
31
|
+
def abort_multipart_upload_request(object_key, upload_id: '')
|
39
32
|
properties[:'object-key'] = object_key
|
40
33
|
input = {
|
41
34
|
config: config,
|
@@ -44,13 +37,15 @@ module QingStor
|
|
44
37
|
request_method: 'DELETE',
|
45
38
|
request_uri: '/<bucket-name>/<object-key>',
|
46
39
|
request_params: {
|
47
|
-
'upload_id' =>
|
40
|
+
'upload_id' => upload_id,
|
48
41
|
},
|
49
42
|
request_headers: {
|
50
43
|
},
|
51
44
|
request_elements: {
|
52
45
|
},
|
46
|
+
|
53
47
|
request_body: nil,
|
48
|
+
|
54
49
|
status_code: [
|
55
50
|
204, # Object multipart deleted
|
56
51
|
],
|
@@ -74,24 +69,21 @@ module QingStor
|
|
74
69
|
|
75
70
|
# complete_multipart_upload: Complete multipart upload.
|
76
71
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/complete_multipart_upload.html
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
# * +:object_parts+ - Object parts
|
86
|
-
#
|
87
|
-
def complete_multipart_upload(object_key, options = {})
|
88
|
-
options.deep_stringify_keys!
|
89
|
-
request = complete_multipart_upload_request object_key, options
|
72
|
+
def complete_multipart_upload(object_key, upload_id: '', etag: '',
|
73
|
+
x_qs_encryption_customer_algorithm: '',
|
74
|
+
x_qs_encryption_customer_key: '',
|
75
|
+
x_qs_encryption_customer_key_md5: '', object_parts: [])
|
76
|
+
request = complete_multipart_upload_request object_key, upload_id: upload_id, etag: etag,
|
77
|
+
x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
|
78
|
+
x_qs_encryption_customer_key: x_qs_encryption_customer_key,
|
79
|
+
x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5, object_parts: object_parts
|
90
80
|
request.send
|
91
81
|
end
|
92
82
|
|
93
|
-
def complete_multipart_upload_request(object_key,
|
94
|
-
|
83
|
+
def complete_multipart_upload_request(object_key, upload_id: '', etag: '',
|
84
|
+
x_qs_encryption_customer_algorithm: '',
|
85
|
+
x_qs_encryption_customer_key: '',
|
86
|
+
x_qs_encryption_customer_key_md5: '', object_parts: [])
|
95
87
|
properties[:'object-key'] = object_key
|
96
88
|
input = {
|
97
89
|
config: config,
|
@@ -100,18 +92,20 @@ module QingStor
|
|
100
92
|
request_method: 'POST',
|
101
93
|
request_uri: '/<bucket-name>/<object-key>',
|
102
94
|
request_params: {
|
103
|
-
'upload_id' =>
|
95
|
+
'upload_id' => upload_id,
|
104
96
|
},
|
105
97
|
request_headers: {
|
106
|
-
'ETag' =>
|
107
|
-
'X-QS-Encryption-Customer-Algorithm' =>
|
108
|
-
'X-QS-Encryption-Customer-Key' =>
|
109
|
-
'X-QS-Encryption-Customer-Key-MD5' =>
|
98
|
+
'ETag' => etag,
|
99
|
+
'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
|
100
|
+
'X-QS-Encryption-Customer-Key' => x_qs_encryption_customer_key,
|
101
|
+
'X-QS-Encryption-Customer-Key-MD5' => x_qs_encryption_customer_key_md5,
|
110
102
|
},
|
111
103
|
request_elements: {
|
112
|
-
'object_parts' =>
|
104
|
+
'object_parts' => object_parts,
|
113
105
|
},
|
106
|
+
|
114
107
|
request_body: nil,
|
108
|
+
|
115
109
|
status_code: [
|
116
110
|
201, # Object created
|
117
111
|
],
|
@@ -141,18 +135,12 @@ module QingStor
|
|
141
135
|
|
142
136
|
# delete_object: Delete the object.
|
143
137
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/delete.html
|
144
|
-
|
145
|
-
|
146
|
-
#
|
147
|
-
#
|
148
|
-
def delete_object(object_key, options = {})
|
149
|
-
options.deep_stringify_keys!
|
150
|
-
request = delete_object_request object_key, options
|
138
|
+
def delete_object(object_key)
|
139
|
+
request = delete_object_request object_key
|
151
140
|
request.send
|
152
141
|
end
|
153
142
|
|
154
|
-
def delete_object_request(object_key
|
155
|
-
options.deep_stringify_keys!
|
143
|
+
def delete_object_request(object_key)
|
156
144
|
properties[:'object-key'] = object_key
|
157
145
|
input = {
|
158
146
|
config: config,
|
@@ -166,7 +154,9 @@ module QingStor
|
|
166
154
|
},
|
167
155
|
request_elements: {
|
168
156
|
},
|
157
|
+
|
169
158
|
request_body: nil,
|
159
|
+
|
170
160
|
status_code: [
|
171
161
|
204, # Object deleted
|
172
162
|
],
|
@@ -186,32 +176,33 @@ module QingStor
|
|
186
176
|
|
187
177
|
# get_object: Retrieve the object.
|
188
178
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/get.html
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
# * +:response_expires+ - Specified the Expires response header
|
206
|
-
#
|
207
|
-
def get_object(object_key, options = {})
|
208
|
-
options.deep_stringify_keys!
|
209
|
-
request = get_object_request object_key, options
|
179
|
+
def get_object(object_key, if_match: '',
|
180
|
+
if_modified_since: '',
|
181
|
+
if_none_match: '',
|
182
|
+
if_unmodified_since: '',
|
183
|
+
range: '',
|
184
|
+
x_qs_encryption_customer_algorithm: '',
|
185
|
+
x_qs_encryption_customer_key: '',
|
186
|
+
x_qs_encryption_customer_key_md5: '')
|
187
|
+
request = get_object_request object_key, if_match: if_match,
|
188
|
+
if_modified_since: if_modified_since,
|
189
|
+
if_none_match: if_none_match,
|
190
|
+
if_unmodified_since: if_unmodified_since,
|
191
|
+
range: range,
|
192
|
+
x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
|
193
|
+
x_qs_encryption_customer_key: x_qs_encryption_customer_key,
|
194
|
+
x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5
|
210
195
|
request.send
|
211
196
|
end
|
212
197
|
|
213
|
-
def get_object_request(object_key,
|
214
|
-
|
198
|
+
def get_object_request(object_key, if_match: '',
|
199
|
+
if_modified_since: '',
|
200
|
+
if_none_match: '',
|
201
|
+
if_unmodified_since: '',
|
202
|
+
range: '',
|
203
|
+
x_qs_encryption_customer_algorithm: '',
|
204
|
+
x_qs_encryption_customer_key: '',
|
205
|
+
x_qs_encryption_customer_key_md5: '')
|
215
206
|
properties[:'object-key'] = object_key
|
216
207
|
input = {
|
217
208
|
config: config,
|
@@ -220,26 +211,22 @@ module QingStor
|
|
220
211
|
request_method: 'GET',
|
221
212
|
request_uri: '/<bucket-name>/<object-key>',
|
222
213
|
request_params: {
|
223
|
-
'response-cache-control' => options['response_cache_control'],
|
224
|
-
'response-content-disposition' => options['response_content_disposition'],
|
225
|
-
'response-content-encoding' => options['response_content_encoding'],
|
226
|
-
'response-content-language' => options['response_content_language'],
|
227
|
-
'response-content-type' => options['response_content_type'],
|
228
|
-
'response-expires' => options['response_expires'],
|
229
214
|
},
|
230
215
|
request_headers: {
|
231
|
-
'If-Match' =>
|
232
|
-
'If-Modified-Since' =>
|
233
|
-
'If-None-Match' =>
|
234
|
-
'If-Unmodified-Since' =>
|
235
|
-
'Range' =>
|
236
|
-
'X-QS-Encryption-Customer-Algorithm' =>
|
237
|
-
'X-QS-Encryption-Customer-Key' =>
|
238
|
-
'X-QS-Encryption-Customer-Key-MD5' =>
|
216
|
+
'If-Match' => if_match,
|
217
|
+
'If-Modified-Since' => if_modified_since,
|
218
|
+
'If-None-Match' => if_none_match,
|
219
|
+
'If-Unmodified-Since' => if_unmodified_since,
|
220
|
+
'Range' => range,
|
221
|
+
'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
|
222
|
+
'X-QS-Encryption-Customer-Key' => x_qs_encryption_customer_key,
|
223
|
+
'X-QS-Encryption-Customer-Key-MD5' => x_qs_encryption_customer_key_md5,
|
239
224
|
},
|
240
225
|
request_elements: {
|
241
226
|
},
|
227
|
+
|
242
228
|
request_body: nil,
|
229
|
+
|
243
230
|
status_code: [
|
244
231
|
200, # OK
|
245
232
|
206, # Partial content
|
@@ -262,25 +249,30 @@ module QingStor
|
|
262
249
|
|
263
250
|
# head_object: Check whether the object exists and available.
|
264
251
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/head.html
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
252
|
+
def head_object(object_key, if_match: '',
|
253
|
+
if_modified_since: '',
|
254
|
+
if_none_match: '',
|
255
|
+
if_unmodified_since: '',
|
256
|
+
x_qs_encryption_customer_algorithm: '',
|
257
|
+
x_qs_encryption_customer_key: '',
|
258
|
+
x_qs_encryption_customer_key_md5: '')
|
259
|
+
request = head_object_request object_key, if_match: if_match,
|
260
|
+
if_modified_since: if_modified_since,
|
261
|
+
if_none_match: if_none_match,
|
262
|
+
if_unmodified_since: if_unmodified_since,
|
263
|
+
x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
|
264
|
+
x_qs_encryption_customer_key: x_qs_encryption_customer_key,
|
265
|
+
x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5
|
279
266
|
request.send
|
280
267
|
end
|
281
268
|
|
282
|
-
def head_object_request(object_key,
|
283
|
-
|
269
|
+
def head_object_request(object_key, if_match: '',
|
270
|
+
if_modified_since: '',
|
271
|
+
if_none_match: '',
|
272
|
+
if_unmodified_since: '',
|
273
|
+
x_qs_encryption_customer_algorithm: '',
|
274
|
+
x_qs_encryption_customer_key: '',
|
275
|
+
x_qs_encryption_customer_key_md5: '')
|
284
276
|
properties[:'object-key'] = object_key
|
285
277
|
input = {
|
286
278
|
config: config,
|
@@ -291,17 +283,19 @@ module QingStor
|
|
291
283
|
request_params: {
|
292
284
|
},
|
293
285
|
request_headers: {
|
294
|
-
'If-Match' =>
|
295
|
-
'If-Modified-Since' =>
|
296
|
-
'If-None-Match' =>
|
297
|
-
'If-Unmodified-Since' =>
|
298
|
-
'X-QS-Encryption-Customer-Algorithm' =>
|
299
|
-
'X-QS-Encryption-Customer-Key' =>
|
300
|
-
'X-QS-Encryption-Customer-Key-MD5' =>
|
286
|
+
'If-Match' => if_match,
|
287
|
+
'If-Modified-Since' => if_modified_since,
|
288
|
+
'If-None-Match' => if_none_match,
|
289
|
+
'If-Unmodified-Since' => if_unmodified_since,
|
290
|
+
'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
|
291
|
+
'X-QS-Encryption-Customer-Key' => x_qs_encryption_customer_key,
|
292
|
+
'X-QS-Encryption-Customer-Key-MD5' => x_qs_encryption_customer_key_md5,
|
301
293
|
},
|
302
294
|
request_elements: {
|
303
295
|
},
|
296
|
+
|
304
297
|
request_body: nil,
|
298
|
+
|
305
299
|
status_code: [
|
306
300
|
200, # OK
|
307
301
|
],
|
@@ -321,22 +315,21 @@ module QingStor
|
|
321
315
|
|
322
316
|
# initiate_multipart_upload: Initial multipart upload on the object.
|
323
317
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/initiate_multipart_upload.html
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
def initiate_multipart_upload(object_key, options = {})
|
333
|
-
options.deep_stringify_keys!
|
334
|
-
request = initiate_multipart_upload_request object_key, options
|
318
|
+
def initiate_multipart_upload(object_key, content_type: '',
|
319
|
+
x_qs_encryption_customer_algorithm: '',
|
320
|
+
x_qs_encryption_customer_key: '',
|
321
|
+
x_qs_encryption_customer_key_md5: '')
|
322
|
+
request = initiate_multipart_upload_request object_key, content_type: content_type,
|
323
|
+
x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
|
324
|
+
x_qs_encryption_customer_key: x_qs_encryption_customer_key,
|
325
|
+
x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5
|
335
326
|
request.send
|
336
327
|
end
|
337
328
|
|
338
|
-
def initiate_multipart_upload_request(object_key,
|
339
|
-
|
329
|
+
def initiate_multipart_upload_request(object_key, content_type: '',
|
330
|
+
x_qs_encryption_customer_algorithm: '',
|
331
|
+
x_qs_encryption_customer_key: '',
|
332
|
+
x_qs_encryption_customer_key_md5: '')
|
340
333
|
properties[:'object-key'] = object_key
|
341
334
|
input = {
|
342
335
|
config: config,
|
@@ -347,14 +340,16 @@ module QingStor
|
|
347
340
|
request_params: {
|
348
341
|
},
|
349
342
|
request_headers: {
|
350
|
-
'Content-Type' =>
|
351
|
-
'X-QS-Encryption-Customer-Algorithm' =>
|
352
|
-
'X-QS-Encryption-Customer-Key' =>
|
353
|
-
'X-QS-Encryption-Customer-Key-MD5' =>
|
343
|
+
'Content-Type' => content_type,
|
344
|
+
'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
|
345
|
+
'X-QS-Encryption-Customer-Key' => x_qs_encryption_customer_key,
|
346
|
+
'X-QS-Encryption-Customer-Key-MD5' => x_qs_encryption_customer_key_md5,
|
354
347
|
},
|
355
348
|
request_elements: {
|
356
349
|
},
|
350
|
+
|
357
351
|
request_body: nil,
|
352
|
+
|
358
353
|
status_code: [
|
359
354
|
200, # OK
|
360
355
|
],
|
@@ -374,21 +369,18 @@ module QingStor
|
|
374
369
|
|
375
370
|
# list_multipart: List object parts.
|
376
371
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/list_multipart.html
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
#
|
384
|
-
def list_multipart(object_key, options = {})
|
385
|
-
options.deep_stringify_keys!
|
386
|
-
request = list_multipart_request object_key, options
|
372
|
+
def list_multipart(object_key, limit: nil,
|
373
|
+
part_number_marker: nil,
|
374
|
+
upload_id: '')
|
375
|
+
request = list_multipart_request object_key, limit: limit,
|
376
|
+
part_number_marker: part_number_marker,
|
377
|
+
upload_id: upload_id
|
387
378
|
request.send
|
388
379
|
end
|
389
380
|
|
390
|
-
def list_multipart_request(object_key,
|
391
|
-
|
381
|
+
def list_multipart_request(object_key, limit: nil,
|
382
|
+
part_number_marker: nil,
|
383
|
+
upload_id: '')
|
392
384
|
properties[:'object-key'] = object_key
|
393
385
|
input = {
|
394
386
|
config: config,
|
@@ -397,15 +389,17 @@ module QingStor
|
|
397
389
|
request_method: 'GET',
|
398
390
|
request_uri: '/<bucket-name>/<object-key>',
|
399
391
|
request_params: {
|
400
|
-
'limit' =>
|
401
|
-
'part_number_marker' =>
|
402
|
-
'upload_id' =>
|
392
|
+
'limit' => limit,
|
393
|
+
'part_number_marker' => part_number_marker,
|
394
|
+
'upload_id' => upload_id,
|
403
395
|
},
|
404
396
|
request_headers: {
|
405
397
|
},
|
406
398
|
request_elements: {
|
407
399
|
},
|
400
|
+
|
408
401
|
request_body: nil,
|
402
|
+
|
409
403
|
status_code: [
|
410
404
|
200, # OK
|
411
405
|
],
|
@@ -429,21 +423,18 @@ module QingStor
|
|
429
423
|
|
430
424
|
# options_object: Check whether the object accepts a origin with method and header.
|
431
425
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/options.html
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
#
|
439
|
-
def options_object(object_key, options = {})
|
440
|
-
options.deep_stringify_keys!
|
441
|
-
request = options_object_request object_key, options
|
426
|
+
def options_object(object_key, access_control_request_headers: '',
|
427
|
+
access_control_request_method: '',
|
428
|
+
origin: '')
|
429
|
+
request = options_object_request object_key, access_control_request_headers: access_control_request_headers,
|
430
|
+
access_control_request_method: access_control_request_method,
|
431
|
+
origin: origin
|
442
432
|
request.send
|
443
433
|
end
|
444
434
|
|
445
|
-
def options_object_request(object_key,
|
446
|
-
|
435
|
+
def options_object_request(object_key, access_control_request_headers: '',
|
436
|
+
access_control_request_method: '',
|
437
|
+
origin: '')
|
447
438
|
properties[:'object-key'] = object_key
|
448
439
|
input = {
|
449
440
|
config: config,
|
@@ -454,13 +445,15 @@ module QingStor
|
|
454
445
|
request_params: {
|
455
446
|
},
|
456
447
|
request_headers: {
|
457
|
-
'Access-Control-Request-Headers' =>
|
458
|
-
'Access-Control-Request-Method' =>
|
459
|
-
'Origin' =>
|
448
|
+
'Access-Control-Request-Headers' => access_control_request_headers,
|
449
|
+
'Access-Control-Request-Method' => access_control_request_method,
|
450
|
+
'Origin' => origin,
|
460
451
|
},
|
461
452
|
request_elements: {
|
462
453
|
},
|
454
|
+
|
463
455
|
request_body: nil,
|
456
|
+
|
464
457
|
status_code: [
|
465
458
|
200, # OK
|
466
459
|
],
|
@@ -488,36 +481,63 @@ module QingStor
|
|
488
481
|
|
489
482
|
# put_object: Upload the object.
|
490
483
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/put.html
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
484
|
+
def put_object(object_key, content_length: nil,
|
485
|
+
content_md5: '',
|
486
|
+
content_type: '',
|
487
|
+
expect: '',
|
488
|
+
x_qs_copy_source: '',
|
489
|
+
x_qs_copy_source_encryption_customer_algorithm: '',
|
490
|
+
x_qs_copy_source_encryption_customer_key: '',
|
491
|
+
x_qs_copy_source_encryption_customer_key_md5: '',
|
492
|
+
x_qs_copy_source_if_match: '',
|
493
|
+
x_qs_copy_source_if_modified_since: '',
|
494
|
+
x_qs_copy_source_if_none_match: '',
|
495
|
+
x_qs_copy_source_if_unmodified_since: '',
|
496
|
+
x_qs_encryption_customer_algorithm: '',
|
497
|
+
x_qs_encryption_customer_key: '',
|
498
|
+
x_qs_encryption_customer_key_md5: '',
|
499
|
+
x_qs_fetch_source: '',
|
500
|
+
x_qs_move_source: '',
|
501
|
+
body: nil)
|
502
|
+
request = put_object_request object_key, content_length: content_length,
|
503
|
+
content_md5: content_md5,
|
504
|
+
content_type: content_type,
|
505
|
+
expect: expect,
|
506
|
+
x_qs_copy_source: x_qs_copy_source,
|
507
|
+
x_qs_copy_source_encryption_customer_algorithm: x_qs_copy_source_encryption_customer_algorithm,
|
508
|
+
x_qs_copy_source_encryption_customer_key: x_qs_copy_source_encryption_customer_key,
|
509
|
+
x_qs_copy_source_encryption_customer_key_md5: x_qs_copy_source_encryption_customer_key_md5,
|
510
|
+
x_qs_copy_source_if_match: x_qs_copy_source_if_match,
|
511
|
+
x_qs_copy_source_if_modified_since: x_qs_copy_source_if_modified_since,
|
512
|
+
x_qs_copy_source_if_none_match: x_qs_copy_source_if_none_match,
|
513
|
+
x_qs_copy_source_if_unmodified_since: x_qs_copy_source_if_unmodified_since,
|
514
|
+
x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
|
515
|
+
x_qs_encryption_customer_key: x_qs_encryption_customer_key,
|
516
|
+
x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5,
|
517
|
+
x_qs_fetch_source: x_qs_fetch_source,
|
518
|
+
x_qs_move_source: x_qs_move_source,
|
519
|
+
body: body
|
516
520
|
request.send
|
517
521
|
end
|
518
522
|
|
519
|
-
def put_object_request(object_key,
|
520
|
-
|
523
|
+
def put_object_request(object_key, content_length: nil,
|
524
|
+
content_md5: '',
|
525
|
+
content_type: '',
|
526
|
+
expect: '',
|
527
|
+
x_qs_copy_source: '',
|
528
|
+
x_qs_copy_source_encryption_customer_algorithm: '',
|
529
|
+
x_qs_copy_source_encryption_customer_key: '',
|
530
|
+
x_qs_copy_source_encryption_customer_key_md5: '',
|
531
|
+
x_qs_copy_source_if_match: '',
|
532
|
+
x_qs_copy_source_if_modified_since: '',
|
533
|
+
x_qs_copy_source_if_none_match: '',
|
534
|
+
x_qs_copy_source_if_unmodified_since: '',
|
535
|
+
x_qs_encryption_customer_algorithm: '',
|
536
|
+
x_qs_encryption_customer_key: '',
|
537
|
+
x_qs_encryption_customer_key_md5: '',
|
538
|
+
x_qs_fetch_source: '',
|
539
|
+
x_qs_move_source: '',
|
540
|
+
body: nil)
|
521
541
|
properties[:'object-key'] = object_key
|
522
542
|
input = {
|
523
543
|
config: config,
|
@@ -528,28 +548,29 @@ module QingStor
|
|
528
548
|
request_params: {
|
529
549
|
},
|
530
550
|
request_headers: {
|
531
|
-
'Content-Length' =>
|
532
|
-
'Content-MD5' =>
|
533
|
-
'Content-Type' =>
|
534
|
-
'Expect' =>
|
535
|
-
'X-QS-Copy-Source' =>
|
536
|
-
'X-QS-Copy-Source-Encryption-Customer-Algorithm' =>
|
537
|
-
'X-QS-Copy-Source-Encryption-Customer-Key' =>
|
538
|
-
'X-QS-Copy-Source-Encryption-Customer-Key-MD5' =>
|
539
|
-
'X-QS-Copy-Source-If-Match' =>
|
540
|
-
'X-QS-Copy-Source-If-Modified-Since' =>
|
541
|
-
'X-QS-Copy-Source-If-None-Match' =>
|
542
|
-
'X-QS-Copy-Source-If-Unmodified-Since' =>
|
543
|
-
'X-QS-Encryption-Customer-Algorithm' =>
|
544
|
-
'X-QS-Encryption-Customer-Key' =>
|
545
|
-
'X-QS-Encryption-Customer-Key-MD5' =>
|
546
|
-
'X-QS-Fetch-
|
547
|
-
'X-QS-
|
548
|
-
'X-QS-Move-Source' => options['x_qs_move_source'],
|
551
|
+
'Content-Length' => content_length,
|
552
|
+
'Content-MD5' => content_md5,
|
553
|
+
'Content-Type' => content_type,
|
554
|
+
'Expect' => expect,
|
555
|
+
'X-QS-Copy-Source' => x_qs_copy_source,
|
556
|
+
'X-QS-Copy-Source-Encryption-Customer-Algorithm' => x_qs_copy_source_encryption_customer_algorithm,
|
557
|
+
'X-QS-Copy-Source-Encryption-Customer-Key' => x_qs_copy_source_encryption_customer_key,
|
558
|
+
'X-QS-Copy-Source-Encryption-Customer-Key-MD5' => x_qs_copy_source_encryption_customer_key_md5,
|
559
|
+
'X-QS-Copy-Source-If-Match' => x_qs_copy_source_if_match,
|
560
|
+
'X-QS-Copy-Source-If-Modified-Since' => x_qs_copy_source_if_modified_since,
|
561
|
+
'X-QS-Copy-Source-If-None-Match' => x_qs_copy_source_if_none_match,
|
562
|
+
'X-QS-Copy-Source-If-Unmodified-Since' => x_qs_copy_source_if_unmodified_since,
|
563
|
+
'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
|
564
|
+
'X-QS-Encryption-Customer-Key' => x_qs_encryption_customer_key,
|
565
|
+
'X-QS-Encryption-Customer-Key-MD5' => x_qs_encryption_customer_key_md5,
|
566
|
+
'X-QS-Fetch-Source' => x_qs_fetch_source,
|
567
|
+
'X-QS-Move-Source' => x_qs_move_source,
|
549
568
|
},
|
550
569
|
request_elements: {
|
551
570
|
},
|
552
|
-
|
571
|
+
|
572
|
+
request_body: body,
|
573
|
+
|
553
574
|
status_code: [
|
554
575
|
201, # Object created
|
555
576
|
],
|
@@ -569,25 +590,30 @@ module QingStor
|
|
569
590
|
|
570
591
|
# upload_multipart: Upload object multipart.
|
571
592
|
# Documentation URL: https://docs.qingcloud.com/qingstor/api/object/multipart/upload_multipart.html
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
593
|
+
def upload_multipart(object_key, part_number: nil,
|
594
|
+
upload_id: '', content_length: nil,
|
595
|
+
content_md5: '',
|
596
|
+
x_qs_encryption_customer_algorithm: '',
|
597
|
+
x_qs_encryption_customer_key: '',
|
598
|
+
x_qs_encryption_customer_key_md5: '',
|
599
|
+
body: nil)
|
600
|
+
request = upload_multipart_request object_key, part_number: part_number,
|
601
|
+
upload_id: upload_id, content_length: content_length,
|
602
|
+
content_md5: content_md5,
|
603
|
+
x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
|
604
|
+
x_qs_encryption_customer_key: x_qs_encryption_customer_key,
|
605
|
+
x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5,
|
606
|
+
body: body
|
586
607
|
request.send
|
587
608
|
end
|
588
609
|
|
589
|
-
def upload_multipart_request(object_key,
|
590
|
-
|
610
|
+
def upload_multipart_request(object_key, part_number: nil,
|
611
|
+
upload_id: '', content_length: nil,
|
612
|
+
content_md5: '',
|
613
|
+
x_qs_encryption_customer_algorithm: '',
|
614
|
+
x_qs_encryption_customer_key: '',
|
615
|
+
x_qs_encryption_customer_key_md5: '',
|
616
|
+
body: nil)
|
591
617
|
properties[:'object-key'] = object_key
|
592
618
|
input = {
|
593
619
|
config: config,
|
@@ -596,19 +622,21 @@ module QingStor
|
|
596
622
|
request_method: 'PUT',
|
597
623
|
request_uri: '/<bucket-name>/<object-key>',
|
598
624
|
request_params: {
|
599
|
-
'part_number' =>
|
600
|
-
'upload_id' =>
|
625
|
+
'part_number' => part_number,
|
626
|
+
'upload_id' => upload_id,
|
601
627
|
},
|
602
628
|
request_headers: {
|
603
|
-
'Content-Length' =>
|
604
|
-
'Content-MD5' =>
|
605
|
-
'X-QS-Encryption-Customer-Algorithm' =>
|
606
|
-
'X-QS-Encryption-Customer-Key' =>
|
607
|
-
'X-QS-Encryption-Customer-Key-MD5' =>
|
629
|
+
'Content-Length' => content_length,
|
630
|
+
'Content-MD5' => content_md5,
|
631
|
+
'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
|
632
|
+
'X-QS-Encryption-Customer-Key' => x_qs_encryption_customer_key,
|
633
|
+
'X-QS-Encryption-Customer-Key-MD5' => x_qs_encryption_customer_key_md5,
|
608
634
|
},
|
609
635
|
request_elements: {
|
610
636
|
},
|
611
|
-
|
637
|
+
|
638
|
+
request_body: body,
|
639
|
+
|
612
640
|
status_code: [
|
613
641
|
201, # Object multipart created
|
614
642
|
],
|