Creating a Virtual Interface
Function
This API is used to create a virtual interface.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
URI
POST /v3/{project_id}/dcaas/virtual-interfaces
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Specifies the project ID. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition Specifies the user token. To obtain the token, see section "Obtaining the User Token" in the Identity and Access Management API Reference. After the request is processed, the value of X-Subject-Token in the header is the token value. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| virtual_interface | Yes | CreateVirtualInterface object | Definition Specifies the parameters for creating a virtual interface. Constraints N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | No | String | Definition Specifies the virtual interface name. Constraints N/A Range The value can contain a maximum of 64 characters. Default Value N/A |
| description | No | String | Definition Provides supplementary information about the virtual interface. Constraints N/A Range The value can contain a maximum of 2,048 characters. Default Value N/A |
| direct_connect_id | No | String | Definition Specifies the ID of the connection associated with the virtual interface. When creating a virtual interface, you need to specify direct_connect_id or lag_id. This parameter is mandatory when LAG is not supported at the site. Constraints N/A Range The value is in UUID format and is connected by hyphens (-). Default Value N/A |
| type | Yes | String | Definition Specifies the type of the virtual interface. Constraints N/A Range Default Value private |
| service_type | No | String | Definition Specifies the gateway type. Constraints This parameter cannot be configured for virtual gateways. Range Default Value N/A |
| vlan | Yes | Integer | Definition Specifies the customer VLAN to be connected. If you select a hosted connection, the VLAN must be the same as that of the hosted connection. Constraints N/A Range 0–3999 Default Value N/A |
| bandwidth | Yes | Integer | Definition Specifies the virtual interface bandwidth. Constraints N/A Range N/A Default Value N/A |
| priority | No | String | Definition Specifies the priority of a virtual interface. The value can be normal or low. If the priorities are the same, the virtual interfaces work in load balancing mode. If the priorities are different, the virtual interfaces work in active/standby pairs. Outbound traffic is preferentially forwarded to the normal virtual interface with a higher priority. This option is only supported by virtual interfaces that use BGP routing. Constraints N/A Range Default Value normal |
| local_gateway_v4_ip | No | String | Definition Specifies the IPv4 interface address of the gateway on the cloud. This parameter is mandatory if address_family is set to ipv4. Constraints N/A Range N/A Default Value N/A |
| remote_gateway_v4_ip | No | String | Definition Specifies the IPv4 interface address of the gateway on the on-premises network. This parameter is mandatory if address_family is set to ipv4. Constraints N/A Range N/A Default Value N/A |
| address_family | No | String | Definition Specifies the address family of the virtual interface, which can be IPv4 or IPv6. Constraints N/A Range N/A Default Value ipv4 |
| local_gateway_v6_ip | No | String | Definition Specifies the IPv6 interface address of the gateway on the cloud. This parameter is mandatory if address_family is set to ipv6. Constraints N/A Range N/A Default Value N/A |
| remote_gateway_v6_ip | No | String | Definition Specifies the IPv6 interface address of the gateway on the on-premises network. This parameter is mandatory if address_family is set to ipv6. Constraints N/A Range N/A Default Value N/A |
| vgw_id | No | String | Definition Specifies the ID of the virtual gateway connected by the virtual interface. Constraints N/A Range The value is in UUID format and is connected by hyphens (-). Default Value N/A |
| gateway_id | No | String | Definition Specifies the ID of the gateway associated with the virtual interface. If service_type is set to GDGW, this parameter is required. gateway_id indicates the ID of the global DC gateway. Constraints N/A Range The value is in UUID format and is connected by hyphens (-). Default Value N/A |
| route_mode | Yes | String | Definition Specifies the routing mode. Constraints N/A Range Default Value static |
| bgp_asn | No | Integer | Definition Specifies the ASN of the BGP peer on the customer side. Constraints N/A Range 1 to 4294967295 Default Value N/A |
| bgp_md5 | No | String | Definition Specifies the MD5 password of the BGP peer. Constraints N/A Range N/A Default Value N/A |
| remote_ep_group | No | Array of strings | Definition Specifies the remote subnet list, which records the CIDR blocks used in the on-premises data center. Constraints N/A |
| service_ep_group | No | Array of strings | Definition Specifies the subnets that access Internet services through a direct connection. Constraints N/A |
| enable_bfd | No | Boolean | Definition Specifies whether to enable the BFD function. Constraints N/A Range Default Value false |
| enable_nqa | No | Boolean | Definition Specifies whether to enable the NQA function. Constraints N/A Range Default Value false |
| lag_id | No | String | Definition Specifies the ID of the LAG associated with the virtual interface. Constraints N/A Range The value can contain up to 36 characters in UUID format and is connected by hyphens (-). Default Value N/A |
| resource_tenant_id | No | String | Definition Specifies the project ID of another tenant, which is used to create virtual interfaces across tenants. Constraints N/A Range N/A Default Value N/A |
| enterprise_project_id | No | String | Definition Specifies the ID of the enterprise project that the instance belongs to. Range The value is 0 or a string that contains a maximum of 36 bytes in UUID format with hyphens (-). 0 indicates the default enterprise project. |
| tags | No | Array of Tag objects | Definition Specifies the tag information. Constraints The array length ranges from 0 to 10. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | Definition Specifies the tag key. Each key cannot start or end with a space, or start with _sys_. Only letters, digits, spaces, and the following special characters are allowed: _.:=+-@ Constraints N/A Range 1 to 128 characters Default Value N/A |
| value | No | String | Definition Specifies the tag value. The value can contain letters, digits, spaces, and the following special characters: _.:/=+-@ Constraints N/A Range The value can contain a maximum of 255 characters. Default Value N/A |
Response Parameters
Status code: 201
| Parameter | Type | Description |
|---|---|---|
| request_id | String | Definition Specifies the request ID. Range N/A |
| virtual_interface | VirtualInterface object | Definition Specifies the virtual interface object. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Specifies the virtual interface ID. Range The value can contain a maximum of 36 characters. |
| name | String | Definition Specifies the virtual interface name. Range The value can contain a maximum of 64 characters. |
| admin_state_up | Boolean | Definition Specifies the administrative status. Range true (enabled) or false (disabled) |
| bandwidth | Integer | Definition Specifies the virtual interface bandwidth. Range N/A |
| create_time | String | Definition Specifies the time when the virtual interface was created. The UTC time format is yyyy-MM-ddTHH:mm:ss.SSSZ. |
| update_time | String | Definition Specifies when the virtual interface was updated. The UTC time format is yyyy-MM-ddTHH:mm:ss.SSSZ. |
| description | String | Definition Provides supplementary information about the virtual interface. Range The value can contain a maximum of 2,048 characters. |
| direct_connect_id | String | Definition Specifies the connection ID. Range The value can contain a maximum of 36 characters. |
| service_type | String | Definition Specifies the gateway type. Range |
| status | String | Definition Specifies the operation status. Range |
| tenant_id | String | Definition Specifies the tenant ID. Range N/A |
| type | String | Definition Specifies the type of the virtual interface. Range |
| vgw_id | String | Definition Specifies the virtual gateway ID. Range The value can contain a maximum of 36 characters. |
| vlan | Integer | Definition Specifies the VLAN for connecting to the user gateway. The value ranges from 0 to 3999. Range 0–3999 |
| route_limit | Integer | Definition Specifies the remote subnet route configurations of the virtual interface. Range 1–200 |
| enable_nqa | Boolean | Definition Specifies whether to enable the NQA function. Range |
| enable_bfd | Boolean | Definition Specifies whether to enable the BFD function. Range |
| lag_id | String | Definition Specifies the ID of the LAG associated with the virtual interface. Range The value can contain a maximum of 36 characters. |
| device_id | String | Definition Specifies the ID of the device to which the virtual interface belongs. Range N/A |
| enterprise_project_id | String | Definition Specifies the ID of the enterprise project that the instance belongs to. Range The value is 0 or a string that contains a maximum of 36 bytes in UUID format with hyphens (-). 0 indicates the default enterprise project. |
| tags | Array of Tag objects | Definition Specifies the tag information. |
| local_gateway_v4_ip | String | Definition Specifies the IPv4 interface address of the gateway used on the cloud. This parameter has been migrated to the vifpeer parameter list and will be discarded later. Range N/A |
| remote_gateway_v4_ip | String | Definition Specifies the IPv4 interface address of the gateway used on premises. This parameter has been migrated to the vifpeer parameter list and will be discarded later. Range N/A |
| ies_id | String | Definition Specifies the ID of a CloudPond site. Range N/A |
| reason | String | Definition Displays error information if the status of a line is Error. Range N/A |
| rate_limit | Boolean | Definition Specifies whether rate limiting is enabled on a virtual interface. Range |
| address_family | String | Definition Specifies the address family of the virtual interface, which can be IPv4 or IPv6. This parameter has been migrated to the vifpeer parameter list and will be discarded later. Range N/A |
| local_gateway_v6_ip | String | Definition Specifies the IPv6 interface address of the gateway used on the cloud. This parameter has been migrated to the vifpeer parameter list and will be discarded later. Range N/A |
| remote_gateway_v6_ip | String | Definition Specifies the IPv6 interface address of the gateway used on premises. This parameter has been migrated to the vifpeer parameter list and will be discarded later. Range N/A |
| lgw_id | String | Definition Specifies the ID of the local gateway that is used in CloudPond scenarios. Range N/A |
| gateway_id | String | Definition Specifies the ID of the gateway associated with the virtual interface. Range N/A |
| remote_ep_group | Array of strings | Definition Specifies the remote subnet list, which records the CIDR blocks used in the on-premises data center. This parameter has been migrated to the vifpeer parameter list and will be discarded later. |
| service_ep_group | Array of strings | Definition Specifies the list of public network addresses that can be accessed by the on-premises data center. This field is required in the APIs of public network connections. This parameter has been migrated to the vifpeer parameter list and will be discarded later. |
| bgp_route_limit | Integer | Definition Specifies the BGP route configuration. Range N/A |
| priority | String | Definition Specifies the priority of a virtual interface. The value can be normal or low. If the priorities are the same, the virtual interfaces work in load balancing mode. If the priorities are different, the virtual interfaces work in active/standby pairs. Outbound traffic is preferentially forwarded to the normal virtual interface with a higher priority. This option is only supported by virtual interfaces that use BGP routing. Range |
| vif_peers | Array of VifPeer objects | Definition Provides information about virtual interface peers. |
| extend_attribute | VifExtendAttribute object | Definition Specifies extended parameters when BFD or NQA is used for reliability detection. |
| Parameter | Type | Description |
|---|---|---|
| key | String | Definition Specifies the tag key. Each key cannot start or end with a space, or start with _sys_. Only letters, digits, spaces, and the following special characters are allowed: _.:=+-@ Range 1 to 128 characters |
| value | String | Definition Specifies the tag value. The value can contain letters, digits, spaces, and the following special characters: _.:/=+-@ Range The value can contain a maximum of 255 characters. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Specifies the resource ID. Range The value can contain a maximum of 36 characters. |
| tenant_id | String | Definition Specifies the ID of the project to which the virtual interface peer belongs. Range N/A |
| name | String | Definition Specifies the virtual interface peer name. Range The value can contain a maximum of 64 characters. |
| description | String | Definition Provides supplementary information about the virtual interface peer. Range The value can contain a maximum of 128 characters. |
| address_family | String | Definition Specifies the address family of the virtual interface, which can be IPv4 or IPv6. Range N/A |
| local_gateway_ip | String | Definition Specifies the IP address of the virtual interface peer used on the cloud. Range N/A |
| remote_gateway_ip | String | Definition Specifies the IP address of the virtual interface peer used in the on-premises data center. Range N/A |
| route_mode | String | Definition Specifies the routing mode, which can be static or bgp. Range |
| bgp_asn | Integer | Definition Specifies the ASN of the BGP peer. Range 1 to 4294967295 |
| bgp_md5 | String | Definition Specifies the MD5 password of the BGP peer. Range N/A |
| remote_ep_group | Array of strings | Definition Specifies the remote subnet list, which records the CIDR blocks used in the on-premises data center. |
| service_ep_group | Array of strings | Definition Specifies the list of public network addresses that can be accessed by the on-premises data center. This field is required in the APIs of public network connections. |
| device_id | String | Definition Specifies the ID of the device to which the virtual interface belongs. Range N/A |
| bgp_route_limit | Integer | Definition Specifies the BGP route configuration. Range N/A |
| bgp_status | String | Definition Specifies the BGP protocol status of the virtual interface peer. If the virtual interface peer uses static routing, the status is null. Range N/A |
| status | String | Definition Specifies the virtual interface peer status. Range |
| vif_id | String | Definition Specifies the ID of the virtual interface corresponding to the virtual interface peer. Range The value can contain a maximum of 36 characters. |
| receive_route_num | Integer | Definition Specifies the number of received BGP routes if BGP routing is used. If static routing is used, this parameter does not take effect and the value is -1. If this parameter cannot be obtained, contact customer service to migrate your ports. Range N/A |
| enable_nqa | Boolean | Definition Specifies whether to enable the NQA function. Range |
| enable_bfd | Boolean | Definition Specifies whether to enable the BFD function. Range |
Example Requests
Creating a private virtual interface, with the bandwidth set to 2 Mbit/s, VLAN to 332, local gateway to 1.1.1.1/30, and remote gateway to 1.1.1.2/30, and routing mode to static routing
POST https://{dc_endpoint}/v3/0605768a3300d5762f82c01180692873/dcaas/virtual-interfaces
{
"virtual_interface" : {
"name" : "vif-0819",
"description" : "mytest",
"direct_connect_id" : "4673e339-8412-4ee1-b73e-2ba9cdfa54c1",
"vgw_id" : "8a47064a-f34c-4f94-b7fe-cac456c9b37b",
"vlan" : 332,
"bandwidth" : 2,
"local_gateway_v4_ip" : "1.1.1.1/30",
"remote_gateway_v4_ip" : "1.1.1.2/30",
"type" : "private",
"route_mode" : "static",
"remote_ep_group" : [ "1.1.2.0/30" ]
}
} Example Responses
Status code: 201
{
"virtual_interface" : {
"id" : "0d0fdf63-f2c4-491c-8866-d504796189be",
"name" : "vif-0819",
"description" : "mytest",
"tenant_id" : "0605768a3300d5762f82c01180692873",
"direct_connect_id" : "4673e339-8412-4ee1-b73e-2ba9cdfa54c1",
"vgw_id" : "8a47064a-f34c-4f94-b7fe-cac456c9b37b",
"type" : "private",
"service_type" : "VGW",
"vlan" : 332,
"bandwidth" : 2,
"device_id" : "18.9.215.131",
"status" : "ACTIVE",
"create_time" : "2022-08-19T11:28:06.000Z",
"update_time" : "2022-08-19T11:28:06.000Z",
"admin_state_up" : true,
"enable_bfd" : false,
"route_limit" : 50,
"enable_nqa" : false,
"local_gateway_v4_ip" : "1.1.1.1/30",
"remote_gateway_v4_ip" : "1.1.1.2/30",
"ies_id" : null,
"reason" : null,
"rate_limit" : false,
"local_gateway_v6_ip" : null,
"remote_gateway_v6_ip" : null,
"lgw_id" : null,
"lag_id" : null,
"priority" : "normal",
"vif_peers" : [ {
"id" : "c768eb52-12a8-4859-9b43-81194643040c",
"tenant_id" : "0605768a3300d5762f82c01180692873",
"name" : "vif-0819",
"description" : "",
"address_family" : "ipv4",
"local_gateway_ip" : "1.1.1.1/30",
"remote_gateway_ip" : "1.1.1.2/30",
"route_mode" : "static",
"bgp_asn" : null,
"bgp_md5" : null,
"device_id" : "18.9.215.131",
"bgp_route_limit" : 100,
"bgp_status" : null,
"status" : "ACTIVE",
"vif_id" : "0d0fdf63-f2c4-491c-8866-d504796189be",
"receive_route_num" : -1,
"remote_ep_group" : [ "1.1.2.0/30" ],
"enable_bfd" : false,
"enable_nqa" : false,
"service_ep_group" : null
} ],
"enterprise_project_id" : "0"
},
"request_id" : "5633df7af874576d819a481c76673236"
} SDK Sample Code
The SDK sample code is as follows.
Creating a private virtual interface, with the bandwidth set to 2 Mbit/s, VLAN to 332, local gateway to 1.1.1.1/30, and remote gateway to 1.1.1.2/30, and routing mode to static routing
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 | 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.dc.v3.region.DcRegion; import com.huaweicloud.sdk.dc.v3.*; import com.huaweicloud.sdk.dc.v3.model.*; import java.util.List; import java.util.ArrayList; public class CreateVirtualInterfaceSolution { 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); DcClient client = DcClient.newBuilder() .withCredential(auth) .withRegion(DcRegion.valueOf("<YOUR REGION>")) .build(); CreateVirtualInterfaceRequest request = new CreateVirtualInterfaceRequest(); CreateVirtualInterfaceRequestBody body = new CreateVirtualInterfaceRequestBody(); List<String> listVirtualInterfaceRemoteEpGroup = new ArrayList<>(); listVirtualInterfaceRemoteEpGroup.add("1.1.2.0/30"); CreateVirtualInterface virtualInterfacebody = new CreateVirtualInterface(); virtualInterfacebody.withName("vif-0819") .withDescription("mytest") .withDirectConnectId("4673e339-8412-4ee1-b73e-2ba9cdfa54c1") .withType(CreateVirtualInterface.TypeEnum.fromValue("private")) .withVlan(332) .withBandwidth(2) .withLocalGatewayV4Ip("1.1.1.1/30") .withRemoteGatewayV4Ip("1.1.1.2/30") .withVgwId("8a47064a-f34c-4f94-b7fe-cac456c9b37b") .withRouteMode(CreateVirtualInterface.RouteModeEnum.fromValue("static")) .withRemoteEpGroup(listVirtualInterfaceRemoteEpGroup); body.withVirtualInterface(virtualInterfacebody); request.withBody(body); try { CreateVirtualInterfaceResponse response = client.createVirtualInterface(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()); } } } |
Creating a private virtual interface, with the bandwidth set to 2 Mbit/s, VLAN to 332, local gateway to 1.1.1.1/30, and remote gateway to 1.1.1.2/30, and routing mode to static routing
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 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkdc.v3.region.dc_region import DcRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkdc.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 = DcClient.new_builder() \ .with_credentials(credentials) \ .with_region(DcRegion.value_of("<YOUR REGION>")) \ .build() try: request = CreateVirtualInterfaceRequest() listRemoteEpGroupVirtualInterface = [ "1.1.2.0/30" ] virtualInterfacebody = CreateVirtualInterface( name="vif-0819", description="mytest", direct_connect_id="4673e339-8412-4ee1-b73e-2ba9cdfa54c1", type="private", vlan=332, bandwidth=2, local_gateway_v4_ip="1.1.1.1/30", remote_gateway_v4_ip="1.1.1.2/30", vgw_id="8a47064a-f34c-4f94-b7fe-cac456c9b37b", route_mode="static", remote_ep_group=listRemoteEpGroupVirtualInterface ) request.body = CreateVirtualInterfaceRequestBody( virtual_interface=virtualInterfacebody ) response = client.create_virtual_interface(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Creating a private virtual interface, with the bandwidth set to 2 Mbit/s, VLAN to 332, local gateway to 1.1.1.1/30, and remote gateway to 1.1.1.2/30, and routing mode to static routing
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 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" dc "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dc/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dc/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dc/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, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := dc.DcClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := dc.NewDcClient(hcClient) request := &model.CreateVirtualInterfaceRequest{} var listRemoteEpGroupVirtualInterface = []string{ "1.1.2.0/30", } nameVirtualInterface:= "vif-0819" descriptionVirtualInterface:= "mytest" directConnectIdVirtualInterface:= "4673e339-8412-4ee1-b73e-2ba9cdfa54c1" localGatewayV4IpVirtualInterface:= "1.1.1.1/30" remoteGatewayV4IpVirtualInterface:= "1.1.1.2/30" vgwIdVirtualInterface:= "8a47064a-f34c-4f94-b7fe-cac456c9b37b" virtualInterfacebody := &model.CreateVirtualInterface{ Name: &nameVirtualInterface, Description: &descriptionVirtualInterface, DirectConnectId: &directConnectIdVirtualInterface, Type: model.GetCreateVirtualInterfaceTypeEnum().PRIVATE, Vlan: int32(332), Bandwidth: int32(2), LocalGatewayV4Ip: &localGatewayV4IpVirtualInterface, RemoteGatewayV4Ip: &remoteGatewayV4IpVirtualInterface, VgwId: &vgwIdVirtualInterface, RouteMode: model.GetCreateVirtualInterfaceRouteModeEnum().STATIC, RemoteEpGroup: &listRemoteEpGroupVirtualInterface, } request.Body = &model.CreateVirtualInterfaceRequestBody{ VirtualInterface: virtualInterfacebody, } response, err := client.CreateVirtualInterface(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 |
|---|---|
| 201 | Created |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank 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