Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(GaussDB): import GaussDB resource, unit test and document. #1040

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/data-sources/gaussdb_cassandra_flavors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
subcategory: "GaussDB NoSQL"
---

# flexibleengine_gaussdb_cassandra_flavors

Use this data source to get available FlexibleEngine gaussdb cassandra flavors.

## Example Usage

```hcl
data "flexibleengine_gaussdb_cassandra_flavors" "flavors" {
}
```

## Argument Reference

* `region` - (Optional, String) The region in which to obtain the flavors. If omitted, the provider-level region will be
used.

* `vcpus` - (Optional, String) Specifies the count of vcpus of the flavors.

* `memory` - (Optional, String) Specifies the memory size of the flavors.

* `version` - (Optional, String) Specifies the engine version of the flavors.

## Attribute Reference

In addition to all arguments above, the following attributes are exported:

* `id` - Specifies the data source ID.

* `flavors` - Indicates the flavors information. The [flavors](#gaussdb_flavors) object structure is documented below.

<a name="gaussdb_flavors"></a>
The `flavors` block supports:

* `name` - Indicates the spec code of the flavor.

* `vcpus` - Indicates the CPU size.

* `memory` - Indicates the memory size in GB.

* `version` - Indicates the database version.

* `az_status` - Indicates the flavor status in each availability zone.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package acceptance

import (
"testing"

"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/utils/fmtp"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccCassandraFlavorsDataSource_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: TestAccProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccCassandraFlavorsDataSource_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckCassandraFlavorsDataSourceID("data.flexibleengine_gaussdb_cassandra_flavors.test"),
),
},
},
})
}

func testAccCheckCassandraFlavorsDataSourceID(n string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmtp.Errorf("Can't find GaussDB cassandra flavors data source: %s ", n)
}

if rs.Primary.ID == "" {
return fmtp.Errorf("GaussDB cassandra flavors data source ID not set ")
}

return nil
}
}

const testAccCassandraFlavorsDataSource_basic = `
data "flexibleengine_gaussdb_cassandra_flavors" "test" {
}
`
1 change: 1 addition & 0 deletions flexibleengine/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ func Provider() *schema.Provider {
"flexibleengine_elb_certificate": elb.DataSourceELBCertificateV3(),
"flexibleengine_fgs_dependencies": fgs.DataSourceFunctionGraphDependencies(),

"flexibleengine_gaussdb_cassandra_flavors": gaussdb.DataSourceCassandraFlavors(),
"flexibleengine_gaussdb_cassandra_instances": gaussdb.DataSourceGeminiDBInstances(),
"flexibleengine_gaussdb_nosql_flavors": gaussdb.DataSourceGaussDBNoSQLFlavors(),

Expand Down
Loading