Skip to content

Commit

Permalink
feat(DCS): Synchronized DCS dataSources, unit test and document.
Browse files Browse the repository at this point in the history
  • Loading branch information
dengyali0125 committed Jan 17, 2024
1 parent ba09928 commit 5629cf9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
5 changes: 4 additions & 1 deletion docs/data-sources/dcs_maintainwindow_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ 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.

* `begin` - (Optional, String) Specifies the time at which a maintenance time window starts.

* `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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
`
10 changes: 5 additions & 5 deletions flexibleengine/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ func Provider() *schema.Provider {

"flexibleengine_cts_tracker_v1": dataSourceCTSTrackerV1(),

"flexibleengine_dcs_maintainwindow_v1": dataSourceDcsMaintainWindowV1(),
"flexibleengine_dcs_product_v1": dataSourceDcsProductV1(),
"flexibleengine_dcs_product_v1": dataSourceDcsProductV1(),

"flexibleengine_dms_product": dataSourceDmsProduct(),

Expand Down Expand Up @@ -321,9 +320,10 @@ func Provider() *schema.Provider {

"flexibleengine_css_flavors": css.DataSourceCssFlavors(),

"flexibleengine_dcs_flavors": dcs.DataSourceDcsFlavorsV2(),
"flexibleengine_dcs_instances": dcs.DataSourceDcsInstance(),
"flexibleengine_dcs_templates": dcs.DataSourceTemplates(),
"flexibleengine_dcs_flavors": dcs.DataSourceDcsFlavorsV2(),
"flexibleengine_dcs_instances": dcs.DataSourceDcsInstance(),
"flexibleengine_dcs_templates": dcs.DataSourceTemplates(),
"flexibleengine_dcs_maintainwindow_v1": dcs.DataSourceDcsMaintainWindow(),

"flexibleengine_ddm_engines": ddm.DataSourceDdmEngines(),
"flexibleengine_ddm_flavors": ddm.DataSourceDdmFlavors(),
Expand Down

0 comments on commit 5629cf9

Please sign in to comment.