You need to enable JavaScript to run this app.
导航

创建云企业网实例

最近更新时间2023.06.27 15:39:07

首次发布时间2023.06.27 15:39:07

本文介绍如何创建一个云企业网实例。

示例代码

package cenexample

import (
	"fmt"

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

func CreateCen() {
		//设置您的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 := cen.New(sess)
	//创建一个CreateCen接口
	createCenInput := &cen.CreateCenInput{
		CenName:     volcengine.String("cen-test"),  //CEN实例的名称
		Description: volcengine.String("test"),  //CEN实例的描述信息
	}

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

相关文档