You need to enable JavaScript to run this app.
导航
创建专线网关
最近更新时间:2023.07.05 15:24:47首次发布时间:2023.07.05 15:24:47

本文介绍如何创建专线网关。

示例代码

// Example Code generated by Beijing Volcanoengine Technology.
package directconnectemample

import (
	"fmt"

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

func CreateDirectConnectGateway() {
	// 设置您的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 := directconnect.New(sess)
	// 创建专线网关。
	createDirectConnectGatewayInput := &directconnect.CreateDirectConnectGatewayInput{
		Description:              volcengine.String("test"), // 设置专线网关的描述。
		DirectConnectGatewayName: volcengine.String("test"), // 设置专线网关的名称。
	}

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

相关文档