接口:CopyObject
2 分钟阅读
简要概述
拷贝文件 官方文档
接口解析
请求语法
PUT /{object_key} HTTP/1.1
Host: {bucket}.{endpoint}
x-amz-acl: ACL
Cache-Control: CacheControl
x-amz-checksum-algorithm: ChecksumAlgorithm
Content-Disposition: ContentDisposition
Content-Encoding: ContentEncoding
Content-Language: ContentLanguage
Content-Type: ContentType
x-amz-copy-source: CopySource
x-amz-copy-source-if-match: CopySourceIfMatch
x-amz-copy-source-if-modified-since: CopySourceIfModifiedSince
x-amz-copy-source-if-none-match: CopySourceIfNoneMatch
x-amz-copy-source-if-unmodified-since: CopySourceIfUnmodifiedSince
Expires: Expires
x-amz-grant-full-control: GrantFullControl
x-amz-grant-read: GrantRead
x-amz-grant-read-acp: GrantReadACP
x-amz-grant-write-acp: GrantWriteACP
x-amz-metadata-directive: MetadataDirective
x-amz-tagging-directive: TaggingDirective
x-amz-server-side-encryption: ServerSideEncryption
x-amz-storage-class: StorageClass
x-amz-website-redirect-location: WebsiteRedirectLocation
x-amz-server-side-encryption-customer-algorithm: SSECustomerAlgorithm
x-amz-server-side-encryption-customer-key: SSECustomerKey
x-amz-server-side-encryption-customer-key-MD5: SSECustomerKeyMD5
x-amz-server-side-encryption-aws-kms-key-id: SSEKMSKeyId
x-amz-server-side-encryption-context: SSEKMSEncryptionContext
x-amz-server-side-encryption-bucket-key-enabled: BucketKeyEnabled
x-amz-copy-source-server-side-encryption-customer-algorithm: CopySourceSSECustomerAlgorithm
x-amz-copy-source-server-side-encryption-customer-key: CopySourceSSECustomerKey
x-amz-copy-source-server-side-encryption-customer-key-MD5: CopySourceSSECustomerKeyMD5
x-amz-request-payer: RequestPayer
x-amz-tagging: Tagging
x-amz-object-lock-mode: ObjectLockMode
x-amz-object-lock-retain-until-date: ObjectLockRetainUntilDate
x-amz-object-lock-legal-hold: ObjectLockLegalHoldStatus
x-amz-expected-bucket-owner: ExpectedBucketOwner
x-amz-source-expected-bucket-owner: ExpectedSourceBucketOwner
URL 参数
名称 | 类型 | 是否必须 | 示例 | 说明 |
---|
请求结构
无。
响应语法
HTTP/1.1 200
x-amz-expiration: Expiration
x-amz-copy-source-version-id: CopySourceVersionId
x-amz-version-id: VersionId
x-amz-server-side-encryption: ServerSideEncryption
x-amz-server-side-encryption-customer-algorithm: SSECustomerAlgorithm
x-amz-server-side-encryption-customer-key-MD5: SSECustomerKeyMD5
x-amz-server-side-encryption-aws-kms-key-id: SSEKMSKeyId
x-amz-server-side-encryption-context: SSEKMSEncryptionContext
x-amz-server-side-encryption-bucket-key-enabled: BucketKeyEnabled
x-amz-request-charged: RequestCharged
<?xml version="1.0" encoding="UTF-8"?>
<CopyObjectResult>
<ETag>string</ETag>
<LastModified>timestamp</LastModified>
<ChecksumCRC32>string</ChecksumCRC32>
<ChecksumCRC32C>string</ChecksumCRC32C>
<ChecksumSHA1>string</ChecksumSHA1>
<ChecksumSHA256>string</ChecksumSHA256>
</CopyObjectResult>
响应参数
名称 | 类型 | 示例 | 说明 |
---|
请求示例
通过 rclone 进行测试
测试指令
./rclone \
--dump bodies \
--s3-force-path-style=false \
moveto \
minio:uptime/hello/a.txt minio:uptime/copy/from/hello-a.txt
请求响应
2023/06/21 13:53:53 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2023/06/21 13:53:53 DEBUG : HTTP REQUEST (req 0x14000828400)
2023/06/21 13:53:53 DEBUG : PUT /copy/from/hello-a.txt HTTP/1.1
Host: uptime.minio.dev.173ops.com
User-Agent: rclone/v1.62.2
Content-Length: 0
Authorization: XXXX
X-Amz-Acl: default
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Copy-Source: uptime/hello/a.txt
X-Amz-Date: 20230621T055353Z
X-Amz-Metadata-Directive: COPY
Accept-Encoding: gzip
2023/06/21 13:53:53 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2023/06/21 13:53:53 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2023/06/21 13:53:53 DEBUG : HTTP RESPONSE (req 0x14000828400)
2023/06/21 13:53:53 DEBUG : HTTP/1.1 200 OK
Content-Length: 232
Accept-Ranges: bytes
Connection: keep-alive
Content-Security-Policy: block-all-mixed-content
Content-Type: application/xml
Date: Wed, 21 Jun 2023 05:53:53 GMT
Etag: "6f5902ac237024bdd0c176cb93063dc4"
Server: nginx/1.16.1
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
Vary: Accept-Encoding
X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
X-Amz-Request-Id: 176A96D09F8DB7C8
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
<?xml version="1.0" encoding="UTF-8"?>
<CopyObjectResult
xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LastModified>2023-06-21T05:53:53.178Z</LastModified>
<ETag>"6f5902ac237024bdd0c176cb93063dc4"</ETag>
</CopyObjectResult>
2023/06/21 13:53:53 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
最后修改 2023.07.06: refactor: update some (5fe4b38)