PUT Object Copy

最近更新时间:2020-04-07 06:04:30

PUT Object - Copy


Description

This PUT interface can copy an existing object to a bucket in KS3. The user specifies the data source to be copied by configuring the request header x-kss-copy-source in the request.

The maximum size of the source file that can be copied by the PUT Object Copy interface is 1GB. If you need to copy more than 1GB of the source file, please use Upload Part Copy Interface for block copy.

The PUT Object Copy interface does not support cross Region copy temporarily.

Through this interface, users can move, rename, modify object metadata and modify storage type.

Unless the storage type is explicitly specified in this interface request, the target object remains the default storage type of the target bucket regardless of the processing method. For details, please refer to Bucket Type.

The put object copy interface supports cross account copying, but users need to have read permission to copy objects and write permission to the target space.

Request

Syntax

PUT /{destinationObject} HTTP/1.1
Host: {destinationBucket}.{endpoint}
x-kss-copy-source: {/source_bucket/sourceObject}
Authorization: {SignatureValue}
Date: {date}

Attention:

Request Parameters

The request does not use the request parameter.

Request Headers

This interface can use all the common request headers. In addition, it can also use the request headers listed in the following table. For more information, please click Public Request Headers.

Name Description Required
x-kss-copy-source The combination of the space name and the object key name of the object is separated by a slash('/')
Type: String
Default: None
Constraint: its value must be URL encoded. In addition, the space name must be valid, and the user needs to have read permission on the copied object.
Yes
x-kss-metadata-directive Specify whether to copy the metadata information of the source Object, Valid Value: COPY, REPLACE. If this option is not specified, it defaults to COPY.
COPY:The meta information of the target Object will be copied from the source object (including the user-defined x-kss-meta - * header and the standard HTTP header header header). The newly specified information in the request does not take effect.
REPLACE:Ignoring the meta information of the source Object, the target Object directly uses the meta information specified in the request.
Notes:If you only need to modify the Object meta information without copying, you need to set the requested object key and x-kss-copy-source to be the same, and set this option to REPLACE, then the newly specified information in the request will be modified.
In addition, it should be noted that if there are multiple meta information of the original object,
except Content-MD5, content-part-md5,
Content-Length, server-side-encryption-customer-key-MD5,other meta information of the object that does not need to be modified in addition to a also needs to be added
If the source object uses encrypted storage, you need to specify x-kss-service-side-encryption - * and x-kss-copy-source-server-side-encryption - * as the source file encryption information.
No
x-kss-storage-class Set the storage class.
Type:String
Default:None
Valid Value:STANDARD/STANDARD_IA/ARCHIVE
Storage type reference Storage Type Introduction.
Notes:1. When the x-kss-storage-class is not uploaded, if the bucket is the archive type, the object will be the archive type automatically. If the bucket is the non archive type, the object will be the standard type automatically 2. If the original file storage type is archive, it can only be modified successfully if it is in unfreezing status.
Constraints:None
No
Server-Side Encryption Specific Request Headers

Attention:If the source Object is not encrypted, encryption of the target Object is not supported. And the encryption method of the target Object should be the same as that of the source Object. If the source Object is the key encryption provided by the customer, the target Object should use the same encryption key.

If you need to use the default encryption for the target Object, you need the following headers

Name Description Required
x-kss-server-side-encryption If server-side encryption is used to store object, the response will contain the header, and the value is the encryption algorithm used.
Type:String
Yes

If the user needs to encrypt the target Object with the secret key provided by the user, the following header is required

Name Description Required
x-kss-server-side-encryption-customer-key The base64-encoded encryption key used by KS3 encryption is specified by the user.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-algorithm,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-server-side-encryption-customer-algorithm If the server uses the encryption key provided by the user for encryption, the response will include the header to confirm the decryption algorithm used when the request is decrypted.
Type:String
Valid Value:AES256
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-server-side-encryption-customer-key-MD5 If the server uses the encryption key provided by the user for encryption, the response will include the header to provide the data consistency verification information of the encryption key provided by the user when the request is decrypted.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-algorithmare used at the same time
Yes
x-kss-copy-source-server-side-encryption-customer-key The base64-encoded encryption key used by KS3 encryption is specified by the user.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-algorithm,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-copy-source-server-side-encryption-customer-algorithm If the server uses the encryption key provided by the user for encryption, the response will include the header to confirm the decryption algorithm used when the request is decrypted.
Type:String
Valid Value:AES256
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-key-MD5 are used at the same time
Yes
x-kss-copy-source-server-side-encryption-customer-key-MD5 If the server uses the encryption key provided by the user for encryption, the response will include the header to provide the data consistency verification information of the encryption key provided by the user when the request is decrypted.
Type:String
Constraint: required and valid x-kss-server-side-encryption-customer-key,x-kss-server-side-encryption-customer-algorithmare used at the same time
Yes

Request Elements

The interface does not use the requested content.

Response

Response Headers

This interface can use all common response headers. For more information, please click Public Response Headers.

Name Description
x-kss-server-side-encryption If server-side encryption is used to store object, the response will contain the header, and the value is the encryption algorithm used.
Type:String
x-kss-server-side-encryption-customer-algorithm If the server uses the encryption key provided by the user for encryption, the response will include the header to confirm the decryption algorithm used when the request is decrypted.
Type:String
Valid Value:AES256
x-kss-server-side-encryption-customer-key-MD5 If the server uses the encryption key provided by the user for encryption, the response will include the header to provide the data consistency verification information of the encryption key provided by the user when the request is decrypted.
Type:String

Response Elements

Name Description
CopyObjectResult Container for the response content.
Type: Container
Ancestors: None
ETag Returns the entity label of a new object. The influencing factor is that the content of the object is independent of the object name or metadata.
Type: String
Ancestors: CopyObjectResult
LastModified Returns the last modified time and date.
Type: String
Ancestors: CopyObjectResult

Special Errors

The request does not return any special errors.

Examples

Sample Normal Replication Request

PUT /rename-image.jpg HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyun.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
x-kss-copy-source: /SourceBucket/SourceObjectKey
Authorization: authorization string

Sample Normal Response

HTTP/1.1 200 OK
Date: Wed, 28 Oct 2009 22:32:00 GMT
Connection: close
Server: Tengine

Sample Modify Metadata Request

PUT /modifymetakey HTTP/1.1
Host: ks3-example.ks3-cn-beijing.ksyun.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
x-kss-copy-source: /bucket/modifymetakey
x-kss-metadata-directive:REPLACE
x-kss-meta-youmetakey:yourmetavalue
Authorization: authorization string

Sample Modify Metadata Response

HTTP/1.1 200 OK
Date: Wed, 28 Oct 2009 22:32:00 GMT
Connection: close
Server: Tengine

<CopyObjectResult>
<LastModified>2009-10-28T22:32:00</LastModified>
<ETag>"9b2cf535f27731c974343645a3985328"</ETag>
</CopyObjectResult>

Sample Modify Object Storage Type Request

PUT /yourobjectkey HTTP/1.1
Host: yourbucket.ks3-cn-beijing.ksyun.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
x-kss-copy-source: /yourbucket/yourobjectkey
x-kss-storage-class:STANDARD_IA
Authorization: authorization string

Sample Modify Object Storage Type Response

HTTP/1.1 200 OK
Date: Wed, 28 Oct 2009 22:32:00 GMT
Connection: close
Server: Tengine

<CopyObjectResult>
<LastModified>2009-10-28T22:32:00</LastModified>
<ETag>"9b2cf535f27731c974343645a3985328"</ETag>
</CopyObjectResult>

Interface Detail Analysis

  • The user must have read permission on the Object of the source bucket and write permission on the target Bucket.
  • If the key with the same name already exists in the target storage you want to copy, KS3 will return 400.
  • Object modifiable metadata includes:
    1. HTTP header:Content-Type,Content-Length, Cache-Control, Content-Disposition, Content-Encoding,Expires
    2. x-kss-meta-

金山云,开启您的云计算之旅

注册有礼