Querying Supplementary Network Interfaces
Function
This API is used to query information about all supplementary network interfaces, including their IP addresses and VLAN IDs.
Calling Method
For details, see Calling APIs.
URI
GET /v3/{project_id}/vpc/sub-network-interfaces
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Definition: ID of the project that a supplementary network interface belongs to. For details about how to obtain a project ID, see Obtaining a Project ID. Range: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limit |
No |
Integer |
Definition: Number of resources on each page. Range: 0 to 2000 |
marker |
No |
String |
Definition: Start resource ID of pagination query. If the parameter is left blank, only resources on the first page are queried. Range: ID of a supplementary network interface. |
id |
No |
Array of strings |
Definition: Supplementary network interface ID. You can use this field to filter supplementary network interfaces. Multiple IDs can be specified for filtering. Range: N/A |
description |
No |
Array of strings |
Definition: Description of a supplementary network interface. You can use this field to filter supplementary network interfaces. Multiple descriptions can be specified for filtering. Range: N/A |
vpc_id |
No |
Array of strings |
Definition: ID of the VPC that a supplementary network interface belongs to. You can use this field to filter supplementary network interfaces in one or more VPCs. Multiple VPC IDs can be specified for filtering. Range: N/A |
virsubnet_id |
No |
Array of strings |
Definition: ID of the virtual subnet that a supplementary network interface belongs to. You can use this field to filter supplementary network interfaces in one or more virtual subnets. Multiple virtual subnet IDs can be specified for filtering. Range: N/A |
parent_id |
No |
Array of strings |
Definition: ID of the elastic network interface that a supplementary network interface is attached to. You can use this field to filter supplementary network interfaces attached to one or more elastic network interfaces. Multiple elastic network interface IDs can be specified for filtering. Range: N/A |
private_ip_address |
No |
Array of strings |
Definition: Private IPv4 address of a supplementary network interface. You can use this field to filter supplementary network interfaces. Multiple IP addresses can be specified for filtering. Range: N/A |
mac_address |
No |
Array of strings |
Definition: MAC address of a supplementary network interface. You can use this field to filter supplementary network interfaces. Multiple MAC addresses can be specified for filtering. Range: N/A |
enable_eip |
No |
Boolean |
Definition: Whether to filter a supplementary network interface with an EIP bound. You can use this field to filter supplementary network interfaces. Only one value can be specified for filtering. Range: true and false |
scope |
No |
String |
Definition: Public network egress information of the site where a supplementary network interface works. You can use this field to filter supplementary network interfaces. Range: N/A |
security_groups |
No |
Array of strings |
Definition: ID of the security group that a supplementary network interface is associated with. You can use this field to filter supplementary network interfaces. Multiple IDs can be specified for filtering. Range: N/A |
parent_device_id |
No |
Array of strings |
Definition: Device ID of the host network interface that a supplementary network interface is attached to. You can use this field to filter supplementary network interfaces. Multiple IDs can be specified for filtering. Range: N/A |
vlan_id |
No |
Array of integers |
Definition: VLAN ID of a supplementary network interface. You can use this field to filter supplementary network interfaces. Multiple VLAN IDs can be specified for filtering. Range: 1 to 4094 |
state |
No |
Array of strings |
Definition: Status of a supplementary network interface. You can use this field to filter supplementary network interfaces. Multiple statuses can be specified for filtering. Range: NORMAL and UNBOUND |
ipv6_ip_address |
No |
Array of strings |
Definition: IPv6 address of a supplementary network interface. You can use this field to filter supplementary network interfaces. Multiple IP addresses can be specified for filtering. Range: N/A |
instance_id |
No |
Array of strings |
Definition: ID of the cloud service instance that a supplementary network interface is attached to, for example, RDS instance ID. You can use this field to filter supplementary network interfaces. Multiple IDs can be specified for filtering. Range: N/A |
instance_type |
No |
Array of strings |
Definition: Type of the cloud service instance that a supplementary network interface is attached to, for example, RDS. You can use this field to filter supplementary network interfaces. Multiple instance types can be specified for filtering. Range: N/A |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Definition: Request ID. Range: N/A |
sub_network_interfaces |
Array of SubNetworkInterface objects |
Definition: Response body for querying supplementary network interfaces. Range: N/A |
page_info |
PageInfo object |
Definition: Pagination information. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Definition: ID of a supplementary network interface. After a supplementary network interface is created, a supplementary network interface ID is generated, which uniquely identifies the supplementary network interface. Range: The value is in UUID format with hyphens (-). |
virsubnet_id |
String |
Definition: ID of the virtual subnet that a supplementary network interface is located. Range: The value is in UUID format with hyphens (-). |
private_ip_address |
String |
Definition: Private IPv4 address of a supplementary network interface. Range: N/A |
ipv6_ip_address |
String |
Definition: Private IPv6 address of a supplementary network interface. Range: N/A |
mac_address |
String |
Definition: MAC address of a supplementary network interface. Range: The value is a valid MAC address assigned by the system randomly. |
parent_device_id |
String |
Definition: Device ID of the host network interface that a supplementary network interface is attached to. Range: The value is in UUID format with hyphens (-). |
parent_id |
String |
Definition: ID of the elastic network interface that a supplementary network interface is attached to. Range: The value is in UUID format with hyphens (-). |
description |
String |
Definition: Description of a supplementary network interface. Range: The value can contain 0 to 255 characters and cannot contain angle brackets (< or >). |
vpc_id |
String |
Definition: ID of the VPC that a supplementary network interface belongs to. Range: The value is in UUID format with hyphens (-). |
vlan_id |
Integer |
Definition: VLAN ID of a supplementary network interface. Range: 1 to 4094 |
security_groups |
Array of strings |
Definition: IDs of the security groups that a supplementary network interface is associated with. For example, "security_groups": ["a0608cbf-d047-4f54-8b28-cd7b59853fff"]. Range: If this parameter is not specified in the request, the supplementary network interface is automatically associated with the default security group after being created. |
tags |
Array of ResponseTag objects |
Definition: Tags of a supplementary network interface, including tag keys and tag values, which can be used to classify and identify resources. For details, see the tag objects. Range: N/A |
project_id |
String |
Definition: ID of the project that a supplementary network interface belongs to. Range: N/A |
created_at |
String |
Definition: Time when a supplementary network interface was created. Range: The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ssZ. |
allowed_address_pairs |
Array of AllowedAddressPair objects |
Definition: IP/MAC address pair list of a supplementary network interface. For details, see the AllowedAddressPair object list. Range: N/A |
state |
String |
Definition: Status of a supplementary network interface. Range:
|
instance_id |
String |
Definition: ID of the cloud service instance that a supplementary network interface is attached to, for example, RDS instance ID. Range: N/A |
instance_type |
String |
Definition: Type of the cloud service instance that a supplementary network interface is attached to, for example, RDS. Range: N/A |
scope |
String |
Definition: Public network egress information of the site where a supplementary network interface works. Range:
|
security_enabled |
Boolean |
Definition: Whether the security option is enabled for a supplementary network interface. If the option is not enabled, the security group does not take effect. Range: N/A |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Definition: Tag key. Range:
|
value |
String |
Definition: Tag value. Range:
|
Parameter |
Type |
Description |
---|---|---|
ip_address |
String |
Definition: IP address. Constraints: Configure a dedicated security group if a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs. Range: Single IP address, for example, 192.168.21.25 A CIDR block, for example, 192.168.21.0/24 Default Value: N/A |
mac_address |
String |
Definition: MAC address. Constraints: N/A Range: N/A Default Value: N/A |
Parameter |
Type |
Description |
---|---|---|
previous_marker |
String |
Definition: The first record on the current page. Range: N/A |
current_count |
Integer |
Definition: Total number of resources on the current page. Range: N/A |
next_marker |
String |
Definition: The last record on the current page. The next_marker field does not exist if the page is the last one. Range: N/A |
Example Requests
-
Querying supplementary network interfaces by its ID
GET https://{Endpoint}/v3/8c6fb137a48a428aaf9a0229dca4edb3/vpc/sub-network-interfaces?id=022b5c53-20e1-4f4b-b90c-0575a5e97412&id=056d6cb4-b436-460d-9a63-67666bf3ea9c
-
Querying supplementary network interfaces by combined filters
https://{Endpoint}/v3/8c6fb137a48a428aaf9a0229dca4edb3/vpc/sub-network-interfaces?virsubnet_id=3eae2c96-de45-4c41-bf2d-e4ad53a2acb4&private_ip_address=192.168.22.177&parent_id=5eb9dc59-8159-4197-88ea-f3507ad8e0a7
-
Querying supplementary network interfaces by page
GET https://{Endpoint}/v3/8c6fb137a48a428aaf9a0229dca4edb3/vpc/sub-network-interfaces?limit=2
Example Responses
Status code: 200
Normal response to the GET operation. For more status codes, see Status Codes.
{ "request_id" : "db2bd86cad7519610d9d405228e63076", "sub_network_interfaces" : [ { "id" : "022b5c53-20e1-4f4b-b90c-0575a5e97412", "project_id" : "8c6fb137a48a428aaf9a0229dca4edb3", "virsubnet_id" : "3c15c3b0-0df4-4115-9c18-e67a8a0d7702", "private_ip_address" : "192.168.0.160", "ipv6_ip_address" : null, "mac_address" : "fa:16:3e:26:7e:1e", "parent_device_id" : "285b2e45-2968-4f4c-8992-54e0d4c8da1d", "security_enabled" : false, "security_groups" : [ ], "allowed_address_pairs" : [ ], "vpc_id" : "c10e1e02-9db2-4bd0-89ef-52536952627e", "instance_id" : "", "instance_type" : "", "description" : "", "parent_id" : "00336617-4552-48c5-9856-f539f4e9aca2", "vlan_id" : 3413, "state" : null, "tags" : [ ], "scope" : "center", "created_at" : "2025-02-10T08:21:16Z" }, { "id" : "056d6cb4-b436-460d-9a63-67666bf3ea9c", "project_id" : "8c6fb137a48a428aaf9a0229dca4edb3", "virsubnet_id" : "3c15c3b0-0df4-4115-9c18-e67a8a0d7702", "private_ip_address" : "192.168.0.20", "ipv6_ip_address" : null, "mac_address" : "fa:16:3e:26:7e:92", "parent_device_id" : "285b2e45-2968-4f4c-8992-54e0d4c8da1d", "security_enabled" : false, "security_groups" : [ ], "allowed_address_pairs" : [ ], "vpc_id" : "c10e1e02-9db2-4bd0-89ef-52536952627e", "instance_id" : "", "instance_type" : "", "description" : "", "parent_id" : "00336617-4552-48c5-9856-f539f4e9aca2", "vlan_id" : 595, "state" : null, "tags" : [ ], "scope" : "center", "created_at" : "2025-02-10T08:21:16Z" } ], "page_info" : { "previous_marker" : "4c2b455a-4c75-4c4d-bada-727be4d0f7b5", "current_count" : 2 } }
SDK Sample Code
The SDK sample code is as follows.
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 |
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.vpc.v3.region.VpcRegion; import com.huaweicloud.sdk.vpc.v3.*; import com.huaweicloud.sdk.vpc.v3.model.*; public class ListSubNetworkInterfacesSolution { 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); VpcClient client = VpcClient.newBuilder() .withCredential(auth) .withRegion(VpcRegion.valueOf("<YOUR REGION>")) .build(); ListSubNetworkInterfacesRequest request = new ListSubNetworkInterfacesRequest(); try { ListSubNetworkInterfacesResponse response = client.listSubNetworkInterfaces(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()); } } } |
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 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkvpc.v3.region.vpc_region import VpcRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkvpc.v3 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 = VpcClient.new_builder() \ .with_credentials(credentials) \ .with_region(VpcRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListSubNetworkInterfacesRequest() response = client.list_sub_network_interfaces(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
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 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" vpc "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpc/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpc/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpc/v3/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 := vpc.NewVpcClient( vpc.VpcClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ListSubNetworkInterfacesRequest{} response, err := client.ListSubNetworkInterfaces(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 |
Normal response to the GET operation. For more status codes, see Status Codes. |
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