Querying Quota Information About a Specified User

Sample Code

You can use the API to query quota information about a specified user. Sample code is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
// 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 userId = "userId_example"; // String | User ID
try {
    QueryUserQuotaResponse result = apiInstance.getUserQuota(xProjectId, userId);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling ClusterApi#getUserQuota");
    System.err.println(e.getResponseBody());
    e.printStackTrace();
}

Parameter Description

Table 1 Parameters

Parameter

Mandatory

Type

Description

xProjectId

Yes

String

Project ID. This parameter is used to obtain the token for the project.

userId

Yes

String

User ID.

Table 2 Parameters involved in QueryUserQuotaResponse

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

-

For details about parameter types, see Table 3.

Table 3 Parameters involved in UserQuotaInfo

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.

Table 4 Parameters involved in UserCluster

Parameter

Mandatory

Type

Description

id

No

Integer

Cluster ID.

name

No

String

Cluster name.