HCP Tenant Management Help


Example 2: Adding an ACL to a bucket by using an ACL request body

Here’s a sample PUT request that uses an ACL request body to add an ACL to the finance bucket and, at the same time, change the owner of the bucket. The ACL grants read and write access to the bucket to user lgreen and changes the bucket owner to user mwhite. The ACL request body is in a file named acl-7.xml.

Request body

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
     <Owner>
          <ID>b9d39144-a081-4760-b0e8-b8fb51e10192</ID>
          <DisplayName>mwhite</DisplayName>
     </Owner>
     <AccessControlList>
          <Grant>
               <Grantee xsi:type="CanonicalUser"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID>
                    <DisplayName>lgreen</DisplayName>
               </Grantee>
               <Permission>READ</Permission>
          </Grant>
          <Grant>
               <Grantee xsi:type="CanonicalUser"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
               <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID>
               <DisplayName>lgreen</DisplayName>
          </Grantee>
          <Permission>WRITE</Permission>
          </Grant>
      </AccessControlList>
</AccessControlPolicy>

Request with s3curl command line

./s3curl.pl --id=lgreen --put acl-7.xml -- -k
     "https://europe.hcp.example.com/finance?acl"

Request headers

PUT /finance?acl HTTP/1.1
Host: europe.hcp.example.com
Date: Fri, 10 May 2019 17:19:26 +0000
Authorization: AWS bGdyZWVu:mVNu4YolbdvK+PVzmafhOvd1VgU=
Content-Length: 727

Response headers

HTTP/1.1 200 OK
Date: Fri, 10 May 2019 17:19:26 GMT
Content-Length: 0

© 2015, 2019 Hitachi Vantara Corporation. All rights reserved.