Deleting a VPC Peering Connection

Sample Code

You can use the API to delete a VPC peering connection. Sample code is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
// Import classes:
import com.huaweicloud.cs.java.v1.client.ApiException;
import com.huaweicloud.cs.java.v1.ClusterApi;


ClusterApi apiInstance = new ClusterApi(apiClient);//apiClient is created when initializing a CS API client.
String xProjectId = "xProjectId_example"; // String | 
Integer clusterId = 56; // Integer | 
String peeringId = "peeringId_example"; // String | 
try {
    apiInstance.deletePeering(xProjectId, clusterId, peeringId);
} catch (ApiException e) {
    System.err.println("Exception when calling ClusterApi#deletePeering");
    System.err.println(e.getResponseBody());
    e.printStackTrace();
}

Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

xProjectId

Yes

String

Project ID. This parameter is used to obtain the token for the project.

clusterId

Yes

Integer

ID of an exclusive cluster.

peeringId

Yes

String

ID of a VPC peering connection.