Skip to content

Commit 9e330a9

Browse files
authored
fix(redis): [123755492] redis&mysql update code logic (#3332)
* add * add * add * add
1 parent 700893f commit 9e330a9

File tree

43 files changed

+786
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+786
-550
lines changed

tencentcloud/services/cdb/service_tencentcloud_mysql.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,7 @@ func (me *MysqlService) DescribeMysqlTimeWindowById(ctx context.Context, instanc
14751475
logId := tccommon.GetLogId(ctx)
14761476

14771477
request := cdb.NewDescribeTimeWindowRequest()
1478+
response := cdb.NewDescribeTimeWindowResponse()
14781479
request.InstanceId = &instanceId
14791480

14801481
defer func() {
@@ -1483,14 +1484,23 @@ func (me *MysqlService) DescribeMysqlTimeWindowById(ctx context.Context, instanc
14831484
}
14841485
}()
14851486

1486-
ratelimit.Check(request.GetAction())
1487+
err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
1488+
ratelimit.Check(request.GetAction())
1489+
result, e := me.client.UseMysqlClient().DescribeTimeWindow(request)
1490+
if e != nil {
1491+
return tccommon.RetryError(e)
1492+
} else {
1493+
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
1494+
}
1495+
1496+
response = result
1497+
return nil
1498+
})
14871499

1488-
response, err := me.client.UseMysqlClient().DescribeTimeWindow(request)
14891500
if err != nil {
14901501
errRet = err
14911502
return
14921503
}
1493-
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
14941504

14951505
timeWindow = response
14961506
return
@@ -1533,14 +1543,22 @@ func (me *MysqlService) DeleteMysqlTimeWindowById(ctx context.Context, instanceI
15331543
}
15341544
}()
15351545

1536-
ratelimit.Check(request.GetAction())
1546+
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
1547+
ratelimit.Check(request.GetAction())
1548+
result, e := me.client.UseMysqlClient().DeleteTimeWindow(request)
1549+
if e != nil {
1550+
return tccommon.RetryError(e)
1551+
} else {
1552+
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
1553+
}
1554+
1555+
return nil
1556+
})
15371557

1538-
response, err := me.client.UseMysqlClient().DeleteTimeWindow(request)
15391558
if err != nil {
15401559
errRet = err
15411560
return
15421561
}
1543-
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
15441562

15451563
return
15461564
}

tencentcloud/services/crs/resource_tc_redis_account.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ resource "tencentcloud_subnet" "subnet" {
2424
resource "tencentcloud_redis_instance" "foo" {
2525
availability_zone = data.tencentcloud_redis_zone_config.zone.list[1].zone
2626
type_id = data.tencentcloud_redis_zone_config.zone.list[1].type_id
27-
password = "test12345789"
27+
password = "Password@123"
2828
mem_size = 8192
2929
redis_shard_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_shard_nums[0]
3030
redis_replicas_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_replicas_nums[0]
31-
name = "terrform_test"
31+
name = "tf_example"
3232
port = 6379
3333
vpc_id = tencentcloud_vpc.vpc.id
3434
subnet_id = tencentcloud_subnet.subnet.id
3535
}
3636
3737
resource "tencentcloud_redis_account" "account" {
38-
instance_id = tencentcloud_redis_instance.foo.id
39-
account_name = "account_test"
40-
account_password = "test1234"
41-
remark = "master"
38+
instance_id = tencentcloud_redis_instance.foo.id
39+
account_name = "tf_example"
40+
account_password = "Password@123"
41+
remark = "master"
4242
readonly_policy = ["master"]
43-
privilege = "rw"
43+
privilege = "rw"
4444
}
4545
```
4646

@@ -63,26 +63,26 @@ resource "tencentcloud_subnet" "subnet" {
6363
cidr_block = "10.0.1.0/24"
6464
}
6565
66-
resource "tencentcloud_redis_instance" "foo" {
66+
resource "tencentcloud_redis_instance" "example" {
6767
availability_zone = data.tencentcloud_redis_zone_config.zone.list[1].zone
6868
type_id = data.tencentcloud_redis_zone_config.zone.list[1].type_id
69-
password = "test12345789"
69+
password = "Password@123"
7070
mem_size = 8192
7171
redis_shard_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_shard_nums[0]
7272
redis_replicas_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_replicas_nums[0]
73-
name = "terrform_test"
73+
name = "tf_example"
7474
port = 6379
7575
vpc_id = tencentcloud_vpc.vpc.id
7676
subnet_id = tencentcloud_subnet.subnet.id
7777
}
7878
79-
resource "tencentcloud_redis_account" "account" {
80-
instance_id = tencentcloud_redis_instance.foo.id
81-
account_name = "account_test"
82-
account_password = "test1234"
83-
remark = "master"
79+
resource "tencentcloud_redis_account" "example" {
80+
instance_id = tencentcloud_redis_instance.example.id
81+
account_name = "tf_example"
82+
account_password = "Password@123"
83+
remark = "master"
8484
readonly_policy = ["master"]
85-
privilege = "r"
85+
privilege = "rw"
8686
}
8787
```
8888

@@ -91,5 +91,5 @@ Import
9191
redis account can be imported using the id, e.g.
9292

9393
```
94-
terraform import tencentcloud_redis_account.account crs-xxxxxx#account_test
95-
```
94+
terraform import tencentcloud_redis_account.example crs-cqdfdzvt#tf_example
95+
```

tencentcloud/services/crs/resource_tc_redis_backup_config.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,22 @@ resource "tencentcloud_subnet" "subnet" {
2121
cidr_block = "10.0.1.0/24"
2222
}
2323
24-
resource "tencentcloud_redis_instance" "foo" {
24+
resource "tencentcloud_redis_instance" "example" {
2525
availability_zone = data.tencentcloud_redis_zone_config.zone.list[1].zone
2626
type_id = data.tencentcloud_redis_zone_config.zone.list[1].type_id
27-
password = "test12345789"
27+
password = "Password@123"
2828
mem_size = 8192
2929
redis_shard_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_shard_nums[0]
3030
redis_replicas_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_replicas_nums[0]
31-
name = "terrform_test"
31+
name = "tf_example"
3232
port = 6379
3333
vpc_id = tencentcloud_vpc.vpc.id
3434
subnet_id = tencentcloud_subnet.subnet.id
3535
}
3636
37-
resource "tencentcloud_redis_backup_config" "foo" {
38-
redis_id = tencentcloud_redis_instance.foo.id
39-
backup_time = "04:00-05:00"
40-
backup_period = ["Monday"]
37+
resource "tencentcloud_redis_backup_config" "example" {
38+
redis_id = tencentcloud_redis_instance.example.id
39+
backup_time = "04:00-05:00"
4140
}
4241
```
4342

@@ -46,5 +45,5 @@ Import
4645
Redis backup config can be imported, e.g.
4746

4847
```
49-
$ terraform import tencentcloud_redis_backup_config.foo redis-id
50-
```
48+
$ terraform import tencentcloud_redis_backup_config.example crs-cqdfdzvt
49+
```
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
Provides a resource to create a redis backup_download_restriction
1+
Provides a resource to create a redis backup download restriction
22

33
Example Usage
44

55
Modify the network information and address of the current region backup file download
66

77
```hcl
8-
resource "tencentcloud_redis_backup_download_restriction" "foo" {
9-
limit_type = "Customize"
10-
vpc_comparison_symbol = "In"
11-
ip_comparison_symbol = "In"
12-
limit_vpc {
13-
region = "ap-guangzhou"
14-
vpc_list = [var.vpc_id]
15-
}
16-
limit_ip = ["10.1.1.12", "10.1.1.13"]
8+
resource "tencentcloud_redis_backup_download_restriction" "example" {
9+
limit_type = "Customize"
10+
vpc_comparison_symbol = "In"
11+
ip_comparison_symbol = "In"
12+
limit_vpc {
13+
region = "ap-guangzhou"
14+
vpc_list = ["vpc-pu8wqojl"]
15+
}
16+
limit_ip = ["10.1.1.12", "10.1.1.13"]
1717
}
1818
```
1919

2020
Import
2121

22-
redis backup_download_restriction can be imported using the region, e.g.
22+
redis backup download restriction can be imported using the region, e.g.
2323

2424
```
25-
terraform import tencentcloud_redis_backup_download_restriction.foo ap-guangzhou
26-
```
25+
terraform import tencentcloud_redis_backup_download_restriction.example ap-guangzhou
26+
```
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
Provides a resource to create a redis backup_operation
1+
Provides a resource to create a redis backup operation
22

33
Example Usage
44

55
Manually back up the Redis instance, and the backup data is kept for 7 days
66

77
```hcl
8-
data "tencentcloud_mysql_instance" "foo" {}
8+
data "tencentcloud_mysql_instance" "example" {}
99
10-
resource "tencentcloud_redis_backup_operation" "backup_operation" {
11-
instance_id = data.tencentcloud_mysql_instance.foo.instance_list[0].mysql_id
12-
remark = "manually back"
10+
resource "tencentcloud_redis_backup_operation" "example" {
11+
instance_id = data.tencentcloud_mysql_instance.example.instance_list[0].mysql_id
12+
remark = "manually back"
1313
storage_days = 7
1414
}
1515
```

tencentcloud/services/crs/resource_tc_redis_clear_instance_operation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Provides a resource to create a redis clear_instance_operation
1+
Provides a resource to create a redis clear instance operation
22

33
Example Usage
44

55
Clear the instance data of the Redis instance
66

77
```hcl
88
variable "password" {
9-
default = "test12345789"
9+
default = "Password@123"
1010
}
1111
1212
data "tencentcloud_redis_zone_config" "zone" {
@@ -25,21 +25,21 @@ resource "tencentcloud_subnet" "subnet" {
2525
cidr_block = "10.0.1.0/24"
2626
}
2727
28-
resource "tencentcloud_redis_instance" "foo" {
28+
resource "tencentcloud_redis_instance" "example" {
2929
availability_zone = data.tencentcloud_redis_zone_config.zone.list[1].zone
3030
type_id = data.tencentcloud_redis_zone_config.zone.list[1].type_id
3131
password = var.password
3232
mem_size = 8192
3333
redis_shard_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_shard_nums[0]
3434
redis_replicas_num = data.tencentcloud_redis_zone_config.zone.list[1].redis_replicas_nums[0]
35-
name = "terrform_test"
35+
name = "tf_example"
3636
port = 6379
3737
vpc_id = tencentcloud_vpc.vpc.id
3838
subnet_id = tencentcloud_subnet.subnet.id
3939
}
4040
41-
resource "tencentcloud_redis_clear_instance_operation" "clear_instance_operation" {
42-
instance_id = tencentcloud_redis_instance.foo.id
41+
resource "tencentcloud_redis_clear_instance_operation" "example" {
42+
instance_id = tencentcloud_redis_instance.example.id
4343
password = var.password
4444
}
4545
```

tencentcloud/services/crs/resource_tc_redis_connection_config.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Provides a resource to create a redis connection_config
1+
Provides a resource to create a redis connection config
22

33
Example Usage
44

@@ -21,31 +21,30 @@ resource "tencentcloud_subnet" "subnet" {
2121
cidr_block = "10.0.1.0/24"
2222
}
2323
24-
resource "tencentcloud_redis_instance" "foo" {
24+
resource "tencentcloud_redis_instance" "example" {
2525
availability_zone = data.tencentcloud_redis_zone_config.zone.list[0].zone
2626
type_id = data.tencentcloud_redis_zone_config.zone.list[0].type_id
27-
password = "test12345789"
27+
password = "Password@123"
2828
mem_size = 8192
2929
redis_shard_num = data.tencentcloud_redis_zone_config.zone.list[0].redis_shard_nums[0]
3030
redis_replicas_num = data.tencentcloud_redis_zone_config.zone.list[0].redis_replicas_nums[0]
31-
name = "terrform_test"
31+
name = "tf_example"
3232
port = 6379
3333
vpc_id = tencentcloud_vpc.vpc.id
3434
subnet_id = tencentcloud_subnet.subnet.id
3535
}
3636
37-
resource "tencentcloud_redis_connection_config" "connection_config" {
38-
instance_id = "crs-fhm9fnv1"
39-
client_limit = "20000"
40-
add_bandwidth = "30"
37+
resource "tencentcloud_redis_connection_config" "example" {
38+
instance_id = tencentcloud_redis_instance.example.id
39+
client_limit = "20000"
40+
add_bandwidth = "30"
4141
}
42-
4342
```
4443

4544
Import
4645

47-
Redis connectionConfig can be imported, e.g.
46+
redis connection config can be imported, e.g.
4847

4948
```
50-
$ terraform import tencentcloud_redis_connection_config.connection_config instance_id
51-
```
49+
$ terraform import tencentcloud_redis_connection_config.example crs-cqdfdzvt
50+
```

tencentcloud/services/crs/resource_tc_redis_log_delivery.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Example Usage
88
Use cls logset and topic which existed
99

1010
```hcl
11-
resource "tencentcloud_redis_log_delivery" "delivery" {
11+
resource "tencentcloud_redis_log_delivery" "example" {
1212
instance_id = "crs-dmjj8en7"
1313
logset_id = "cc31d9d6-74c0-4888-8b2f-b8148c3bcc5c"
1414
topic_id = "5c2333e9-0bab-41fd-9f75-c602b3f9545f"
@@ -18,10 +18,10 @@ resource "tencentcloud_redis_log_delivery" "delivery" {
1818
Use exist cls logset and create new topic
1919

2020
```hcl
21-
resource "tencentcloud_redis_log_delivery" "delivery" {
21+
resource "tencentcloud_redis_log_delivery" "example" {
2222
instance_id = "crs-dmjj8en7"
2323
logset_id = "cc31d9d6-74c0-4888-8b2f-b8148c3bcc5c"
24-
topic_name = "test13"
24+
topic_name = "tf-example"
2525
period = 20
2626
create_index = true
2727
}
@@ -30,11 +30,11 @@ resource "tencentcloud_redis_log_delivery" "delivery" {
3030
Create new cls logset and topic
3131

3232
```hcl
33-
resource "tencentcloud_redis_log_delivery" "delivery" {
33+
resource "tencentcloud_redis_log_delivery" "example" {
3434
instance_id = "crs-dmjj8en7"
3535
log_region = "ap-guangzhou"
36-
logset_name = "test"
37-
topic_name = "test"
36+
logset_name = "tf-example"
37+
topic_name = "tf-example"
3838
period = 20
3939
create_index = true
4040
}
@@ -45,5 +45,5 @@ Import
4545
Redis log delivery can be imported, e.g.
4646

4747
```
48-
$ terraform import tencentcloud_redis_log_delivery.delivery crs-dmjj8en7
49-
```
48+
$ terraform import tencentcloud_redis_log_delivery.example crs-dmjj8en7
49+
```

0 commit comments

Comments
 (0)