更新时间:2021-03-18 GMT+08:00
分享

获取桶标签

功能说明

获取指定桶的标签。

方法定义

1. ObsClient->getBucketTagging(array $parameter)
2. ObsClient->getBucketTaggingAsync(array $parameter, callable $callback)

请求参数

字段名

类型

约束

说明

Bucket

string

必选

桶名。

返回结果

字段名

类型

说明

HttpStatusCode

integer

HTTP状态码。

Reason

string

HTTP文本描述。

RequestId

string

OBS服务端返回的请求ID。

Tags

indexed array

桶标签列表。

  

Key

string

标签的名字,最大36个字符。

Value

string

标签的值,最大43个字符。

代码样例

try{
       $resp = $obsClient -> getBucketTagging([
              'Bucket' => 'bucketname'
       ]);
       printf("RequestId:%s\n", $resp['RequestId']);
       foreach ($resp['Tags'] as $index => $tag){
              printf("TagSet[%d]\n", $index + 1);
              printf("Key:%s\n", $tag['Key']);
              printf("Value:%s\n", $tag['Value']);
       }
}catch (Obs\Common\ObsException $obsException){
       printf("ExceptionCode:%s\n", $obsException->getExceptionCode());              
       printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}
分享:

    相关文档

    相关产品