Put Object Copy使用實(shí)例

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>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容