-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(GaussDB): add gaussdb_cassandra_flavors data source (FlexibleEng…
- Loading branch information
1 parent
0d849f3
commit 8b6f92e
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
45 changes: 45 additions & 0 deletions
45
flexibleengine/acceptance/data_source_flexibleengine_gaussdb_cassandra_flavors_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" { | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters