put object copy有两种类型,一种是同帐号不同bucket下的文件转移,另一种是不同账号之间的文件转移
同帐号之间的转移非常简单,直接发送请求即可,而不同帐号之间的转移,则需要设置被转移文件的acl,才能转移成功。
example
这里修改327874225账号下的lewzylu01桶中1.txt文件的acl,设置为对3210232098帐号可读
PUT /1.txt?acl HTTP/1.1
Accept-Encoding: identity
Host: lewzylu01-1253725992.cn-north.myqcloud.com
Content-Length: 436
Authorization: q-sign-algorithm=sha1&q-ak=AKIDKxVr2CINT0PcdTa6eGhFrMgnieU7wlTZ&q-sign-time=1501814639;1501824699&q-key-time=1501814639;1501824699&q-header-list=host&q-url-param-list=&q-signature=6d3647893af7803a68fd5a928dca03f566bf8ed0
<AccessControlPolicy>
<Owner>
<ID>qcs::cam::uin/327874225:uin/327874225</ID>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RootAccount">
<ID>qcs::cam::uin/3210232098:uin/3210232098</ID>
</Grantee>
<Permission>READ</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 0
Connection: keep-alive
Date: Fri, 04 Aug 2017 02:45:20 GMT
Server: tencent-cos
x-cos-request-id: NTk4M2RmYmZfOGFiMjM1MGFfMmE1Zl8xMWY5Zg==
再将cos://lewzylu01-1253725992.cn-north/1.txt复制到cos://lewzylu06-1252448703.cn-north/222.txt
PUT /222.txt HTTP/1.1 Host: lewzylu06-1252448703.cn-north.myqcloud.com
Connection: keep-alive Accept-Encoding: gzip, deflate Accept: */*
User-Agent: python-requests/2.12.4 Authorization: q-sign-algorithm=sha1&q-ak=AKID15IsskiBQKTZbAo6WhgcBqVls9SmuG00&q-sign-time=1480932292;1981012292&q-key-time=1480932292;1981012292&q-url-param-list=&q-header-list=host&q-signature=eacefe8e2a0dc8a18741d9a29707b1dfa5aa47cc
x-cos-copy-source: lewzylu01-1253725992.cn-north.myqcloud.com/1.txt
Content-Length: 0
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 133 Connection: keep-alive Date: Fri, 04 Aug 2017 02:41:45 GMT
Server: tencent-cos
x-cos-request-id: NTk4M2RlZTlfZDRiMDM1MGFfYTA1ZV8xMzNlYw==
<CopyObjectResult><ETag>"ba82b57cfdfda8bd17ad4e5879ebb4fe"</ETag><LastModified>2017-08-04T02:41:45</LastModified></CopyObjectResult>