Querying Network ACLs Using Tags
Function
This API is used to query network ACLs using tags.
URI
POST /v3/{project_id}/firewalls/resource-instances/filter
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limit |
No |
Integer |
Number of records to be queried The value can be from 1 to 1000. The default value is 1000. Default: 1000 |
offset |
No |
Integer |
The index position. The query starts from the next piece of data indexed by this parameter. The value is 0 by default, indicating that the query starts from the first piece of data. The value cannot be a negative number. Default: 0 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
matches |
No |
Array of Match objects |
The key-value pair to be matched in the query.The key is a fixed dictionary value and must be a unique and supported key. The key can only be resource_name. |
tags |
No |
Array of ListTag objects |
The resources to be queried contain all tags listed in tags. A maximum of 50 tags can be specified. Each tag key can have a maximum of 10 tag values. Each tag value can be an empty array but the structure cannot be missing. Each tag key must be unique, and each tag value of a tag must also be unique.Resources with all tags listed in tags will be returned. Keys in this list are in an AND relationship while values in each key-value structure are in an OR relationship. If tags is not specified, all resources will be returned. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key. Currently, the tag key can only be the resource name. Maximum length: 128 Minimum: 1 Maximum: 128 |
value |
Yes |
String |
Tag value. Each value can contain a maximum of 255 Unicode characters. Maximum length: 255 Minimum: 0 Maximum: 255 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key The key cannot be left blank. Maximum length: 128 Minimum: 1 Maximum: 128 |
values |
Yes |
Array of strings |
Tag values. If values is left blank, it indicates any_value (querying any value). The values are in the OR relationship. Maximum length: 255 Maximum: 255 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
resources |
Array of ListResourceResp objects |
Resources |
total_count |
Integer |
Resource quantity |
request_id |
String |
Request ID |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Resource ID |
resource_detail |
Object |
Resource details that are used for extension. This parameter is left blank by default. |
resource_name |
String |
Resource name. This parameter is an empty string by default if there is no resource name. |
tags |
Array of ResourceTag objects |
A list of tags for queried resources to match against. This parameter is an empty array by default if there is no tag. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Tag key Tag keys must be unique for each resource. Maximum length: 128 Minimum: 1 Maximum: 128 |
value |
String |
Tag value Maximum length: 255 Maximum: 255 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID |
error_msg |
String |
Error message |
error_code |
String |
Error code |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID |
error_msg |
String |
Error message |
error_code |
String |
Error code |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID |
error_msg |
String |
Error message |
error_code |
String |
Error code |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID |
error_msg |
String |
Error message |
error_code |
String |
Error code |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID |
error_msg |
String |
Error message |
error_code |
String |
Error code |
Example Requests
Query network ACLs using tags and matches. A maximum of 100 records can be returned. The query starts from the first record.
https://{{Endpoint}}/v3/{project_id}/firewalls/resource-instances/filter?limit=100&offset=0 { "tags" : [ { "key" : "key1", "values" : [ "value1" ] } ], "matches" : [ { "key" : "resource_name", "value" : "network_aclv3_test" } ] }
Example Responses
Status code: 200
Normal request response
{ "resources" : [ { "resource_id" : "55046c0b-f38e-4bc4-988a-06529b34a7db", "resource_detail" : "", "resource_name" : "network_aclv3_test", "tags" : [ { "key" : "key1", "value" : "value1" }, { "key" : "key2", "value" : "value2" } ] }, { "resource_id" : "1828c600-793d-4570-987b-ac59f3ef0734", "resource_detail" : "", "resource_name" : "network_aclv3_test", "tags" : [ { "key" : "key1", "value" : "value1" }, { "key" : "key5", "value" : "value5" } ] } ], "request_id" : "2d9cef8c-4e17-40bc-9111-f3fc97b97294", "total_count" : 2 }
Status Codes
Status Code |
Description |
---|---|
200 |
Normal request response |
400 |
Invalid parameter |
401 |
Authentication failure |
403 |
Insufficient permissions |
404 |
Not found |
500 |
System exception |
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