This operation uploads a part by copying data from an existing object.
Usage notes
To copy an object larger than 1 GB, you must use the
upload-part-copycommand. To copy an object smaller than 1 GB in a single operation, see copy-object.The source bucket and the destination bucket must be in the same region.
Before uploading a part using this operation, you must first call the
initiate-multipart-uploadcommand to get an upload ID.
Permissions
By default, an Alibaba Cloud account has full permissions. RAM users or RAM roles under an Alibaba Cloud account do not have any permissions by default. The Alibaba Cloud account or account administrator must grant operation permissions through RAM policies or Bucket Policy.
|
API |
Action |
Description |
|
UploadPartCopy |
|
Reads data in the source object when you upload a part by copying data from an existing object. |
|
|
Writes data to the destination object when you upload a part by copying data from an existing object. |
|
|
|
When uploading a part by copying data from an existing object, if you specify the object version through versionId, this permission is required to read the specified version of the source object. |
Syntax
ossutil api upload-part-copy --bucket value --key value --copy-source value --part-number value --upload-id value [flags]Parameter | Type | Description |
--bucket | string | The name of the destination bucket. |
--key | string | The full path of the destination object. |
--copy-source | string | The source address for the copy operation (you must have read permission for the source) is in the format |
--copy-source-if-match | string | Copies the part only if the ETag of the source object matches the specified ETag. Otherwise, a 412 Precondition Failed error is returned. |
--copy-source-if-modified-since | string | Copies the part only if the source object has been modified since the specified time. Otherwise, a 304 Not Modified error is returned. |
--copy-source-if-none-match | string | Copies the part only if the ETag of the source object does not match the specified ETag. Otherwise, a 304 Not Modified error is returned. |
--copy-source-if-unmodified-since | string | Copies the part only if the source object has not been modified since the specified time. Otherwise, a 412 Precondition Failed error is returned. |
--copy-source-range | string | The byte range of the source object to copy. |
--part-number | string | The part number, which must be unique for each part in the multipart upload. |
--upload-id | string | The upload ID for the multipart upload. |
The
upload-part-copycommand wraps theUploadPartCopyAPI operation. For details about the API parameters, see the UploadPartCopy documentation.For more information about supported global command-line options, see Global command-line options.
Examples
Upload a part by copying data from the current version of
srcobjectin thesrcbucketbucket.ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1Upload a part by copying data and format the output as JSON.
ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --output-format jsonUpload a part by copying data and format the output as YAML.
ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --output-format yamlUpload a part by copying a specific range of bytes (0 to 9) from the source object.
ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --copy-source-range bytes=0-9Upload a part by copying data only if the ETag of the source object
srcobjectmatches123.ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --copy-source-if-match 123Upload a part by copying data only if the source object
srcobjectis unmodified since"Mon, 11 May 2020 08:16:23 GMT".ossutil api upload-part-copy --bucket examplebucket --key exampleobject --copy-source /srcbucket/srcobject --upload-id 123 --part-number 1 --copy-source-if-unmodified-since "Mon, 11 May 2020 08:16:23 GMT"