diff --git a/docs/data-sources/dcs_maintainwindow_v1.md b/docs/data-sources/dcs_maintainwindow_v1.md index 2371ed81..b3dca566 100644 --- a/docs/data-sources/dcs_maintainwindow_v1.md +++ b/docs/data-sources/dcs_maintainwindow_v1.md @@ -18,7 +18,8 @@ data "flexibleengine_dcs_maintainwindow_v1" "maintainwindow1" { ## Argument Reference -* `default` - (Optional, Bool) Specifies whether a maintenance time window is set to the default time segment. +* `region` - (Optional, String) The region in which to obtain the dcs maintenance windows. If omitted, the provider-level + region will be used. * `seq` - (Optional, Int) Specifies the sequential number of a maintenance time window. @@ -26,6 +27,8 @@ data "flexibleengine_dcs_maintainwindow_v1" "maintainwindow1" { * `end` - (Optional, String) Specifies the time at which a maintenance time window ends. +* `default` - (Optional, Bool) Specifies whether a maintenance time window is set to the default time segment. + ## Attribute Reference `id` is set to the ID of the found maintainwindow. In addition, the following attributes diff --git a/flexibleengine/acceptance/data_source_flexibleengine_dcs_maintainwindow_v1_test.go b/flexibleengine/acceptance/data_source_flexibleengine_dcs_maintainwindow_v1_test.go new file mode 100644 index 00000000..2c33aec6 --- /dev/null +++ b/flexibleengine/acceptance/data_source_flexibleengine_dcs_maintainwindow_v1_test.go @@ -0,0 +1,35 @@ +package acceptance + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance" +) + +func TestAccDcsMaintainWindowDataSource_basic(t *testing.T) { + sourceName := "data.flexibleengine_dcs_maintainwindow_v1.maintainwindow1" + dc := acceptance.InitDataSourceCheck(sourceName) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProviderFactories: TestAccProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccDcsMaintainWindowDataSource_basic, + Check: resource.ComposeTestCheckFunc( + dc.CheckResourceExists(), + resource.TestCheckResourceAttr(sourceName, "seq", "1"), + resource.TestMatchResourceAttr(sourceName, "begin", regexp.MustCompile(`^\d{2}$`)), + ), + }, + }, + }) +} + +var testAccDcsMaintainWindowDataSource_basic = ` +data "flexibleengine_dcs_maintainwindow_v1" "maintainwindow1" { + seq = 1 +} +` diff --git a/flexibleengine/provider.go b/flexibleengine/provider.go index 5a861c87..c6b5e3ad 100644 --- a/flexibleengine/provider.go +++ b/flexibleengine/provider.go @@ -275,7 +275,7 @@ func Provider() *schema.Provider { "flexibleengine_cts_tracker_v1": dataSourceCTSTrackerV1(), - "flexibleengine_dcs_maintainwindow_v1": dataSourceDcsMaintainWindowV1(), + "flexibleengine_dcs_maintainwindow_v1": dcs.DataSourceDcsMaintainWindow(), "flexibleengine_dcs_product_v1": dataSourceDcsProductV1(), "flexibleengine_dms_product": dataSourceDmsProduct(),