Skip to content

Commit 52c1beb

Browse files
committed
add
1 parent 76fad48 commit 52c1beb

File tree

12 files changed

+8772
-3032
lines changed

12 files changed

+8772
-3032
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ require (
4646
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1034
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
4848
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.1046
49-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1056
49+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1058
5050
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1014
5151
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
52-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
52+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.1058
5353
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dayu v1.0.335
5454
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dbbrain v1.0.652
5555
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.633

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1052 h1:RCs
936936
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1052/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
937937
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1056 h1:bOSZ7cOXvBe8MCBqDBTtpyKIqx9q6woxqIPK5M9FhNY=
938938
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1056/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
939+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1058 h1:VVv5rEFtGbxEB23V3gJO5pFHEXGlOh9duEWEtNm+w6c=
940+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1058/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
939941
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
940942
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
941943
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
@@ -946,6 +948,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762 h1:2egy69S
946948
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762/go.mod h1:1XylIfNUbAzmNqi4XMhwcM3VhmUHdu1OYybOeaJ4sOw=
947949
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692 h1:lD44AqXCzkraZiCeMjL7dZmvuyurpyQRKwPHA6Ux5To=
948950
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692/go.mod h1:nH1mCLxOm21eqEYORMJ5pifOfHoupCIx8YwMOu9YW2c=
951+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.1058 h1:qgni/qIuUYkc5THMbtyGNSNleoac5ffMeM5TErJ9bnA=
952+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.1058/go.mod h1:HqoJMWKikraStfU3fj5HRK8linrtr4mfWF03GbOj2j8=
949953
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dasb v1.0.970 h1:qVIRHgG1twsqF4aVN/x2T2yMRfPpsZBTNefDkqzM06M=
950954
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dasb v1.0.970/go.mod h1:NJuuQD4z6vcnsZnC7Tvz2U9hElNS1wroc34UQbZvP2U=
951955
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dayu v1.0.335 h1:D8qrelkK5udv8RzJJIABMzItGIyaZoYnxEVeIsYqiNw=

tencentcloud/services/cynosdb/extension_cynosdb.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,70 @@ func TencentCynosdbClusterBaseInfo() map[string]*schema.Schema {
377377
ConflictsWith: []string{"prarm_template_id"},
378378
Description: "The ID of the parameter template.",
379379
},
380+
"instance_init_infos": {
381+
Type: schema.TypeList,
382+
Optional: true,
383+
ForceNew: true,
384+
Description: "Instance initialization configuration information, mainly used to select instances of different specifications when purchasing a cluster.",
385+
Elem: &schema.Resource{
386+
Schema: map[string]*schema.Schema{
387+
"cpu": {
388+
Type: schema.TypeInt,
389+
Required: true,
390+
ForceNew: true,
391+
Description: "CPU of instance.",
392+
},
393+
"memory": {
394+
Type: schema.TypeInt,
395+
Required: true,
396+
ForceNew: true,
397+
Description: "Memory of instance.",
398+
},
399+
"instance_type": {
400+
Type: schema.TypeString,
401+
Required: true,
402+
ForceNew: true,
403+
Description: "Instance type. Value: `rw`, `ro`.",
404+
},
405+
"instance_count": {
406+
Type: schema.TypeInt,
407+
Required: true,
408+
ForceNew: true,
409+
Description: "Instance count. Range: [1, 15].",
410+
},
411+
"min_ro_count": {
412+
Type: schema.TypeInt,
413+
Optional: true,
414+
ForceNew: true,
415+
Description: "Minimum number of Serverless instances. Range [1,15].",
416+
},
417+
"max_ro_count": {
418+
Type: schema.TypeInt,
419+
Optional: true,
420+
ForceNew: true,
421+
Description: "Maximum number of Serverless instances. Range [1,15].",
422+
},
423+
"min_ro_cpu": {
424+
Type: schema.TypeFloat,
425+
Optional: true,
426+
ForceNew: true,
427+
Description: "Minimum Serverless Instance Specifications.",
428+
},
429+
"max_ro_cpu": {
430+
Type: schema.TypeFloat,
431+
Optional: true,
432+
ForceNew: true,
433+
Description: "Maximum Serverless Instance Specifications.",
434+
},
435+
"device_type": {
436+
Type: schema.TypeString,
437+
Optional: true,
438+
ForceNew: true,
439+
Description: "Instance machine type. Values: `common`, `exclusive`.",
440+
},
441+
},
442+
},
443+
},
380444
"db_mode": {
381445
Type: schema.TypeString,
382446
Optional: true,

tencentcloud/services/cynosdb/resource_tc_cynosdb_cluster.go

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,50 @@ func resourceTencentCloudCynosdbClusterCreate(d *schema.ResourceData, meta inter
121121
request.ParamTemplateId = helper.IntInt64(v.(int))
122122
}
123123

124+
if v, ok := d.GetOk("instance_init_infos"); ok {
125+
for _, item := range v.([]interface{}) {
126+
value := item.(map[string]interface{})
127+
tmpInitInfo := cynosdb.InstanceInitInfo{}
128+
if v, ok := value["cpu"]; ok {
129+
tmpInitInfo.Cpu = helper.IntInt64(v.(int))
130+
}
131+
132+
if v, ok := value["memory"]; ok {
133+
tmpInitInfo.Memory = helper.IntInt64(v.(int))
134+
}
135+
136+
if v, ok := value["instance_type"]; ok {
137+
tmpInitInfo.InstanceType = helper.String(v.(string))
138+
}
139+
140+
if v, ok := value["instance_count"]; ok {
141+
tmpInitInfo.InstanceCount = helper.IntInt64(v.(int))
142+
}
143+
144+
if v, ok := value["min_ro_count"].(int); ok && v != 0 {
145+
tmpInitInfo.MinRoCount = helper.IntInt64(v)
146+
}
147+
148+
if v, ok := value["max_ro_count"].(int); ok && v != 0 {
149+
tmpInitInfo.MaxRoCount = helper.IntInt64(v)
150+
}
151+
152+
if v, ok := value["min_ro_cpu"].(float64); ok && v != 0 {
153+
tmpInitInfo.MinRoCpu = helper.Float64(v)
154+
}
155+
156+
if v, ok := value["max_ro_cpu"].(float64); ok && v != 0 {
157+
tmpInitInfo.MaxRoCpu = helper.Float64(v)
158+
}
159+
160+
if v, ok := value["device_type"].(string); ok && v != "" {
161+
tmpInitInfo.DeviceType = helper.String(v)
162+
}
163+
164+
request.InstanceInitInfos = append(request.InstanceInitInfos, &tmpInitInfo)
165+
}
166+
}
167+
124168
isServerless := d.Get("db_mode").(string) == CYNOSDB_SERVERLESS
125169
if v, ok := d.GetOk("instance_cpu_core"); ok {
126170
request.Cpu = helper.IntInt64(v.(int))
@@ -158,8 +202,6 @@ func resourceTencentCloudCynosdbClusterCreate(d *schema.ResourceData, meta inter
158202
}
159203

160204
request.PayMode = &chargeType
161-
request.InstanceCount = helper.Int64(1)
162-
163205
var response *cynosdb.CreateClustersResponse
164206
var err error
165207
err = resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {

tencentcloud/services/cynosdb/resource_tc_cynosdb_cluster.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ resource "tencentcloud_cynosdb_cluster" "example" {
4444
db_type = "MYSQL"
4545
db_version = "5.7"
4646
port = 3306
47-
storage_limit = 1000
4847
cluster_name = "tf-example"
4948
password = "cynosDB@123"
5049
instance_maintain_duration = 7200
@@ -80,6 +79,22 @@ resource "tencentcloud_cynosdb_cluster" "example" {
8079
tencentcloud_security_group.example.id,
8180
]
8281
82+
instance_init_infos {
83+
cpu = 2
84+
memory = 4
85+
instance_type = "rw"
86+
instance_count = 1
87+
device_type = "common"
88+
}
89+
90+
instance_init_infos {
91+
cpu = 2
92+
memory = 4
93+
instance_type = "ro"
94+
instance_count = 1
95+
device_type = "exclusive"
96+
}
97+
8398
tags = {
8499
createBy = "terraform"
85100
}
@@ -146,7 +161,6 @@ resource "tencentcloud_cynosdb_cluster" "example" {
146161
db_type = "MYSQL"
147162
db_version = "8.0"
148163
port = 3306
149-
storage_limit = 1000
150164
cluster_name = "tf-example"
151165
password = "cynosDB@123"
152166
instance_maintain_duration = 7200

tencentcloud/services/cynosdb/service_tencentcloud_cynosdb.go

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,48 +1649,48 @@ func (me *CynosdbService) DescribeCynosdbRollbackTimeRangeByFilter(ctx context.C
16491649
return
16501650
}
16511651

1652-
func (me *CynosdbService) DescribeCynosdbRollbackTimeValidityByFilter(ctx context.Context, param map[string]interface{}) (rollbackTimeValidity *cynosdb.DescribeRollbackTimeValidityResponseParams, errRet error) {
1653-
var (
1654-
logId = tccommon.GetLogId(ctx)
1655-
request = cynosdb.NewDescribeRollbackTimeValidityRequest()
1656-
)
1657-
1658-
defer func() {
1659-
if errRet != nil {
1660-
log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error())
1661-
}
1662-
}()
1663-
1664-
for k, v := range param {
1665-
if k == "ClusterId" {
1666-
request.ClusterId = v.(*string)
1667-
}
1668-
if k == "ExpectTime" {
1669-
request.ExpectTime = v.(*string)
1670-
}
1671-
if k == "ExpectTimeThresh" {
1672-
request.ExpectTimeThresh = v.(*uint64)
1673-
}
1674-
}
1675-
1676-
ratelimit.Check(request.GetAction())
1677-
1678-
response, err := me.client.UseCynosdbClient().DescribeRollbackTimeValidity(request)
1679-
if err != nil {
1680-
errRet = err
1681-
return
1682-
}
1683-
1684-
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
1685-
1686-
if response == nil {
1687-
return
1688-
}
1689-
1690-
rollbackTimeValidity = response.Response
1691-
1692-
return
1693-
}
1652+
// func (me *CynosdbService) DescribeCynosdbRollbackTimeValidityByFilter(ctx context.Context, param map[string]interface{}) (rollbackTimeValidity *cynosdb.DescribeRollbackTimeValidityResponseParams, errRet error) {
1653+
// var (
1654+
// logId = tccommon.GetLogId(ctx)
1655+
// request = cynosdb.NewDescribeRollbackTimeValidityRequest()
1656+
// )
1657+
1658+
// defer func() {
1659+
// if errRet != nil {
1660+
// log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error())
1661+
// }
1662+
// }()
1663+
1664+
// for k, v := range param {
1665+
// if k == "ClusterId" {
1666+
// request.ClusterId = v.(*string)
1667+
// }
1668+
// if k == "ExpectTime" {
1669+
// request.ExpectTime = v.(*string)
1670+
// }
1671+
// if k == "ExpectTimeThresh" {
1672+
// request.ExpectTimeThresh = v.(*uint64)
1673+
// }
1674+
// }
1675+
1676+
// ratelimit.Check(request.GetAction())
1677+
1678+
// response, err := me.client.UseCynosdbClient().DescribeRollbackTimeValidity(request)
1679+
// if err != nil {
1680+
// errRet = err
1681+
// return
1682+
// }
1683+
1684+
// log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
1685+
1686+
// if response == nil {
1687+
// return
1688+
// }
1689+
1690+
// rollbackTimeValidity = response.Response
1691+
1692+
// return
1693+
// }
16941694

16951695
func (me *CynosdbService) DescribeCynosdbResourcePackageListByFilter(ctx context.Context, param map[string]interface{}) (resourcePackageList []*cynosdb.Package, errRet error) {
16961696
var (

vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)