Query DNS resources by tag.
Resources are sorted by creation time in descending order.
POST /v2/{project_id}/{resource_type}/resource_instances/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. You can obtain it in Obtaining a Project ID. |
resource_type |
Yes |
String |
Resource type, which can be DNS-public_zone, DNS-private_zone, DNS-public_recordset, DNS-private_recordset, or DNS-ptr_record |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tags |
No |
Array of object |
Includes specified tags. For details, see Table 3. The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. One tag key can have up to 10 tag values. Each tag key must be unique, and the tag values of one key must also be unique. |
tags_any |
No |
Array of object |
Includes any of the specified tags. For details, see Table 3. The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. One tag key can have up to 10 tag values. Each tag key must be unique, and the tag values of one key must also be unique. |
not_tags |
No |
Array of object |
Excludes specified tags. For details, see Table 3. The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. One tag key can have up to 10 tag values. Each tag key must be unique, and the tag values of one key must also be unique. |
not_tags_any |
No |
Array of object |
Excludes any of the specified tags. For details, see Table 3. The structure body is mandatory. A maximum of 20 tag keys are allowed in each query operation. The tag key cannot be left blank or set to the empty string. One tag key can have up to 10 tag values. Each tag key must be unique, and the tag values of one key must also be unique. |
limit |
No |
Integer |
Number of resources on each page The value range is 1–1000.
|
offset |
No |
Integer |
Start offset of pagination query. The query will start from the next resource of the offset value. The value ranges from 0 to 2147483647. The default value is 0.
|
action |
Yes |
String |
Operation to be performed The value can be:
|
matches |
No |
Array of object |
Field to be matched. For details, see Table 4. This parameter specifies the key-value pair to be matched in the query. If value is left blank, an exact match is performed. Otherwise, a fuzzy match is performed. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key. A key contains 127 Unicode characters and cannot be blank. (This parameter is not verified in the search process.) |
values |
Yes |
Array of strings |
Values of the tag. A value contains a maximum of 255 Unicode characters. The asterisk (*) is a reserved character. If the value starts with an asterisk (*), fuzzy matching will work for the string following the asterisk. If this parameter is not specified, any value is matched. The values are in OR relationship. |
POST https://{DNS_Endpoint}/v2/{project_id}/DNS-private_zone/resource_instances/action
{ "offset": "100", "limit": "100", "action": "filter", "matches": [ { "key": "resource_name", "value": "resource1" } ], "not_tags": [ { "key": "key1", "values": [ "*value1", "value2" ] } ], "tags": [ { "key": "key1", "values": [ "*value1", "value2" ] } ], "tags_any": [ { "key": "key1", "values": [ "value1", "value2" ] } ], "not_tags_any": [ { "key": "key1", "values": [ "value1", "value2" ] } ] }
{ "action": "count", "not_tags": [ { "key": "key1", "values": [ "value1", "*value2" ] } ], "tags": [ { "key": "key1", "values": [ "value1", "value2" ] }, { "key": "key2", "values": [ "value1", "value2" ] } ], "tags_any": [ { "key": "key1", "values": [ "value1", "value2" ] } ], "not_tags_any": [ { "key": "key1", "values": [ "value1", "value2" ] } ], "matches": [ { "key": "resource_name", "value": "resource1" } ] }
Parameter |
Type |
Description |
---|---|---|
resources |
Array of object |
Resource list For details, see Table 6. |
total_count |
Integer |
Number of resources that meet the filter criteria. The number is irrelevant to limit or offset. |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Resource ID |
resource_detail |
String |
Resource details. This field is reserved for subsequent extension, and its value defaults to an empty string. |
tags |
Array of object |
List of queried tags. If no tag is matched, an empty array is returned. For details, see Table 2. |
resource_name |
String |
Resource name. If no resource name is matched, the value is left blank. |
{ "resources": [ { "resource_detail": null, "resource_id": "cdfs_cefs_wesas_12_dsad", "resource_name": "resouece1", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value1" } ] } ], "total_count": 1000 }
{ "total_count": 1000 }
If the API call returns a code of 2xx, for example, 200, 202, or 204, the request is successful.
For details, see Status Code.