Low level implementation of CopyObject API, supports only upto 5GiB worth of copy.
(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, metadata map[string]string, srcOpts CopySrcOptions, dstOpts PutObjectOptions, )
| 234 | |
| 235 | // Low level implementation of CopyObject API, supports only upto 5GiB worth of copy. |
| 236 | func (c *Client) copyObjectDo(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, |
| 237 | metadata map[string]string, srcOpts CopySrcOptions, dstOpts PutObjectOptions, |
| 238 | ) (ObjectInfo, error) { |
| 239 | // Build headers. |
| 240 | headers := make(http.Header) |
| 241 | |
| 242 | // Set all the metadata headers. |
| 243 | for k, v := range metadata { |
| 244 | headers.Set(k, v) |
| 245 | } |
| 246 | if !dstOpts.Internal.ReplicationStatus.Empty() { |
| 247 | headers.Set(amzBucketReplicationStatus, string(dstOpts.Internal.ReplicationStatus)) |
| 248 | } |
| 249 | if !dstOpts.Internal.SourceMTime.IsZero() { |
| 250 | headers.Set(minIOBucketSourceMTime, dstOpts.Internal.SourceMTime.Format(time.RFC3339Nano)) |
| 251 | } |
| 252 | if dstOpts.Internal.SourceETag != "" { |
| 253 | headers.Set(minIOBucketSourceETag, dstOpts.Internal.SourceETag) |
| 254 | } |
| 255 | if dstOpts.Internal.ReplicationRequest { |
| 256 | headers.Set(minIOBucketReplicationRequest, "true") |
| 257 | } |
| 258 | if dstOpts.Internal.ReplicationValidityCheck { |
| 259 | headers.Set(minIOBucketReplicationCheck, "true") |
| 260 | } |
| 261 | if !dstOpts.Internal.LegalholdTimestamp.IsZero() { |
| 262 | headers.Set(minIOBucketReplicationObjectLegalHoldTimestamp, dstOpts.Internal.LegalholdTimestamp.Format(time.RFC3339Nano)) |
| 263 | } |
| 264 | if !dstOpts.Internal.RetentionTimestamp.IsZero() { |
| 265 | headers.Set(minIOBucketReplicationObjectRetentionTimestamp, dstOpts.Internal.RetentionTimestamp.Format(time.RFC3339Nano)) |
| 266 | } |
| 267 | if !dstOpts.Internal.TaggingTimestamp.IsZero() { |
| 268 | headers.Set(minIOBucketReplicationTaggingTimestamp, dstOpts.Internal.TaggingTimestamp.Format(time.RFC3339Nano)) |
| 269 | } |
| 270 | |
| 271 | if len(dstOpts.UserTags) != 0 { |
| 272 | if tags, _ := tags.NewTags(dstOpts.UserTags, true); tags != nil { |
| 273 | headers.Set(amzTaggingHeader, tags.String()) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | reqMetadata := requestMetadata{ |
| 278 | bucketName: destBucket, |
| 279 | objectName: destObject, |
| 280 | customHeader: headers, |
| 281 | } |
| 282 | if dstOpts.Internal.SourceVersionID != "" { |
| 283 | if dstOpts.Internal.SourceVersionID != nullVersionID { |
| 284 | if _, err := uuid.Parse(dstOpts.Internal.SourceVersionID); err != nil { |
| 285 | return ObjectInfo{}, errInvalidArgument(err.Error()) |
| 286 | } |
| 287 | } |
| 288 | urlValues := make(url.Values) |
| 289 | urlValues.Set("versionId", dstOpts.Internal.SourceVersionID) |
| 290 | reqMetadata.queryValues = urlValues |
| 291 | } |
| 292 | |
| 293 | // Set the source header |
no test coverage detected