Help Center/ Virtual Private Cloud/ API Reference/ API V3/ Network ACL Tag Management/ Querying the Number of Network ACLs Using Tags
Updated on 2024-08-01 GMT+08:00

Querying the Number of Network ACLs Using Tags

Function

This API is used to query the number of network ACLs using tags.

URI

POST /v3/{project_id}/firewalls/resource-instances/count

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

Request Parameters

Table 2 Request body 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.

Table 3 Match

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

Table 4 ListTag

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

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Request ID

total_count

Integer

Resource quantity

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

request_id

String

Request ID

error_msg

String

Error message

error_code

String

Error code

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

request_id

String

Request ID

error_msg

String

Error message

error_code

String

Error code

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

request_id

String

Request ID

error_msg

String

Error message

error_code

String

Error code

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

request_id

String

Request ID

error_msg

String

Error message

error_code

String

Error code

Status code: 500

Table 10 Response body parameters

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.

POST https://{{Endpoint}}/v3/{project_id}/firewalls/resource-instances/count

{
  "tags" : [ {
    "key" : "key1",
    "values" : [ "value1" ]
  } ],
  "matches" : [ {
    "key" : "resource_name",
    "value" : "network_aclv3_test"
  } ]
}

Example Responses

Status code: 200

Normal request response

{
  "request_id" : "239df34e-a651-4631-aaa1-d5fef231933a",
  "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.