uploadPartCopy - helper function to create a part in a multipart upload via an upload-part-copy request https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPartCopy.html
(ctx context.Context, bucket, object, uploadID string, partNumber int, headers http.Header, )
| 375 | // upload via an upload-part-copy request |
| 376 | // https://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadUploadPartCopy.html |
| 377 | func (c *Client) uploadPartCopy(ctx context.Context, bucket, object, uploadID string, partNumber int, |
| 378 | headers http.Header, |
| 379 | ) (p CompletePart, err error) { |
| 380 | // Build query parameters |
| 381 | urlValues := make(url.Values) |
| 382 | urlValues.Set("partNumber", strconv.Itoa(partNumber)) |
| 383 | urlValues.Set("uploadId", uploadID) |
| 384 | |
| 385 | // Send upload-part-copy request |
| 386 | resp, err := c.executeMethod(ctx, http.MethodPut, requestMetadata{ |
| 387 | bucketName: bucket, |
| 388 | objectName: object, |
| 389 | customHeader: headers, |
| 390 | queryValues: urlValues, |
| 391 | }) |
| 392 | defer closeResponse(resp) |
| 393 | if err != nil { |
| 394 | return p, err |
| 395 | } |
| 396 | |
| 397 | // Check if we got an error response. |
| 398 | if resp.StatusCode != http.StatusOK { |
| 399 | return p, httpRespToErrorResponse(resp, bucket, object) |
| 400 | } |
| 401 | |
| 402 | // Decode copy-part response on success. |
| 403 | cpObjRes := copyObjectResult{} |
| 404 | err = xmlDecoder(resp.Body, &cpObjRes) |
| 405 | if err != nil { |
| 406 | return p, err |
| 407 | } |
| 408 | p.PartNumber, p.ETag = partNumber, cpObjRes.ETag |
| 409 | return p, nil |
| 410 | } |
| 411 | |
| 412 | // ComposeObject - creates an object using server-side copying |
| 413 | // of existing objects. It takes a list of source objects (with optional offsets) |
no test coverage detected