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

Returns a new instance of 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, upload_id: '') ⇒ Object

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



26
27
28
29
# File 'lib/qingstor/sdk/service/object.rb', line 26

def abort_multipart_upload(object_key, upload_id: '')
  request = abort_multipart_upload_request object_key, upload_id: upload_id
  request.send
end

#abort_multipart_upload_request(object_key, upload_id: '') ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/qingstor/sdk/service/object.rb', line 31

def abort_multipart_upload_request(object_key, upload_id: '')
  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' => 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, upload_id: '', etag: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '', object_parts: []) ⇒ Object

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



70
71
72
73
74
75
76
77
78
79
# File 'lib/qingstor/sdk/service/object.rb', line 70

def complete_multipart_upload(object_key, upload_id: '', etag: '',
                              x_qs_encryption_customer_algorithm: '',
                              x_qs_encryption_customer_key: '',
                              x_qs_encryption_customer_key_md5: '', object_parts: [])
  request = complete_multipart_upload_request object_key, upload_id: upload_id, etag: etag,
    x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
    x_qs_encryption_customer_key: x_qs_encryption_customer_key,
    x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5, object_parts: object_parts
  request.send
end

#complete_multipart_upload_request(object_key, upload_id: '', etag: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '', object_parts: []) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/qingstor/sdk/service/object.rb', line 81

def complete_multipart_upload_request(object_key, upload_id: '', etag: '',
                                      x_qs_encryption_customer_algorithm: '',
                                      x_qs_encryption_customer_key: '',
                                      x_qs_encryption_customer_key_md5: '', object_parts: [])
  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' => upload_id,
    },
    request_headers:  {
      'ETag'                               => etag,
      'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
      'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
      'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5,
    },
    request_elements: {
      'object_parts' => object_parts,
    },
    request_body:     nil,
    status_code:      [
      201, # Object created
    ],
  }

  complete_multipart_upload_input_validate input
  Request.new input
end

#deleteObject

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



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

def delete
  request = delete_request
  request.send
end

#delete_corsObject

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



69
70
71
72
# File 'lib/qingstor/sdk/service/bucket.rb', line 69

def delete_cors
  request = delete_cors_request
  request.send
end

#delete_cors_requestObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/qingstor/sdk/service/bucket.rb', line 74

def delete_cors_request
  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:      [
      204, # OK
    ],
  }

  delete_bucket_cors_input_validate input
  Request.new input
end

#delete_external_mirrorObject

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



107
108
109
110
# File 'lib/qingstor/sdk/service/bucket.rb', line 107

def delete_external_mirror
  request = delete_external_mirror_request
  request.send
end

#delete_external_mirror_requestObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/qingstor/sdk/service/bucket.rb', line 112

def delete_external_mirror_request
  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(objects: [], quiet: nil) ⇒ Object

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



183
184
185
186
187
188
# File 'lib/qingstor/sdk/service/bucket.rb', line 183

def delete_multiple_objects(objects: [],
                            quiet: nil)
  request = delete_multiple_objects_request objects: objects,
                                            quiet:   quiet
  request.send
end

#delete_multiple_objects_request(objects: [], quiet: nil) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/qingstor/sdk/service/bucket.rb', line 190

def delete_multiple_objects_request(objects: [],
                                    quiet: nil)
  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' => objects,
      'quiet'   => quiet,
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  delete_multiple_objects_input_validate input
  Request.new input
end

#delete_object(object_key) ⇒ Object

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



134
135
136
137
# File 'lib/qingstor/sdk/service/object.rb', line 134

def delete_object(object_key)
  request = delete_object_request object_key
  request.send
end

#delete_object_request(object_key) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/qingstor/sdk/service/object.rb', line 139

def delete_object_request(object_key)
  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_policyObject

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



145
146
147
148
# File 'lib/qingstor/sdk/service/bucket.rb', line 145

def delete_policy
  request = delete_policy_request
  request.send
end

#delete_policy_requestObject



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/qingstor/sdk/service/bucket.rb', line 150

def delete_policy_request
  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_requestObject



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

def delete_request
  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_aclObject

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



233
234
235
236
# File 'lib/qingstor/sdk/service/bucket.rb', line 233

def get_acl
  request = get_acl_request
  request.send
end

#get_acl_requestObject



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/qingstor/sdk/service/bucket.rb', line 238

def get_acl_request
  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_corsObject

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



271
272
273
274
# File 'lib/qingstor/sdk/service/bucket.rb', line 271

def get_cors
  request = get_cors_request
  request.send
end

#get_cors_requestObject



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

def get_cors_request
  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_mirrorObject

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



309
310
311
312
# File 'lib/qingstor/sdk/service/bucket.rb', line 309

def get_external_mirror
  request = get_external_mirror_request
  request.send
end

#get_external_mirror_requestObject



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

def get_external_mirror_request
  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, response_cache_control: '', response_content_disposition: '', response_content_encoding: '', response_content_language: '', response_content_type: '', response_expires: '', if_match: '', if_modified_since: '', if_none_match: '', if_unmodified_since: '', range: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '') ⇒ Object

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



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

def get_object(object_key, response_cache_control: '',
               response_content_disposition: '',
               response_content_encoding: '',
               response_content_language: '',
               response_content_type: '',
               response_expires: '', if_match: '',
               if_modified_since: '',
               if_none_match: '',
               if_unmodified_since: '',
               range: '',
               x_qs_encryption_customer_algorithm: '',
               x_qs_encryption_customer_key: '',
               x_qs_encryption_customer_key_md5: '')
  request = get_object_request object_key, response_cache_control: response_cache_control,
    response_content_disposition: response_content_disposition,
    response_content_encoding: response_content_encoding,
    response_content_language: response_content_language,
    response_content_type: response_content_type,
    response_expires: response_expires, if_match: if_match,
    if_modified_since: if_modified_since,
    if_none_match: if_none_match,
    if_unmodified_since: if_unmodified_since,
    range: range,
    x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
    x_qs_encryption_customer_key: x_qs_encryption_customer_key,
    x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5
  request.send
end

#get_object_request(object_key, response_cache_control: '', response_content_disposition: '', response_content_encoding: '', response_content_language: '', response_content_type: '', response_expires: '', if_match: '', if_modified_since: '', if_none_match: '', if_unmodified_since: '', range: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '') ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
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 202

def get_object_request(object_key, response_cache_control: '',
                       response_content_disposition: '',
                       response_content_encoding: '',
                       response_content_language: '',
                       response_content_type: '',
                       response_expires: '', if_match: '',
                       if_modified_since: '',
                       if_none_match: '',
                       if_unmodified_since: '',
                       range: '',
                       x_qs_encryption_customer_algorithm: '',
                       x_qs_encryption_customer_key: '',
                       x_qs_encryption_customer_key_md5: '')
  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'       => response_cache_control,
      'response-content-disposition' => response_content_disposition,
      'response-content-encoding'    => response_content_encoding,
      'response-content-language'    => response_content_language,
      'response-content-type'        => response_content_type,
      'response-expires'             => response_expires,
    },
    request_headers:  {
      'If-Match'                           => if_match,
      'If-Modified-Since'                  => if_modified_since,
      'If-None-Match'                      => if_none_match,
      'If-Unmodified-Since'                => if_unmodified_since,
      'Range'                              => range,
      'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
      'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
      'X-QS-Encryption-Customer-Key-MD5'   => 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_policyObject

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



347
348
349
350
# File 'lib/qingstor/sdk/service/bucket.rb', line 347

def get_policy
  request = get_policy_request
  request.send
end

#get_policy_requestObject



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/qingstor/sdk/service/bucket.rb', line 352

def get_policy_request
  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_statisticsObject

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



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

def get_statistics
  request = get_statistics_request
  request.send
end

#get_statistics_requestObject



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

def get_statistics_request
  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

#headObject

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



423
424
425
426
# File 'lib/qingstor/sdk/service/bucket.rb', line 423

def head
  request = head_request
  request.send
end

#head_object(object_key, if_match: '', if_modified_since: '', if_none_match: '', if_unmodified_since: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '') ⇒ Object

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



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/qingstor/sdk/service/object.rb', line 265

def head_object(object_key, if_match: '',
                if_modified_since: '',
                if_none_match: '',
                if_unmodified_since: '',
                x_qs_encryption_customer_algorithm: '',
                x_qs_encryption_customer_key: '',
                x_qs_encryption_customer_key_md5: '')
  request = head_object_request object_key, if_match:                           if_match,
                                            if_modified_since:                  if_modified_since,
                                            if_none_match:                      if_none_match,
                                            if_unmodified_since:                if_unmodified_since,
                                            x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
                                            x_qs_encryption_customer_key:       x_qs_encryption_customer_key,
                                            x_qs_encryption_customer_key_md5:   x_qs_encryption_customer_key_md5
  request.send
end

#head_object_request(object_key, if_match: '', if_modified_since: '', if_none_match: '', if_unmodified_since: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '') ⇒ 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
313
314
315
316
317
# File 'lib/qingstor/sdk/service/object.rb', line 282

def head_object_request(object_key, if_match: '',
                        if_modified_since: '',
                        if_none_match: '',
                        if_unmodified_since: '',
                        x_qs_encryption_customer_algorithm: '',
                        x_qs_encryption_customer_key: '',
                        x_qs_encryption_customer_key_md5: '')
  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'                           => if_match,
      'If-Modified-Since'                  => if_modified_since,
      'If-None-Match'                      => if_none_match,
      'If-Unmodified-Since'                => if_unmodified_since,
      'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
      'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
      'X-QS-Encryption-Customer-Key-MD5'   => 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_requestObject



428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/qingstor/sdk/service/bucket.rb', line 428

def head_request
  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, content_type: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '') ⇒ Object

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



329
330
331
332
333
334
335
336
337
338
# File 'lib/qingstor/sdk/service/object.rb', line 329

def initiate_multipart_upload(object_key, content_type: '',
                              x_qs_encryption_customer_algorithm: '',
                              x_qs_encryption_customer_key: '',
                              x_qs_encryption_customer_key_md5: '')
  request = initiate_multipart_upload_request object_key, content_type:                       content_type,
                                                          x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
                                                          x_qs_encryption_customer_key:       x_qs_encryption_customer_key,
                                                          x_qs_encryption_customer_key_md5:   x_qs_encryption_customer_key_md5
  request.send
end

#initiate_multipart_upload_request(object_key, content_type: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '') ⇒ Object



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
366
367
368
369
# File 'lib/qingstor/sdk/service/object.rb', line 340

def initiate_multipart_upload_request(object_key, content_type: '',
                                      x_qs_encryption_customer_algorithm: '',
                                      x_qs_encryption_customer_key: '',
                                      x_qs_encryption_customer_key_md5: '')
  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'                       => content_type,
      'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
      'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
      'X-QS-Encryption-Customer-Key-MD5'   => 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, limit: nil, part_number_marker: nil, upload_id: '') ⇒ Object

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



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

def list_multipart(object_key, limit: nil,
                   part_number_marker: nil,
                   upload_id: '')
  request = list_multipart_request object_key, limit:              limit,
                                               part_number_marker: part_number_marker,
                                               upload_id:          upload_id
  request.send
end

#list_multipart_request(object_key, limit: nil, part_number_marker: nil, upload_id: '') ⇒ 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
417
# File 'lib/qingstor/sdk/service/object.rb', line 390

def list_multipart_request(object_key, limit: nil,
                           part_number_marker: nil,
                           upload_id: '')
  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'              => limit,
      'part_number_marker' => part_number_marker,
      'upload_id'          => upload_id,
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  list_multipart_input_validate input
  Request.new input
end

#list_multipart_uploads(delimiter: '', limit: nil, marker: '', prefix: '') ⇒ Object

list_multipart_uploads: List multipart uploads in the bucket. Documentation URL: docs.qingcloud.com/qingstor/api/bucket/list_multipart_uploads.html



461
462
463
464
465
466
467
468
469
470
# File 'lib/qingstor/sdk/service/bucket.rb', line 461

def list_multipart_uploads(delimiter: '',
                           limit: nil,
                           marker: '',
                           prefix: '')
  request = list_multipart_uploads_request delimiter: delimiter,
                                           limit:     limit,
                                           marker:    marker,
                                           prefix:    prefix
  request.send
end

#list_multipart_uploads_request(delimiter: '', limit: nil, marker: '', prefix: '') ⇒ Object



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/qingstor/sdk/service/bucket.rb', line 472

def list_multipart_uploads_request(delimiter: '',
                                   limit: nil,
                                   marker: '',
                                   prefix: '')
  input = {
    config:           config,
    properties:       properties,
    api_name:         'List Multipart Uploads',
    request_method:   'GET',
    request_uri:      '/<bucket-name>?uploads',
    request_params:   {
      'delimiter' => delimiter,
      'limit'     => limit,
      'marker'    => marker,
      'prefix'    => prefix,
    },
    request_headers:  {
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  list_multipart_uploads_input_validate input
  Request.new input
end

#list_objects(delimiter: '', limit: nil, marker: '', prefix: '') ⇒ Object

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



512
513
514
515
516
517
518
519
520
521
# File 'lib/qingstor/sdk/service/bucket.rb', line 512

def list_objects(delimiter: '',
                 limit: nil,
                 marker: '',
                 prefix: '')
  request = list_objects_request delimiter: delimiter,
                                 limit:     limit,
                                 marker:    marker,
                                 prefix:    prefix
  request.send
end

#list_objects_request(delimiter: '', limit: nil, marker: '', prefix: '') ⇒ Object



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
# File 'lib/qingstor/sdk/service/bucket.rb', line 523

def list_objects_request(delimiter: '',
                         limit: nil,
                         marker: '',
                         prefix: '')
  input = {
    config:           config,
    properties:       properties,
    api_name:         'GET Bucket (List Objects)',
    request_method:   'GET',
    request_uri:      '/<bucket-name>',
    request_params:   {
      'delimiter' => delimiter,
      'limit'     => limit,
      'marker'    => marker,
      'prefix'    => 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, access_control_request_headers: '', access_control_request_method: '', origin: '') ⇒ Object

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



433
434
435
436
437
438
439
440
# File 'lib/qingstor/sdk/service/object.rb', line 433

def options_object(object_key, access_control_request_headers: '',
                   access_control_request_method: '',
                   origin: '')
  request = options_object_request object_key, access_control_request_headers: access_control_request_headers,
                                               access_control_request_method:  access_control_request_method,
                                               origin:                         origin
  request.send
end

#options_object_request(object_key, access_control_request_headers: '', access_control_request_method: '', origin: '') ⇒ Object



442
443
444
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
# File 'lib/qingstor/sdk/service/object.rb', line 442

def options_object_request(object_key, access_control_request_headers: '',
                           access_control_request_method: '',
                           origin: '')
  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' => access_control_request_headers,
      'Access-Control-Request-Method'  => access_control_request_method,
      'Origin'                         => origin,
    },
    request_elements: {
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  options_object_input_validate input
  Request.new input
end

#putObject

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



563
564
565
566
# File 'lib/qingstor/sdk/service/bucket.rb', line 563

def put
  request = put_request
  request.send
end

#put_acl(acl: []) ⇒ Object

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



601
602
603
604
# File 'lib/qingstor/sdk/service/bucket.rb', line 601

def put_acl(acl: [])
  request = put_acl_request acl: acl
  request.send
end

#put_acl_request(acl: []) ⇒ Object



606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/qingstor/sdk/service/bucket.rb', line 606

def put_acl_request(acl: [])
  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' => acl,
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_acl_input_validate input
  Request.new input
end

#put_cors(cors_rules: []) ⇒ Object

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



680
681
682
683
# File 'lib/qingstor/sdk/service/bucket.rb', line 680

def put_cors(cors_rules: [])
  request = put_cors_request cors_rules: cors_rules
  request.send
end

#put_cors_request(cors_rules: []) ⇒ Object



685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
# File 'lib/qingstor/sdk/service/bucket.rb', line 685

def put_cors_request(cors_rules: [])
  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' => cors_rules,
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_cors_input_validate input
  Request.new input
end

#put_external_mirror(source_site: '') ⇒ 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



733
734
735
736
# File 'lib/qingstor/sdk/service/bucket.rb', line 733

def put_external_mirror(source_site: '')
  request = put_external_mirror_request source_site: source_site
  request.send
end

#put_external_mirror_request(source_site: '') ⇒ Object



738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
# File 'lib/qingstor/sdk/service/bucket.rb', line 738

def put_external_mirror_request(source_site: '')
  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' => source_site,
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_external_mirror_input_validate input
  Request.new input
end

#put_object(object_key, content_length: nil, content_md5: '', content_type: '', expect: '', x_qs_copy_source: '', x_qs_copy_source_encryption_customer_algorithm: '', x_qs_copy_source_encryption_customer_key: '', x_qs_copy_source_encryption_customer_key_md5: '', x_qs_copy_source_if_match: '', x_qs_copy_source_if_modified_since: '', x_qs_copy_source_if_none_match: '', x_qs_copy_source_if_unmodified_since: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '', x_qs_fetch_if_unmodified_since: '', x_qs_fetch_source: '', x_qs_move_source: '', body: nil) ⇒ Object

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



489
490
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
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/qingstor/sdk/service/object.rb', line 489

def put_object(object_key, content_length: nil,
               content_md5: '',
               content_type: '',
               expect: '',
               x_qs_copy_source: '',
               x_qs_copy_source_encryption_customer_algorithm: '',
               x_qs_copy_source_encryption_customer_key: '',
               x_qs_copy_source_encryption_customer_key_md5: '',
               x_qs_copy_source_if_match: '',
               x_qs_copy_source_if_modified_since: '',
               x_qs_copy_source_if_none_match: '',
               x_qs_copy_source_if_unmodified_since: '',
               x_qs_encryption_customer_algorithm: '',
               x_qs_encryption_customer_key: '',
               x_qs_encryption_customer_key_md5: '',
               x_qs_fetch_if_unmodified_since: '',
               x_qs_fetch_source: '',
               x_qs_move_source: '',
               body: nil)
  request = put_object_request object_key, content_length:                                 content_length,
                                           content_md5:                                    content_md5,
                                           content_type:                                   content_type,
                                           expect:                                         expect,
                                           x_qs_copy_source:                               x_qs_copy_source,
                                           x_qs_copy_source_encryption_customer_algorithm: x_qs_copy_source_encryption_customer_algorithm,
                                           x_qs_copy_source_encryption_customer_key:       x_qs_copy_source_encryption_customer_key,
                                           x_qs_copy_source_encryption_customer_key_md5:   x_qs_copy_source_encryption_customer_key_md5,
                                           x_qs_copy_source_if_match:                      x_qs_copy_source_if_match,
                                           x_qs_copy_source_if_modified_since:             x_qs_copy_source_if_modified_since,
                                           x_qs_copy_source_if_none_match:                 x_qs_copy_source_if_none_match,
                                           x_qs_copy_source_if_unmodified_since:           x_qs_copy_source_if_unmodified_since,
                                           x_qs_encryption_customer_algorithm:             x_qs_encryption_customer_algorithm,
                                           x_qs_encryption_customer_key:                   x_qs_encryption_customer_key,
                                           x_qs_encryption_customer_key_md5:               x_qs_encryption_customer_key_md5,
                                           x_qs_fetch_if_unmodified_since:                 x_qs_fetch_if_unmodified_since,
                                           x_qs_fetch_source:                              x_qs_fetch_source,
                                           x_qs_move_source:                               x_qs_move_source,
                                           body:                                           body
  request.send
end

#put_object_request(object_key, content_length: nil, content_md5: '', content_type: '', expect: '', x_qs_copy_source: '', x_qs_copy_source_encryption_customer_algorithm: '', x_qs_copy_source_encryption_customer_key: '', x_qs_copy_source_encryption_customer_key_md5: '', x_qs_copy_source_if_match: '', x_qs_copy_source_if_modified_since: '', x_qs_copy_source_if_none_match: '', x_qs_copy_source_if_unmodified_since: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '', x_qs_fetch_if_unmodified_since: '', x_qs_fetch_source: '', x_qs_move_source: '', body: nil) ⇒ Object



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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/qingstor/sdk/service/object.rb', line 530

def put_object_request(object_key, content_length: nil,
                       content_md5: '',
                       content_type: '',
                       expect: '',
                       x_qs_copy_source: '',
                       x_qs_copy_source_encryption_customer_algorithm: '',
                       x_qs_copy_source_encryption_customer_key: '',
                       x_qs_copy_source_encryption_customer_key_md5: '',
                       x_qs_copy_source_if_match: '',
                       x_qs_copy_source_if_modified_since: '',
                       x_qs_copy_source_if_none_match: '',
                       x_qs_copy_source_if_unmodified_since: '',
                       x_qs_encryption_customer_algorithm: '',
                       x_qs_encryption_customer_key: '',
                       x_qs_encryption_customer_key_md5: '',
                       x_qs_fetch_if_unmodified_since: '',
                       x_qs_fetch_source: '',
                       x_qs_move_source: '',
                       body: nil)
  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'                                 => content_length,
      'Content-MD5'                                    => content_md5,
      'Content-Type'                                   => content_type,
      'Expect'                                         => expect,
      'X-QS-Copy-Source'                               => x_qs_copy_source,
      'X-QS-Copy-Source-Encryption-Customer-Algorithm' => x_qs_copy_source_encryption_customer_algorithm,
      'X-QS-Copy-Source-Encryption-Customer-Key'       => x_qs_copy_source_encryption_customer_key,
      'X-QS-Copy-Source-Encryption-Customer-Key-MD5'   => x_qs_copy_source_encryption_customer_key_md5,
      'X-QS-Copy-Source-If-Match'                      => x_qs_copy_source_if_match,
      'X-QS-Copy-Source-If-Modified-Since'             => x_qs_copy_source_if_modified_since,
      'X-QS-Copy-Source-If-None-Match'                 => x_qs_copy_source_if_none_match,
      'X-QS-Copy-Source-If-Unmodified-Since'           => x_qs_copy_source_if_unmodified_since,
      'X-QS-Encryption-Customer-Algorithm'             => x_qs_encryption_customer_algorithm,
      'X-QS-Encryption-Customer-Key'                   => x_qs_encryption_customer_key,
      'X-QS-Encryption-Customer-Key-MD5'               => x_qs_encryption_customer_key_md5,
      'X-QS-Fetch-If-Unmodified-Since'                 => x_qs_fetch_if_unmodified_since,
      'X-QS-Fetch-Source'                              => x_qs_fetch_source,
      'X-QS-Move-Source'                               => x_qs_move_source,
    },
    request_elements: {
    },
    request_body:     body,
    status_code:      [
      201, # Object created
    ],
  }

  put_object_input_validate input
  Request.new input
end

#put_policy(statement: []) ⇒ Object

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



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

def put_policy(statement: [])
  request = put_policy_request statement: statement
  request.send
end

#put_policy_request(statement: []) ⇒ Object



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 781

def put_policy_request(statement: [])
  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' => statement,
    },
    request_body:     nil,
    status_code:      [
      200, # OK
    ],
  }

  put_bucket_policy_input_validate input
  Request.new input
end

#put_requestObject



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/qingstor/sdk/service/bucket.rb', line 568

def put_request
  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, part_number: nil, upload_id: '', content_length: nil, content_md5: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '', body: nil) ⇒ Object

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



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/qingstor/sdk/service/object.rb', line 600

def upload_multipart(object_key, part_number: nil,
                     upload_id: '', content_length: nil,
                     content_md5: '',
                     x_qs_encryption_customer_algorithm: '',
                     x_qs_encryption_customer_key: '',
                     x_qs_encryption_customer_key_md5: '',
                     body: nil)
  request = upload_multipart_request object_key, part_number: part_number,
    upload_id: upload_id, content_length: content_length,
    content_md5: content_md5,
    x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
    x_qs_encryption_customer_key: x_qs_encryption_customer_key,
    x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5,
    body: body
  request.send
end

#upload_multipart_request(object_key, part_number: nil, upload_id: '', content_length: nil, content_md5: '', x_qs_encryption_customer_algorithm: '', x_qs_encryption_customer_key: '', x_qs_encryption_customer_key_md5: '', body: nil) ⇒ Object



617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/qingstor/sdk/service/object.rb', line 617

def upload_multipart_request(object_key, part_number: nil,
                             upload_id: '', content_length: nil,
                             content_md5: '',
                             x_qs_encryption_customer_algorithm: '',
                             x_qs_encryption_customer_key: '',
                             x_qs_encryption_customer_key_md5: '',
                             body: nil)
  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' => part_number,
      'upload_id'   => upload_id,
    },
    request_headers:  {
      'Content-Length'                     => content_length,
      'Content-MD5'                        => content_md5,
      'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
      'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
      'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5,
    },
    request_elements: {
    },
    request_body:     body,
    status_code:      [
      201, # Object multipart created
    ],
  }

  upload_multipart_input_validate input
  Request.new input
end