put object copy有兩種類型宗收,一種是同帳號(hào)不同bucket下的文件轉(zhuǎn)移,另一種是不同賬號(hào)之間的文件轉(zhuǎn)移
同帳號(hào)之間的轉(zhuǎn)移非常簡(jiǎn)單,直接發(fā)送請(qǐng)求即可并淋,而不同帳號(hào)之間的轉(zhuǎn)移,則需要設(shè)置被轉(zhuǎn)移文件的acl珍昨,才能轉(zhuǎn)移成功县耽。
example
這里修改327874225賬號(hào)下的lewzylu01桶中1.txt文件的acl,設(shè)置為對(duì)3210232098帳號(hào)可讀
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復(fù)制到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>