
# 查询topic的磁盘存储情况 - ShowKafkaTopicPartitionDiskusage
#### 功能介绍
查询topic在Broker上磁盘占用情况。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/ROMA/doc?api=ShowKafkaTopicPartitionDiskusage)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-roma/roma_06_0018.html)。
#### URI
GET /v2/{project_id}/mqs/instances/{instance_id}/topics/diskusage
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述    |
|:---|:---|:---|:---|
| project_id  | 是    | String | 项目ID。 |
| instance_id | 是    | String | 实例ID。 |
   
表2Query参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                           |
|:---|:---|:---|:---|
| minSize    | 否    | String | 占用磁盘大小，单位(K、M、G)。范围：1-10000。（minSize，top和percentage参数不能同时为空） |
| top        | 否    | String | 占用磁盘大小，查询top N。范围：1-1000。（minSize，top和percentage参数不能同时为空）    |
| percentage | 否    | String | 占用磁盘大小，查询大于占比的分区。范围：1-100。（minSize，top和percentage参数不能同时为空）   |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数                       | 参数类型                                                                                          | 描述        |
|:---|:---|:---|
| broker_name              | String                                                                                        | broker名称。 |
| data_disk_size           | String                                                                                        | 磁盘大小。     |
| data_disk_use            | String                                                                                        | 已使用磁盘大小。  |
| data_disk_free           | String                                                                                        | 空闲磁盘大小。   |
| data_disk_use_percentage | Integer                                                                                       | 磁盘使用率。    |
| status                   | String                                                                                        | 查询状态。     |
| topic_list               | Array of [TopicListEnity] objects | Topic列表。  |
   
 表5TopicListEnity 
| 参数              | 参数类型    | 描述       |
|:---|:---|:---|
| size            | String  | 大小。      |
| topic_name      | String  | Topic名称。 |
| topic_partition | Integer | Topic分区。 |
| percentage      | String  | 使用百分比。   |
   
**状态码：400**
表6响应Body参数 
| 参数         | 参数类型   | 描述    |
|:---|:---|:---|
| error_code | String | 错误码。  |
| error_msg  | String | 错误信息。 |
   
**状态码：403**
表7响应Body参数 
| 参数         | 参数类型   | 描述    |
|:---|:---|:---|
| error_code | String | 错误码。  |
| error_msg  | String | 错误信息。 |
   
#### 请求示例
查询成功。
```
"GET https://{endpoint}/v2/{project_id}/instances/{instance_id}/topics/diskusage?minSize=1G"
{
  "broker_list" : [ {
    "broker_name" : "broker-0",
    "data_disk_size" : "66G",
    "data_disk_use" : "53M",
    "data_disk_free" : "63G",
    "data_disk_use_percentage" : "1",
    "status" : "Success get info",
    "topic_list" : [ {
      "size" : "12K",
      "topic_name" : "topic-test",
      "topic_partition" : "2",
      "percentage" : 1.7339533025568183E-5
    }, {
      "size" : "12K",
      "topic_name" : "__consumer_offsets",
      "topic_partition" : "4",
      "percentage" : 1.7339533025568183E-5
    }, {
      "size" : "12K",
      "topic_name" : "__consumer_offsets",
      "topic_partition" : "3",
      "percentage" : 1.7339533025568183E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "6",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "4",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "2",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "0",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "topic-test",
      "topic_partition" : "0",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "topic-1568537362",
      "topic_partition" : "2",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__consumer_offsets",
      "topic_partition" : "7",
      "percentage" : 1.1559688683712121E-5
    } ]
  } ]
}
```
#### 响应示例
**状态码：200**
OK
```
{
  "broker_list" : [ {
    "broker_name" : "broker-0",
    "data_disk_size" : "66G",
    "data_disk_use" : "53M",
    "data_disk_free" : "63G",
    "data_disk_use_percentage" : "1",
    "status" : "Success get info",
    "topic_list" : [ {
      "size" : "12K",
      "topic_name" : "topic-test",
      "topic_partition" : "2",
      "percentage" : 1.7339533025568183E-5
    }, {
      "size" : "12K",
      "topic_name" : "__consumer_offsets",
      "topic_partition" : "4",
      "percentage" : 1.7339533025568183E-5
    }, {
      "size" : "12K",
      "topic_name" : "__consumer_offsets",
      "topic_partition" : "3",
      "percentage" : 1.7339533025568183E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "6",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "4",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "2",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__trace",
      "topic_partition" : "0",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "topic-test",
      "topic_partition" : "0",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "topic-1568537362",
      "topic_partition" : "2",
      "percentage" : 1.1559688683712121E-5
    }, {
      "size" : "8.0K",
      "topic_name" : "__consumer_offsets",
      "topic_partition" : "7",
      "percentage" : 1.1559688683712121E-5
    } ]
  } ]
}
```
**状态码：400**
查询失败。
```
{
  "error_code" : 400,
  "error_msg" : "Bad Request"
}
```
**状态码：403**
查询失败。
```
{
  "error_code" : 403,
  "error_msg" : "Forbidden"
}
```
#### 状态码
| 状态码 | 描述    |
|:---|:---|
| 200 | OK    |
| 400 | 查询失败。 |
| 403 | 查询失败。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-roma/ErrorCode.html)。
