Reviewed-by: Sarda, Priya <prsarda@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Hongwei, King Wang <king.wanghongwei@huawei.com> Co-committed-by: Hongwei, King Wang <king.wanghongwei@huawei.com>
32 KiB
Querying VPNs by Tag
Function
This API is used to query VPNs by tag.
Tag Management Service (TMS) filters service resource instances by tag and displays them in a list.
URI
POST /v2.0/{project_id}/ipsec-site-connections/resource_instances/action
Request
Table 1 describes the request parameters.
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
tags |
List<tag> |
No |
Specifies the list of tags.
|
limit |
Integer |
No |
Specifies the maximum number of resources to be queried.
|
offset |
Integer |
No |
Specifies the index position. The query starts from the next data record indexed by this parameter.
|
action |
String |
Yes |
Specifies the operation identifier. The identifier can be filter or count.
|
matches |
List<match> |
No |
Specifies the search criteria. The tag key is the field to match. Currently, only resource_name is supported. The tag value indicates the value to be matched. The key field is a fixed dictionary value. |
Name |
Type |
Mandatory |
Description |
---|---|---|---|
key |
String |
Yes |
Specifies the tag key.
|
values |
List<String> |
Yes |
Specifies the list of tag values. |
Name |
Type |
Mandatory |
Description |
---|---|---|---|
key |
String |
Yes |
Specifies the tag key. The tag key can only be the resource name. |
value |
String |
Yes |
Specifies the tag value. Each value can contain a maximum of 255 Unicode characters. |
Response
Table 4 describes the response parameters.
Name |
Type |
Description |
---|---|---|
resources |
List<resource> |
N/A |
total_count |
int |
Specifies the total number of records. |
Name |
Type |
Description |
---|---|---|
resource_id |
String |
Specifies the resource ID. |
resource_detail |
Object |
Specifies the resource details. The details are left blank by default. |
tags |
List<resource_tag> |
Specifies the list of tags. If there is no tag in the list, tags is taken as an empty array. |
resource_name |
String |
Specifies the resource name. If there is no resource name, the parameter is an empty string by default. |
Example
- Request example
POST /v2.0/{project_id}/ipsec-site-connections/resource_instances/action
- Request body
- action is set to filter.
{ "offset": "0", "limit": "100", "action": "filter", "matches": [ { "key": "resource_name", "value": "resource1" } ], "tags": [ { "key": "key1", "values": [ "*value1", "value2" ] } ] }
- action is set to count.
{ "action": "count", "tags": [ { "key": "key1", "values": [ "value1", "value2" ] }, { "key": "key2", "values": [ "value1", "value2" ] } ], "matches": [ { "key": "resource_name", "value": "resource1" } ] }
- action is set to filter.
- Example response
- action is set to filter.
{ "resources": [ { "resource_detail": null, "resource_id": "cdfs_cefs_wesas_12_dsad", "resource_name": "resource1", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value1" } ] } ], "total_count": 1000 }
- action is set to count.
{ "total_count": 1000 }
- action is set to filter.