From 0d15cefdd0fad5db2e0666d4b7b6c1f255a17c14 Mon Sep 17 00:00:00 2001 From: zhukun <2019229048@tju.edu.cn> Date: Thu, 2 Nov 2023 17:20:34 +0800 Subject: [PATCH] dms_branch --- docs/data-sources/dms_maintainwindow.md | 34 ++++++++++++++++++ ..._flexibleengine_dms_maintainwindow_test.go | 35 +++++++++++++++++++ flexibleengine/provider.go | 1 + 3 files changed, 70 insertions(+) create mode 100644 docs/data-sources/dms_maintainwindow.md create mode 100644 flexibleengine/acceptance/data_source_flexibleengine_dms_maintainwindow_test.go diff --git a/docs/data-sources/dms_maintainwindow.md b/docs/data-sources/dms_maintainwindow.md new file mode 100644 index 00000000..2d37cbe9 --- /dev/null +++ b/docs/data-sources/dms_maintainwindow.md @@ -0,0 +1,34 @@ +--- +subcategory: "Distributed Message Service (DMS)" +--- + +# flexibleengine_dms_maintainwindow + +Use this data source to get the ID of an available FlexibleEngine dms maintainwindow. + +## Example Usage + +```hcl +data "flexibleengine_dms_maintainwindow" "maintainwindow1" { + seq = 1 +} +``` + +## Argument Reference + +* `region` - (Optional, String) The region in which to obtain the dms maintainwindows. If omitted, the provider-level + region will be used. + +* `seq` - (Optional, Int) Indicates the sequential number of a maintenance time window. + +* `begin` - (Optional, String) Indicates the time at which a maintenance time window starts. + +* `end` - (Optional, String) Indicates the time at which a maintenance time window ends. + +* `default` - (Optional, Bool) Indicates whether a maintenance time window is set to the default time segment. + +## Attribute Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - Specifies a data source ID in UUID format. diff --git a/flexibleengine/acceptance/data_source_flexibleengine_dms_maintainwindow_test.go b/flexibleengine/acceptance/data_source_flexibleengine_dms_maintainwindow_test.go new file mode 100644 index 00000000..bd5e37d9 --- /dev/null +++ b/flexibleengine/acceptance/data_source_flexibleengine_dms_maintainwindow_test.go @@ -0,0 +1,35 @@ +package acceptance + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" +) + +func TestAccDmsMaintainWindowDataSource_basic(t *testing.T) { + dataSourceName := "data.flexibleengine_dms_maintainwindow.maintainwindow1" + dc := acceptance.InitDataSourceCheck(dataSourceName) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProviderFactories: TestAccProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccDmsMaintainWindowDataSource_basic, + Check: resource.ComposeTestCheckFunc( + dc.CheckResourceExists(), + resource.TestCheckResourceAttr(dataSourceName, "seq", "1"), + resource.TestCheckResourceAttr(dataSourceName, "begin", "22:00:00"), + ), + }, + }, + }) +} + +var testAccDmsMaintainWindowDataSource_basic = ` +data "flexibleengine_dms_maintainwindow" "maintainwindow1" { + seq = 1 +} +` diff --git a/flexibleengine/provider.go b/flexibleengine/provider.go index 6be2041f..6bdfdc30 100644 --- a/flexibleengine/provider.go +++ b/flexibleengine/provider.go @@ -296,6 +296,7 @@ func Provider() *schema.Provider { "flexibleengine_dms_kafka_instances": dms.DataSourceDmsKafkaInstances(), "flexibleengine_dms_rocketmq_broker": dms.DataSourceDmsRocketMQBroker(), "flexibleengine_dms_rocketmq_instances": dms.DataSourceDmsRocketMQInstances(), + "flexibleengine_dms_maintainwindow": dms.DataSourceDmsMaintainWindow(), "flexibleengine_dws_flavors": dws.DataSourceDwsFlavors(), "flexibleengine_elb_certificate": elb.DataSourceELBCertificateV3(),