You need to enable JavaScript to run this app.
导航
修改IPsec连接信息
最近更新时间:2023.07.05 15:21:25首次发布时间:2023.07.05 15:21:25

本文介绍如何修改IPsec连接信息。

示例代码

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 ModifyVpnConnectionAttributes() {
	// 设置您的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)
	// 配置待修改IPsec连接的信息。
	modifyVpnConnectionAttributesInput := &vpn.ModifyVpnConnectionAttributesInput{
		VpnConnectionId: volcengine.String("vgc-2bzvqi8kerd342dx0eg2f****"), // 待修改IPsec连接的ID。
	}

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

相关文档