PUT Part - Copy
API Description
After a multipart upload is initialized, you can use this API to copy a part to a specified bucket by using the multipart upload ID.
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 Parameter
| Field | Type | Optional or Mandatory |
|---|---|---|
| input | Mandatory |
Returned Result
| 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: PUT Part
Next Article: List Parts
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.