summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/minio/minio-go/api-put-object-copy.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/minio/minio-go/api-put-object-copy.go')
-rw-r--r--vendor/github.com/minio/minio-go/api-put-object-copy.go56
1 files changed, 3 insertions, 53 deletions
diff --git a/vendor/github.com/minio/minio-go/api-put-object-copy.go b/vendor/github.com/minio/minio-go/api-put-object-copy.go
index 56978d427..32fa873d8 100644
--- a/vendor/github.com/minio/minio-go/api-put-object-copy.go
+++ b/vendor/github.com/minio/minio-go/api-put-object-copy.go
@@ -16,57 +16,7 @@
package minio
-import (
- "net/http"
-
- "github.com/minio/minio-go/pkg/s3utils"
-)
-
-// CopyObject - copy a source object into a new object with the provided name in the provided bucket
-func (c Client) CopyObject(bucketName string, objectName string, objectSource string, cpCond CopyConditions) error {
- // Input validation.
- if err := isValidBucketName(bucketName); err != nil {
- return err
- }
- if err := isValidObjectName(objectName); err != nil {
- return err
- }
- if objectSource == "" {
- return ErrInvalidArgument("Object source cannot be empty.")
- }
-
- // customHeaders apply headers.
- customHeaders := make(http.Header)
- for _, cond := range cpCond.conditions {
- customHeaders.Set(cond.key, cond.value)
- }
-
- // Set copy source.
- customHeaders.Set("x-amz-copy-source", s3utils.EncodePath(objectSource))
-
- // Execute PUT on objectName.
- resp, err := c.executeMethod("PUT", requestMetadata{
- bucketName: bucketName,
- objectName: objectName,
- customHeader: customHeaders,
- })
- defer closeResponse(resp)
- if err != nil {
- return err
- }
- if resp != nil {
- if resp.StatusCode != http.StatusOK {
- return httpRespToErrorResponse(resp, bucketName, objectName)
- }
- }
-
- // Decode copy response on success.
- cpObjRes := copyObjectResult{}
- err = xmlDecoder(resp.Body, &cpObjRes)
- if err != nil {
- return err
- }
-
- // Return nil on success.
- return nil
+// CopyObject - copy a source object into a new object
+func (c Client) CopyObject(dst DestinationInfo, src SourceInfo) error {
+ return c.ComposeObject(dst, []SourceInfo{src})
}