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

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

示例代码

package vpnexample

import (
	"fmt"

	"github.com/volcengine/volcengine-go-sdk/service/vpn"
	"github.com/volcengine/volcengine-go-sdk/volcengine"
	"github.com/volcengine/volcengine-go-sdk/volcengine/credentials"
	"github.com/volcengine/volcengine-go-sdk/volcengine/session"
)

func DeleteVpnGatewayRoute() {
	// 设置您的AK、SK和要访问的地域。
	ak, sk, region := "Your AK", "Your SK", "Region"
	config := volcengine.NewConfig().
		WithRegion(region).
		WithCredentials(credentials.NewStaticCredentials(ak, sk, ""))
	sess, err := session.NewSession(config)
	if err != nil {
		panic(err)
	}
	svc := vpn.New(sess)
	// 配置待删除VPN网关路由条目的参数。
	deleteVpnGatewayRouteInput := &vpn.DeleteVpnGatewayRouteInput{
		VpnGatewayRouteId: volcengine.String("vgr-7qthudw0ll6jmc****"), // 待删除VPN网关路由条目的ID。
	}

	// 发起请求并处理返回或异常。
	resp, err := svc.DeleteVpnGatewayRoute(deleteVpnGatewayRouteInput)
	if err != nil {
		panic(err)
	}
	fmt.Println(resp)
}

相关文档

SDK源码:example_delete_vpn_gateway_route_2020-04-01.go
API接口:DeleteVpnGatewayRoute