Querying Public NAT Gateways by Tag
Function
-
This API is used to query public NAT gateways by tag.
-
Tag Management Service (TMS) uses this API to filter and list public NAT gateways.
-
By default, public NAT gateways and their tags are sorted by creation time in descending order.
Calling Method
For details, see Calling APIs.
URI
POST /v3/{project_id}/nat_gateways/resource_instances/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the user token. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. The value of X-Subject-Token in the response header is the token value. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tags |
No |
Array of PublicTag objects |
The resources to be queried contain tags listed in tags. Each resource to be queried contains a maximum of 20 keys. Each tag key can have a maximum of 20 tag values. The structure body cannot be missing, and the key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique.Resources that contain the tags listed in *tags will be returned.Keys are in AND relationship, and values in a tag are in OR relationship.If this parameter is not specified, all resources will be returned. |
tags_any |
No |
Array of PublicTag objects |
The resources to be queried contain any tag listed in tags_any. Each resource to be queried contains a maximum of 20 keys. Each tag key can have a maximum of 20 tag values. The structure body cannot be missing, and the key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique.Resources that contain any tag listed in *tags_any will be returned.Keys are in AND relationship, and values in a tag are in OR relationship.If this parameter is not specified, all resources will be returned. |
not_tags |
No |
Array of PublicTag objects |
The resources to be queried do not contain tags listed in not_tags. Each resource to be queried contains a maximum of 20 keys. Each tag key can have a maximum of 20 tag values. The structure body cannot be missing, and the key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique.Resources that do not contain the tags listed in not_tags will be returned.Keys are in AND relationship, and values in a tag are in OR relationship.If this parameter is not specified, all resources will be returned. |
not_tags_any |
No |
Array of PublicTag objects |
The resources to be queried do not contain any tag listed in not_tags_any. Each resource to be queried contains a maximum of 20 keys. Each tag key can have a maximum of 20 tag values. The structure body cannot be missing, and the key cannot be left blank or set to an empty string. Each tag key must be unique, and each tag value in a tag must be unique.Resources that do not contain any tag listed in not_tags_any will be returned.Keys are in AND relationship, and values in a tag are in OR relationship.If this parameter is not specified, all resources will be returned. |
limit |
No |
String |
Specifies the number of records to be queried. This parameter is not available when action is set to count. If action is set to filter, the default value is 1000, which is also the maximum value. The minimum value is 1. The value cannot be a negative number. |
offset |
No |
String |
Specifies the index position. The query starts from the next piece of data indexed by offset. This parameter is not required when you query data on the first page. The value in the response returned for querying data on the previous page will be included in this parameter for querying data on subsequent pages. This parameter is not available when action is set to count. When action is set to filter, the value must be a positive number, and the default value is 0. |
action |
Yes |
String |
|
matches |
No |
Array of PublicMatch objects |
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Specifies the tag key. A key can contain up to 128 Unicode characters. key cannot be left blank. (The system does not verify key when searching for resources.) key cannot be left blank, be an empty string, or be only spaces. Before using key, delete spaces before and after the value. |
values |
Yes |
Array of strings |
|
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
resources |
Array of PublicResource objects |
Specifies the resource object list. For details, see the Resource field description. |
total_count |
Integer |
Specifies the total number of resources. |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Specifies the resource ID. |
resource_detail |
Object |
Specifies resource details. The value is a resource object used for extension. This parameter is left blank by default. |
tags |
Array of PublicResourceTag objects |
Specifies the list of queried tags. If no tag is matched, an empty array is returned. For details, see the ResourceTag field description. |
resource_name |
String |
Specifies the resource name. This parameter is an empty string by default if there is no resource name. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Specifies the tag key. A key can contain up to 128 Unicode characters. key cannot be left blank. A key cannot contain ASCII characters (0–31 decimal) nor the following characters: * < > \ =\ |
value |
String |
Specifies the tag value. Each value can contain up to 255 Unicode characters and can be an empty string. A value cannot contain ASCII characters (0–31 decimal) nor the following special characters: * < > \ = |
Example Requests
-
Querying public NAT gateways by tag (Setting action to filter and limit to 1000)
POST https://{NAT_endpoint}/v3/9ad601814ac94c80bf7bb9073ded66fc/nat_gateways/resource_instances/action { "offset" : "0", "limit" : "1000", "action" : "filter", "matches" : [ { "key" : "resource_name", "value" : "nat_gateways" } ], "not_tags" : [ { "key" : "key1", "values" : [ "value2" ] } ], "tags" : [ { "key" : "key2", "values" : [ "value4" ] } ], "tags_any" : [ { "key" : "key3", "values" : [ "value6" ] } ], "not_tags_any" : [ { "key" : "key4", "values" : [ "value8" ] } ] }
-
Querying public NAT gateways (Setting action to count)
POST https://{NAT_endpoint}/v3/9ad601814ac94c80bf7bb9073ded66fc/nat_gateways/resource_instances/action { "action" : "count", "matches" : [ { "key" : "resource_name", "value" : "nat_gateways" } ], "not_tags" : [ { "key" : "key1", "values" : [ "value2" ] } ], "tags" : [ { "key" : "key2", "values" : [ "value4" ] } ], "tags_any" : [ { "key" : "key3", "values" : [ "value6" ] } ], "not_tags_any" : [ { "key" : "key4", "values" : [ "value8" ] } ] }
Example Responses
Status code: 200
-
Query operation succeeded.
-
Example 1: the response body when action is set to filter
-
Example 2: the response body when action is set to count
-
Example 1
{ "resources" : [ { "resource_detail" : null, "resource_id" : "e5ad289f-9c56-4daf-b08b-2e53a983473a", "resource_name" : "nat_gateways", "tags" : [ { "key" : "key2", "value" : "value4" }, { "key" : "key2", "value" : "value3" } ] } ], "total_count" : 1000 }
-
Example 2
{ "total_count" : 1000 }
SDK Sample Code
The SDK sample code is as follows.
-
Querying public NAT gateways by tag (Setting action to filter and limit to 1000)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.nat.v2.region.NatRegion; import com.huaweicloud.sdk.nat.v2.*; import com.huaweicloud.sdk.nat.v2.model.*; import java.util.List; import java.util.ArrayList; public class ListNatGatewayByTagSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); NatClient client = NatClient.newBuilder() .withCredential(auth) .withRegion(NatRegion.valueOf("<YOUR REGION>")) .build(); ListNatGatewayByTagRequest request = new ListNatGatewayByTagRequest(); ListNatsByTagsRequestBody body = new ListNatsByTagsRequestBody(); List<PublicMatch> listbodyMatches = new ArrayList<>(); listbodyMatches.add( new PublicMatch() .withKey("resource_name") .withValue("nat_gateways") ); List<String> listNotTagsAnyValues = new ArrayList<>(); listNotTagsAnyValues.add("value8"); List<PublicTag> listbodyNotTagsAny = new ArrayList<>(); listbodyNotTagsAny.add( new PublicTag() .withKey("key4") .withValues(listNotTagsAnyValues) ); List<String> listNotTagsValues = new ArrayList<>(); listNotTagsValues.add("value2"); List<PublicTag> listbodyNotTags = new ArrayList<>(); listbodyNotTags.add( new PublicTag() .withKey("key1") .withValues(listNotTagsValues) ); List<String> listTagsAnyValues = new ArrayList<>(); listTagsAnyValues.add("value6"); List<PublicTag> listbodyTagsAny = new ArrayList<>(); listbodyTagsAny.add( new PublicTag() .withKey("key3") .withValues(listTagsAnyValues) ); List<String> listTagsValues = new ArrayList<>(); listTagsValues.add("value4"); List<PublicTag> listbodyTags = new ArrayList<>(); listbodyTags.add( new PublicTag() .withKey("key2") .withValues(listTagsValues) ); body.withMatches(listbodyMatches); body.withAction("filter"); body.withOffset("0"); body.withLimit("1000"); body.withNotTagsAny(listbodyNotTagsAny); body.withNotTags(listbodyNotTags); body.withTagsAny(listbodyTagsAny); body.withTags(listbodyTags); request.withBody(body); try { ListNatGatewayByTagResponse response = client.listNatGatewayByTag(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Querying public NAT gateways (Setting action to count)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.nat.v2.region.NatRegion; import com.huaweicloud.sdk.nat.v2.*; import com.huaweicloud.sdk.nat.v2.model.*; import java.util.List; import java.util.ArrayList; public class ListNatGatewayByTagSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); NatClient client = NatClient.newBuilder() .withCredential(auth) .withRegion(NatRegion.valueOf("<YOUR REGION>")) .build(); ListNatGatewayByTagRequest request = new ListNatGatewayByTagRequest(); ListNatsByTagsRequestBody body = new ListNatsByTagsRequestBody(); [](model.PublicMatch) listbodyMatches = new ArrayList<>(); listbodyMatches.add( new PublicMatch() .withKey("resource_name") .withValue("nat_gateways") ); []string listNotTagsAnyValues = new ArrayList<>(); listNotTagsAnyValues.add("value8"); [](model.PublicTag) listbodyNotTagsAny = new ArrayList<>(); listbodyNotTagsAny.add( new PublicTag() .withKey("key4") .withValues(listNotTagsAnyValues) ); []string listNotTagsValues = new ArrayList<>(); listNotTagsValues.add("value2"); [](model.PublicTag) listbodyNotTags = new ArrayList<>(); listbodyNotTags.add( new PublicTag() .withKey("key1") .withValues(listNotTagsValues) ); []string listTagsAnyValues = new ArrayList<>(); listTagsAnyValues.add("value6"); [](model.PublicTag) listbodyTagsAny = new ArrayList<>(); listbodyTagsAny.add( new PublicTag() .withKey("key3") .withValues(listTagsAnyValues) ); []string listTagsValues = new ArrayList<>(); listTagsValues.add("value4"); [](model.PublicTag) listbodyTags = new ArrayList<>(); listbodyTags.add( new PublicTag() .withKey("key2") .withValues(listTagsValues) ); body.withMatches(listbodyMatches); body.withAction("count"); body.withNotTagsAny(listbodyNotTagsAny); body.withNotTags(listbodyNotTags); body.withTagsAny(listbodyTagsAny); body.withTags(listbodyTags); request.withBody(body); try { ListNatGatewayByTagResponse response = client.listNatGatewayByTag(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } }
-
Querying public NAT gateways by tag (Setting action to filter and limit to 1000)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdknat.v2.region.nat_region import NatRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdknat.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = NatClient.new_builder() \ .with_credentials(credentials) \ .with_region(NatRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListNatGatewayByTagRequest() listMatchesbody = [ PublicMatch( key="resource_name", value="nat_gateways" ) ] listValuesNotTagsAny = [ "value8" ] listNotTagsAnybody = [ PublicTag( key="key4", values=listValuesNotTagsAny ) ] listValuesNotTags = [ "value2" ] listNotTagsbody = [ PublicTag( key="key1", values=listValuesNotTags ) ] listValuesTagsAny = [ "value6" ] listTagsAnybody = [ PublicTag( key="key3", values=listValuesTagsAny ) ] listValuesTags = [ "value4" ] listTagsbody = [ PublicTag( key="key2", values=listValuesTags ) ] request.body = ListNatsByTagsRequestBody( matches=listMatchesbody, action="filter", offset="0", limit="1000", not_tags_any=listNotTagsAnybody, not_tags=listNotTagsbody, tags_any=listTagsAnybody, tags=listTagsbody ) response = client.list_nat_gateway_by_tag(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Querying public NAT gateways (Setting action to count)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdknat.v2.region.nat_region import NatRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdknat.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = NatClient.new_builder() \ .with_credentials(credentials) \ .with_region(NatRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListNatGatewayByTagRequest() listMatchesbody = [ PublicMatch( key="resource_name", value="nat_gateways" ) ] listValuesNotTagsAny = [ "value8" ] listNotTagsAnybody = [ PublicTag( key="key4", values=listValuesNotTagsAny ) ] listValuesNotTags = [ "value2" ] listNotTagsbody = [ PublicTag( key="key1", values=listValuesNotTags ) ] listValuesTagsAny = [ "value6" ] listTagsAnybody = [ PublicTag( key="key3", values=listValuesTagsAny ) ] listValuesTags = [ "value4" ] listTagsbody = [ PublicTag( key="key2", values=listValuesTags ) ] request.body = ListNatsByTagsRequestBody( matches=listMatchesbody, action="count", not_tags_any=listNotTagsAnybody, not_tags=listNotTagsbody, tags_any=listTagsAnybody, tags=listTagsbody ) response = client.list_nat_gateway_by_tag(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
Querying public NAT gateways by tag (Setting action to filter and limit to 1000)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" nat "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/nat/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/nat/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/nat/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := nat.NewNatClient( nat.NatClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListNatGatewayByTagRequest{} var listMatchesbody = []model.PublicMatch{ { Key: "resource_name", Value: "nat_gateways", }, } var listValuesNotTagsAny = []string{ "value8", } var listNotTagsAnybody = []model.PublicTag{ { Key: "key4", Values: listValuesNotTagsAny, }, } var listValuesNotTags = []string{ "value2", } var listNotTagsbody = []model.PublicTag{ { Key: "key1", Values: listValuesNotTags, }, } var listValuesTagsAny = []string{ "value6", } var listTagsAnybody = []model.PublicTag{ { Key: "key3", Values: listValuesTagsAny, }, } var listValuesTags = []string{ "value4", } var listTagsbody = []model.PublicTag{ { Key: "key2", Values: listValuesTags, }, } offsetListNatsByTagsRequestBody:= "0" limitListNatsByTagsRequestBody:= "1000" request.Body = &model.ListNatsByTagsRequestBody{ Matches: &listMatchesbody, Action: "filter", Offset: &offsetListNatsByTagsRequestBody, Limit: &limitListNatsByTagsRequestBody, NotTagsAny: &listNotTagsAnybody, NotTags: &listNotTagsbody, TagsAny: &listTagsAnybody, Tags: &listTagsbody, } response, err := client.ListNatGatewayByTag(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
Querying public NAT gateways (Setting action to count)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" nat "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/nat/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/nat/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/nat/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := nat.NewNatClient( nat.NatClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListNatGatewayByTagRequest{} var listMatchesbody = []model.PublicMatch{ { Key: "resource_name", Value: "nat_gateways", }, } var listValuesNotTagsAny = []string{ "value8", } var listNotTagsAnybody = []model.PublicTag{ { Key: "key4", Values: listValuesNotTagsAny, }, } var listValuesNotTags = []string{ "value2", } var listNotTagsbody = []model.PublicTag{ { Key: "key1", Values: listValuesNotTags, }, } var listValuesTagsAny = []string{ "value6", } var listTagsAnybody = []model.PublicTag{ { Key: "key3", Values: listValuesTagsAny, }, } var listValuesTags = []string{ "value4", } var listTagsbody = []model.PublicTag{ { Key: "key2", Values: listValuesTags, }, } request.Body = &model.ListNatsByTagsRequestBody{ Matches: &listMatchesbody, Action: "count", NotTagsAny: &listNotTagsAnybody, NotTags: &listNotTagsbody, TagsAny: &listTagsAnybody, Tags: &listTagsbody, } response, err := client.ListNatGatewayByTag(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
|
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