Copying a Part
API Description
After a multipart upload is initialized, you can use this API to copy a part of a multipart upload task to a specified bucket.
Method Definition
func (obsClient ObsClient) CopyPart(input *CopyPartInput) (output *CopyPartOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) CopyPartWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header) (output *CopyPartOutput, err error)
Request Parameters
| Field | Type | Optional or Mandatory |
|---|---|---|
| input | Mandatory |
Returned Results
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
func main() { input := &obs.CopyPartInput{} input.Bucket = "bucketname" input.Key = "objectkey" input.CopySourceBucket = "sourcebucketname" input.CopySourceKey = "sourceobjectkey" input.UploadId = "uploadid" input.PartNumber = 1 input.CopySourceRangeStart = 0 input.CopySourceRangeEnd = 1024 output, err := obsClient.CopyPart(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) fmt.Printf("ETag:%s\n", output.ETag) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Last Article: Listing Uploaded Parts
Next Article: Aborting a Multipart Upload
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.