Class: QingStor::SDK::Bucket

Inherits:
Object
  • Object
show all
Defined in:
lib/qingstor/sdk/service/bucket.rb,
lib/qingstor/sdk/service/object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, properties) ⇒ Bucket



24
25
26
27
# File 'lib/qingstor/sdk/service/bucket.rb', line 24

def initialize(config, properties)
  self.config     = config
  self.properties = properties.deep_symbolize_keys
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



22
23
24
# File 'lib/qingstor/sdk/service/bucket.rb', line 22

def config
  @config
end

#propertiesObject

Returns the value of attribute properties.



22
23
24
# File 'lib/qingstor/sdk/service/bucket.rb', line 22

def properties
  @properties
end

Instance Method Details

#abort_multipart_upload(object_key, options = {}) ⇒ Object

abort_multipart_upload: Abort multipart upload. Documentation URL: docs.qingcloud.com/qingstor/api/object/abort_multipart_upload.html

Options

  • :upload_id - Object multipart upload ID



31
32
33
34
35
# File 'lib/qingstor/sdk/service/object.rb', line 31

def abort_multipart_upload(object_key, options = {})
  options.deep_stringify_keys!
  request = abort_multipart_upload_request object_key, options
  request.send
end

#abort_multipart_upload_request(object_key, options = {}) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/qingstor/sdk/service/object.rb', line 37

def abort_multipart_upload_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'Abort Multipart Upload',
    request_method:   'DELETE',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
      'upload_id' => options['upload_id'],
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      204, # Object multipart deleted
    ],
  }

  abort_multipart_upload_input_validate input
  Request.new input
end

#complete_multipart_upload(object_key, options = {}) ⇒ Object

complete_multipart_upload: Complete multipart upload. Documentation URL: docs.qingcloud.com/qingstor/api/object/complete_multipart_upload.html

Options

  • :etag - MD5sum of the object part

  • :x_qs_encryption_customer_algorithm - Encryption algorithm of the object

  • :x_qs_encryption_customer_key - Encryption key of the object

  • :x_qs_encryption_customer_key_md5 - MD5sum of encryption key

  • :upload_id - Object multipart upload ID

  • :object_parts - Object parts



87
88
89
90
91
# File 'lib/qingstor/sdk/service/object.rb', line 87

def complete_multipart_upload(object_key, options = {})
  options.deep_stringify_keys!
  request = complete_multipart_upload_request object_key, options
  request.send
end

#complete_multipart_upload_request(object_key, options = {}) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/qingstor/sdk/service/object.rb', line 93

def complete_multipart_upload_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'Complete multipart upload',
    request_method:   'POST',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
      'upload_id' => options['upload_id'],
    },
    request_headers:  {
      'ETag'                               => options['etag'],
      'X-QS-Encryption-Customer-Algorithm' => options['x_qs_encryption_customer_algorithm'],
      'X-QS-Encryption-Customer-Key'       => options['x_qs_encryption_customer_key'],
      'X-QS-Encryption-Customer-Key-MD5'   => options['x_qs_encryption_customer_key_md5'],
    },
    request_elements: {
      'object_parts' => options['object_parts'],
    },
    request_body:     nil,
    status_code:      [
      201, # Object created
    ],
  }

  complete_multipart_upload_input_validate input
  Request.new input
end

#delete(options = {}) ⇒ Object

delete_bucket: Delete a bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/delete.html

Options



35
36
37
38
39
# File 'lib/qingstor/sdk/service/bucket.rb', line 35

def delete(options = {})
  options.deep_stringify_keys!
  request = delete_request options
  request.send
end

#delete_cors(options = {}) ⇒ Object

delete_bucket_cors: Delete CORS information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/cors/delete_cors.html

Options



79
80
81
82
83
# File 'lib/qingstor/sdk/service/bucket.rb', line 79

def delete_cors(options = {})
  options.deep_stringify_keys!
  request = delete_cors_request options
  request.send
end

#delete_cors_request(options = {}) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/qingstor/sdk/service/bucket.rb', line 85

def delete_cors_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'DELETE Bucket CORS',
    request_method:   'DELETE',
    request_uri:      '/<bucket-name>?cors',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  delete_bucket_cors_input_validate input
  Request.new input
end

#delete_external_mirror(options = {}) ⇒ Object

delete_bucket_external_mirror: Delete external mirror of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/external_mirror/delete_external_mirror.html

Options



123
124
125
126
127
# File 'lib/qingstor/sdk/service/bucket.rb', line 123

def delete_external_mirror(options = {})
  options.deep_stringify_keys!
  request = delete_external_mirror_request options
  request.send
end

#delete_external_mirror_request(options = {}) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/qingstor/sdk/service/bucket.rb', line 129

def delete_external_mirror_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'DELETE Bucket External Mirror',
    request_method:   'DELETE',
    request_uri:      '/<bucket-name>?mirror',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      204, # No content
    ],
  }

  delete_bucket_external_mirror_input_validate input
  Request.new input
end

#delete_multiple_objects(options = {}) ⇒ Object

delete_multiple_objects: Delete multiple objects from the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/delete_multiple.html

Options

  • :content_md5 - Object MD5sum

  • :objects - A list of keys to delete

  • :quiet - Whether to return the list of deleted objects



214
215
216
217
218
# File 'lib/qingstor/sdk/service/bucket.rb', line 214

def delete_multiple_objects(options = {})
  options.deep_stringify_keys!
  request = delete_multiple_objects_request options
  request.send
end

#delete_multiple_objects_request(options = {}) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/qingstor/sdk/service/bucket.rb', line 220

def delete_multiple_objects_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'Delete Multiple Objects',
    request_method:   'POST',
    request_uri:      '/<bucket-name>?delete',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
      'objects' => options['objects'],
      'quiet'   => options['quiet'],
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  delete_multiple_objects_input_validate input
  Request.new input
end

#delete_object(object_key, options = {}) ⇒ Object

delete_object: Delete the object. Documentation URL: docs.qingcloud.com/qingstor/api/object/delete.html

Options



148
149
150
151
152
# File 'lib/qingstor/sdk/service/object.rb', line 148

def delete_object(object_key, options = {})
  options.deep_stringify_keys!
  request = delete_object_request object_key, options
  request.send
end

#delete_object_request(object_key, options = {}) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/qingstor/sdk/service/object.rb', line 154

def delete_object_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'DELETE Object',
    request_method:   'DELETE',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      204, # Object deleted
    ],
  }

  delete_object_input_validate input
  Request.new input
end

#delete_policy(options = {}) ⇒ Object

delete_bucket_policy: Delete policy information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/policy/delete_policy.html

Options



167
168
169
170
171
# File 'lib/qingstor/sdk/service/bucket.rb', line 167

def delete_policy(options = {})
  options.deep_stringify_keys!
  request = delete_policy_request options
  request.send
end

#delete_policy_request(options = {}) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/qingstor/sdk/service/bucket.rb', line 173

def delete_policy_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'DELETE Bucket Policy',
    request_method:   'DELETE',
    request_uri:      '/<bucket-name>?policy',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      204, # No content
    ],
  }

  delete_bucket_policy_input_validate input
  Request.new input
end

#delete_request(options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/qingstor/sdk/service/bucket.rb', line 41

def delete_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'DELETE Bucket',
    request_method:   'DELETE',
    request_uri:      '/<bucket-name>',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      204, # Bucket deleted
    ],
  }

  delete_bucket_input_validate input
  Request.new input
end

#get_acl(options = {}) ⇒ Object

get_bucket_acl: Get ACL information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/get_acl.html

Options



267
268
269
270
271
# File 'lib/qingstor/sdk/service/bucket.rb', line 267

def get_acl(options = {})
  options.deep_stringify_keys!
  request = get_acl_request options
  request.send
end

#get_acl_request(options = {}) ⇒ Object



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/qingstor/sdk/service/bucket.rb', line 273

def get_acl_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Bucket ACL',
    request_method:   'GET',
    request_uri:      '/<bucket-name>?acl',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  get_bucket_acl_input_validate input
  Request.new input
end

#get_cors(options = {}) ⇒ Object

get_bucket_cors: Get CORS information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/cors/get_cors.html

Options



311
312
313
314
315
# File 'lib/qingstor/sdk/service/bucket.rb', line 311

def get_cors(options = {})
  options.deep_stringify_keys!
  request = get_cors_request options
  request.send
end

#get_cors_request(options = {}) ⇒ Object



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/qingstor/sdk/service/bucket.rb', line 317

def get_cors_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Bucket CORS',
    request_method:   'GET',
    request_uri:      '/<bucket-name>?cors',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  get_bucket_cors_input_validate input
  Request.new input
end

#get_external_mirror(options = {}) ⇒ Object

get_bucket_external_mirror: Get external mirror of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/external_mirror/get_external_mirror.html

Options



355
356
357
358
359
# File 'lib/qingstor/sdk/service/bucket.rb', line 355

def get_external_mirror(options = {})
  options.deep_stringify_keys!
  request = get_external_mirror_request options
  request.send
end

#get_external_mirror_request(options = {}) ⇒ Object



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/qingstor/sdk/service/bucket.rb', line 361

def get_external_mirror_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Bucket External Mirror',
    request_method:   'GET',
    request_uri:      '/<bucket-name>?mirror',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  get_bucket_external_mirror_input_validate input
  Request.new input
end

#get_object(object_key, options = {}) ⇒ Object

get_object: Retrieve the object. Documentation URL: docs.qingcloud.com/qingstor/api/object/get.html

Options

  • :if_match - Check whether the ETag matches

  • :if_modified_since - Check whether the object has been modified

  • :if_none_match - Check whether the ETag does not match

  • :if_unmodified_since - Check whether the object has not been modified

  • :range - Specified range of the object

  • :x_qs_encryption_customer_algorithm - Encryption algorithm of the object

  • :x_qs_encryption_customer_key - Encryption key of the object

  • :x_qs_encryption_customer_key_md5 - MD5sum of encryption key

  • :response_cache_control - Specified the Cache-Control response header

  • :response_content_disposition - Specified the Content-Disposition response header

  • :response_content_encoding - Specified the Content-Encoding response header

  • :response_content_language - Specified the Content-Language response header

  • :response_content_type - Specified the Content-Type response header

  • :response_expires - Specified the Expires response header



207
208
209
210
211
# File 'lib/qingstor/sdk/service/object.rb', line 207

def get_object(object_key, options = {})
  options.deep_stringify_keys!
  request = get_object_request object_key, options
  request.send
end

#get_object_request(object_key, options = {}) ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/qingstor/sdk/service/object.rb', line 213

def get_object_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Object',
    request_method:   'GET',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
      'response-cache-control'       => options['response_cache_control'],
      'response-content-disposition' => options['response_content_disposition'],
      'response-content-encoding'    => options['response_content_encoding'],
      'response-content-language'    => options['response_content_language'],
      'response-content-type'        => options['response_content_type'],
      'response-expires'             => options['response_expires'],
    },
    request_headers:  {
      'If-Match'                           => options['if_match'],
      'If-Modified-Since'                  => options['if_modified_since'],
      'If-None-Match'                      => options['if_none_match'],
      'If-Unmodified-Since'                => options['if_unmodified_since'],
      'Range'                              => options['range'],
      'X-QS-Encryption-Customer-Algorithm' => options['x_qs_encryption_customer_algorithm'],
      'X-QS-Encryption-Customer-Key'       => options['x_qs_encryption_customer_key'],
      'X-QS-Encryption-Customer-Key-MD5'   => options['x_qs_encryption_customer_key_md5'],
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
      206,  # Partial content
      304,  # Not modified
      412,  # Precondition failed
    ],
  }

  get_object_input_validate input
  Request.new input
end

#get_policy(options = {}) ⇒ Object

get_bucket_policy: Get policy information of the bucket. Documentation URL: https://docs.qingcloud.com/qingstor/api/bucket/policy/get_policy.html

Options



399
400
401
402
403
# File 'lib/qingstor/sdk/service/bucket.rb', line 399

def get_policy(options = {})
  options.deep_stringify_keys!
  request = get_policy_request options
  request.send
end

#get_policy_request(options = {}) ⇒ Object



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/qingstor/sdk/service/bucket.rb', line 405

def get_policy_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Bucket Policy',
    request_method:   'GET',
    request_uri:      '/<bucket-name>?policy',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  get_bucket_policy_input_validate input
  Request.new input
end

#get_statistics(options = {}) ⇒ Object

get_bucket_statistics: Get statistics information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/get_stats.html

Options



443
444
445
446
447
# File 'lib/qingstor/sdk/service/bucket.rb', line 443

def get_statistics(options = {})
  options.deep_stringify_keys!
  request = get_statistics_request options
  request.send
end

#get_statistics_request(options = {}) ⇒ Object



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/qingstor/sdk/service/bucket.rb', line 449

def get_statistics_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Bucket Statistics',
    request_method:   'GET',
    request_uri:      '/<bucket-name>?stats',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  get_bucket_statistics_input_validate input
  Request.new input
end

#head(options = {}) ⇒ Object

head_bucket: Check whether the bucket exists and available. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/head.html

Options



487
488
489
490
491
# File 'lib/qingstor/sdk/service/bucket.rb', line 487

def head(options = {})
  options.deep_stringify_keys!
  request = head_request options
  request.send
end

#head_object(object_key, options = {}) ⇒ Object

head_object: Check whether the object exists and available. Documentation URL: docs.qingcloud.com/qingstor/api/object/head.html

Options

  • :if_match - Check whether the ETag matches

  • :if_modified_since - Check whether the object has been modified

  • :if_none_match - Check whether the ETag does not match

  • :if_unmodified_since - Check whether the object has not been modified

  • :x_qs_encryption_customer_algorithm - Encryption algorithm of the object

  • :x_qs_encryption_customer_key - Encryption key of the object

  • :x_qs_encryption_customer_key_md5 - MD5sum of encryption key



276
277
278
279
280
# File 'lib/qingstor/sdk/service/object.rb', line 276

def head_object(object_key, options = {})
  options.deep_stringify_keys!
  request = head_object_request object_key, options
  request.send
end

#head_object_request(object_key, options = {}) ⇒ Object



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/qingstor/sdk/service/object.rb', line 282

def head_object_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'HEAD Object',
    request_method:   'HEAD',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
    },
    request_headers:  {
      'If-Match'                           => options['if_match'],
      'If-Modified-Since'                  => options['if_modified_since'],
      'If-None-Match'                      => options['if_none_match'],
      'If-Unmodified-Since'                => options['if_unmodified_since'],
      'X-QS-Encryption-Customer-Algorithm' => options['x_qs_encryption_customer_algorithm'],
      'X-QS-Encryption-Customer-Key'       => options['x_qs_encryption_customer_key'],
      'X-QS-Encryption-Customer-Key-MD5'   => options['x_qs_encryption_customer_key_md5'],
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  head_object_input_validate input
  Request.new input
end

#head_request(options = {}) ⇒ Object



493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/qingstor/sdk/service/bucket.rb', line 493

def head_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'HEAD Bucket',
    request_method:   'HEAD',
    request_uri:      '/<bucket-name>',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  head_bucket_input_validate input
  Request.new input
end

#initiate_multipart_upload(object_key, options = {}) ⇒ Object

initiate_multipart_upload: Initial multipart upload on the object. Documentation URL: docs.qingcloud.com/qingstor/api/object/initiate_multipart_upload.html

Options

  • :content_type - Object content type

  • :x_qs_encryption_customer_algorithm - Encryption algorithm of the object

  • :x_qs_encryption_customer_key - Encryption key of the object

  • :x_qs_encryption_customer_key_md5 - MD5sum of encryption key



332
333
334
335
336
# File 'lib/qingstor/sdk/service/object.rb', line 332

def initiate_multipart_upload(object_key, options = {})
  options.deep_stringify_keys!
  request = initiate_multipart_upload_request object_key, options
  request.send
end

#initiate_multipart_upload_request(object_key, options = {}) ⇒ Object



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/qingstor/sdk/service/object.rb', line 338

def initiate_multipart_upload_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'Initiate Multipart Upload',
    request_method:   'POST',
    request_uri:      '/<bucket-name>/<object-key>?uploads',
    request_params:   {
    },
    request_headers:  {
      'Content-Type'                       => options['content_type'],
      'X-QS-Encryption-Customer-Algorithm' => options['x_qs_encryption_customer_algorithm'],
      'X-QS-Encryption-Customer-Key'       => options['x_qs_encryption_customer_key'],
      'X-QS-Encryption-Customer-Key-MD5'   => options['x_qs_encryption_customer_key_md5'],
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  initiate_multipart_upload_input_validate input
  Request.new input
end

#list_multipart(object_key, options = {}) ⇒ Object

list_multipart: List object parts. Documentation URL: docs.qingcloud.com/qingstor/api/object/list_multipart.html

Options

  • :limit - Limit results count

  • :part_number_marker - Object multipart upload part number

  • :upload_id - Object multipart upload ID



384
385
386
387
388
# File 'lib/qingstor/sdk/service/object.rb', line 384

def list_multipart(object_key, options = {})
  options.deep_stringify_keys!
  request = list_multipart_request object_key, options
  request.send
end

#list_multipart_request(object_key, options = {}) ⇒ Object



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/qingstor/sdk/service/object.rb', line 390

def list_multipart_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'List Multipart',
    request_method:   'GET',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
      'limit'              => options['limit'],
      'part_number_marker' => options['part_number_marker'],
      'upload_id'          => options['upload_id'],
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  list_multipart_input_validate input
  Request.new input
end

#list_objects(options = {}) ⇒ Object

list_objects: Retrieve the object list in a bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/get.html

Options

  • :delimiter - Put all keys that share a common prefix into a list

  • :limit - Results count limit

  • :marker - Limit results to keys that start at this marker

  • :prefix - Limits results to keys that begin with the prefix



535
536
537
538
539
# File 'lib/qingstor/sdk/service/bucket.rb', line 535

def list_objects(options = {})
  options.deep_stringify_keys!
  request = list_objects_request options
  request.send
end

#list_objects_request(options = {}) ⇒ Object



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/qingstor/sdk/service/bucket.rb', line 541

def list_objects_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Bucket (List Objects)',
    request_method:   'GET',
    request_uri:      '/<bucket-name>',
    request_params:   {
      'delimiter' => options['delimiter'],
      'limit'     => options['limit'],
      'marker'    => options['marker'],
      'prefix'    => options['prefix'],
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  list_objects_input_validate input
  Request.new input
end

#options_object(object_key, options = {}) ⇒ Object

options_object: Check whether the object accepts a origin with method and header. Documentation URL: docs.qingcloud.com/qingstor/api/object/options.html

Options

  • :access_control_request_headers - Request headers

  • :access_control_request_method - Request method

  • :origin - Request origin



439
440
441
442
443
# File 'lib/qingstor/sdk/service/object.rb', line 439

def options_object(object_key, options = {})
  options.deep_stringify_keys!
  request = options_object_request object_key, options
  request.send
end

#options_object_request(object_key, options = {}) ⇒ Object



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/qingstor/sdk/service/object.rb', line 445

def options_object_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'OPTIONS Object',
    request_method:   'OPTIONS',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
    },
    request_headers:  {
      'Access-Control-Request-Headers' => options['access_control_request_headers'],
      'Access-Control-Request-Method'  => options['access_control_request_method'],
      'Origin'                         => options['origin'],
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  options_object_input_validate input
  Request.new input
end

#put(options = {}) ⇒ Object

put_bucket: Create a new bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/put.html

Options



583
584
585
586
587
# File 'lib/qingstor/sdk/service/bucket.rb', line 583

def put(options = {})
  options.deep_stringify_keys!
  request = put_request options
  request.send
end

#put_acl(options = {}) ⇒ Object

put_bucket_acl: Set ACL information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/put_acl.html

Options

  • :acl - Bucket ACL rules



628
629
630
631
632
# File 'lib/qingstor/sdk/service/bucket.rb', line 628

def put_acl(options = {})
  options.deep_stringify_keys!
  request = put_acl_request options
  request.send
end

#put_acl_request(options = {}) ⇒ Object



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/qingstor/sdk/service/bucket.rb', line 634

def put_acl_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'PUT Bucket ACL',
    request_method:   'PUT',
    request_uri:      '/<bucket-name>?acl',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
      'acl' => options['acl'],
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_acl_input_validate input
  Request.new input
end

#put_cors(options = {}) ⇒ Object

put_bucket_cors: Set CORS information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/cors/put_cors.html

Options

  • :cors_rules - Bucket CORS rules



714
715
716
717
718
# File 'lib/qingstor/sdk/service/bucket.rb', line 714

def put_cors(options = {})
  options.deep_stringify_keys!
  request = put_cors_request options
  request.send
end

#put_cors_request(options = {}) ⇒ Object



720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
# File 'lib/qingstor/sdk/service/bucket.rb', line 720

def put_cors_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'PUT Bucket CORS',
    request_method:   'PUT',
    request_uri:      '/<bucket-name>?cors',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
      'cors_rules' => options['cors_rules'],
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_cors_input_validate input
  Request.new input
end

#put_external_mirror(options = {}) ⇒ Object

put_bucket_external_mirror: Set external mirror of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/external_mirror/put_external_mirror.html

Options

  • :source_site - Source site url



774
775
776
777
778
# File 'lib/qingstor/sdk/service/bucket.rb', line 774

def put_external_mirror(options = {})
  options.deep_stringify_keys!
  request = put_external_mirror_request options
  request.send
end

#put_external_mirror_request(options = {}) ⇒ Object



780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
# File 'lib/qingstor/sdk/service/bucket.rb', line 780

def put_external_mirror_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'PUT Bucket External Mirror',
    request_method:   'PUT',
    request_uri:      '/<bucket-name>?mirror',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
      'source_site' => options['source_site'],
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_external_mirror_input_validate input
  Request.new input
end

#put_object(object_key, options = {}) ⇒ Object

put_object: Upload the object. Documentation URL: docs.qingcloud.com/qingstor/api/object/put.html

Options

  • :content_length - Object content size

  • :content_md5 - Object MD5sum

  • :content_type - Object content type

  • :expect - Used to indicate that particular server behaviors are required by the client

  • :x_qs_copy_source - Copy source, format (/<bucket-name>/<object-key>)

  • :x_qs_copy_source_encryption_customer_algorithm - Encryption algorithm of the object

  • :x_qs_copy_source_encryption_customer_key - Encryption key of the object

  • :x_qs_copy_source_encryption_customer_key_md5 - MD5sum of encryption key

  • :x_qs_copy_source_if_match - Check whether the copy source matches

  • :x_qs_copy_source_if_modified_since - Check whether the copy source has been modified

  • :x_qs_copy_source_if_none_match - Check whether the copy source does not match

  • :x_qs_copy_source_if_unmodified_since - Check whether the copy source has not been modified

  • :x_qs_encryption_customer_algorithm - Encryption algorithm of the object

  • :x_qs_encryption_customer_key - Encryption key of the object

  • :x_qs_encryption_customer_key_md5 - MD5sum of encryption key

  • :x_qs_fetch_if_unmodified_since - Check whether fetch target object has not been modified

  • :x_qs_fetch_source - Fetch source, should be a valid url

  • :x_qs_move_source - Move source, format (/<bucket-name>/<object-key>)# * :body - The request body



513
514
515
516
517
# File 'lib/qingstor/sdk/service/object.rb', line 513

def put_object(object_key, options = {})
  options.deep_stringify_keys!
  request = put_object_request object_key, options
  request.send
end

#put_object_request(object_key, options = {}) ⇒ Object



519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# File 'lib/qingstor/sdk/service/object.rb', line 519

def put_object_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'PUT Object',
    request_method:   'PUT',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
    },
    request_headers:  {
      'Content-Length'                                 => options['content_length'],
      'Content-MD5'                                    => options['content_md5'],
      'Content-Type'                                   => options['content_type'],
      'Expect'                                         => options['expect'],
      'X-QS-Copy-Source'                               => options['x_qs_copy_source'],
      'X-QS-Copy-Source-Encryption-Customer-Algorithm' => options['x_qs_copy_source_encryption_customer_algorithm'],
      'X-QS-Copy-Source-Encryption-Customer-Key'       => options['x_qs_copy_source_encryption_customer_key'],
      'X-QS-Copy-Source-Encryption-Customer-Key-MD5'   => options['x_qs_copy_source_encryption_customer_key_md5'],
      'X-QS-Copy-Source-If-Match'                      => options['x_qs_copy_source_if_match'],
      'X-QS-Copy-Source-If-Modified-Since'             => options['x_qs_copy_source_if_modified_since'],
      'X-QS-Copy-Source-If-None-Match'                 => options['x_qs_copy_source_if_none_match'],
      'X-QS-Copy-Source-If-Unmodified-Since'           => options['x_qs_copy_source_if_unmodified_since'],
      'X-QS-Encryption-Customer-Algorithm'             => options['x_qs_encryption_customer_algorithm'],
      'X-QS-Encryption-Customer-Key'                   => options['x_qs_encryption_customer_key'],
      'X-QS-Encryption-Customer-Key-MD5'               => options['x_qs_encryption_customer_key_md5'],
      'X-QS-Fetch-If-Unmodified-Since'                 => options['x_qs_fetch_if_unmodified_since'],
      'X-QS-Fetch-Source'                              => options['x_qs_fetch_source'],
      'X-QS-Move-Source'                               => options['x_qs_move_source'],
    },
    request_elements: {
    },
    request_body:     options['body'],
    status_code:      [
      201, # Object created
    ],
  }

  put_object_input_validate input
  Request.new input
end

#put_policy(options = {}) ⇒ Object

put_bucket_policy: Set policy information of the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/policy/put_policy.html

Options

  • :statement - Bucket policy statement



824
825
826
827
828
# File 'lib/qingstor/sdk/service/bucket.rb', line 824

def put_policy(options = {})
  options.deep_stringify_keys!
  request = put_policy_request options
  request.send
end

#put_policy_request(options = {}) ⇒ Object



830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
# File 'lib/qingstor/sdk/service/bucket.rb', line 830

def put_policy_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'PUT Bucket Policy',
    request_method:   'PUT',
    request_uri:      '/<bucket-name>?policy',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
      'statement' => options['statement'],
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_policy_input_validate input
  Request.new input
end

#put_request(options = {}) ⇒ Object



589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
# File 'lib/qingstor/sdk/service/bucket.rb', line 589

def put_request(options = {})
  options.deep_stringify_keys!
  input = {
    config:           config,
    properties:       properties,
    api_name:         'PUT Bucket',
    request_method:   'PUT',
    request_uri:      '/<bucket-name>',
    request_params:   {
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      201, # Bucket created
    ],
  }

  put_bucket_input_validate input
  Request.new input
end

#upload_multipart(object_key, options = {}) ⇒ Object

upload_multipart: Upload object multipart. Documentation URL: docs.qingcloud.com/qingstor/api/object/multipart/upload_multipart.html

Options

  • :content_length - Object multipart content length

  • :content_md5 - Object multipart content MD5sum

  • :x_qs_encryption_customer_algorithm - Encryption algorithm of the object

  • :x_qs_encryption_customer_key - Encryption key of the object

  • :x_qs_encryption_customer_key_md5 - MD5sum of encryption key

  • :part_number - Object multipart upload part number

  • :upload_id - Object multipart upload ID# * :body - The request body



583
584
585
586
587
# File 'lib/qingstor/sdk/service/object.rb', line 583

def upload_multipart(object_key, options = {})
  options.deep_stringify_keys!
  request = upload_multipart_request object_key, options
  request.send
end

#upload_multipart_request(object_key, options = {}) ⇒ Object



589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'lib/qingstor/sdk/service/object.rb', line 589

def upload_multipart_request(object_key, options = {})
  options.deep_stringify_keys!
  properties[:'object-key'] = object_key
  input = {
    config:           config,
    properties:       properties,
    api_name:         'Upload Multipart',
    request_method:   'PUT',
    request_uri:      '/<bucket-name>/<object-key>',
    request_params:   {
      'part_number' => options['part_number'],
      'upload_id'   => options['upload_id'],
    },
    request_headers:  {
      'Content-Length'                     => options['content_length'],
      'Content-MD5'                        => options['content_md5'],
      'X-QS-Encryption-Customer-Algorithm' => options['x_qs_encryption_customer_algorithm'],
      'X-QS-Encryption-Customer-Key'       => options['x_qs_encryption_customer_key'],
      'X-QS-Encryption-Customer-Key-MD5'   => options['x_qs_encryption_customer_key_md5'],
    },
    request_elements: {
    },
    request_body:     options['body'],
    status_code:      [
      201, # Object multipart created
    ],
  }

  upload_multipart_input_validate input
  Request.new input
end