You need to enable JavaScript to run this app.
导航
删除VPN网关路由条目
最近更新时间:2023.07.05 15:21:26首次发布时间:2023.07.05 15:21:26

本文介绍如何删除VPN网关目的路由条目。

示例代码

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 TestDeleteVpnGatewayRoute {
    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);
        
        // 配置待删除VPN网关路由条目的参数。
        DeleteVpnGatewayRouteRequest deleteVpnGatewayRouteRequest = new DeleteVpnGatewayRouteRequest();
        deleteVpnGatewayRouteRequest.setVpnGatewayRouteId("vgr-7qthudw0ll6jmc****"); // 待删除VPN网关路由条目的ID。
        
        // 发起请求并处理返回或异常。
        try {
            DeleteVpnGatewayRouteResponse response = api.deleteVpnGatewayRoute(deleteVpnGatewayRouteRequest);
            System.out.println(response);
        } catch (ApiException e) {
            System.out.println(e.getResponseBody());
        }
    }
}

相关文档

SDK源码:TestDeleteVpnGatewayRoute.java
API接口:DeleteVpnGatewayRoute