本文介绍如何创建专线网关。
// 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) }