Skip to content

Commit

Permalink
feat(GaussDB): add gaussdb_cassandra_flavors data source (FlexibleEng…
Browse files Browse the repository at this point in the history
  • Loading branch information
Zippo-Wang committed Nov 10, 2023
1 parent d20c6b1 commit 444cc15
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
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" {
}
`

0 comments on commit 444cc15

Please sign in to comment.