Skip to content

Commit eed6376

Browse files
authored
fix(dts): [128090395] tencentcloud_dts_sync_config support rate_limit_option (#3578)
* add * add * add
1 parent 46529fa commit eed6376

File tree

11 files changed

+7952
-2674
lines changed

11 files changed

+7952
-2674
lines changed

.changelog/3578.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_dts_sync_config: support `rate_limit_option`
3+
```

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1107
4747
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.1033
4848
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.1148
49-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.45
49+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.46
5050
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.1206
5151
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
5252
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.1161
@@ -57,7 +57,7 @@ require (
5757
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dlc v1.1.35
5858
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.1056
5959
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/domain v1.0.414
60-
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.628
60+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.1.46
6161
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/eb v1.1.30
6262
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/emr v1.0.1115
6363
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.1.13

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.42 h1:zOTQC
968968
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.42/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
969969
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.45 h1:aHdlXJIg0Ro2gNeBUFBP25t7zBLAJVpWVDRxGp6J7oE=
970970
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.45/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
971+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.46 h1:wWcfc+d0BJSGvLtIdPSLuN//KCgIhuWbjao68roZrzw=
972+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.1.46/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
971973
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
972974
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
973975
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
@@ -1002,6 +1004,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/domain v1.0.414 h1:egwj
10021004
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/domain v1.0.414/go.mod h1:LRWnBUNRxs/Ee8MzJJd3eHzydlqyB5qmia975Ca/Ox0=
10031005
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.628 h1:cnhe9uh8tSyBfiPUckfqNI6t51YNZG9POupTrqWG9lM=
10041006
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.628/go.mod h1:JxTXEld643DHk5HeQe4xIvuuoxsCmbTjgmE64Mtrdxw=
1007+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.1.46 h1:JWl2IK+vX/806sPABd6ejdgcNy4CKrtUJJa8Kp1gYLo=
1008+
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.1.46/go.mod h1:X1E1GJZG7GGpX0M69URtDEkf0ZfH9i92K4wLxPIIWaY=
10051009
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/eb v1.1.30 h1:fuy1NhRyTbwMku0VS1/uFao77pK1HuLCqRRYVxow3Uk=
10061010
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/eb v1.1.30/go.mod h1:ORMs9Hzzlrmsq0gqKdw+XBE0uMWA026Bsy3jvpCWdFA=
10071011
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/emr v1.0.1115 h1:hKzATWx2kZm32piKYM5WZLsHA1pWlDw9w7tNL6jo+0g=

tencentcloud/services/dts/resource_tc_dts_sync_config.go

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,72 @@ func ResourceTencentCloudDtsSyncConfig() *schema.Resource {
129129
},
130130
},
131131
},
132+
"rate_limit_option": {
133+
Type: schema.TypeList,
134+
Optional: true,
135+
Computed: true,
136+
MaxItems: 1,
137+
Description: "Task speed limit information\nNote: This field may return null, indicating that no valid values can be obtained.",
138+
Elem: &schema.Resource{
139+
Schema: map[string]*schema.Schema{
140+
"current_dump_thread": {
141+
Type: schema.TypeInt,
142+
Required: true,
143+
Description: "The number of full export threads currently in effect. The value of this field can be adjusted when configuring the task. Note: If it is not set or set to 0, it means the current value is maintained. The maximum value is 16.Note: This field may return null, indicating that no valid values can be obtained.",
144+
},
145+
"default_dump_thread": {
146+
Type: schema.TypeInt,
147+
Required: true,
148+
Description: "The default number of full export threads. This field is only meaningful in the output parameter.Note: This field may return null, indicating that no valid values can be obtained.",
149+
},
150+
"current_dump_rps": {
151+
Type: schema.TypeInt,
152+
Required: true,
153+
Description: "The full export Rps currently in effect. The value of this field can be adjusted when configuring the task. Note: If it is not set or set to 0, it means the current value is maintained. The maximum value is 50,000,000.Note: This field may return null, indicating that no valid values can be obtained.",
154+
},
155+
"default_dump_rps": {
156+
Type: schema.TypeInt,
157+
Required: true,
158+
Description: "The default full export Rps. This field is only meaningful in the output parameter.Note: This field may return null, indicating that no valid values can be obtained.",
159+
},
160+
"current_load_thread": {
161+
Type: schema.TypeInt,
162+
Required: true,
163+
Description: "The number of full import threads currently in effect. The value of this field can be adjusted when configuring the task. Note: If it is not set or set to 0, it means the current value is maintained. The maximum value is 16.Note: This field may return null, indicating that no valid values can be obtained.",
164+
},
165+
"default_load_thread": {
166+
Type: schema.TypeInt,
167+
Required: true,
168+
Description: "The default number of full import threads. This field is only meaningful in the output parameter.Note: This field may return null, indicating that no valid values can be obtained.",
169+
},
170+
"current_load_rps": {
171+
Type: schema.TypeInt,
172+
Required: true,
173+
Description: "The full import Rps currently in effect. The value of this field can be adjusted when configuring the task. Note: If it is not set or set to 0, it means the current value is maintained. The maximum value is 50,000,000.Note: This field may return null, indicating that no valid values can be obtained.",
174+
},
175+
"default_load_rps": {
176+
Type: schema.TypeInt,
177+
Required: true,
178+
Description: "The default full import Rps. This field is only meaningful in the output parameter.Note: This field may return null, indicating that no valid values can be obtained.",
179+
},
180+
"current_sinker_thread": {
181+
Type: schema.TypeInt,
182+
Required: true,
183+
Description: "The number of incremental import threads currently in effect. The value of this field can be adjusted when configuring the task. Note: If it is not set or set to 0, it means the current value is maintained. The maximum value is 128.Note: This field may return null, indicating that no valid values can be obtained.",
184+
},
185+
"default_sinker_thread": {
186+
Type: schema.TypeInt,
187+
Required: true,
188+
Description: "The default number of incremental import threads. This field is only meaningful in the output parameter.\nNote: This field may return null, indicating that no valid values can be obtained.",
189+
},
190+
"has_user_set_rate_limit": {
191+
Type: schema.TypeString,
192+
Required: true,
193+
Description: "enum:\"no\"/\"yes\", no: the user has not set a speed limit; yes: a speed limit has been set. This field is only meaningful in the output parameter.Note: This field may return null, indicating that no valid values can be obtained.",
194+
},
195+
},
196+
},
197+
},
132198
},
133199
},
134200
},
@@ -747,6 +813,55 @@ func resourceTencentCloudDtsSyncConfigRead(d *schema.ResourceData, meta interfac
747813
optionsMap["ddl_options"] = ddlOptionsList
748814
}
749815

816+
if syncConfig.Options.RateLimitOption != nil {
817+
rateLimitOptionMap := map[string]interface{}{}
818+
if syncConfig.Options.RateLimitOption.CurrentDumpThread != nil {
819+
rateLimitOptionMap["current_dump_thread"] = syncConfig.Options.RateLimitOption.CurrentDumpThread
820+
}
821+
822+
if syncConfig.Options.RateLimitOption.DefaultDumpThread != nil {
823+
rateLimitOptionMap["default_dump_thread"] = syncConfig.Options.RateLimitOption.DefaultDumpThread
824+
}
825+
826+
if syncConfig.Options.RateLimitOption.CurrentDumpRps != nil {
827+
rateLimitOptionMap["current_dump_rps"] = syncConfig.Options.RateLimitOption.CurrentDumpRps
828+
}
829+
830+
if syncConfig.Options.RateLimitOption.DefaultDumpRps != nil {
831+
rateLimitOptionMap["default_dump_rps"] = syncConfig.Options.RateLimitOption.DefaultDumpRps
832+
}
833+
834+
if syncConfig.Options.RateLimitOption.CurrentLoadThread != nil {
835+
rateLimitOptionMap["current_load_thread"] = syncConfig.Options.RateLimitOption.CurrentLoadThread
836+
}
837+
838+
if syncConfig.Options.RateLimitOption.DefaultLoadThread != nil {
839+
rateLimitOptionMap["default_load_thread"] = syncConfig.Options.RateLimitOption.DefaultLoadThread
840+
}
841+
842+
if syncConfig.Options.RateLimitOption.CurrentLoadRps != nil {
843+
rateLimitOptionMap["current_load_rps"] = syncConfig.Options.RateLimitOption.CurrentLoadRps
844+
}
845+
846+
if syncConfig.Options.RateLimitOption.DefaultLoadRps != nil {
847+
rateLimitOptionMap["default_load_rps"] = syncConfig.Options.RateLimitOption.DefaultLoadRps
848+
}
849+
850+
if syncConfig.Options.RateLimitOption.CurrentSinkerThread != nil {
851+
rateLimitOptionMap["current_sinker_thread"] = syncConfig.Options.RateLimitOption.CurrentSinkerThread
852+
}
853+
854+
if syncConfig.Options.RateLimitOption.DefaultSinkerThread != nil {
855+
rateLimitOptionMap["default_sinker_thread"] = syncConfig.Options.RateLimitOption.DefaultSinkerThread
856+
}
857+
858+
if syncConfig.Options.RateLimitOption.HasUserSetRateLimit != nil {
859+
rateLimitOptionMap["has_user_set_rate_limit"] = syncConfig.Options.RateLimitOption.HasUserSetRateLimit
860+
}
861+
862+
optionsMap["rate_limit_option"] = []interface{}{rateLimitOptionMap}
863+
}
864+
750865
_ = d.Set("options", []interface{}{optionsMap})
751866
}
752867

@@ -1215,6 +1330,55 @@ func resourceTencentCloudDtsSyncConfigUpdate(d *schema.ResourceData, meta interf
12151330
options.DdlOptions = append(options.DdlOptions, &ddlOption)
12161331
}
12171332
}
1333+
if rateLimitOptionMap, ok := helper.InterfaceToMap(dMap, "rate_limit_option"); ok {
1334+
rateLimitOption := dts.RateLimitOption{}
1335+
if v, ok := rateLimitOptionMap["current_dump_thread"].(int); ok {
1336+
rateLimitOption.CurrentDumpThread = helper.IntInt64(v)
1337+
}
1338+
1339+
if v, ok := rateLimitOptionMap["default_dump_thread"].(int); ok {
1340+
rateLimitOption.DefaultDumpThread = helper.IntInt64(v)
1341+
}
1342+
1343+
if v, ok := rateLimitOptionMap["current_dump_rps"].(int); ok {
1344+
rateLimitOption.CurrentDumpRps = helper.IntInt64(v)
1345+
}
1346+
1347+
if v, ok := rateLimitOptionMap["default_dump_rps"].(int); ok {
1348+
rateLimitOption.DefaultDumpRps = helper.IntInt64(v)
1349+
}
1350+
1351+
if v, ok := rateLimitOptionMap["current_load_thread"].(int); ok {
1352+
rateLimitOption.CurrentLoadThread = helper.IntInt64(v)
1353+
}
1354+
1355+
if v, ok := rateLimitOptionMap["default_load_thread"].(int); ok {
1356+
rateLimitOption.DefaultLoadThread = helper.IntInt64(v)
1357+
}
1358+
1359+
if v, ok := rateLimitOptionMap["current_load_rps"].(int); ok {
1360+
rateLimitOption.CurrentLoadRps = helper.IntInt64(v)
1361+
}
1362+
1363+
if v, ok := rateLimitOptionMap["default_load_rps"].(int); ok {
1364+
rateLimitOption.DefaultLoadRps = helper.IntInt64(v)
1365+
}
1366+
1367+
if v, ok := rateLimitOptionMap["current_sinker_thread"].(int); ok {
1368+
rateLimitOption.CurrentSinkerThread = helper.IntInt64(v)
1369+
}
1370+
1371+
if v, ok := rateLimitOptionMap["default_sinker_thread"].(int); ok {
1372+
rateLimitOption.DefaultSinkerThread = helper.IntInt64(v)
1373+
}
1374+
1375+
if v, ok := rateLimitOptionMap["has_user_set_rate_limit"].(string); ok && v != "" {
1376+
rateLimitOption.HasUserSetRateLimit = helper.String(v)
1377+
}
1378+
1379+
options.RateLimitOption = &rateLimitOption
1380+
}
1381+
12181382
request.Options = &options
12191383
}
12201384

0 commit comments

Comments
 (0)