Querying Resource Quantity
Function
This API is used to query the number of resources.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
cts:resource:count
List
-
-
-
-
URI
POST /v3/{project_id}/{resource_type}/resource-instances/count
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. |
|
resource_type |
Yes |
String |
Resource type. The value is cts-tracker. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
without_any_tag |
No |
Boolean |
Whether to query only untagged resources. If this parameter is set to true, all resources without tags are queried. In this case, the true field is ignored. If this parameter is set to false or not specified, it does not take effect, meaning that all resources are returned or resources are filtered by tags or matches. |
|
tags |
No |
Array of TmsTags objects |
Tag list. A maximum of 20 keys can be included. Each key has a maximum of 20 values. |
|
matches |
No |
Array of Match objects |
Field to be matched. This parameter specifies the key-value pair to be matched in the query. If value is left blank, exact matching will work. Otherwise, fuzzy matching will work. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
total_count |
Integer |
Total number of records. |
Example Requests
https://{endpoint}/v3/{project_id}/{resource_type}/resource-instances/count
{
"offset" : "100",
"limit" : "100",
"action" : "count",
"without_any_tag" : true,
"tags" : [ {
"key" : "key1",
"values" : [ "*value1", "value2" ]
} ],
"tags_any" : [ {
"key" : "key1",
"values" : [ "*value1", "value2" ]
} ],
"not_tags" : [ {
"key" : "key1",
"values" : [ "*value1", "value2" ]
} ],
"not_tags_any" : [ {
"key" : "key1",
"values" : [ "*value1", "value2" ]
} ],
"sys_tags" : [ {
"key" : "key1",
"values" : [ "*value1", "value2" ]
} ],
"matches" : [ {
"key" : "resource_name",
"value" : "resource1"
} ]
}
Example Responses
Status code: 200
Request succeeded.
{
"total_count" : 1000
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Request succeeded. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot