代码示例在example目录下
package main
import (
"fmt"
"github.com/volcengine/volcengine-go-sdk/service/vpc"
"github.com/volcengine/volcengine-go-sdk/volcengine"
"github.com/volcengine/volcengine-go-sdk/volcengine/credentials"
"github.com/volcengine/volcengine-go-sdk/volcengine/session"
)
func main() {
var (
ak string
sk string
region string
config *volcengine.Config
sess *session.Session
client *vpc.VPC
resp *vpc.DescribeVpcsOutput
err error
)
ak = "your ak"
sk = "your sk"
region = "cn-beijing"
config = volcengine.NewConfig().
WithCredentials(credentials.NewStaticCredentials(ak, sk, "")).
WithRegion(region)
sess, _ = session.NewSession(config)
client = vpc.New(sess)
resp, err = client.DescribeVpcs(&vpc.DescribeVpcsInput{
PageNumber: volcengine.Int64(1),
PageSize: volcengine.Int64(10),
})
if err != nil {
panic(err)
}
fmt.Println(&resp)
}