qingstor-sdk 2.2.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +48 -4
- data/lib/qingstor/sdk/general/config.rb +2 -2
- data/lib/qingstor/sdk/general/logger.rb +1 -1
- data/lib/qingstor/sdk/request/preprocessor.rb +19 -1
- data/lib/qingstor/sdk/request/request.rb +5 -2
- data/lib/qingstor/sdk/request/signer.rb +5 -4
- data/lib/qingstor/sdk/service/bucket.rb +888 -73
- data/lib/qingstor/sdk/service/object.rb +300 -44
- data/lib/qingstor/sdk/service/qingstor.rb +13 -7
- data/lib/qingstor/sdk/version.rb +1 -1
- metadata +47 -28
| @@ -37,16 +37,17 @@ module QingStor | |
| 37 37 | 
             
                      request_method:   'DELETE',
         | 
| 38 38 | 
             
                      request_uri:      '/<bucket-name>/<object-key>',
         | 
| 39 39 | 
             
                      request_params:   {
         | 
| 40 | 
            -
                        'upload_id' => upload_id | 
| 40 | 
            +
                        'upload_id' => upload_id
         | 
| 41 41 | 
             
                      },
         | 
| 42 42 | 
             
                      request_headers:  {
         | 
| 43 43 | 
             
                      },
         | 
| 44 44 | 
             
                      request_elements: {
         | 
| 45 45 | 
             
                      },
         | 
| 46 46 | 
             
                      request_body:     nil,
         | 
| 47 | 
            +
             | 
| 47 48 | 
             
                      status_code:      [
         | 
| 48 | 
            -
                        204 | 
| 49 | 
            -
                      ] | 
| 49 | 
            +
                        204
         | 
| 50 | 
            +
                      ]
         | 
| 50 51 | 
             
                    }
         | 
| 51 52 |  | 
| 52 53 | 
             
                    abort_multipart_upload_input_validate input
         | 
| @@ -65,6 +66,78 @@ module QingStor | |
| 65 66 |  | 
| 66 67 | 
             
                  public
         | 
| 67 68 |  | 
| 69 | 
            +
                  # append_object: Append the Object.
         | 
| 70 | 
            +
                  # Documentation URL: https://docs.qingcloud.com/qingstor/api/object/append.html
         | 
| 71 | 
            +
                  def append_object(object_key, position: nil, content_length: nil,
         | 
| 72 | 
            +
                                    content_md5: '',
         | 
| 73 | 
            +
                                    content_type: '',
         | 
| 74 | 
            +
                                    x_qs_storage_class: '',
         | 
| 75 | 
            +
                                    body: nil)
         | 
| 76 | 
            +
                    request = append_object_request object_key, position: position, content_length: content_length,
         | 
| 77 | 
            +
                      content_md5: content_md5,
         | 
| 78 | 
            +
                      content_type: content_type,
         | 
| 79 | 
            +
                      x_qs_storage_class: x_qs_storage_class,
         | 
| 80 | 
            +
                      body: body
         | 
| 81 | 
            +
                    request.send
         | 
| 82 | 
            +
                  end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                  def append_object_request(object_key, position: nil, content_length: nil,
         | 
| 85 | 
            +
                                            content_md5: '',
         | 
| 86 | 
            +
                                            content_type: '',
         | 
| 87 | 
            +
                                            x_qs_storage_class: '',
         | 
| 88 | 
            +
                                            body: nil)
         | 
| 89 | 
            +
                    properties[:'object-key'] = object_key
         | 
| 90 | 
            +
                    input = {
         | 
| 91 | 
            +
                      config:           config,
         | 
| 92 | 
            +
                      properties:       properties,
         | 
| 93 | 
            +
                      api_name:         'Append Object',
         | 
| 94 | 
            +
                      request_method:   'POST',
         | 
| 95 | 
            +
                      request_uri:      '/<bucket-name>/<object-key>?append',
         | 
| 96 | 
            +
                      request_params:   {
         | 
| 97 | 
            +
                        'position' => position
         | 
| 98 | 
            +
                      },
         | 
| 99 | 
            +
                      request_headers:  {
         | 
| 100 | 
            +
                        'Content-Length'     => content_length,
         | 
| 101 | 
            +
                        'Content-MD5'        => content_md5,
         | 
| 102 | 
            +
                        'Content-Type'       => content_type,
         | 
| 103 | 
            +
                        'X-QS-Storage-Class' => x_qs_storage_class
         | 
| 104 | 
            +
                      },
         | 
| 105 | 
            +
                      request_elements: {
         | 
| 106 | 
            +
                      },
         | 
| 107 | 
            +
                      request_body:     body,
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                      status_code:      [
         | 
| 110 | 
            +
                        200
         | 
| 111 | 
            +
                      ]
         | 
| 112 | 
            +
                    }
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                    append_object_input_validate input
         | 
| 115 | 
            +
                    Request.new input
         | 
| 116 | 
            +
                  end
         | 
| 117 | 
            +
             | 
| 118 | 
            +
                  private
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                  def append_object_input_validate(input)
         | 
| 121 | 
            +
                    input.deep_stringify_keys!
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                    unless !input['request_params']['position'].nil? && !input['request_params']['position'].to_s.empty?
         | 
| 124 | 
            +
                      raise ParameterRequiredError.new('position', 'AppendObjectInput')
         | 
| 125 | 
            +
                    end
         | 
| 126 | 
            +
             | 
| 127 | 
            +
                    if input['request_headers']['X-QS-Storage-Class'] && !input['request_headers']['X-QS-Storage-Class'].to_s.empty?
         | 
| 128 | 
            +
                      x_qs_storage_class_valid_values = %w[STANDARD STANDARD_IA]
         | 
| 129 | 
            +
                      unless x_qs_storage_class_valid_values.include? input['request_headers']['X-QS-Storage-Class'].to_s
         | 
| 130 | 
            +
                        raise ParameterValueNotAllowedError.new(
         | 
| 131 | 
            +
                          'X-QS-Storage-Class',
         | 
| 132 | 
            +
                          input['request_headers']['X-QS-Storage-Class'],
         | 
| 133 | 
            +
                          x_qs_storage_class_valid_values,
         | 
| 134 | 
            +
                        )
         | 
| 135 | 
            +
                      end
         | 
| 136 | 
            +
                    end
         | 
| 137 | 
            +
                  end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
                  public
         | 
| 140 | 
            +
             | 
| 68 141 | 
             
                  # complete_multipart_upload: Complete multipart upload.
         | 
| 69 142 | 
             
                  # Documentation URL: https://docs.qingcloud.com/qingstor/api/object/complete_multipart_upload.html
         | 
| 70 143 | 
             
                  def complete_multipart_upload(object_key, upload_id: '', etag: '',
         | 
| @@ -90,21 +163,22 @@ module QingStor | |
| 90 163 | 
             
                      request_method:   'POST',
         | 
| 91 164 | 
             
                      request_uri:      '/<bucket-name>/<object-key>',
         | 
| 92 165 | 
             
                      request_params:   {
         | 
| 93 | 
            -
                        'upload_id' => upload_id | 
| 166 | 
            +
                        'upload_id' => upload_id
         | 
| 94 167 | 
             
                      },
         | 
| 95 168 | 
             
                      request_headers:  {
         | 
| 96 169 | 
             
                        'ETag'                               => etag,
         | 
| 97 170 | 
             
                        'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
         | 
| 98 171 | 
             
                        'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
         | 
| 99 | 
            -
                        'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5 | 
| 172 | 
            +
                        'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5
         | 
| 100 173 | 
             
                      },
         | 
| 101 174 | 
             
                      request_elements: {
         | 
| 102 | 
            -
                        'object_parts' => object_parts | 
| 175 | 
            +
                        'object_parts' => object_parts
         | 
| 103 176 | 
             
                      },
         | 
| 104 177 | 
             
                      request_body:     nil,
         | 
| 178 | 
            +
             | 
| 105 179 | 
             
                      status_code:      [
         | 
| 106 | 
            -
                        201 | 
| 107 | 
            -
                      ] | 
| 180 | 
            +
                        201
         | 
| 181 | 
            +
                      ]
         | 
| 108 182 | 
             
                    }
         | 
| 109 183 |  | 
| 110 184 | 
             
                    complete_multipart_upload_input_validate input
         | 
| @@ -120,6 +194,10 @@ module QingStor | |
| 120 194 | 
             
                      raise ParameterRequiredError.new('upload_id', 'CompleteMultipartUploadInput')
         | 
| 121 195 | 
             
                    end
         | 
| 122 196 |  | 
| 197 | 
            +
                    unless !input['request_elements']['object_parts'].nil? && !input['request_elements']['object_parts'].empty?
         | 
| 198 | 
            +
                      raise ParameterRequiredError.new('object_parts', 'CompleteMultipartUploadInput')
         | 
| 199 | 
            +
                    end
         | 
| 200 | 
            +
             | 
| 123 201 | 
             
                    input['request_elements']['object_parts'].each do |x|
         | 
| 124 202 | 
             
                      unless !x['part_number'].nil? && !x['part_number'].to_s.empty?
         | 
| 125 203 | 
             
                        raise ParameterRequiredError.new('part_number', 'object_part')
         | 
| @@ -151,9 +229,10 @@ module QingStor | |
| 151 229 | 
             
                      request_elements: {
         | 
| 152 230 | 
             
                      },
         | 
| 153 231 | 
             
                      request_body:     nil,
         | 
| 232 | 
            +
             | 
| 154 233 | 
             
                      status_code:      [
         | 
| 155 | 
            -
                        204 | 
| 156 | 
            -
                      ] | 
| 234 | 
            +
                        204
         | 
| 235 | 
            +
                      ]
         | 
| 157 236 | 
             
                    }
         | 
| 158 237 |  | 
| 159 238 | 
             
                    delete_object_input_validate input
         | 
| @@ -225,7 +304,7 @@ module QingStor | |
| 225 304 | 
             
                        'response-content-encoding'    => response_content_encoding,
         | 
| 226 305 | 
             
                        'response-content-language'    => response_content_language,
         | 
| 227 306 | 
             
                        'response-content-type'        => response_content_type,
         | 
| 228 | 
            -
                        'response-expires'             => response_expires | 
| 307 | 
            +
                        'response-expires'             => response_expires
         | 
| 229 308 | 
             
                      },
         | 
| 230 309 | 
             
                      request_headers:  {
         | 
| 231 310 | 
             
                        'If-Match'                           => if_match,
         | 
| @@ -235,17 +314,18 @@ module QingStor | |
| 235 314 | 
             
                        'Range'                              => range,
         | 
| 236 315 | 
             
                        'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
         | 
| 237 316 | 
             
                        'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
         | 
| 238 | 
            -
                        'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5 | 
| 317 | 
            +
                        'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5
         | 
| 239 318 | 
             
                      },
         | 
| 240 319 | 
             
                      request_elements: {
         | 
| 241 320 | 
             
                      },
         | 
| 242 321 | 
             
                      request_body:     nil,
         | 
| 322 | 
            +
             | 
| 243 323 | 
             
                      status_code:      [
         | 
| 244 | 
            -
                        200, | 
| 245 | 
            -
                        206, | 
| 246 | 
            -
                        304, | 
| 247 | 
            -
                        412 | 
| 248 | 
            -
                      ] | 
| 324 | 
            +
                        200,
         | 
| 325 | 
            +
                        206,
         | 
| 326 | 
            +
                        304,
         | 
| 327 | 
            +
                        412
         | 
| 328 | 
            +
                      ]
         | 
| 249 329 | 
             
                    }
         | 
| 250 330 |  | 
| 251 331 | 
             
                    get_object_input_validate input
         | 
| @@ -302,14 +382,15 @@ module QingStor | |
| 302 382 | 
             
                        'If-Unmodified-Since'                => if_unmodified_since,
         | 
| 303 383 | 
             
                        'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
         | 
| 304 384 | 
             
                        'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
         | 
| 305 | 
            -
                        'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5 | 
| 385 | 
            +
                        'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5
         | 
| 306 386 | 
             
                      },
         | 
| 307 387 | 
             
                      request_elements: {
         | 
| 308 388 | 
             
                      },
         | 
| 309 389 | 
             
                      request_body:     nil,
         | 
| 390 | 
            +
             | 
| 310 391 | 
             
                      status_code:      [
         | 
| 311 | 
            -
                        200 | 
| 312 | 
            -
                      ] | 
| 392 | 
            +
                        200
         | 
| 393 | 
            +
                      ]
         | 
| 313 394 | 
             
                    }
         | 
| 314 395 |  | 
| 315 396 | 
             
                    head_object_input_validate input
         | 
| @@ -324,23 +405,100 @@ module QingStor | |
| 324 405 |  | 
| 325 406 | 
             
                  public
         | 
| 326 407 |  | 
| 408 | 
            +
                  # image_process: Image process with the action on the object
         | 
| 409 | 
            +
                  # Documentation URL: https://docs.qingcloud.com/qingstor/data_process/image_process/index.html
         | 
| 410 | 
            +
                  def image_process(object_key, action: '',
         | 
| 411 | 
            +
                                    response_cache_control: '',
         | 
| 412 | 
            +
                                    response_content_disposition: '',
         | 
| 413 | 
            +
                                    response_content_encoding: '',
         | 
| 414 | 
            +
                                    response_content_language: '',
         | 
| 415 | 
            +
                                    response_content_type: '',
         | 
| 416 | 
            +
                                    response_expires: '', if_modified_since: '')
         | 
| 417 | 
            +
                    request = image_process_request object_key, action: action,
         | 
| 418 | 
            +
                      response_cache_control: response_cache_control,
         | 
| 419 | 
            +
                      response_content_disposition: response_content_disposition,
         | 
| 420 | 
            +
                      response_content_encoding: response_content_encoding,
         | 
| 421 | 
            +
                      response_content_language: response_content_language,
         | 
| 422 | 
            +
                      response_content_type: response_content_type,
         | 
| 423 | 
            +
                      response_expires: response_expires, if_modified_since: if_modified_since
         | 
| 424 | 
            +
                    request.send
         | 
| 425 | 
            +
                  end
         | 
| 426 | 
            +
             | 
| 427 | 
            +
                  def image_process_request(object_key, action: '',
         | 
| 428 | 
            +
                                            response_cache_control: '',
         | 
| 429 | 
            +
                                            response_content_disposition: '',
         | 
| 430 | 
            +
                                            response_content_encoding: '',
         | 
| 431 | 
            +
                                            response_content_language: '',
         | 
| 432 | 
            +
                                            response_content_type: '',
         | 
| 433 | 
            +
                                            response_expires: '', if_modified_since: '')
         | 
| 434 | 
            +
                    properties[:'object-key'] = object_key
         | 
| 435 | 
            +
                    input = {
         | 
| 436 | 
            +
                      config:           config,
         | 
| 437 | 
            +
                      properties:       properties,
         | 
| 438 | 
            +
                      api_name:         'Image Process',
         | 
| 439 | 
            +
                      request_method:   'GET',
         | 
| 440 | 
            +
                      request_uri:      '/<bucket-name>/<object-key>?image',
         | 
| 441 | 
            +
                      request_params:   {
         | 
| 442 | 
            +
                        'action'                       => action,
         | 
| 443 | 
            +
                        'response-cache-control'       => response_cache_control,
         | 
| 444 | 
            +
                        'response-content-disposition' => response_content_disposition,
         | 
| 445 | 
            +
                        'response-content-encoding'    => response_content_encoding,
         | 
| 446 | 
            +
                        'response-content-language'    => response_content_language,
         | 
| 447 | 
            +
                        'response-content-type'        => response_content_type,
         | 
| 448 | 
            +
                        'response-expires'             => response_expires
         | 
| 449 | 
            +
                      },
         | 
| 450 | 
            +
                      request_headers:  {
         | 
| 451 | 
            +
                        'If-Modified-Since' => if_modified_since
         | 
| 452 | 
            +
                      },
         | 
| 453 | 
            +
                      request_elements: {
         | 
| 454 | 
            +
                      },
         | 
| 455 | 
            +
                      request_body:     nil,
         | 
| 456 | 
            +
             | 
| 457 | 
            +
                      status_code:      [
         | 
| 458 | 
            +
                        200,
         | 
| 459 | 
            +
                        304
         | 
| 460 | 
            +
                      ]
         | 
| 461 | 
            +
                    }
         | 
| 462 | 
            +
             | 
| 463 | 
            +
                    image_process_input_validate input
         | 
| 464 | 
            +
                    Request.new input
         | 
| 465 | 
            +
                  end
         | 
| 466 | 
            +
             | 
| 467 | 
            +
                  private
         | 
| 468 | 
            +
             | 
| 469 | 
            +
                  def image_process_input_validate(input)
         | 
| 470 | 
            +
                    input.deep_stringify_keys!
         | 
| 471 | 
            +
             | 
| 472 | 
            +
                    unless !input['request_params']['action'].nil? && !input['request_params']['action'].to_s.empty?
         | 
| 473 | 
            +
                      raise ParameterRequiredError.new('action', 'ImageProcessInput')
         | 
| 474 | 
            +
                    end
         | 
| 475 | 
            +
                  end
         | 
| 476 | 
            +
             | 
| 477 | 
            +
                  public
         | 
| 478 | 
            +
             | 
| 327 479 | 
             
                  # initiate_multipart_upload: Initial multipart upload on the object.
         | 
| 328 480 | 
             
                  # Documentation URL: https://docs.qingcloud.com/qingstor/api/object/initiate_multipart_upload.html
         | 
| 329 481 | 
             
                  def initiate_multipart_upload(object_key, content_type: '',
         | 
| 330 482 | 
             
                                                x_qs_encryption_customer_algorithm: '',
         | 
| 331 483 | 
             
                                                x_qs_encryption_customer_key: '',
         | 
| 332 | 
            -
                                                x_qs_encryption_customer_key_md5: '' | 
| 484 | 
            +
                                                x_qs_encryption_customer_key_md5: '',
         | 
| 485 | 
            +
                                                x_qs_meta_data: {},
         | 
| 486 | 
            +
                                                x_qs_storage_class: '')
         | 
| 333 487 | 
             
                    request = initiate_multipart_upload_request object_key, content_type:                       content_type,
         | 
| 334 488 | 
             
                                                                            x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
         | 
| 335 489 | 
             
                                                                            x_qs_encryption_customer_key:       x_qs_encryption_customer_key,
         | 
| 336 | 
            -
                                                                            x_qs_encryption_customer_key_md5:   x_qs_encryption_customer_key_md5
         | 
| 490 | 
            +
                                                                            x_qs_encryption_customer_key_md5:   x_qs_encryption_customer_key_md5,
         | 
| 491 | 
            +
                                                                            x_qs_meta_data:                     x_qs_meta_data,
         | 
| 492 | 
            +
                                                                            x_qs_storage_class:                 x_qs_storage_class
         | 
| 337 493 | 
             
                    request.send
         | 
| 338 494 | 
             
                  end
         | 
| 339 495 |  | 
| 340 496 | 
             
                  def initiate_multipart_upload_request(object_key, content_type: '',
         | 
| 341 497 | 
             
                                                        x_qs_encryption_customer_algorithm: '',
         | 
| 342 498 | 
             
                                                        x_qs_encryption_customer_key: '',
         | 
| 343 | 
            -
                                                        x_qs_encryption_customer_key_md5: '' | 
| 499 | 
            +
                                                        x_qs_encryption_customer_key_md5: '',
         | 
| 500 | 
            +
                                                        x_qs_meta_data: {},
         | 
| 501 | 
            +
                                                        x_qs_storage_class: '')
         | 
| 344 502 | 
             
                    properties[:'object-key'] = object_key
         | 
| 345 503 | 
             
                    input = {
         | 
| 346 504 | 
             
                      config:           config,
         | 
| @@ -355,13 +513,16 @@ module QingStor | |
| 355 513 | 
             
                        'X-QS-Encryption-Customer-Algorithm' => x_qs_encryption_customer_algorithm,
         | 
| 356 514 | 
             
                        'X-QS-Encryption-Customer-Key'       => x_qs_encryption_customer_key,
         | 
| 357 515 | 
             
                        'X-QS-Encryption-Customer-Key-MD5'   => x_qs_encryption_customer_key_md5,
         | 
| 516 | 
            +
                        'X-QS-MetaData'                      => x_qs_meta_data,
         | 
| 517 | 
            +
                        'X-QS-Storage-Class'                 => x_qs_storage_class
         | 
| 358 518 | 
             
                      },
         | 
| 359 519 | 
             
                      request_elements: {
         | 
| 360 520 | 
             
                      },
         | 
| 361 521 | 
             
                      request_body:     nil,
         | 
| 522 | 
            +
             | 
| 362 523 | 
             
                      status_code:      [
         | 
| 363 | 
            -
                        200 | 
| 364 | 
            -
                      ] | 
| 524 | 
            +
                        200
         | 
| 525 | 
            +
                      ]
         | 
| 365 526 | 
             
                    }
         | 
| 366 527 |  | 
| 367 528 | 
             
                    initiate_multipart_upload_input_validate input
         | 
| @@ -372,6 +533,17 @@ module QingStor | |
| 372 533 |  | 
| 373 534 | 
             
                  def initiate_multipart_upload_input_validate(input)
         | 
| 374 535 | 
             
                    input.deep_stringify_keys!
         | 
| 536 | 
            +
             | 
| 537 | 
            +
                    if input['request_headers']['X-QS-Storage-Class'] && !input['request_headers']['X-QS-Storage-Class'].to_s.empty?
         | 
| 538 | 
            +
                      x_qs_storage_class_valid_values = %w[STANDARD STANDARD_IA]
         | 
| 539 | 
            +
                      unless x_qs_storage_class_valid_values.include? input['request_headers']['X-QS-Storage-Class'].to_s
         | 
| 540 | 
            +
                        raise ParameterValueNotAllowedError.new(
         | 
| 541 | 
            +
                          'X-QS-Storage-Class',
         | 
| 542 | 
            +
                          input['request_headers']['X-QS-Storage-Class'],
         | 
| 543 | 
            +
                          x_qs_storage_class_valid_values,
         | 
| 544 | 
            +
                        )
         | 
| 545 | 
            +
                      end
         | 
| 546 | 
            +
                    end
         | 
| 375 547 | 
             
                  end
         | 
| 376 548 |  | 
| 377 549 | 
             
                  public
         | 
| @@ -400,16 +572,17 @@ module QingStor | |
| 400 572 | 
             
                      request_params:   {
         | 
| 401 573 | 
             
                        'limit'              => limit,
         | 
| 402 574 | 
             
                        'part_number_marker' => part_number_marker,
         | 
| 403 | 
            -
                        'upload_id'          => upload_id | 
| 575 | 
            +
                        'upload_id'          => upload_id
         | 
| 404 576 | 
             
                      },
         | 
| 405 577 | 
             
                      request_headers:  {
         | 
| 406 578 | 
             
                      },
         | 
| 407 579 | 
             
                      request_elements: {
         | 
| 408 580 | 
             
                      },
         | 
| 409 581 | 
             
                      request_body:     nil,
         | 
| 582 | 
            +
             | 
| 410 583 | 
             
                      status_code:      [
         | 
| 411 | 
            -
                        200 | 
| 412 | 
            -
                      ] | 
| 584 | 
            +
                        200
         | 
| 585 | 
            +
                      ]
         | 
| 413 586 | 
             
                    }
         | 
| 414 587 |  | 
| 415 588 | 
             
                    list_multipart_input_validate input
         | 
| @@ -454,14 +627,17 @@ module QingStor | |
| 454 627 | 
             
                      request_headers:  {
         | 
| 455 628 | 
             
                        'Access-Control-Request-Headers' => access_control_request_headers,
         | 
| 456 629 | 
             
                        'Access-Control-Request-Method'  => access_control_request_method,
         | 
| 457 | 
            -
                        'Origin'                         => origin | 
| 630 | 
            +
                        'Origin'                         => origin
         | 
| 458 631 | 
             
                      },
         | 
| 459 632 | 
             
                      request_elements: {
         | 
| 460 633 | 
             
                      },
         | 
| 461 634 | 
             
                      request_body:     nil,
         | 
| 635 | 
            +
             | 
| 462 636 | 
             
                      status_code:      [
         | 
| 463 | 
            -
                        200, | 
| 464 | 
            -
             | 
| 637 | 
            +
                        200,
         | 
| 638 | 
            +
                        304,
         | 
| 639 | 
            +
                        412
         | 
| 640 | 
            +
                      ]
         | 
| 465 641 | 
             
                    }
         | 
| 466 642 |  | 
| 467 643 | 
             
                    options_object_input_validate input
         | 
| @@ -486,7 +662,9 @@ module QingStor | |
| 486 662 |  | 
| 487 663 | 
             
                  # put_object: Upload the object.
         | 
| 488 664 | 
             
                  # Documentation URL: https://docs.qingcloud.com/qingstor/api/object/put.html
         | 
| 489 | 
            -
                  def put_object(object_key,  | 
| 665 | 
            +
                  def put_object(object_key, cache_control: '',
         | 
| 666 | 
            +
                                 content_encoding: '',
         | 
| 667 | 
            +
                                 content_length: nil,
         | 
| 490 668 | 
             
                                 content_md5: '',
         | 
| 491 669 | 
             
                                 content_type: '',
         | 
| 492 670 | 
             
                                 expect: '',
         | 
| @@ -503,9 +681,14 @@ module QingStor | |
| 503 681 | 
             
                                 x_qs_encryption_customer_key_md5: '',
         | 
| 504 682 | 
             
                                 x_qs_fetch_if_unmodified_since: '',
         | 
| 505 683 | 
             
                                 x_qs_fetch_source: '',
         | 
| 684 | 
            +
                                 x_qs_meta_data: {},
         | 
| 685 | 
            +
                                 x_qs_metadata_directive: '',
         | 
| 506 686 | 
             
                                 x_qs_move_source: '',
         | 
| 687 | 
            +
                                 x_qs_storage_class: '',
         | 
| 507 688 | 
             
                                 body: nil)
         | 
| 508 | 
            -
                    request = put_object_request object_key,  | 
| 689 | 
            +
                    request = put_object_request object_key, cache_control:                                  cache_control,
         | 
| 690 | 
            +
                                                             content_encoding:                               content_encoding,
         | 
| 691 | 
            +
                                                             content_length:                                 content_length,
         | 
| 509 692 | 
             
                                                             content_md5:                                    content_md5,
         | 
| 510 693 | 
             
                                                             content_type:                                   content_type,
         | 
| 511 694 | 
             
                                                             expect:                                         expect,
         | 
| @@ -522,12 +705,17 @@ module QingStor | |
| 522 705 | 
             
                                                             x_qs_encryption_customer_key_md5:               x_qs_encryption_customer_key_md5,
         | 
| 523 706 | 
             
                                                             x_qs_fetch_if_unmodified_since:                 x_qs_fetch_if_unmodified_since,
         | 
| 524 707 | 
             
                                                             x_qs_fetch_source:                              x_qs_fetch_source,
         | 
| 708 | 
            +
                                                             x_qs_meta_data:                                 x_qs_meta_data,
         | 
| 709 | 
            +
                                                             x_qs_metadata_directive:                        x_qs_metadata_directive,
         | 
| 525 710 | 
             
                                                             x_qs_move_source:                               x_qs_move_source,
         | 
| 711 | 
            +
                                                             x_qs_storage_class:                             x_qs_storage_class,
         | 
| 526 712 | 
             
                                                             body:                                           body
         | 
| 527 713 | 
             
                    request.send
         | 
| 528 714 | 
             
                  end
         | 
| 529 715 |  | 
| 530 | 
            -
                  def put_object_request(object_key,  | 
| 716 | 
            +
                  def put_object_request(object_key, cache_control: '',
         | 
| 717 | 
            +
                                         content_encoding: '',
         | 
| 718 | 
            +
                                         content_length: nil,
         | 
| 531 719 | 
             
                                         content_md5: '',
         | 
| 532 720 | 
             
                                         content_type: '',
         | 
| 533 721 | 
             
                                         expect: '',
         | 
| @@ -544,7 +732,10 @@ module QingStor | |
| 544 732 | 
             
                                         x_qs_encryption_customer_key_md5: '',
         | 
| 545 733 | 
             
                                         x_qs_fetch_if_unmodified_since: '',
         | 
| 546 734 | 
             
                                         x_qs_fetch_source: '',
         | 
| 735 | 
            +
                                         x_qs_meta_data: {},
         | 
| 736 | 
            +
                                         x_qs_metadata_directive: '',
         | 
| 547 737 | 
             
                                         x_qs_move_source: '',
         | 
| 738 | 
            +
                                         x_qs_storage_class: '',
         | 
| 548 739 | 
             
                                         body: nil)
         | 
| 549 740 | 
             
                    properties[:'object-key'] = object_key
         | 
| 550 741 | 
             
                    input = {
         | 
| @@ -556,6 +747,8 @@ module QingStor | |
| 556 747 | 
             
                      request_params:   {
         | 
| 557 748 | 
             
                      },
         | 
| 558 749 | 
             
                      request_headers:  {
         | 
| 750 | 
            +
                        'Cache-Control'                                  => cache_control,
         | 
| 751 | 
            +
                        'Content-Encoding'                               => content_encoding,
         | 
| 559 752 | 
             
                        'Content-Length'                                 => content_length,
         | 
| 560 753 | 
             
                        'Content-MD5'                                    => content_md5,
         | 
| 561 754 | 
             
                        'Content-Type'                                   => content_type,
         | 
| @@ -573,14 +766,18 @@ module QingStor | |
| 573 766 | 
             
                        'X-QS-Encryption-Customer-Key-MD5'               => x_qs_encryption_customer_key_md5,
         | 
| 574 767 | 
             
                        'X-QS-Fetch-If-Unmodified-Since'                 => x_qs_fetch_if_unmodified_since,
         | 
| 575 768 | 
             
                        'X-QS-Fetch-Source'                              => x_qs_fetch_source,
         | 
| 769 | 
            +
                        'X-QS-MetaData'                                  => x_qs_meta_data,
         | 
| 770 | 
            +
                        'X-QS-Metadata-Directive'                        => x_qs_metadata_directive,
         | 
| 576 771 | 
             
                        'X-QS-Move-Source'                               => x_qs_move_source,
         | 
| 772 | 
            +
                        'X-QS-Storage-Class'                             => x_qs_storage_class
         | 
| 577 773 | 
             
                      },
         | 
| 578 774 | 
             
                      request_elements: {
         | 
| 579 775 | 
             
                      },
         | 
| 580 776 | 
             
                      request_body:     body,
         | 
| 777 | 
            +
             | 
| 581 778 | 
             
                      status_code:      [
         | 
| 582 | 
            -
                        201 | 
| 583 | 
            -
                      ] | 
| 779 | 
            +
                        201
         | 
| 780 | 
            +
                      ]
         | 
| 584 781 | 
             
                    }
         | 
| 585 782 |  | 
| 586 783 | 
             
                    put_object_input_validate input
         | 
| @@ -591,6 +788,28 @@ module QingStor | |
| 591 788 |  | 
| 592 789 | 
             
                  def put_object_input_validate(input)
         | 
| 593 790 | 
             
                    input.deep_stringify_keys!
         | 
| 791 | 
            +
             | 
| 792 | 
            +
                    if input['request_headers']['X-QS-Metadata-Directive'] && !input['request_headers']['X-QS-Metadata-Directive'].to_s.empty?
         | 
| 793 | 
            +
                      x_qs_metadata_directive_valid_values = %w[COPY REPLACE]
         | 
| 794 | 
            +
                      unless x_qs_metadata_directive_valid_values.include? input['request_headers']['X-QS-Metadata-Directive'].to_s
         | 
| 795 | 
            +
                        raise ParameterValueNotAllowedError.new(
         | 
| 796 | 
            +
                          'X-QS-Metadata-Directive',
         | 
| 797 | 
            +
                          input['request_headers']['X-QS-Metadata-Directive'],
         | 
| 798 | 
            +
                          x_qs_metadata_directive_valid_values,
         | 
| 799 | 
            +
                        )
         | 
| 800 | 
            +
                      end
         | 
| 801 | 
            +
                    end
         | 
| 802 | 
            +
             | 
| 803 | 
            +
                    if input['request_headers']['X-QS-Storage-Class'] && !input['request_headers']['X-QS-Storage-Class'].to_s.empty?
         | 
| 804 | 
            +
                      x_qs_storage_class_valid_values = %w[STANDARD STANDARD_IA]
         | 
| 805 | 
            +
                      unless x_qs_storage_class_valid_values.include? input['request_headers']['X-QS-Storage-Class'].to_s
         | 
| 806 | 
            +
                        raise ParameterValueNotAllowedError.new(
         | 
| 807 | 
            +
                          'X-QS-Storage-Class',
         | 
| 808 | 
            +
                          input['request_headers']['X-QS-Storage-Class'],
         | 
| 809 | 
            +
                          x_qs_storage_class_valid_values,
         | 
| 810 | 
            +
                        )
         | 
| 811 | 
            +
                      end
         | 
| 812 | 
            +
                    end
         | 
| 594 813 | 
             
                  end
         | 
| 595 814 |  | 
| 596 815 | 
             
                  public
         | 
| @@ -600,6 +819,15 @@ module QingStor | |
| 600 819 | 
             
                  def upload_multipart(object_key, part_number: nil,
         | 
| 601 820 | 
             
                                       upload_id: '', content_length: nil,
         | 
| 602 821 | 
             
                                       content_md5: '',
         | 
| 822 | 
            +
                                       x_qs_copy_range: '',
         | 
| 823 | 
            +
                                       x_qs_copy_source: '',
         | 
| 824 | 
            +
                                       x_qs_copy_source_encryption_customer_algorithm: '',
         | 
| 825 | 
            +
                                       x_qs_copy_source_encryption_customer_key: '',
         | 
| 826 | 
            +
                                       x_qs_copy_source_encryption_customer_key_md5: '',
         | 
| 827 | 
            +
                                       x_qs_copy_source_if_match: '',
         | 
| 828 | 
            +
                                       x_qs_copy_source_if_modified_since: '',
         | 
| 829 | 
            +
                                       x_qs_copy_source_if_none_match: '',
         | 
| 830 | 
            +
                                       x_qs_copy_source_if_unmodified_since: '',
         | 
| 603 831 | 
             
                                       x_qs_encryption_customer_algorithm: '',
         | 
| 604 832 | 
             
                                       x_qs_encryption_customer_key: '',
         | 
| 605 833 | 
             
                                       x_qs_encryption_customer_key_md5: '',
         | 
| @@ -607,6 +835,15 @@ module QingStor | |
| 607 835 | 
             
                    request = upload_multipart_request object_key, part_number: part_number,
         | 
| 608 836 | 
             
                      upload_id: upload_id, content_length: content_length,
         | 
| 609 837 | 
             
                      content_md5: content_md5,
         | 
| 838 | 
            +
                      x_qs_copy_range: x_qs_copy_range,
         | 
| 839 | 
            +
                      x_qs_copy_source: x_qs_copy_source,
         | 
| 840 | 
            +
                      x_qs_copy_source_encryption_customer_algorithm: x_qs_copy_source_encryption_customer_algorithm,
         | 
| 841 | 
            +
                      x_qs_copy_source_encryption_customer_key: x_qs_copy_source_encryption_customer_key,
         | 
| 842 | 
            +
                      x_qs_copy_source_encryption_customer_key_md5: x_qs_copy_source_encryption_customer_key_md5,
         | 
| 843 | 
            +
                      x_qs_copy_source_if_match: x_qs_copy_source_if_match,
         | 
| 844 | 
            +
                      x_qs_copy_source_if_modified_since: x_qs_copy_source_if_modified_since,
         | 
| 845 | 
            +
                      x_qs_copy_source_if_none_match: x_qs_copy_source_if_none_match,
         | 
| 846 | 
            +
                      x_qs_copy_source_if_unmodified_since: x_qs_copy_source_if_unmodified_since,
         | 
| 610 847 | 
             
                      x_qs_encryption_customer_algorithm: x_qs_encryption_customer_algorithm,
         | 
| 611 848 | 
             
                      x_qs_encryption_customer_key: x_qs_encryption_customer_key,
         | 
| 612 849 | 
             
                      x_qs_encryption_customer_key_md5: x_qs_encryption_customer_key_md5,
         | 
| @@ -617,6 +854,15 @@ module QingStor | |
| 617 854 | 
             
                  def upload_multipart_request(object_key, part_number: nil,
         | 
| 618 855 | 
             
                                               upload_id: '', content_length: nil,
         | 
| 619 856 | 
             
                                               content_md5: '',
         | 
| 857 | 
            +
                                               x_qs_copy_range: '',
         | 
| 858 | 
            +
                                               x_qs_copy_source: '',
         | 
| 859 | 
            +
                                               x_qs_copy_source_encryption_customer_algorithm: '',
         | 
| 860 | 
            +
                                               x_qs_copy_source_encryption_customer_key: '',
         | 
| 861 | 
            +
                                               x_qs_copy_source_encryption_customer_key_md5: '',
         | 
| 862 | 
            +
                                               x_qs_copy_source_if_match: '',
         | 
| 863 | 
            +
                                               x_qs_copy_source_if_modified_since: '',
         | 
| 864 | 
            +
                                               x_qs_copy_source_if_none_match: '',
         | 
| 865 | 
            +
                                               x_qs_copy_source_if_unmodified_since: '',
         | 
| 620 866 | 
             
                                               x_qs_encryption_customer_algorithm: '',
         | 
| 621 867 | 
             
                                               x_qs_encryption_customer_key: '',
         | 
| 622 868 | 
             
                                               x_qs_encryption_customer_key_md5: '',
         | 
| @@ -630,21 +876,31 @@ module QingStor | |
| 630 876 | 
             
                      request_uri:      '/<bucket-name>/<object-key>',
         | 
| 631 877 | 
             
                      request_params:   {
         | 
| 632 878 | 
             
                        'part_number' => part_number,
         | 
| 633 | 
            -
                        'upload_id'   => upload_id | 
| 879 | 
            +
                        'upload_id'   => upload_id
         | 
| 634 880 | 
             
                      },
         | 
| 635 881 | 
             
                      request_headers:  {
         | 
| 636 | 
            -
                        'Content-Length' | 
| 637 | 
            -
                        'Content-MD5' | 
| 638 | 
            -
                        'X-QS- | 
| 639 | 
            -
                        'X-QS- | 
| 640 | 
            -
                        'X-QS-Encryption-Customer- | 
| 882 | 
            +
                        'Content-Length'                                 => content_length,
         | 
| 883 | 
            +
                        'Content-MD5'                                    => content_md5,
         | 
| 884 | 
            +
                        'X-QS-Copy-Range'                                => x_qs_copy_range,
         | 
| 885 | 
            +
                        'X-QS-Copy-Source'                               => x_qs_copy_source,
         | 
| 886 | 
            +
                        'X-QS-Copy-Source-Encryption-Customer-Algorithm' => x_qs_copy_source_encryption_customer_algorithm,
         | 
| 887 | 
            +
                        'X-QS-Copy-Source-Encryption-Customer-Key'       => x_qs_copy_source_encryption_customer_key,
         | 
| 888 | 
            +
                        'X-QS-Copy-Source-Encryption-Customer-Key-MD5'   => x_qs_copy_source_encryption_customer_key_md5,
         | 
| 889 | 
            +
                        'X-QS-Copy-Source-If-Match'                      => x_qs_copy_source_if_match,
         | 
| 890 | 
            +
                        'X-QS-Copy-Source-If-Modified-Since'             => x_qs_copy_source_if_modified_since,
         | 
| 891 | 
            +
                        'X-QS-Copy-Source-If-None-Match'                 => x_qs_copy_source_if_none_match,
         | 
| 892 | 
            +
                        'X-QS-Copy-Source-If-Unmodified-Since'           => x_qs_copy_source_if_unmodified_since,
         | 
| 893 | 
            +
                        'X-QS-Encryption-Customer-Algorithm'             => x_qs_encryption_customer_algorithm,
         | 
| 894 | 
            +
                        'X-QS-Encryption-Customer-Key'                   => x_qs_encryption_customer_key,
         | 
| 895 | 
            +
                        'X-QS-Encryption-Customer-Key-MD5'               => x_qs_encryption_customer_key_md5
         | 
| 641 896 | 
             
                      },
         | 
| 642 897 | 
             
                      request_elements: {
         | 
| 643 898 | 
             
                      },
         | 
| 644 899 | 
             
                      request_body:     body,
         | 
| 900 | 
            +
             | 
| 645 901 | 
             
                      status_code:      [
         | 
| 646 | 
            -
                        201 | 
| 647 | 
            -
                      ] | 
| 902 | 
            +
                        201
         | 
| 903 | 
            +
                      ]
         | 
| 648 904 | 
             
                    }
         | 
| 649 905 |  | 
| 650 906 | 
             
                    upload_multipart_input_validate input
         |