Querying the Number of Gateways with a Specified Tag
Function
This API is used to query the number of gateways with a specified tag.
Constraints
When a policy is used to authorize users, this API can be called only when the apig:instance:getNumByTags action is contained.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/apigw/resource-instances/count
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain it, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
without_any_tag |
No |
Boolean |
Resources to be queried contain no tags. If this parameter is set to true, all resources without tags are queried. In this case, the tags field is ignored. If this parameter is set to false or not specified, it does not take effect. |
tags |
No |
Array of TmsKeyValues objects |
Included tags. A maximum of 20 keys are included. Each key can have a maximum of 20 values. If no tag filtering criteria is specified, full data is returned. Array Length: 0 - 20 |
sys_tags |
No |
Array of TmsKeyValues objects |
Enterprise project. Only the op_service permission can use this field to filter resources. If sys_tags is not used, resources are filtered by tag. If no tag filtering criteria is specified, full data is returned. Array Length: 0 - 1 |
matches |
No |
Array of TmsMatchesKeyValue objects |
Search criteria. The tag key is the field to match. Currently, only resource_name is supported. The tag value indicates the matched value. Check whether fuzzy match is required based on the key value. For example, if key is set to resource_name, prefix search is performed. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
Key. Include UTF-8 letters, digits, spaces, or special characters (_.:=+-@). Do not start with _sys_ because it is a system label. Minimum: 1 Maximum: 128 |
values |
No |
Array of strings |
Value. You can enter letters, digits, and spaces or other special characters (_.:/=+-@) in UTF-8 format. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
Specifies the field to be matched.
|
value |
No |
String |
Indicates the value. The value can contain UTF-8 letters, digits, spaces, and the following characters: (_.:/=+-@) : / = + - @ Maximum: 255 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total_count |
Integer |
Total number of records. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
-
Querying the number of gateways with a specified tag
{ "without_any_tag" : false, "tags" : [ { "key" : "test-key", "values" : [ "test-value" ] } ], "matches" : [ { "key" : "resource_name", "value" : "test-apig" } ] }
-
Querying the number of gateways with a specified enterprise project ID
{ "without_any_tag" : false, "sys_tags" : [ { "key" : "_sys_enterprise_project_id", "values" : [ "0" ] } ], "matches" : [ { "key" : "resource_name", "value" : "test-apig" } ] }
Example Responses
Status code: 200
OK
{ "total_count" : 20 }
Status code: 401
Unauthorized
{ "error_code" : "APIC.7102", "error_msg" : "Incorrect token or token resolution failed" }
Status code: 403
Forbidden
{ "error_code" : "APIC.7106", "error_msg" : "No permissions to request for the method" }
Status code: 500
Internal Server Error
{ "error_code" : "APIC.9000" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
401 |
Unauthorized |
403 |
Forbidden |
500 |
Internal Server Error |
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