列举桶清单-ListBucketInventory
功能介绍
桶清单功能可以定期生成桶内对象的元数据信息,通过查看这些信息,可以帮助您更好地了解桶内对象的状态。调用本接口可以获取桶的所有清单配置,获取到的清单配置一次性返回,不分页。有关更多桶清单的介绍和使用限制,请参见桶清单。
授权信息
您必须是桶拥有者或拥有列举桶清单的权限,才能调用本接口,建议使用IAM或桶策略进行授权。了解更多OBS授权方式请参见OBS不同权限控制方式的区别。
- 如果使用IAM授权,那么请在“角色与策略授权”、“身份策略授权”两种IAM授权方式中选择一种,并配置相应权限:
- 如果使用角色与策略授权(旧版IAM,即IAM v3接口),需具备obs:bucket:GetBucketInventoryConfiguration权限,授权操作请参见创建IAM自定义策略。
- 如果使用身份策略授权(新版IAM,即IAM v5接口),如下表所示,需具备obs:bucket:getBucketInventoryConfiguration权限,授权操作请参见创建IAM自定义身份策略。
授权项
Action
访问级别
Access Level
资源类型(*为必须)
Resource Type (*: required)
Condition Key
Alias
依赖的授权项
Dependencies
obs:bucket:getBucketInventoryConfiguration
Read
bucket *
-
-
-
- obs:EpochTime
- obs:SourceIp
- obs:TlsVersion
- obs:CustomDomain
- 如果使用桶策略进行授权,需具备obs:bucket:GetBucketInventoryConfiguration权限,具体操作请参见自定义创建桶策略。
请求消息样式
以下为请求消息样例,请将示例中的BucketName修改为您的桶名,RegionID修改为桶所在的区域ID,可参考支持区域获取区域ID。
1 2 3 4 5 6 | GET /?inventory HTTP/1.1 User-Agent: curl/7.29.0 Host: BucketName.obs.RegionID.myhuaweicloud.com Accept: */* Date: GMT Date Authorization: SignatureValue |
URI参数(URI Parameters)
该请求消息中不使用URI参数。
请求头参数(Request headers)
该请求使用公共请求头,具体参见表3。
请求体参数(Request body)
该请求消息中不带请求体参数。
响应消息样式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | HTTP/1.1 status_code Server: OBS x-obs-request-id: request id x-obs-id-2: id Content-Type: application/xml Date: date Content-Length: length <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ListInventoryConfiguration xmlns="http://obs.cn-north-4.myhuaweicloud.com/doc/2015-06-30/"> <InventoryConfiguration> <Id>id</Id> <IsEnabled>true</IsEnabled> <Destination> <Format>CSV</Format> <Bucket>bucket</Bucket> <Prefix>prefix</Prefix> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <IncludedObjectVersions>Current</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>ReplicationStatus</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> </ListInventoryConfiguration> |
响应头 (Response Headers)
该请求的响应消息使用公共响应头,具体请参考表1。
响应体 (Response Body)
在此请求返回的响应消息体中包含的配置元素如表1。
| 名称 | 描述 |
|---|---|
| ListInventoryConfiguration | 桶清单配置列表。 类型:Container |
| InventoryConfiguration | 桶清单配置,配置元素见表2。 类型:Container 父节点:ListInventoryConfiguration |
错误响应消息
无特殊错误,所有错误已经包含在表2中。
请求示例
1 2 3 4 5 6 | GET /?inventory HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.cn-north-4.myhuaweicloud.com Accept: */* Date: Tue, 08 Jan 2019 09:32:24 +0000 Authorization: OBS UDSIAMSTUBTEST000001:ySWncC9M08jNsyXdJLSMJkpi7XM= |
响应示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | HTTP/1.1 200 OK Server: OBS x-obs-request-id: 000001682CB4C2EE6808A0D8DF9F3D00 x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSBjn5O7Jv9CqvUMO0BenehRdil1n8rR Content-Type: application/xml Date: Tue, 08 Jan 2019 09:04:30 GMT Content-Length: 626 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ListInventoryConfiguration xmlns="http://obs.cn-north-4.myhuaweicloud.com/doc/2015-06-30/"> <InventoryConfiguration> <Id>id1</Id> <IsEnabled>true</IsEnabled> <Destination> <Format>CSV</Format> <Bucket>bucket</Bucket> <Prefix>prefix</Prefix> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <IncludedObjectVersions>Current</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>ReplicationStatus</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> </ListInventoryConfiguration> |
使用SDK调用接口
建议您使用OBS SDK调用接口。SDK对API进行了封装以简化您的开发工作,直接调用SDK接口函数即可访问OBS,无需手动计算签名。
| Python不支持 | C不支持 | Go不支持 | BrowserJS不支持 | .NET不支持 | Android不支持 | iOS不支持 | PHP不支持 | Node.js不支持 | Harmony不支持 |

