Querying the List of VPC Peering Connections
Sample Code
You can use the API to query the list of VPC peering connections. 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 |
try {
GetPeeringsResponse result = apiInstance.getPeerings(xProjectId, clusterId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ClusterApi#getPeerings");
System.err.println(e.getResponseBody());
e.printStackTrace();
}
|
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. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| peerings | No | - | Information about the list of VPC peering connections. For details about parameter types, see Table 3. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | No | String | Name of a VPC peering connection. |
| id | No | String | ID of a VPC peering connection. |
| requestVpcInfo | No | - | Information about the local VPC. For details, see Table 5. |
| acceptVpcInfo | No | - | Information about the peer VPC. For details, see Table 5. |
| status | No | String | Status of a VPC peering connection. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| vpcId | No | String | ID of a VPC peering connection. |
| tenantId | No | String | Tenant ID. |
Last Article: Querying a VPC Peering Connection
Next Article: Creating a Route
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.