Skip to content

Commit 2b47aba

Browse files
author
mikatong
committed
support in_maintenance
1 parent e8f7a1e commit 2b47aba

10 files changed

+45
-3
lines changed

tencentcloud/services/mongodb/extension_mongodb.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ func TencentMongodbBasicInfo() map[string]*schema.Schema {
200200
Default: 0,
201201
Description: "Auto renew flag. Valid values are `0`(NOTIFY_AND_MANUAL_RENEW), `1`(NOTIFY_AND_AUTO_RENEW) and `2`(DISABLE_NOTIFY_AND_MANUAL_RENEW). Default value is `0`. Note: only works for PREPAID instance. Only supports`0` and `1` for creation.",
202202
},
203+
"in_maintenance": {
204+
Type: schema.TypeInt,
205+
Optional: true,
206+
Description: "Switch time for instance configuration changes.\n" +
207+
" - 0: When the adjustment is completed, perform the configuration task immediately. Default is 0.\n" +
208+
" - 1: Perform reconfiguration tasks within the maintenance time window.\n" +
209+
"Note: Adjusting the number of nodes and slices does not support changes within the maintenance window.",
210+
},
203211
// Computed
204212
"status": {
205213
Type: schema.TypeInt,

tencentcloud/services/mongodb/resource_tc_mongodb_instance.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@ func resourceTencentCloudMongodbInstanceUpdate(d *schema.ResourceData, meta inte
553553
removeNodeList := v.([]interface{})
554554
params["remove_node_list"] = removeNodeList
555555
}
556+
if v, ok := d.GetOkExists("in_maintenance"); ok {
557+
params["in_maintenance"] = v.(int)
558+
}
556559
dealId, err := mongodbService.UpgradeInstance(ctx, instanceId, memory, volume, params)
557560
if err != nil {
558561
return err

tencentcloud/services/mongodb/resource_tc_mongodb_readonly_instance.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,11 @@ func resourceTencentCloudMongodbReadOnlyInstanceUpdate(d *schema.ResourceData, m
448448
if d.HasChange("memory") || d.HasChange("volume") {
449449
memory := d.Get("memory").(int)
450450
volume := d.Get("volume").(int)
451-
dealId, err := mongodbService.UpgradeInstance(ctx, instanceId, memory, volume, nil)
451+
params := make(map[string]interface{})
452+
if v, ok := d.GetOkExists("in_maintenance"); ok {
453+
params["in_maintenance"] = v.(int)
454+
}
455+
dealId, err := mongodbService.UpgradeInstance(ctx, instanceId, memory, volume, params)
452456
if err != nil {
453457
return err
454458
}

tencentcloud/services/mongodb/resource_tc_mongodb_sharding_instance.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,11 @@ func resourceMongodbShardingInstanceUpdate(d *schema.ResourceData, meta interfac
468468
if d.HasChange("memory") || d.HasChange("volume") {
469469
memory := d.Get("memory").(int)
470470
volume := d.Get("volume").(int)
471-
_, err := mongodbService.UpgradeInstance(ctx, instanceId, memory, volume, nil)
471+
params := make(map[string]interface{})
472+
if v, ok := d.GetOkExists("in_maintenance"); ok {
473+
params["in_maintenance"] = v.(int)
474+
}
475+
_, err := mongodbService.UpgradeInstance(ctx, instanceId, memory, volume, params)
472476
if err != nil {
473477
return err
474478
}

tencentcloud/services/mongodb/resource_tc_mongodb_standby_instance.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,11 @@ func resourceTencentCloudMongodbStandbyInstanceUpdate(d *schema.ResourceData, me
403403
if d.HasChange("memory") || d.HasChange("volume") {
404404
memory := d.Get("memory").(int)
405405
volume := d.Get("volume").(int)
406-
dealId, err := mongodbService.UpgradeInstance(ctx, instanceId, memory, volume, nil)
406+
params := make(map[string]interface{})
407+
if v, ok := d.GetOkExists("in_maintenance"); ok {
408+
params["in_maintenance"] = v.(int)
409+
}
410+
dealId, err := mongodbService.UpgradeInstance(ctx, instanceId, memory, volume, params)
407411
if err != nil {
408412
return err
409413
}

tencentcloud/services/mongodb/service_tencentcloud_mongodb.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ func (me *MongodbService) UpgradeInstance(ctx context.Context, instanceId string
190190
})
191191
}
192192
}
193+
if v, ok := params["in_maintenance"]; ok {
194+
request.InMaintenance = helper.IntUint64(v.(int))
195+
}
193196
var response *mongodb.ModifyDBInstanceSpecResponse
194197
tradeError := false
195198
err := resource.Retry(6*tccommon.WriteRetryTimeout, func() *resource.RetryError {

website/docs/r/mongodb_instance.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ The following arguments are supported:
4747
- Basic network cannot be selected.
4848
* `charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. Default value is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`. Caution that update operation on this field will delete old instances and create new one with new charge type.
4949
* `hidden_zone` - (Optional, String) The availability zone to which the Hidden node belongs. This parameter is required in cross-AZ instance deployment.
50+
* `in_maintenance` - (Optional, Int) Switch time for instance configuration changes.
51+
- 0: When the adjustment is completed, perform the configuration task immediately. Default is 0.
52+
- 1: Perform reconfiguration tasks within the maintenance time window.
53+
Note: Adjusting the number of nodes and slices does not support changes within the maintenance window.
5054
* `maintenance_end` - (Optional, String) Maintenance window end time.
5155
- The value range is any full point or half point from `00:00-23:00`, and the maintenance time duration is at least 30 minutes and at most 3 hours.
5256
- The end time must be based on the start time backwards.

website/docs/r/mongodb_readonly_instance.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ The following arguments are supported:
7171
* `volume` - (Required, Int) Disk size. The minimum value is 25, and unit is GB. Memory and volume must be upgraded or degraded simultaneously.
7272
* `auto_renew_flag` - (Optional, Int) Auto renew flag. Valid values are `0`(NOTIFY_AND_MANUAL_RENEW), `1`(NOTIFY_AND_AUTO_RENEW) and `2`(DISABLE_NOTIFY_AND_MANUAL_RENEW). Default value is `0`. Note: only works for PREPAID instance. Only supports`0` and `1` for creation.
7373
* `charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. Default value is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`. Caution that update operation on this field will delete old instances and create new one with new charge type.
74+
* `in_maintenance` - (Optional, Int) Switch time for instance configuration changes.
75+
- 0: When the adjustment is completed, perform the configuration task immediately. Default is 0.
76+
- 1: Perform reconfiguration tasks within the maintenance time window.
77+
Note: Adjusting the number of nodes and slices does not support changes within the maintenance window.
7478
* `mongos_cpu` - (Optional, Int) Number of mongos cpu.
7579
* `mongos_memory` - (Optional, Int) Mongos memory size in GB.
7680
* `mongos_node_num` - (Optional, Int) Number of mongos.

website/docs/r/mongodb_sharding_instance.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ The following arguments are supported:
5353
- Basic network cannot be selected.
5454
* `charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. Default value is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`. Caution that update operation on this field will delete old instances and create new one with new charge type.
5555
* `hidden_zone` - (Optional, String) The availability zone to which the Hidden node belongs. This parameter is required in cross-AZ instance deployment.
56+
* `in_maintenance` - (Optional, Int) Switch time for instance configuration changes.
57+
- 0: When the adjustment is completed, perform the configuration task immediately. Default is 0.
58+
- 1: Perform reconfiguration tasks within the maintenance time window.
59+
Note: Adjusting the number of nodes and slices does not support changes within the maintenance window.
5660
* `mongos_cpu` - (Optional, Int) Number of mongos cpu.
5761
* `mongos_memory` - (Optional, Int) Mongos memory size in GB.
5862
* `mongos_node_num` - (Optional, Int) Number of mongos.

website/docs/r/mongodb_standby_instance.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ The following arguments are supported:
6666
* `volume` - (Required, Int) Disk size. The minimum value is 25, and unit is GB. Memory and volume must be upgraded or degraded simultaneously.
6767
* `auto_renew_flag` - (Optional, Int) Auto renew flag. Valid values are `0`(NOTIFY_AND_MANUAL_RENEW), `1`(NOTIFY_AND_AUTO_RENEW) and `2`(DISABLE_NOTIFY_AND_MANUAL_RENEW). Default value is `0`. Note: only works for PREPAID instance. Only supports`0` and `1` for creation.
6868
* `charge_type` - (Optional, String, ForceNew) The charge type of instance. Valid values are `PREPAID` and `POSTPAID_BY_HOUR`. Default value is `POSTPAID_BY_HOUR`. Note: TencentCloud International only supports `POSTPAID_BY_HOUR`. Caution that update operation on this field will delete old instances and create new one with new charge type.
69+
* `in_maintenance` - (Optional, Int) Switch time for instance configuration changes.
70+
- 0: When the adjustment is completed, perform the configuration task immediately. Default is 0.
71+
- 1: Perform reconfiguration tasks within the maintenance time window.
72+
Note: Adjusting the number of nodes and slices does not support changes within the maintenance window.
6973
* `prepaid_period` - (Optional, Int) The tenancy (time unit is month) of the prepaid instance. Valid values are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36. NOTE: it only works when charge_type is set to `PREPAID`.
7074
* `project_id` - (Optional, Int) ID of the project which the instance belongs.
7175
* `security_groups` - (Optional, Set: [`String`]) ID of the security group.

0 commit comments

Comments
 (0)