feature: support data disks for tencentcloud builder

Data disk is an important feature for instances and images, this
patch implements the basic functionality of it. More work needs
to be done to make it friendly to users. Docs has pointed out
current limitation.

Also update dependencies because this feature requires new code in
tencentcloud go sdk.
This commit is contained in:
ZhiQiang Fan 2019-06-19 17:17:19 +08:00
parent 049811d329
commit 7235a4a775
18 changed files with 3734 additions and 1371 deletions

View File

@ -104,6 +104,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
InstanceName: b.config.InstanceName,
DiskType: b.config.DiskType,
DiskSize: b.config.DiskSize,
DataDisks: b.config.DataDisks,
HostName: b.config.HostName,
InternetMaxBandwidthOut: b.config.InternetMaxBandwidthOut,
AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,

View File

@ -10,6 +10,12 @@ import (
"github.com/pkg/errors"
)
type tencentCloudDataDisk struct {
DiskType string `mapstructure:"disk_type"`
DiskSize int64 `mapstructure:"disk_size"`
SnapshotId string `mapstructure:"disk_snapshot_id"`
}
type TencentCloudRunConfig struct {
AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"`
SourceImageId string `mapstructure:"source_image_id"`
@ -17,6 +23,7 @@ type TencentCloudRunConfig struct {
InstanceName string `mapstructure:"instance_name"`
DiskType string `mapstructure:"disk_type"`
DiskSize int64 `mapstructure:"disk_size"`
DataDisks []tencentCloudDataDisk `mapstructure:"data_disks"`
VpcId string `mapstructure:"vpc_id"`
VpcName string `mapstructure:"vpc_name"`
VpcIp string `mapstructure:"vpc_ip"`

View File

@ -28,6 +28,15 @@ func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) mul
req.ImageName = &config.ImageName
req.ImageDescription = &config.ImageDescription
req.InstanceId = instance.InstanceId
// TODO: We should allow user to specify which data disk should be
// included into created image.
var dataDiskIds []*string
for _, disk := range instance.DataDisks {
dataDiskIds = append(dataDiskIds, disk.DiskId)
}
if len(dataDiskIds) > 0 {
req.DataDiskIds = dataDiskIds
}
True := "True"
False := "False"

View File

@ -27,6 +27,7 @@ type stepRunInstance struct {
InternetMaxBandwidthOut int64
AssociatePublicIpAddress bool
Tags map[string]string
DataDisks []tencentCloudDataDisk
}
func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
@ -62,10 +63,46 @@ func (s *stepRunInstance) Run(ctx context.Context, state multistep.StateBag) mul
req.ImageId = source_image.ImageId
req.InstanceChargeType = &POSTPAID_BY_HOUR
req.InstanceType = &s.InstanceType
// TODO: Add check for system disk size, it should be larger than image system disk size.
req.SystemDisk = &cvm.SystemDisk{
DiskType: &s.DiskType,
DiskSize: &s.DiskSize,
}
// System disk snapshot is mandatory, so if there are additional data disks,
// length will be larger than 1.
if source_image.SnapshotSet != nil && len(source_image.SnapshotSet) > 1 {
ui.Say("Use source image snapshot data disks, ignore user data disk settings.")
var dataDisks []*cvm.DataDisk
for _, snapshot := range source_image.SnapshotSet {
if *snapshot.DiskUsage == "DATA_DISK" {
var dataDisk cvm.DataDisk
// FIXME: Currently we have no way to get original disk type
// from data disk snapshots, and we don't allow user to overwrite
// snapshot settings, and we cannot guarantee a certain hard-coded type
// is not sold out, so here we use system disk type as a workaround.
//
// Eventually, we need to allow user to overwrite snapshot disk
// settings.
dataDisk.DiskType = &s.DiskType
dataDisk.DiskSize = snapshot.DiskSize
dataDisk.SnapshotId = snapshot.SnapshotId
dataDisks = append(dataDisks, &dataDisk)
}
}
req.DataDisks = dataDisks
} else {
var dataDisks []*cvm.DataDisk
for _, disk := range s.DataDisks {
var dataDisk cvm.DataDisk
dataDisk.DiskType = &disk.DiskType
dataDisk.DiskSize = &disk.DiskSize
if disk.SnapshotId != "" {
dataDisk.SnapshotId = &disk.SnapshotId
}
dataDisks = append(dataDisks, &dataDisk)
}
req.DataDisks = dataDisks
}
req.VirtualPrivateCloud = &cvm.VirtualPrivateCloud{
VpcId: &vpc_id,
SubnetId: &subnet_id,

View File

@ -0,0 +1,34 @@
{
"variables": {
"secret_id": "{{env `TENCENTCLOUD_ACCESS_KEY`}}",
"secret_key": "{{env `TENCENTCLOUD_SECRET_KEY`}}"
},
"builders": [{
"type": "tencentcloud-cvm",
"secret_id": "{{user `secret_id`}}",
"secret_key": "{{user `secret_key`}}",
"region": "ap-guangzhou",
"zone": "ap-guangzhou-4",
"instance_type": "S4.SMALL1",
"source_image_id": "img-oikl1tzv",
"ssh_username" : "root",
"image_name": "PackerTest",
"disk_type": "CLOUD_PREMIUM",
"packer_debug": true,
"associate_public_ip_address": true,
"run_tags": {
"good": "luck"
},
"data_disks": [{
"disk_type": "CLOUD_PREMIUM",
"disk_size": 50
}]
}],
"provisioners": [{
"type": "shell",
"inline": [
"sleep 30",
"yum install redis.x86_64 -y"
]
}]
}

2
go.mod
View File

@ -109,7 +109,7 @@ require (
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
github.com/stretchr/testify v1.3.0
github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346
github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible
github.com/ucloud/ucloud-sdk-go v0.8.7
github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1
github.com/ulikunitz/xz v0.5.5

4
go.sum
View File

@ -425,8 +425,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346 h1:a014AaXz7AISMePv8xKRffUZZkr5z2XmSDf41gRV3+A=
github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4=
github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible h1:9sIWfe6ZC7xoSlshYWNGicPqomK7N+CsHMa1YFWBCWU=
github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4=
github.com/ucloud/ucloud-sdk-go v0.8.7 h1:BmXOb5RivI0Uu4oZRpjI6SQ9/y7n/H9wxTGR1txIE8o=
github.com/ucloud/ucloud-sdk-go v0.8.7/go.mod h1:lM6fpI8y6iwACtlbHUav823/uKPdXsNBlnBpRF2fj3c=
github.com/ugorji/go v0.0.0-20151218193438-646ae4a518c1 h1:U6ufy3mLDgg9RYupntOvAF7xCmNNquyKaYaaVHo1Nnk=

View File

@ -1,8 +1,13 @@
package common
import (
"encoding/hex"
"encoding/json"
"fmt"
"log"
"net/http"
"strconv"
"strings"
"time"
tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
@ -15,6 +20,7 @@ type Client struct {
httpProfile *profile.HttpProfile
credential *Credential
signMethod string
unsignedPayload bool
debug bool
}
@ -31,18 +37,27 @@ func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err err
request.SetHttpMethod(c.httpProfile.ReqMethod)
}
tchttp.CompleteCommonParams(request, c.GetRegion())
if c.signMethod == "HmacSHA1" || c.signMethod == "HmacSHA256" {
return c.sendWithSignatureV1(request, response)
} else {
return c.sendWithSignatureV3(request, response)
}
}
func (c *Client) sendWithSignatureV1(request tchttp.Request, response tchttp.Response) (err error) {
err = tchttp.ConstructParams(request)
if err != nil {
return
return err
}
tchttp.CompleteCommonParams(request, c.GetRegion())
err = signRequest(request, c.credential, c.signMethod)
if err != nil {
return
return err
}
httpRequest, err := http.NewRequest(request.GetHttpMethod(), request.GetUrl(), request.GetBodyReader())
if err != nil {
return
return err
}
if request.GetHttpMethod() == "POST" {
httpRequest.Header["Content-Type"] = []string{"application/x-www-form-urlencoded"}
@ -53,7 +68,129 @@ func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err err
return err
}
err = tchttp.ParseFromHttpResponse(httpResponse, response)
return
return err
}
func (c *Client) sendWithSignatureV3(request tchttp.Request, response tchttp.Response) (err error) {
headers := map[string]string{
"Host": request.GetDomain(),
"X-TC-Action": request.GetAction(),
"X-TC-Version": request.GetVersion(),
"X-TC-Timestamp": request.GetParams()["Timestamp"],
"X-TC-RequestClient": request.GetParams()["RequestClient"],
}
if c.region != "" {
headers["X-TC-Region"] = c.region
}
if c.credential.Token != "" {
headers["X-TC-Token"] = c.credential.Token
}
if request.GetHttpMethod() == "GET" {
headers["Content-Type"] = "application/x-www-form-urlencoded"
} else {
headers["Content-Type"] = "application/json"
}
// start signature v3 process
// build canonical request string
httpRequestMethod := request.GetHttpMethod()
canonicalURI := "/"
canonicalQueryString := ""
if httpRequestMethod == "GET" {
err = tchttp.ConstructParams(request)
if err != nil {
return err
}
params := make(map[string]string)
for key, value := range request.GetParams() {
params[key] = value
}
delete(params, "Action")
delete(params, "Version")
delete(params, "Nonce")
delete(params, "Region")
delete(params, "RequestClient")
delete(params, "Timestamp")
canonicalQueryString = tchttp.GetUrlQueriesEncoded(params)
}
canonicalHeaders := fmt.Sprintf("content-type:%s\nhost:%s\n", headers["Content-Type"], headers["Host"])
signedHeaders := "content-type;host"
requestPayload := ""
if httpRequestMethod == "POST" {
b, err := json.Marshal(request)
if err != nil {
return err
}
requestPayload = string(b)
}
hashedRequestPayload := ""
if c.unsignedPayload {
hashedRequestPayload = sha256hex("UNSIGNED-PAYLOAD")
headers["X-TC-Content-SHA256"] = "UNSIGNED-PAYLOAD"
} else {
hashedRequestPayload = sha256hex(requestPayload)
}
canonicalRequest := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s",
httpRequestMethod,
canonicalURI,
canonicalQueryString,
canonicalHeaders,
signedHeaders,
hashedRequestPayload)
//log.Println("canonicalRequest:", canonicalRequest)
// build string to sign
algorithm := "TC3-HMAC-SHA256"
requestTimestamp := headers["X-TC-Timestamp"]
timestamp, _ := strconv.ParseInt(requestTimestamp, 10, 64)
t := time.Unix(timestamp, 0).UTC()
// must be the format 2006-01-02, ref to package time for more info
date := t.Format("2006-01-02")
credentialScope := fmt.Sprintf("%s/%s/tc3_request", date, request.GetService())
hashedCanonicalRequest := sha256hex(canonicalRequest)
string2sign := fmt.Sprintf("%s\n%s\n%s\n%s",
algorithm,
requestTimestamp,
credentialScope,
hashedCanonicalRequest)
//log.Println("string2sign", string2sign)
// sign string
secretDate := hmacsha256(date, "TC3"+c.credential.SecretKey)
secretService := hmacsha256(request.GetService(), secretDate)
secretKey := hmacsha256("tc3_request", secretService)
signature := hex.EncodeToString([]byte(hmacsha256(string2sign, secretKey)))
//log.Println("signature", signature)
// build authorization
authorization := fmt.Sprintf("%s Credential=%s/%s, SignedHeaders=%s, Signature=%s",
algorithm,
c.credential.SecretId,
credentialScope,
signedHeaders,
signature)
//log.Println("authorization", authorization)
headers["Authorization"] = authorization
url := "https://" + request.GetDomain() + request.GetPath()
if canonicalQueryString != "" {
url = url + "?" + canonicalQueryString
}
httpRequest, err := http.NewRequest(httpRequestMethod, url, strings.NewReader(requestPayload))
if err != nil {
return err
}
for k, v := range headers {
httpRequest.Header[k] = []string{v}
}
//log.Printf("[DEBUG] http request=%v, body=%v", httpRequest, requestPayload)
httpResponse, err := c.httpClient.Do(httpRequest)
if err != nil {
return err
}
err = tchttp.ParseFromHttpResponse(httpResponse, response)
return err
}
func (c *Client) GetRegion() string {
@ -81,6 +218,7 @@ func (c *Client) WithCredential(cred *Credential) *Client {
func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client {
c.signMethod = clientProfile.SignMethod
c.unsignedPayload = clientProfile.UnsignedPayload
c.httpProfile = clientProfile.HttpProfile
c.httpClient.Timeout = time.Duration(c.httpProfile.ReqTimeout) * time.Second
return c
@ -91,6 +229,11 @@ func (c *Client) WithSignatureMethod(method string) *Client {
return c
}
func (c *Client) WithHttpTransport(transport http.RoundTripper) *Client {
c.httpClient.Transport = transport
return c
}
func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
client = &Client{}
client.Init(region).WithSecretId(secretId, secretKey)

View File

@ -92,7 +92,7 @@ func (r *BaseRequest) GetService() string {
func (r *BaseRequest) GetUrl() string {
if r.httpMethod == GET {
return "https://" + r.domain + r.path + "?" + getUrlQueriesEncoded(r.params)
return "https://" + r.domain + r.path + "?" + GetUrlQueriesEncoded(r.params)
} else if r.httpMethod == POST {
return "https://" + r.domain + r.path
} else {
@ -104,7 +104,7 @@ func (r *BaseRequest) GetVersion() string {
return r.version
}
func getUrlQueriesEncoded(params map[string]string) string {
func GetUrlQueriesEncoded(params map[string]string) string {
values := url.Values{}
for key, value := range params {
if value != "" {
@ -116,8 +116,7 @@ func getUrlQueriesEncoded(params map[string]string) string {
func (r *BaseRequest) GetBodyReader() io.Reader {
if r.httpMethod == POST {
s := getUrlQueriesEncoded(r.params)
//log.Printf("[DEBUG] body: %s", s)
s := GetUrlQueriesEncoded(r.params)
return strings.NewReader(s)
} else {
return strings.NewReader("")
@ -153,7 +152,7 @@ func CompleteCommonParams(request Request, region string) {
params["Action"] = request.GetAction()
params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10)
params["Nonce"] = strconv.Itoa(rand.Int())
params["RequestClient"] = "SDK_GO_3.0.42"
params["RequestClient"] = "SDK_GO_3.0.71"
}
func ConstructParams(req Request) (err error) {
@ -196,9 +195,8 @@ func flatStructure(value reflect.Value, request Request, prefix string) (err err
} else if kind == reflect.Float64 {
request.GetParams()[key] = strconv.FormatFloat(field.Float(), 'f', -1, 64)
} else if kind == reflect.Slice {
list := value.Field(i)
for j := 0; j < list.Len(); j++ {
vj := list.Index(j)
for j := 0; j < field.Len(); j++ {
vj := field.Index(j)
key := prefix + nameTag + "." + strconv.Itoa(j)
kind = vj.Kind()
if kind == reflect.Ptr && vj.IsNil() {
@ -219,11 +217,11 @@ func flatStructure(value reflect.Value, request Request, prefix string) (err err
} else if kind == reflect.Float64 {
request.GetParams()[key] = strconv.FormatFloat(vj.Float(), 'f', -1, 64)
} else {
flatStructure(vj, request, key+".")
return flatStructure(vj, request, key+".")
}
}
} else {
flatStructure(reflect.ValueOf(field.Interface()), request, prefix+nameTag+".")
return flatStructure(reflect.ValueOf(field.Interface()), request, prefix+nameTag+".")
}
}
return

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
//"log"
"log"
"net/http"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
@ -69,5 +69,8 @@ func ParseFromHttpResponse(hr *http.Response, response Response) (err error) {
return
}
err = json.Unmarshal(body, &response)
if err != nil {
log.Printf("Unexpected Error occurs when parsing API response\n%s\n", string(body[:]))
}
return
}

View File

@ -3,11 +3,13 @@ package profile
type ClientProfile struct {
HttpProfile *HttpProfile
SignMethod string
UnsignedPayload bool
}
func NewClientProfile() *ClientProfile {
return &ClientProfile{
HttpProfile: NewHttpProfile(),
SignMethod: "HmacSHA256",
SignMethod: "TC3-HMAC-SHA256",
UnsignedPayload: false,
}
}

View File

@ -5,6 +5,7 @@ import (
"crypto/sha1"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"sort"
"strings"
@ -27,6 +28,17 @@ func Sign(s, secretKey, method string) string {
return base64.StdEncoding.EncodeToString(hashed.Sum(nil))
}
func sha256hex(s string) string {
b := sha256.Sum256([]byte(s))
return hex.EncodeToString(b[:])
}
func hmacsha256(s, key string) string {
hashed := hmac.New(sha256.New, []byte(key))
hashed.Write([]byte(s))
return string(hashed.Sum(nil))
}
func signRequest(request tchttp.Request, credential *Credential, method string) (err error) {
if method != SHA256 {
method = SHA1

View File

@ -611,6 +611,33 @@ func (c *Client) DescribeInstances(request *DescribeInstancesRequest) (response
return
}
func NewDescribeInstancesOperationLimitRequest() (request *DescribeInstancesOperationLimitRequest) {
request = &DescribeInstancesOperationLimitRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstancesOperationLimit")
return
}
func NewDescribeInstancesOperationLimitResponse() (response *DescribeInstancesOperationLimitResponse) {
response = &DescribeInstancesOperationLimitResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口DescribeInstancesOperationLimit用于查询实例操作限制。
//
// * 目前支持调整配置操作限制次数查询。
func (c *Client) DescribeInstancesOperationLimit(request *DescribeInstancesOperationLimitRequest) (response *DescribeInstancesOperationLimitResponse, err error) {
if request == nil {
request = NewDescribeInstancesOperationLimitRequest()
}
response = NewDescribeInstancesOperationLimitResponse()
err = c.Send(request, response)
return
}
func NewDescribeInstancesStatusRequest() (request *DescribeInstancesStatusRequest) {
request = &DescribeInstancesStatusRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -785,7 +812,7 @@ func NewDisassociateInstancesKeyPairsResponse() (response *DisassociateInstances
//
// * 只支持[`STOPPED`](https://cloud.tencent.com/document/api/213/9452#INSTANCE_STATE)状态的`Linux`操作系统的实例。
// * 解绑密钥后,实例可以通过原来设置的密码登录。
// * 如果原来没有设置密码,解绑后将无法使用 `SSH` 登录。可以调用 [ResetInstancesPassword](https://cloud.tencent.com/document/api/213/9397) 接口来设置登陆密码。
// * 如果原来没有设置密码,解绑后将无法使用 `SSH` 登录。可以调用 [ResetInstancesPassword](https://cloud.tencent.com/document/api/213/15736) 接口来设置登录密码。
// * 支持批量操作。每次请求批量实例的上限为100。如果批量实例存在不允许操作的实例操作会以特定错误码返回。
func (c *Client) DisassociateInstancesKeyPairs(request *DisassociateInstancesKeyPairsRequest) (response *DisassociateInstancesKeyPairsResponse, err error) {
if request == nil {
@ -1006,7 +1033,6 @@ func NewInquiryPriceResetInstancesTypeResponse() (response *InquiryPriceResetIns
//
// * 目前只支持[系统盘类型](https://cloud.tencent.com/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口进行调整机型询价。
// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型询价。
// * 目前不支持跨机型系统来调整机型,即使用该接口时指定的`InstanceType`和实例原来的机型需要属于同一系列。
// * 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
func (c *Client) InquiryPriceResetInstancesType(request *InquiryPriceResetInstancesTypeRequest) (response *InquiryPriceResetInstancesTypeResponse, err error) {
if request == nil {
@ -1034,7 +1060,7 @@ func NewInquiryPriceResizeInstanceDisksResponse() (response *InquiryPriceResizeI
// 本接口 (InquiryPriceResizeInstanceDisks) 用于扩容实例的数据盘询价。
//
// * 目前只支持扩容随实例购买的数据盘询价,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。
// * 目前只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性)询价,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。
// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘询价。* 仅支持包年包月实例随机器购买的数据盘。* 目前只支持扩容一块数据盘询价。
func (c *Client) InquiryPriceResizeInstanceDisks(request *InquiryPriceResizeInstanceDisksRequest) (response *InquiryPriceResizeInstanceDisksResponse, err error) {
if request == nil {
@ -1544,7 +1570,7 @@ func NewResetInstancesTypeResponse() (response *ResetInstancesTypeResponse) {
// 本接口 (ResetInstancesType) 用于调整实例的机型。
// * 目前只支持[系统盘类型](/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口进行机型调整。
// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型。* 目前不支持跨机型系统来调整机型,即使用该接口时指定的`InstanceType`和实例原来的机型需要属于同一系列。* 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型。对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
func (c *Client) ResetInstancesType(request *ResetInstancesTypeRequest) (response *ResetInstancesTypeResponse, err error) {
if request == nil {
request = NewResetInstancesTypeRequest()
@ -1571,7 +1597,8 @@ func NewResizeInstanceDisksResponse() (response *ResizeInstanceDisksResponse) {
// 本接口 (ResizeInstanceDisks) 用于扩容实例的数据盘。
//
// * 目前只支持扩容随实例购买的数据盘,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。* 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘。
// * 目前只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性),且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。
// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘。
// * 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
// * 目前只支持扩容一块数据盘。
func (c *Client) ResizeInstanceDisks(request *ResizeInstanceDisksRequest) (response *ResizeInstanceDisksResponse, err error) {

File diff suppressed because it is too large Load Diff

View File

@ -93,6 +93,33 @@ func (c *Client) AddBandwidthPackageResources(request *AddBandwidthPackageResour
return
}
func NewAddIp6RulesRequest() (request *AddIp6RulesRequest) {
request = &AddIp6RulesRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "AddIp6Rules")
return
}
func NewAddIp6RulesResponse() (response *AddIp6RulesResponse) {
response = &AddIp6RulesResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 1. 该接口用于在转换实例下添加IPV6转换规则。
// 2. 支持在同一个转换实例下批量添加转换规则一个账户在一个地域最多50个。
// 3. 一个完整的转换规则包括vip6:vport6:protocol:vip:vport其中vip6:vport6:protocol必须是唯一。
func (c *Client) AddIp6Rules(request *AddIp6RulesRequest) (response *AddIp6RulesResponse, err error) {
if request == nil {
request = NewAddIp6RulesRequest()
}
response = NewAddIp6RulesResponse()
err = c.Send(request, response)
return
}
func NewAllocateAddressesRequest() (request *AllocateAddressesRequest) {
request = &AllocateAddressesRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -121,6 +148,90 @@ func (c *Client) AllocateAddresses(request *AllocateAddressesRequest) (response
return
}
func NewAssignIpv6AddressesRequest() (request *AssignIpv6AddressesRequest) {
request = &AssignIpv6AddressesRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6Addresses")
return
}
func NewAssignIpv6AddressesResponse() (response *AssignIpv6AddressesResponse) {
response = &AssignIpv6AddressesResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口AssignIpv6Addresses用于弹性网卡申请`IPv6`地址。<br />
// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口。
// * 一个弹性网卡支持绑定的IP地址是有限制的更多资源限制信息详见<a href="/document/product/576/18527">弹性网卡使用限制</a>。
// * 可以指定`IPv6`地址申请,地址类型不能为主`IP``IPv6`地址暂时只支持作为辅助`IP`。
// * 地址必须要在弹性网卡所在子网内,而且不能被占用。
// * 在弹性网卡上申请一个到多个辅助`IPv6`地址,接口会在弹性网卡所在子网段内返回指定数量的辅助`IPv6`地址。
func (c *Client) AssignIpv6Addresses(request *AssignIpv6AddressesRequest) (response *AssignIpv6AddressesResponse, err error) {
if request == nil {
request = NewAssignIpv6AddressesRequest()
}
response = NewAssignIpv6AddressesResponse()
err = c.Send(request, response)
return
}
func NewAssignIpv6CidrBlockRequest() (request *AssignIpv6CidrBlockRequest) {
request = &AssignIpv6CidrBlockRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6CidrBlock")
return
}
func NewAssignIpv6CidrBlockResponse() (response *AssignIpv6CidrBlockResponse) {
response = &AssignIpv6CidrBlockResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口AssignIpv6CidrBlock用于分配IPv6网段。
// * 使用本接口前你需要已有VPC实例如果没有可通过接口<a href="https://cloud.tencent.com/document/api/215/15774" title="CreateVpc" target="_blank">CreateVpc</a>创建。
// * 每个VPC只能申请一个IPv6网段
func (c *Client) AssignIpv6CidrBlock(request *AssignIpv6CidrBlockRequest) (response *AssignIpv6CidrBlockResponse, err error) {
if request == nil {
request = NewAssignIpv6CidrBlockRequest()
}
response = NewAssignIpv6CidrBlockResponse()
err = c.Send(request, response)
return
}
func NewAssignIpv6SubnetCidrBlockRequest() (request *AssignIpv6SubnetCidrBlockRequest) {
request = &AssignIpv6SubnetCidrBlockRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6SubnetCidrBlock")
return
}
func NewAssignIpv6SubnetCidrBlockResponse() (response *AssignIpv6SubnetCidrBlockResponse) {
response = &AssignIpv6SubnetCidrBlockResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口AssignIpv6SubnetCidrBlock用于分配IPv6子网段。
// * 给子网分配 `IPv6` 网段,要求子网所属 `VPC` 已获得 `IPv6` 网段。如果尚未分配,请先通过接口 `AssignIpv6CidrBlock` 给子网所属 `VPC` 分配一个 `IPv6` 网段。否则无法分配 `IPv6` 子网段。
// * 每个子网只能分配一个IPv6网段。
func (c *Client) AssignIpv6SubnetCidrBlock(request *AssignIpv6SubnetCidrBlockRequest) (response *AssignIpv6SubnetCidrBlockResponse, err error) {
if request == nil {
request = NewAssignIpv6SubnetCidrBlockRequest()
}
response = NewAssignIpv6SubnetCidrBlockResponse()
err = c.Send(request, response)
return
}
func NewAssignPrivateIpAddressesRequest() (request *AssignPrivateIpAddressesRequest) {
request = &AssignPrivateIpAddressesRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -165,9 +276,10 @@ func NewAssociateAddressResponse() (response *AssociateAddressResponse) {
}
// 本接口 (AssociateAddress) 用于将[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP绑定到实例或弹性网卡的指定内网 IP 上。
// * 将 EIP 绑定到实例上,其本质是将 EIP 绑定到实例上主网卡的主内网 IP 上。
// * 将 EIP 绑定到实例CVM上,其本质是将 EIP 绑定到实例上主网卡的主内网 IP 上。
// * 将 EIP 绑定到主网卡的主内网IP上绑定过程会把其上绑定的普通公网 IP 自动解绑并释放。
// * 如果指定网卡的内网 IP 已经绑定了 EIP则必须先解绑该 EIP才能再绑定新的。
// * 将 EIP 绑定到指定网卡的内网 IP上非主网卡的主内网IP则必须先解绑该 EIP才能再绑定新的。
// * 将 EIP 绑定到NAT网关请使用接口[EipBindNatGateway](https://cloud.tencent.com/document/product/215/4093)
// * EIP 如果欠费或被封堵,则不能被绑定。
// * 只有状态为 UNBIND 的 EIP 才能够被绑定。
func (c *Client) AssociateAddress(request *AssociateAddressRequest) (response *AssociateAddressResponse, err error) {
@ -276,7 +388,7 @@ func NewCreateAddressTemplateResponse() (response *CreateAddressTemplateResponse
return
}
// 创建IP地址模版
// 本接口CreateAddressTemplate用于创建IP地址模版
func (c *Client) CreateAddressTemplate(request *CreateAddressTemplateRequest) (response *CreateAddressTemplateResponse, err error) {
if request == nil {
request = NewCreateAddressTemplateRequest()
@ -301,7 +413,7 @@ func NewCreateAddressTemplateGroupResponse() (response *CreateAddressTemplateGro
return
}
// 创建IP地址模版集合
// 本接口CreateAddressTemplateGroup用于创建IP地址模版集合
func (c *Client) CreateAddressTemplateGroup(request *CreateAddressTemplateGroupRequest) (response *CreateAddressTemplateGroupResponse, err error) {
if request == nil {
request = NewCreateAddressTemplateGroupRequest()
@ -470,6 +582,31 @@ func (c *Client) CreateDirectConnectGatewayCcnRoutes(request *CreateDirectConnec
return
}
func NewCreateFlowLogRequest() (request *CreateFlowLogRequest) {
request = &CreateFlowLogRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "CreateFlowLog")
return
}
func NewCreateFlowLogResponse() (response *CreateFlowLogResponse) {
response = &CreateFlowLogResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口CreateFlowLog用于创建流日志
func (c *Client) CreateFlowLog(request *CreateFlowLogRequest) (response *CreateFlowLogResponse, err error) {
if request == nil {
request = NewCreateFlowLogRequest()
}
response = NewCreateFlowLogResponse()
err = c.Send(request, response)
return
}
func NewCreateHaVipRequest() (request *CreateHaVipRequest) {
request = &CreateHaVipRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -495,6 +632,32 @@ func (c *Client) CreateHaVip(request *CreateHaVipRequest) (response *CreateHaVip
return
}
func NewCreateIp6TranslatorsRequest() (request *CreateIp6TranslatorsRequest) {
request = &CreateIp6TranslatorsRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "CreateIp6Translators")
return
}
func NewCreateIp6TranslatorsResponse() (response *CreateIp6TranslatorsResponse) {
response = &CreateIp6TranslatorsResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 1. 该接口用于创建IPV6转换IPV4实例支持批量
// 2. 同一个账户在在一个地域最多允许创建10个转换实例
func (c *Client) CreateIp6Translators(request *CreateIp6TranslatorsRequest) (response *CreateIp6TranslatorsResponse, err error) {
if request == nil {
request = NewCreateIp6TranslatorsRequest()
}
response = NewCreateIp6TranslatorsResponse()
err = c.Send(request, response)
return
}
func NewCreateNetworkInterfaceRequest() (request *CreateNetworkInterfaceRequest) {
request = &CreateNetworkInterfaceRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -624,7 +787,7 @@ func NewCreateSecurityGroupPoliciesResponse() (response *CreateSecurityGroupPoli
// * Protocol字段支持输入TCP, UDP, ICMP, GRE, ALL。
// * CidrBlock字段允许输入符合cidr格式标准的任意字符串。(展开)在基础网络中如果CidrBlock包含您的账户内的云服务器之外的设备在腾讯云的内网IP并不代表此规则允许您访问这些设备租户之间网络隔离规则优先于安全组中的内网规则。
// * SecurityGroupId字段允许输入与待修改的安全组位于相同项目中的安全组ID包括这个安全组ID本身代表安全组下所有云服务器的内网IP。使用这个字段时这条规则用来匹配网络报文的过程中会随着被使用的这个ID所关联的云服务器变化而变化不需要重新修改。
// * Port字段允许输入一个单独端口号或者用减号分隔的两个端口号代表端口范围例如80或8000-8010。只有当Protocol字段是TCP或UDP时Port字段才被接受
// * Port字段允许输入一个单独端口号或者用减号分隔的两个端口号代表端口范围例如80或8000-8010。只有当Protocol字段是TCP或UDP时Port字段才被接受即Protocol字段不是TCP或UDP时Protocol和Port排他关系不允许同时输入否则会接口报错
// * Action字段只允许输入ACCEPT或DROP。
// * CidrBlock, SecurityGroupId, AddressTemplate三者是排他关系不允许同时输入Protocol + Port和ServiceTemplate二者是排他关系不允许同时输入。
// * 一次请求中只能创建单个方向的规则, 如果需要指定索引PolicyIndex参数, 多条规则的索引必须一致。
@ -652,7 +815,7 @@ func NewCreateServiceTemplateResponse() (response *CreateServiceTemplateResponse
return
}
// 创建协议端口模板
// 本接口CreateServiceTemplate用于创建协议端口模板
func (c *Client) CreateServiceTemplate(request *CreateServiceTemplateRequest) (response *CreateServiceTemplateResponse, err error) {
if request == nil {
request = NewCreateServiceTemplateRequest()
@ -677,7 +840,7 @@ func NewCreateServiceTemplateGroupResponse() (response *CreateServiceTemplateGro
return
}
// 创建协议端口模板集合
// 本接口CreateServiceTemplateGroup用于创建协议端口模板集合
func (c *Client) CreateServiceTemplateGroup(request *CreateServiceTemplateGroupRequest) (response *CreateServiceTemplateGroupResponse, err error) {
if request == nil {
request = NewCreateServiceTemplateGroupRequest()
@ -717,6 +880,36 @@ func (c *Client) CreateSubnet(request *CreateSubnetRequest) (response *CreateSub
return
}
func NewCreateSubnetsRequest() (request *CreateSubnetsRequest) {
request = &CreateSubnetsRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "CreateSubnets")
return
}
func NewCreateSubnetsResponse() (response *CreateSubnetsResponse) {
response = &CreateSubnetsResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口(CreateSubnets)用于批量创建子网。
// * 创建子网前必须创建好 VPC。
// * 子网创建成功后子网网段不能修改。子网网段必须在VPC网段内可以和VPC网段相同VPC有且只有一个子网时建议子网网段在VPC网段内预留网段给其他子网使用。
// * 你可以创建的最小网段子网掩码为28有16个IP地址最大网段子网掩码为1665,536个IP地址
// * 同一个VPC内多个子网的网段不能重叠。
// * 子网创建后会自动关联到默认路由表。
func (c *Client) CreateSubnets(request *CreateSubnetsRequest) (response *CreateSubnetsResponse, err error) {
if request == nil {
request = NewCreateSubnetsRequest()
}
response = NewCreateSubnetsResponse()
err = c.Send(request, response)
return
}
func NewCreateVpcRequest() (request *CreateVpcRequest) {
request = &CreateVpcRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -784,7 +977,7 @@ func NewCreateVpnGatewayResponse() (response *CreateVpnGatewayResponse) {
return
}
// 本接口CreateVpnGateways用于创建VPN网关。
// 本接口CreateVpnGateway用于创建VPN网关。
func (c *Client) CreateVpnGateway(request *CreateVpnGatewayRequest) (response *CreateVpnGatewayResponse, err error) {
if request == nil {
request = NewCreateVpnGatewayRequest()
@ -809,7 +1002,7 @@ func NewDeleteAddressTemplateResponse() (response *DeleteAddressTemplateResponse
return
}
// 删除IP地址模板
// 本接口DeleteAddressTemplate用于删除IP地址模板
func (c *Client) DeleteAddressTemplate(request *DeleteAddressTemplateRequest) (response *DeleteAddressTemplateResponse, err error) {
if request == nil {
request = NewDeleteAddressTemplateRequest()
@ -834,7 +1027,7 @@ func NewDeleteAddressTemplateGroupResponse() (response *DeleteAddressTemplateGro
return
}
// 删除IP地址模板集合
// 本接口DeleteAddressTemplateGroup用于删除IP地址模板集合
func (c *Client) DeleteAddressTemplateGroup(request *DeleteAddressTemplateGroupRequest) (response *DeleteAddressTemplateGroupResponse, err error) {
if request == nil {
request = NewDeleteAddressTemplateGroupRequest()
@ -974,6 +1167,31 @@ func (c *Client) DeleteDirectConnectGatewayCcnRoutes(request *DeleteDirectConnec
return
}
func NewDeleteFlowLogRequest() (request *DeleteFlowLogRequest) {
request = &DeleteFlowLogRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DeleteFlowLog")
return
}
func NewDeleteFlowLogResponse() (response *DeleteFlowLogResponse) {
response = &DeleteFlowLogResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口DeleteFlowLog用于删除流日志
func (c *Client) DeleteFlowLog(request *DeleteFlowLogRequest) (response *DeleteFlowLogResponse, err error) {
if request == nil {
request = NewDeleteFlowLogRequest()
}
response = NewDeleteFlowLogResponse()
err = c.Send(request, response)
return
}
func NewDeleteHaVipRequest() (request *DeleteHaVipRequest) {
request = &DeleteHaVipRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -1000,6 +1218,32 @@ func (c *Client) DeleteHaVip(request *DeleteHaVipRequest) (response *DeleteHaVip
return
}
func NewDeleteIp6TranslatorsRequest() (request *DeleteIp6TranslatorsRequest) {
request = &DeleteIp6TranslatorsRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DeleteIp6Translators")
return
}
func NewDeleteIp6TranslatorsResponse() (response *DeleteIp6TranslatorsResponse) {
response = &DeleteIp6TranslatorsResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 1. 该接口用于释放IPV6转换实例支持批量。
// 2. 如果IPV6转换实例建立有转换规则会一并删除。
func (c *Client) DeleteIp6Translators(request *DeleteIp6TranslatorsRequest) (response *DeleteIp6TranslatorsResponse, err error) {
if request == nil {
request = NewDeleteIp6TranslatorsRequest()
}
response = NewDeleteIp6TranslatorsResponse()
err = c.Send(request, response)
return
}
func NewDeleteNetworkInterfaceRequest() (request *DeleteNetworkInterfaceRequest) {
request = &DeleteNetworkInterfaceRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -1146,7 +1390,7 @@ func NewDeleteServiceTemplateResponse() (response *DeleteServiceTemplateResponse
return
}
// 删除协议端口模板
// 本接口DeleteServiceTemplate用于删除协议端口模板
func (c *Client) DeleteServiceTemplate(request *DeleteServiceTemplateRequest) (response *DeleteServiceTemplateResponse, err error) {
if request == nil {
request = NewDeleteServiceTemplateRequest()
@ -1171,7 +1415,7 @@ func NewDeleteServiceTemplateGroupResponse() (response *DeleteServiceTemplateGro
return
}
// 删除协议端口模板集合
// 本接口DeleteServiceTemplateGroup用于删除协议端口模板集合
func (c *Client) DeleteServiceTemplateGroup(request *DeleteServiceTemplateGroupRequest) (response *DeleteServiceTemplateGroupResponse, err error) {
if request == nil {
request = NewDeleteServiceTemplateGroupRequest()
@ -1349,7 +1593,7 @@ func NewDescribeAddressTemplateGroupsResponse() (response *DescribeAddressTempla
return
}
// 查询IP地址模板集合
// 本接口DescribeAddressTemplateGroups用于查询IP地址模板集合
func (c *Client) DescribeAddressTemplateGroups(request *DescribeAddressTemplateGroupsRequest) (response *DescribeAddressTemplateGroupsResponse, err error) {
if request == nil {
request = NewDescribeAddressTemplateGroupsRequest()
@ -1374,7 +1618,7 @@ func NewDescribeAddressTemplatesResponse() (response *DescribeAddressTemplatesRe
return
}
// 查询IP地址模板
// 本接口DescribeAddressTemplates用于查询IP地址模板
func (c *Client) DescribeAddressTemplates(request *DescribeAddressTemplatesRequest) (response *DescribeAddressTemplatesResponse, err error) {
if request == nil {
request = NewDescribeAddressTemplatesRequest()
@ -1685,6 +1929,83 @@ func (c *Client) DescribeDirectConnectGateways(request *DescribeDirectConnectGat
return
}
func NewDescribeFlowLogRequest() (request *DescribeFlowLogRequest) {
request = &DescribeFlowLogRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DescribeFlowLog")
return
}
func NewDescribeFlowLogResponse() (response *DescribeFlowLogResponse) {
response = &DescribeFlowLogResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口DescribeFlowLog用于查询流日志实例信息
func (c *Client) DescribeFlowLog(request *DescribeFlowLogRequest) (response *DescribeFlowLogResponse, err error) {
if request == nil {
request = NewDescribeFlowLogRequest()
}
response = NewDescribeFlowLogResponse()
err = c.Send(request, response)
return
}
func NewDescribeFlowLogsRequest() (request *DescribeFlowLogsRequest) {
request = &DescribeFlowLogsRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DescribeFlowLogs")
return
}
func NewDescribeFlowLogsResponse() (response *DescribeFlowLogsResponse) {
response = &DescribeFlowLogsResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口DescribeFlowLogs用于查询获取流日志集合
func (c *Client) DescribeFlowLogs(request *DescribeFlowLogsRequest) (response *DescribeFlowLogsResponse, err error) {
if request == nil {
request = NewDescribeFlowLogsRequest()
}
response = NewDescribeFlowLogsResponse()
err = c.Send(request, response)
return
}
func NewDescribeGatewayFlowMonitorDetailRequest() (request *DescribeGatewayFlowMonitorDetailRequest) {
request = &DescribeGatewayFlowMonitorDetailRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DescribeGatewayFlowMonitorDetail")
return
}
func NewDescribeGatewayFlowMonitorDetailResponse() (response *DescribeGatewayFlowMonitorDetailResponse) {
response = &DescribeGatewayFlowMonitorDetailResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口DescribeGatewayFlowMonitorDetail用于查询网关流量监控明细。
// * 只支持单个网关实例查询。即入参 `VpnId` `DirectConnectGatewayId` `PeeringConnectionId` `NatId` 最多只支持传一个,且必须传一个。
// * 如果网关有流量,但调用本接口没有返回数据,请在控制台对应网关详情页确认是否开启网关流量监控。
func (c *Client) DescribeGatewayFlowMonitorDetail(request *DescribeGatewayFlowMonitorDetailRequest) (response *DescribeGatewayFlowMonitorDetailResponse, err error) {
if request == nil {
request = NewDescribeGatewayFlowMonitorDetailRequest()
}
response = NewDescribeGatewayFlowMonitorDetailResponse()
err = c.Send(request, response)
return
}
func NewDescribeHaVipsRequest() (request *DescribeHaVipsRequest) {
request = &DescribeHaVipsRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -1710,6 +2031,57 @@ func (c *Client) DescribeHaVips(request *DescribeHaVipsRequest) (response *Descr
return
}
func NewDescribeIp6TranslatorQuotaRequest() (request *DescribeIp6TranslatorQuotaRequest) {
request = &DescribeIp6TranslatorQuotaRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DescribeIp6TranslatorQuota")
return
}
func NewDescribeIp6TranslatorQuotaResponse() (response *DescribeIp6TranslatorQuotaResponse) {
response = &DescribeIp6TranslatorQuotaResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 查询账户在指定地域IPV6转换实例和规则的配额
func (c *Client) DescribeIp6TranslatorQuota(request *DescribeIp6TranslatorQuotaRequest) (response *DescribeIp6TranslatorQuotaResponse, err error) {
if request == nil {
request = NewDescribeIp6TranslatorQuotaRequest()
}
response = NewDescribeIp6TranslatorQuotaResponse()
err = c.Send(request, response)
return
}
func NewDescribeIp6TranslatorsRequest() (request *DescribeIp6TranslatorsRequest) {
request = &DescribeIp6TranslatorsRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DescribeIp6Translators")
return
}
func NewDescribeIp6TranslatorsResponse() (response *DescribeIp6TranslatorsResponse) {
response = &DescribeIp6TranslatorsResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 1. 该接口用于查询账户下的IPV6转换实例及其绑定的转换规则信息
// 2. 支持过滤查询
func (c *Client) DescribeIp6Translators(request *DescribeIp6TranslatorsRequest) (response *DescribeIp6TranslatorsResponse, err error) {
if request == nil {
request = NewDescribeIp6TranslatorsRequest()
}
response = NewDescribeIp6TranslatorsResponse()
err = c.Send(request, response)
return
}
func NewDescribeNetworkInterfacesRequest() (request *DescribeNetworkInterfacesRequest) {
request = &DescribeNetworkInterfacesRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -1875,7 +2247,7 @@ func NewDescribeServiceTemplateGroupsResponse() (response *DescribeServiceTempla
return
}
// 查询协议端口模板集合
// 本接口DescribeServiceTemplateGroups用于查询协议端口模板集合
func (c *Client) DescribeServiceTemplateGroups(request *DescribeServiceTemplateGroupsRequest) (response *DescribeServiceTemplateGroupsResponse, err error) {
if request == nil {
request = NewDescribeServiceTemplateGroupsRequest()
@ -1900,7 +2272,7 @@ func NewDescribeServiceTemplatesResponse() (response *DescribeServiceTemplatesRe
return
}
// 查询协议端口模板
// 本接口DescribeServiceTemplates用于查询协议端口模板
func (c *Client) DescribeServiceTemplates(request *DescribeServiceTemplatesRequest) (response *DescribeServiceTemplatesResponse, err error) {
if request == nil {
request = NewDescribeServiceTemplatesRequest()
@ -1935,6 +2307,58 @@ func (c *Client) DescribeSubnets(request *DescribeSubnetsRequest) (response *Des
return
}
func NewDescribeVpcIpv6AddressesRequest() (request *DescribeVpcIpv6AddressesRequest) {
request = &DescribeVpcIpv6AddressesRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpcIpv6Addresses")
return
}
func NewDescribeVpcIpv6AddressesResponse() (response *DescribeVpcIpv6AddressesResponse) {
response = &DescribeVpcIpv6AddressesResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口DescribeVpcIpv6Addresses用于查询 `VPC` `IPv6` 信息。
// 只能查询已使用的`IPv6`信息当查询未使用的IP时本接口不会报错但不会出现在返回结果里。
func (c *Client) DescribeVpcIpv6Addresses(request *DescribeVpcIpv6AddressesRequest) (response *DescribeVpcIpv6AddressesResponse, err error) {
if request == nil {
request = NewDescribeVpcIpv6AddressesRequest()
}
response = NewDescribeVpcIpv6AddressesResponse()
err = c.Send(request, response)
return
}
func NewDescribeVpcPrivateIpAddressesRequest() (request *DescribeVpcPrivateIpAddressesRequest) {
request = &DescribeVpcPrivateIpAddressesRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpcPrivateIpAddresses")
return
}
func NewDescribeVpcPrivateIpAddressesResponse() (response *DescribeVpcPrivateIpAddressesResponse) {
response = &DescribeVpcPrivateIpAddressesResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口DescribeVpcPrivateIpAddresses用于查询VPC内网IP信息。<br />
// 只能查询已使用的IP信息当查询未使用的IP时本接口不会报错但不会出现在返回结果里。
func (c *Client) DescribeVpcPrivateIpAddresses(request *DescribeVpcPrivateIpAddressesRequest) (response *DescribeVpcPrivateIpAddressesResponse, err error) {
if request == nil {
request = NewDescribeVpcPrivateIpAddressesRequest()
}
response = NewDescribeVpcPrivateIpAddressesResponse()
err = c.Send(request, response)
return
}
func NewDescribeVpcsRequest() (request *DescribeVpcsRequest) {
request = &DescribeVpcsRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -2152,6 +2576,8 @@ func NewDisassociateAddressResponse() (response *DisassociateAddressResponse) {
}
// 本接口 (DisassociateAddress) 用于解绑[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP
// * 支持CVM实例弹性网卡上的EIP解绑
// * 不支持NAT上的EIP解绑。NAT上的EIP解绑请参考[EipUnBindNatGateway](https://cloud.tencent.com/document/product/215/4092)
// * 只有状态为 BIND 和 BIND_ENI 的 EIP 才能进行解绑定操作。
// * EIP 如果被封堵,则不能进行解绑定操作。
func (c *Client) DisassociateAddress(request *DisassociateAddressRequest) (response *DisassociateAddressResponse, err error) {
@ -2460,7 +2886,7 @@ func NewModifyAddressTemplateAttributeResponse() (response *ModifyAddressTemplat
return
}
// 修改IP地址模板
// 本接口ModifyAddressTemplateAttribute用于修改IP地址模板
func (c *Client) ModifyAddressTemplateAttribute(request *ModifyAddressTemplateAttributeRequest) (response *ModifyAddressTemplateAttributeResponse, err error) {
if request == nil {
request = NewModifyAddressTemplateAttributeRequest()
@ -2485,7 +2911,7 @@ func NewModifyAddressTemplateGroupAttributeResponse() (response *ModifyAddressTe
return
}
// 修改IP地址模板集合
// 本接口ModifyAddressTemplateGroupAttribute用于修改IP地址模板集合
func (c *Client) ModifyAddressTemplateGroupAttribute(request *ModifyAddressTemplateGroupAttributeRequest) (response *ModifyAddressTemplateGroupAttributeResponse, err error) {
if request == nil {
request = NewModifyAddressTemplateGroupAttributeRequest()
@ -2510,7 +2936,7 @@ func NewModifyAddressesBandwidthResponse() (response *ModifyAddressesBandwidthRe
return
}
// 接口用于调整[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称EIP)带宽包括后付费EIP, 预付费EIP和带宽包EIP
// 接口ModifyAddressesBandwidth用于调整[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称EIP)带宽包括后付费EIP, 预付费EIP和带宽包EIP
func (c *Client) ModifyAddressesBandwidth(request *ModifyAddressesBandwidthRequest) (response *ModifyAddressesBandwidthResponse, err error) {
if request == nil {
request = NewModifyAddressesBandwidthRequest()
@ -2620,6 +3046,31 @@ func (c *Client) ModifyDirectConnectGatewayAttribute(request *ModifyDirectConnec
return
}
func NewModifyFlowLogAttributeRequest() (request *ModifyFlowLogAttributeRequest) {
request = &ModifyFlowLogAttributeRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "ModifyFlowLogAttribute")
return
}
func NewModifyFlowLogAttributeResponse() (response *ModifyFlowLogAttributeResponse) {
response = &ModifyFlowLogAttributeResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口ModifyFlowLogAttribute用于修改流日志属性
func (c *Client) ModifyFlowLogAttribute(request *ModifyFlowLogAttributeRequest) (response *ModifyFlowLogAttributeResponse, err error) {
if request == nil {
request = NewModifyFlowLogAttributeRequest()
}
response = NewModifyFlowLogAttributeResponse()
err = c.Send(request, response)
return
}
func NewModifyHaVipAttributeRequest() (request *ModifyHaVipAttributeRequest) {
request = &ModifyHaVipAttributeRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -2645,6 +3096,81 @@ func (c *Client) ModifyHaVipAttribute(request *ModifyHaVipAttributeRequest) (res
return
}
func NewModifyIp6RuleRequest() (request *ModifyIp6RuleRequest) {
request = &ModifyIp6RuleRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "ModifyIp6Rule")
return
}
func NewModifyIp6RuleResponse() (response *ModifyIp6RuleResponse) {
response = &ModifyIp6RuleResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 该接口用于修改IPV6转换规则当前仅支持修改转换规则名称IPV4地址和IPV4端口号
func (c *Client) ModifyIp6Rule(request *ModifyIp6RuleRequest) (response *ModifyIp6RuleResponse, err error) {
if request == nil {
request = NewModifyIp6RuleRequest()
}
response = NewModifyIp6RuleResponse()
err = c.Send(request, response)
return
}
func NewModifyIp6TranslatorRequest() (request *ModifyIp6TranslatorRequest) {
request = &ModifyIp6TranslatorRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "ModifyIp6Translator")
return
}
func NewModifyIp6TranslatorResponse() (response *ModifyIp6TranslatorResponse) {
response = &ModifyIp6TranslatorResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 该接口用于修改IP6转换实例属性当前仅支持修改实例名称。
func (c *Client) ModifyIp6Translator(request *ModifyIp6TranslatorRequest) (response *ModifyIp6TranslatorResponse, err error) {
if request == nil {
request = NewModifyIp6TranslatorRequest()
}
response = NewModifyIp6TranslatorResponse()
err = c.Send(request, response)
return
}
func NewModifyIpv6AddressesAttributeRequest() (request *ModifyIpv6AddressesAttributeRequest) {
request = &ModifyIpv6AddressesAttributeRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "ModifyIpv6AddressesAttribute")
return
}
func NewModifyIpv6AddressesAttributeResponse() (response *ModifyIpv6AddressesAttributeResponse) {
response = &ModifyIpv6AddressesAttributeResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口ModifyIpv6AddressesAttribute用于修改弹性网卡内网IPv6地址属性。
func (c *Client) ModifyIpv6AddressesAttribute(request *ModifyIpv6AddressesAttributeRequest) (response *ModifyIpv6AddressesAttributeResponse, err error) {
if request == nil {
request = NewModifyIpv6AddressesAttributeRequest()
}
response = NewModifyIpv6AddressesAttributeResponse()
err = c.Send(request, response)
return
}
func NewModifyNetworkInterfaceAttributeRequest() (request *ModifyNetworkInterfaceAttributeRequest) {
request = &ModifyNetworkInterfaceAttributeRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -2794,7 +3320,7 @@ func NewModifyServiceTemplateAttributeResponse() (response *ModifyServiceTemplat
return
}
// 修改协议端口模板
// 本接口ModifyServiceTemplateAttribute用于修改协议端口模板
func (c *Client) ModifyServiceTemplateAttribute(request *ModifyServiceTemplateAttributeRequest) (response *ModifyServiceTemplateAttributeResponse, err error) {
if request == nil {
request = NewModifyServiceTemplateAttributeRequest()
@ -3006,6 +3532,32 @@ func (c *Client) RemoveBandwidthPackageResources(request *RemoveBandwidthPackage
return
}
func NewRemoveIp6RulesRequest() (request *RemoveIp6RulesRequest) {
request = &RemoveIp6RulesRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "RemoveIp6Rules")
return
}
func NewRemoveIp6RulesResponse() (response *RemoveIp6RulesResponse) {
response = &RemoveIp6RulesResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 1. 该接口用于删除IPV6转换规则
// 2. 支持批量删除同一个转换实例下的多个转换规则
func (c *Client) RemoveIp6Rules(request *RemoveIp6RulesRequest) (response *RemoveIp6RulesResponse, err error) {
if request == nil {
request = NewRemoveIp6RulesRequest()
}
response = NewRemoveIp6RulesResponse()
err = c.Send(request, response)
return
}
func NewRenewVpnGatewayRequest() (request *RenewVpnGatewayRequest) {
request = &RenewVpnGatewayRequest{
BaseRequest: &tchttp.BaseRequest{},
@ -3285,6 +3837,84 @@ func (c *Client) TransformAddress(request *TransformAddressRequest) (response *T
return
}
func NewUnassignIpv6AddressesRequest() (request *UnassignIpv6AddressesRequest) {
request = &UnassignIpv6AddressesRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6Addresses")
return
}
func NewUnassignIpv6AddressesResponse() (response *UnassignIpv6AddressesResponse) {
response = &UnassignIpv6AddressesResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口UnassignIpv6Addresses用于释放弹性网卡`IPv6`地址。<br />
// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口。
func (c *Client) UnassignIpv6Addresses(request *UnassignIpv6AddressesRequest) (response *UnassignIpv6AddressesResponse, err error) {
if request == nil {
request = NewUnassignIpv6AddressesRequest()
}
response = NewUnassignIpv6AddressesResponse()
err = c.Send(request, response)
return
}
func NewUnassignIpv6CidrBlockRequest() (request *UnassignIpv6CidrBlockRequest) {
request = &UnassignIpv6CidrBlockRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6CidrBlock")
return
}
func NewUnassignIpv6CidrBlockResponse() (response *UnassignIpv6CidrBlockResponse) {
response = &UnassignIpv6CidrBlockResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口UnassignIpv6CidrBlock用于释放IPv6网段。<br />
// 网段如果还有IP占用且未回收则网段无法释放。
func (c *Client) UnassignIpv6CidrBlock(request *UnassignIpv6CidrBlockRequest) (response *UnassignIpv6CidrBlockResponse, err error) {
if request == nil {
request = NewUnassignIpv6CidrBlockRequest()
}
response = NewUnassignIpv6CidrBlockResponse()
err = c.Send(request, response)
return
}
func NewUnassignIpv6SubnetCidrBlockRequest() (request *UnassignIpv6SubnetCidrBlockRequest) {
request = &UnassignIpv6SubnetCidrBlockRequest{
BaseRequest: &tchttp.BaseRequest{},
}
request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6SubnetCidrBlock")
return
}
func NewUnassignIpv6SubnetCidrBlockResponse() (response *UnassignIpv6SubnetCidrBlockResponse) {
response = &UnassignIpv6SubnetCidrBlockResponse{
BaseResponse: &tchttp.BaseResponse{},
}
return
}
// 本接口UnassignIpv6SubnetCidrBlock用于释放IPv6子网段。<br />
// 子网段如果还有IP占用且未回收则子网段无法释放。
func (c *Client) UnassignIpv6SubnetCidrBlock(request *UnassignIpv6SubnetCidrBlockRequest) (response *UnassignIpv6SubnetCidrBlockResponse, err error) {
if request == nil {
request = NewUnassignIpv6SubnetCidrBlockRequest()
}
response = NewUnassignIpv6SubnetCidrBlockResponse()
err = c.Send(request, response)
return
}
func NewUnassignPrivateIpAddressesRequest() (request *UnassignPrivateIpAddressesRequest) {
request = &UnassignPrivateIpAddressesRequest{
BaseRequest: &tchttp.BaseRequest{},

File diff suppressed because it is too large Load Diff

2
vendor/modules.txt vendored
View File

@ -401,7 +401,7 @@ github.com/sirupsen/logrus
# github.com/stretchr/testify v1.3.0
github.com/stretchr/testify/assert
github.com/stretchr/testify/require
# github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181220135002-f1744d40d346
# github.com/tencentcloud/tencentcloud-sdk-go v3.0.71+incompatible
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile

View File

@ -88,6 +88,16 @@ builder.
- LOCAL_BASIC: 50
- Other: 50 ~ 1000 (need whitelist if > 50)
- `data_disks` (array of data disks) - Add one or more data disks to the instance before creating the
image. Note that if the source image has data disk snapshots, this argument will be ignored, and
the running instance will use source image data disk settings, in such case, `disk_type`
argument will be used as disk type for all data disks, and each data disk size will use the
origin value in source image.
The data disks allow for the following argument:
- `disk_type` - Type of the data disk. Valid choices: `CLOUD_BASIC`, `CLOUD_PREMIUM` and `CLOUD_SSD`.
- `disk_size` - Size of the data disk.
- `disk_snapshot_id` - Id of the snapshot for a data disk.
- `vpc_id` (string) - Specify vpc your cvm will be launched by.
- `vpc_name` (string) - Specify vpc name you will create. if `vpc_id` is not set, packer will