Obtaining User Quota Information About a Tenant
Sample Code
You can use the API to query user quota information about a tenant. The following parameters are involved in this API: name, order, cursor, next, and limit. In this example, the query results are displayed in descending order and information about quotas of the users whose IDs are less than the value of cursor is displayed. Sample code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | // Import classes:
import com.huaweicloud.cs.java.v1.client.ApiException;
import com.huaweicloud.cs.java.v1.ClusterApi;
ClusterApi apiInstance = new ClusterApi(apiClient);//apiClient is created when initializing a CS API client.
String xProjectId = "xProjectId_example"; // String | Project ID used for obtaining the token for the project.
String name = "name_example"; // String | Username.
String cursor = "cursor_example"; // String | User ID.
Boolean next = true; // Boolean | Whether to turn to the previous or next page.
Integer limit = 20; // Integer | Number of returned data records.
String order = "desc"; // String | Query result display. The query results can be displayed in ascending or descending order.
try {
QueryUserQuotasResponse result = apiInstance.getUserQuotas(xProjectId, name, cursor, next, limit, order);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ClusterApi#getUserQuotas");
System.err.println(e.getResponseBody());
e.printStackTrace();
}
|
Parameter Description
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| xProjectId | Yes | String | Project ID. This parameter is used to obtain the token for the project. |
| name | No | String | Username. |
| cursor | No | String | User ID cursor. |
| next | No | Boolean | Whether to switch to the previous or next page. The default value is true. |
| limit | No | Integer | Number of returned data records. The default value is 20. |
| order | No | String | Query result display. Value asc indicates that the query results are displayed in ascending order, and value desc indicates that the query results are displayed in descending order. The default value is desc. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| messageId | No | String | Message type ID. |
| message | No | String | Message content. |
| currentTime | No | Integer | Current time, expressed by milliseconds. |
| payload | No | Integer | Number of user quota query results. |
| users | No | - | For details, see Table 3. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| userId | No | String | User ID. |
| userName | No | String | Username. |
| spuUsed | No | Integer | SPU quota used by a user. |
| spuQuota | No | Integer | Maximum SPU quota of a user. |
| clusters | No | Array | List of clusters that users can use. For details about parameter types, see Table 4. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | No | Integer | Cluster ID. |
| name | No | String | Cluster name. |
Last Article: Updating Quota Information About a Specified User
Next Article: Creating a VPC Peering Connection
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.