Querying Gateways by Tag
Function
This API is used to query gateways by tag.
Constraints
When a policy is used to authorize users, this API can be called only when the apig:instance:listByTags action is contained.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/apigw/resource-instances/filter
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain it, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
offset |
No |
Long |
Offset from which the query starts. If the value is less than 0, it is automatically converted to 0. Default: 0 |
limit |
No |
Integer |
Number of items displayed on each page. A value less than or equal to 0 will be automatically converted to 20, and a value greater than 500 will be automatically converted to 500. Minimum: 1 Maximum: 500 Default: 20 |
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 |
---|---|---|
resources |
Array of TmsResourceResp objects |
Gateways |
total_count |
Integer |
Total number of records. |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Gateway ID. |
resouce_detail |
String |
Detailed description of the gateway. Not supported. |
resource_name |
String |
Gateway name. |
tags |
Array of TmsKeyValue objects |
Tags bound to the gateway. Array Length: 0 - 20 |
Parameter |
Type |
Description |
---|---|---|
key |
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 |
value |
String |
Value. You can enter letters, digits, and spaces or other special characters (_.:/=+-@) in UTF-8 format. Minimum: 0 Maximum: 255 |
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
-
Filtering gateways by tag
{ "without_any_tag" : false, "tags" : [ { "key" : "test-key", "values" : [ "test-value" ] } ], "matches" : [ { "key" : "resource_name", "value" : "test-apig" } ] }
-
Filtering gateways by enterprise project IDs
{ "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
Returned gateways
{ "resources" : [ { "resource_id" : "e120108ac331422cb539d8609e9a7bb2", "resouce_detail" : null, "resource_name" : "apig_instance", "tags" : [ { "key" : "test-key", "value" : "test-value" } ] } ], "total_count" : 1 }
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 |
Returned gateways |
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