Updating a Virtual Interface
Function
This API is used to update 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
PUT /v3/{project_id}/dcaas/virtual-interfaces/{virtual_interface_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Specifies the project ID. Constraints N/A Range N/A Default Value N/A |
| virtual_interface_id | Yes | String | Definition Specifies the virtual interface ID. Constraints N/A Range The value can contain up to 36 characters in UUID format and is connected by hyphens (-). 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 | UpdateVirtualInterface object | Definition Request body for updating the 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 |
| bandwidth | No | Integer | Definition Specifies the bandwidth size of the virtual interface. 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 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 local endpoint group that is connected to the public network over a connection. Constraints N/A |
| enable_bfd | No | Boolean | Definition Specifies whether to enable the BFD function. Constraints N/A Range Default Value N/A |
| enable_nqa | No | Boolean | Definition Specifies whether to enable the NQA function. Constraints N/A Range Default Value N/A |
| status | No | String | Definition Specifies whether to accept the virtual interface created by other tenants. Constraints N/A Range Default Value N/A |
Response Parameters
Status code: 200
| 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
Updating the name and description of a virtual interface and changing its bandwidth to 2 Mbit/s
PUT https://{dc_endpoint}/v3/0605768a3300d5762f82c01180692873/dcaas/virtual-interfaces/0d0fdf63-f2c4-491c-8866-d504796189be
{
"virtual_interface" : {
"name" : "vif-0819",
"description" : "mytest",
"bandwidth" : 2
}
} Example Responses
Status code: 200
{
"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,
"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,
"address_family" : "ipv4",
"local_gateway_v6_ip" : null,
"remote_gateway_v6_ip" : null,
"lgw_id" : null,
"lag_id" : null,
"gateway_id" : null,
"remote_ep_group" : [ "1.1.2.0/30" ],
"service_ep_group" : [ ],
"bgp_route_limit" : 100,
"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" ],
"service_ep_group" : null,
"enable_bfd" : false,
"enable_nqa" : false
} ],
"enterprise_project_id" : "0"
},
"request_id" : "5633df7af874576d819a481c76673236"
} SDK Sample Code
The SDK sample code is as follows.
Updating the name and description of a virtual interface and changing its bandwidth to 2 Mbit/s
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 | 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.*; public class UpdateVirtualInterfaceSolution { 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(); UpdateVirtualInterfaceRequest request = new UpdateVirtualInterfaceRequest(); request.withVirtualInterfaceId("{virtual_interface_id}"); UpdateVirtualInterfaceRequestBody body = new UpdateVirtualInterfaceRequestBody(); UpdateVirtualInterface virtualInterfacebody = new UpdateVirtualInterface(); virtualInterfacebody.withName("vif-0819") .withDescription("mytest") .withBandwidth(2); body.withVirtualInterface(virtualInterfacebody); request.withBody(body); try { UpdateVirtualInterfaceResponse response = client.updateVirtualInterface(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()); } } } |
Updating the name and description of a virtual interface and changing its bandwidth to 2 Mbit/s
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 | # 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 = UpdateVirtualInterfaceRequest() request.virtual_interface_id = "{virtual_interface_id}" virtualInterfacebody = UpdateVirtualInterface( name="vif-0819", description="mytest", bandwidth=2 ) request.body = UpdateVirtualInterfaceRequestBody( virtual_interface=virtualInterfacebody ) response = client.update_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) |
Updating the name and description of a virtual interface and changing its bandwidth to 2 Mbit/s
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 | 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.UpdateVirtualInterfaceRequest{} request.VirtualInterfaceId = "{virtual_interface_id}" nameVirtualInterface:= "vif-0819" descriptionVirtualInterface:= "mytest" bandwidthVirtualInterface:= int32(2) virtualInterfacebody := &model.UpdateVirtualInterface{ Name: &nameVirtualInterface, Description: &descriptionVirtualInterface, Bandwidth: &bandwidthVirtualInterface, } request.Body = &model.UpdateVirtualInterfaceRequestBody{ VirtualInterface: virtualInterfacebody, } response, err := client.UpdateVirtualInterface(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 | OK |
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