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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tags |
No |
Array of PublicTag objects |
Specifies the included tags. Each tag has a maximum of 10 keys, and each key has a maximum of 10 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 for a tag key must be unique. Resources that contain all keys and one or multiple values listed in tags will be found and returned. If no tag filtering criteria is specified, full data is returned. Array Length: 1 - 10 |
tags_any |
No |
Array of PublicTag objects |
Specifies any included tags. Each tag has a maximum of 10 keys, and each key has a maximum of 10 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 for a tag key must be unique. Resources identified by different keys are in OR relationship, and values in one tag are in OR relationship. If no tag filtering criteria is specified, full data is returned. |
not_tags |
No |
Array of PublicTag objects |
Specifies the excluded tags. Each tag has a maximum of 10 keys, and each key has a maximum of 10 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 for a tag key must be unique. Resources not identified by different keys are in AND relationship, and values in one tag are in OR relationship. If no tag filtering criteria is specified, full data is returned. |
not_tags_any |
No |
Array of PublicTag objects |
Specifies any excluded tags. Each tag has a maximum of 10 keys, and each key has a maximum of 10 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 for a tag key must be unique. Resources not identified by different keys are in OR relationship, and values in one tag are in OR relationship. If no tag filtering criteria is specified, full data is returned. |
limit |
No |
String |
Specifies the number of records to be queried. This parameter is not available when action is set to count. When 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 this parameter. 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 records. |
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 special characters: *<>\= |
value |
String |
Specifies the value. Each value can contain a maximum of 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 (Setting limit to 100 and action to filter)
POST https://{Endpoint}/v3/9ad601814ac94c80bf7bb9073ded66fc/nat_gateways/resource_instances/action { "offset" : "100", "limit" : "100", "action" : "filter", "matches" : [ { "key" : "resource_name", "value" : "nat_gateways" } ], "not_tags" : [ { "key" : "key1", "values" : [ "*value1", "value2" ] } ], "tags" : [ { "key" : "key2", "values" : [ "*value3", "value4" ] } ], "tags_any" : [ { "key" : "key3", "values" : [ "*value5", "value6" ] } ], "not_tags_any" : [ { "key" : "key4", "values" : [ "*value7", "value8" ] } ] }
-
Querying public NAT gateways (Setting action to count)
POST https://{Endpoint}/v3/9ad601814ac94c80bf7bb9073ded66fc/nat_gateways/resource_instances/action { "action" : "count", "matches" : [ { "key" : "resource_name", "value" : "nat_gateways" } ], "not_tags" : [ { "key" : "key1", "values" : [ "*value1", "value2" ] } ], "tags" : [ { "key" : "key2", "values" : [ "*value3", "value4" ] } ], "tags_any" : [ { "key" : "key3", "values" : [ "*value5", "value6" ] } ], "not_tags_any" : [ { "key" : "key4", "values" : [ "*value7", "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 (Setting limit to 100 and action to filter)
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 98 99
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"); ICredential auth = new BasicCredentials() .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("*value7"); listNotTagsAnyValues.add("value8"); List<PublicTag> listbodyNotTagsAny = new ArrayList<>(); listbodyNotTagsAny.add( new PublicTag() .withKey("key4") .withValues(listNotTagsAnyValues) ); List<String> listNotTagsValues = new ArrayList<>(); listNotTagsValues.add("*value1"); listNotTagsValues.add("value2"); List<PublicTag> listbodyNotTags = new ArrayList<>(); listbodyNotTags.add( new PublicTag() .withKey("key1") .withValues(listNotTagsValues) ); List<String> listTagsAnyValues = new ArrayList<>(); listTagsAnyValues.add("*value5"); listTagsAnyValues.add("value6"); List<PublicTag> listbodyTagsAny = new ArrayList<>(); listbodyTagsAny.add( new PublicTag() .withKey("key3") .withValues(listTagsAnyValues) ); List<String> listTagsValues = new ArrayList<>(); listTagsValues.add("*value3"); listTagsValues.add("value4"); List<PublicTag> listbodyTags = new ArrayList<>(); listbodyTags.add( new PublicTag() .withKey("key2") .withValues(listTagsValues) ); body.withMatches(listbodyMatches); body.withAction("filter"); body.withOffset("100"); body.withLimit("100"); 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 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"); ICredential auth = new BasicCredentials() .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("*value7"); listNotTagsAnyValues.add("value8"); List<PublicTag> listbodyNotTagsAny = new ArrayList<>(); listbodyNotTagsAny.add( new PublicTag() .withKey("key4") .withValues(listNotTagsAnyValues) ); List<String> listNotTagsValues = new ArrayList<>(); listNotTagsValues.add("*value1"); listNotTagsValues.add("value2"); List<PublicTag> listbodyNotTags = new ArrayList<>(); listbodyNotTags.add( new PublicTag() .withKey("key1") .withValues(listNotTagsValues) ); List<String> listTagsAnyValues = new ArrayList<>(); listTagsAnyValues.add("*value5"); listTagsAnyValues.add("value6"); List<PublicTag> listbodyTagsAny = new ArrayList<>(); listbodyTagsAny.add( new PublicTag() .withKey("key3") .withValues(listTagsAnyValues) ); List<String> listTagsValues = new ArrayList<>(); listTagsValues.add("*value3"); listTagsValues.add("value4"); List<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 (Setting limit to 100 and action to filter)
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
# coding: utf-8 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 = __import__('os').getenv("CLOUD_SDK_AK") sk = __import__('os').getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ 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 = [ "*value7", "value8" ] listNotTagsAnybody = [ PublicTag( key="key4", values=listValuesNotTagsAny ) ] listValuesNotTags = [ "*value1", "value2" ] listNotTagsbody = [ PublicTag( key="key1", values=listValuesNotTags ) ] listValuesTagsAny = [ "*value5", "value6" ] listTagsAnybody = [ PublicTag( key="key3", values=listValuesTagsAny ) ] listValuesTags = [ "*value3", "value4" ] listTagsbody = [ PublicTag( key="key2", values=listValuesTags ) ] request.body = ListNatsByTagsRequestBody( matches=listMatchesbody, action="filter", offset="100", limit="100", 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 82 83
# coding: utf-8 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 = __import__('os').getenv("CLOUD_SDK_AK") sk = __import__('os').getenv("CLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ 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 = [ "*value7", "value8" ] listNotTagsAnybody = [ PublicTag( key="key4", values=listValuesNotTagsAny ) ] listValuesNotTags = [ "*value1", "value2" ] listNotTagsbody = [ PublicTag( key="key1", values=listValuesNotTags ) ] listValuesTagsAny = [ "*value5", "value6" ] listTagsAnybody = [ PublicTag( key="key3", values=listValuesTagsAny ) ] listValuesTags = [ "*value3", "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 (Setting limit to 100 and action to filter)
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
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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). 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 = List{ "*value7", "value8", } var listNotTagsAnybody = []model.PublicTag{ { Key: "key4", Values: listValuesNotTagsAny, }, } var listValuesNotTags = List{ "*value1", "value2", } var listNotTagsbody = []model.PublicTag{ { Key: "key1", Values: listValuesNotTags, }, } var listValuesTagsAny = List{ "*value5", "value6", } var listTagsAnybody = []model.PublicTag{ { Key: "key3", Values: listValuesTagsAny, }, } var listValuesTags = List{ "*value3", "value4", } var listTagsbody = []model.PublicTag{ { Key: "key2", Values: listValuesTags, }, } offsetListNatsByTagsRequestBody:= "100" limitListNatsByTagsRequestBody:= "100" 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 88 89
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") auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). 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{ "*value7", "value8", } var listNotTagsAnybody = []model.PublicTag{ { Key: "key4", Values: listValuesNotTagsAny, }, } var listValuesNotTags = []string{ "*value1", "value2", } var listNotTagsbody = []model.PublicTag{ { Key: "key1", Values: listValuesNotTags, }, } var listValuesTagsAny = []string{ "*value5", "value6", } var listTagsAnybody = []model.PublicTag{ { Key: "key3", Values: listValuesTagsAny, }, } var listValuesTags = []string{ "*value3", "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