API | 操作名 | 操作描述 |
设置存储桶 ACL | 设置指定存储桶的访问权限控制列表(ACL) | |
查询存储桶 ACL | 获取指定存储桶的访问权限控制列表(ACL) |
API | 操作名 | 操作描述 |
设置对象 ACL | 设置 Bucket 中某个 Object (文件/对象)的 ACL | |
查询对象 ACL | 查询 Object(文件/对象)的 ACL |
public Guzzle\\Service\\Resource\\Model putBucketAcl(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->putBucketAcl(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'ACL' => 'private','Grants' => array(array('Grantee' => array('DisplayName' => 'qcs::cam::uin/100000000001:uin/100000000001','ID' => 'qcs::cam::uin/100000000001:uin/100000000001','Type' => 'CanonicalUser',),'Permission' => 'FULL_CONTROL',),// ... repeated),'Owner' => array('DisplayName' => 'qcs::cam::uin/100000000001:uin/100000000001','ID' => 'qcs::cam::uin/100000000001:uin/100000000001',)));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo "$e\\n";}
参数名称 | 类型 | 描述 | 父节点 |
Bucket | String | 存储桶名称,格式:BucketName-APPID | 无 |
Grants | Array | ACL权限列表 | 无 |
Grant | Array | ACL权限信息 | Grants |
Grantee | Array | ACL权限信息 | Grant |
Type | String | 所有者权限类型 | Grantee |
Permission | String | 权限类型,可选值: FULL_CONTROL 、 WRITE 、 READ | Grant |
ACL | String | 整体权限类型,可选值:private 、 public-read 、public-read-write | 无 |
Owner | String | 存储桶所有者信息 | 无 |
DisplayName | String | 权限所有者的名字信息 | Grantee/Owner |
ID | String | 权限所有者 ID | Grantee/Owner |
public Guzzle\\Service\\Resource\\Model getBucketAcl(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->getBucketAcl(array('Bucket' => 'examplebucket-1250000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
Array([data:protected] => Array([Owner] => Array([ID] => qcs::cam::uin/100000000001:uin/100000000001[DisplayName] => qcs::cam::uin/100000000001:uin/100000000001)[Grants] => Array([0] => Array([Grantee] => Array([ID] => qcs::cam::uin/100000000001:uin/100000000001[DisplayName] => qcs::cam::uin/100000000001:uin/100000000001)[Permission] => FULL_CONTROL))[RequestId] => NWE3YzhjMTRfYzdhMzNiMGFfYjdiOF8yYzZmMzU=))
参数名称 | 类型 | 描述 | 父节点 |
Grants | Array | ACL 权限列表 | 无 |
Grant | Array | ACL 权限信息 | Grants |
Grantee | Array | ACL 权限信息 | Grant |
Permission | String | 权限类型,可选值: FULL_CONTROL 、WRITE 、 READ | Grant |
Owner | String | 存储桶所有者信息 | 无 |
DisplayName | String | 权限所有者的名字信息 | Grantee/Owner |
ID | String | 权限所有者 ID | Grantee/Owner |
public Guzzle\\Service\\Resource\\Model putObjectAcl(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->putObjectAcl(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'Key' => 'exampleobject','ACL' => 'private','Grants' => array(array('Grantee' => array('DisplayName' => 'qcs::cam::uin/100000000001:uin/100000000001','ID' => 'qcs::cam::uin/100000000001:uin/100000000001','Type' => 'CanonicalUser',),'Permission' => 'FULL_CONTROL',),// ... repeated),'Owner' => array('DisplayName' => 'qcs::cam::uin/100000000001:uin/100000000001','ID' => 'qcs::cam::uin/100000000001:uin/100000000001',)));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo "$e\\n";}
参数名称 | 类型 | 描述 | 是否必填 |
Bucket | String | 存储桶名称,格式:BucketName-APPID | 是 |
Key | String | 对象键 | 是 |
Grants | Array | ACL权限列表 | 否 |
Grant | Array | ACL权限信息 | 否 |
Grantee | Array | ACL权限信息 | 否 |
Type | String | 所有者权限类型 | 否 |
Permission | String | 权限类型,可选值:FULL_CONTROL 、WRITE 、READ | 否 |
ACL | String | 整体权限类型,可选值:private 、 public-read | 否 |
Owner | String | 存储桶所有者信息 | 否 |
DisplayName | String | 权限所有者的名字信息 | 否 |
ID | String | 权限所有者 ID | 否 |
public Guzzle\\Service\\Resource\\Model getObjectAcl(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->getObjectAcl(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'Key' => 'exampleobject',));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
Array([data:protected] => Array([Owner] => Array([ID] => qcs::cam::uin/100000000001:uin/100000000001[DisplayName] => qcs::cam::uin/100000000001:uin/100000000001)[Grants] => Array([0] => Array([Grantee] => Array([ID] => qcs::cam::uin/100000000001:uin/100000000001[DisplayName] => qcs::cam::uin/100000000001:uin/100000000001)[Permission] => FULL_CONTROL))[RequestId] => NWE3YzhjMTRfYzdhMzNiMGFfYjdiOF8yYzZmMzU=))
参数名称 | 类型 | 描述 | 父节点 |
Grants | Array | ACL权限列表 | 无 |
Grant | Array | ACL权限信息 | Grants |
Grantee | Array | ACL权限信息 | Grant |
Permission | String | 权限类型,可选值:FULL_CONTROL 、WRITE 、 READ | Grant |
Owner | String | 存储桶所有者信息 | 无 |
DisplayName | String | 权限所有者的名字信息 | Grantee / Owner |
ID | String | 权限所有者 ID | Grantee / Owner |
本页内容是否解决了您的问题?