本文介绍如何查询IPsec连接的信息。
package com.volcengine.vpn.examples; import com.volcengine.ApiClient; import com.volcengine.ApiException; import com.volcengine.sign.Credentials; import com.volcengine.vpn.VpnApi; import com.volcengine.vpn.model.*; public class TestDescribeVpnConnectionAttributes { public static void main(String[] args) throws Exception { // 设置您的AK信息。 String ak = "Your AK"; // 设置您的SK信息。 String sk = "Your SK"; // 设置您要访问的地域。 String region = "Your Region"; // 初始化apiclient。 ApiClient apiClient = new ApiClient() .setCredentials(Credentials.getCredentials(ak, sk)) .setRegion(region); VpnApi api = new VpnApi(apiClient); // 配置待查询IPsec连接的参数。 DescribeVpnConnectionAttributesRequest describeVpnConnectionAttributesRequest = new DescribeVpnConnectionAttributesRequest(); describeVpnConnectionAttributesRequest.setVpnConnectionId("vgc-2bzvqi8kerd342dx0eg2f****"); // 设置待查询IPsec连接的ID。 // 发起请求并处理返回或异常。 try { DescribeVpnConnectionAttributesResponse response = api.describeVpnConnectionAttributes(describeVpnConnectionAttributesRequest); System.out.println(response); } catch (ApiException e) { System.out.println(e.getResponseBody()); } } }