Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/feat/fke' into dedicated-fke
Browse files Browse the repository at this point in the history
  • Loading branch information
ducvm29 committed Oct 2, 2024
2 parents 70bae72 + a8f1ff5 commit 3b1f9ff
Show file tree
Hide file tree
Showing 11 changed files with 1,340 additions and 1 deletion.
30 changes: 29 additions & 1 deletion commons/api_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ var ApiPath = struct {
FindSubnet func(vpcId string, subnetId string) string
ListSubnets func(vpcId string) string

Subnet func(vpcId string) string
Subnet func(vpcId string) string
EdgeGatewayList func(vpcId string) string

DatabaseGet func(databaseId string) string
DatabaseCreate func() string
DatabaseDelete func(databaseId string) string
DatabaseStop func() string
DatabaseStart func() string

DedicatedFKEList func(vpcId string, page, pageSize int) string
DedicatedFKEGet func(vpcId string, clusterId string) string
DedicatedFKEUpgradeVersion func(vpcId string, clusterId string) string
Expand Down Expand Up @@ -154,6 +162,26 @@ var ApiPath = struct {

Subnet: func(vpcId string) string { return fmt.Sprintf("/v1/vmware/vpc/%s/network/subnets", vpcId) },

EdgeGatewayList: func(vpcId string) string {
return fmt.Sprintf("/v1/vmware/vpc/%s/edge_gateway/list", vpcId)
},

DatabaseGet: func(databaseId string) string {
return fmt.Sprintf("/v1/xplat/database/management/cluster/detail/%s", databaseId)
},
DatabaseCreate: func() string {
return fmt.Sprintf("/v1/xplat/database/provision/create")
},
DatabaseDelete: func(databaseId string) string {
return fmt.Sprintf("/v1/xplat/database/provision/delete/%s", databaseId)
},
DatabaseStop: func() string {
return fmt.Sprintf("/v1/xplat/database/management/cluster/stop")
},
DatabaseStart: func() string {
return fmt.Sprintf("/v1/xplat/database/management/cluster/start")
},

DedicatedFKEList: func(vpcId string, page, pageSize int) string {
return fmt.Sprintf("/v1/xplat/fke/vpc/%s/kubernetes?page=%d&page_size=%d", vpcId, page, pageSize)
},
Expand Down
26 changes: 26 additions & 0 deletions docs/data-sources/edge_gateway.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "fptcloud_edge_gateway Data Source - terraform-provider-fptcloud"
subcategory: ""
description: |-
Retrieves information about FPT Cloud edge gateway
---

# fptcloud_edge_gateway (Data Source)

Retrieves information about FPT Cloud edge gateway



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name of the compute edge_gateway
- `vpc_id` (String) VPC id

### Read-Only

- `edge_gateway_id` (String) Edge gateway id
- `id` (String) Identifier of the edge_gateway
49 changes: 49 additions & 0 deletions docs/resources/database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "fptcloud_database Resource - terraform-provider-fptcloud"
subcategory: ""
description: |-
Provides a Fpt database cluster which can be used to store data.
---

# fptcloud_database (Resource)

Provides a Fpt database cluster which can be used to store data.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `admin_password` (String) The admin password of the database cluster.
- `cluster_name` (String) The name of the database cluster.
- `data_disk_size` (Number) The size of the data disk in each node of the database cluster.
- `database_name` (String) The name of the database in the database cluster.
- `domain_name` (String) The domain name of the database cluster.
- `edge_id` (String) The edge Id of the database cluster.
- `edition` (String) The edition of the database cluster.
- `flavor` (String) The flavor of the database cluster.
- `is_cluster` (String) The cluster status of the database cluster.
- `is_ops` (String) Whether the database is OpenStack or VMware
- `is_public` (String) Whether the database is public or not.
- `master_count` (Number) The number of master nodes in the database cluster.
- `network_id` (String) The network Id of the database cluster.
- `node_core` (Number) The number of cores in each node of the database cluster.
- `node_cpu` (Number) The number of CPUs in each node of the database cluster.
- `node_ram` (Number) The amount of RAM in each node of the database cluster.
- `number_of_node` (Number) The number of nodes in the database cluster.
- `storage_profile` (String) The storage profile of the database cluster.
- `type_config` (String) The type of configuration of the database cluster (short-config or custom-config).
- `type_db` (String) The type of database of the database cluster
- `vdc_name` (String) The VDC name of the database cluster.
- `version` (String) The version of the database cluster.
- `vhost_name` (String) The name of the RabbitMQ database.
- `vm_network` (String) The VM network of the database cluster.
- `vpc_id` (String) The VPC Id of the database cluster.
- `worker_count` (Number) The number of worker nodes in the database cluster.

### Read-Only

- `id` (String) The Id of the database cluster.
21 changes: 21 additions & 0 deletions docs/resources/database_status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "fptcloud_database_status Resource - terraform-provider-fptcloud"
subcategory: ""
description: |-
Provides a Fpt database cluster status to temporarily stop or start a database.
---

# fptcloud_database_status (Resource)

Provides a Fpt database cluster status to temporarily stop or start a database.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The Id of the database cluster.
- `status` (String) The status of the database cluster, must be 'running' or 'stopped'.
7 changes: 7 additions & 0 deletions examples/data-sources/fptcloud_edge_gateway/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data "fptcloud_edge_gateway" "example" {
vpc_id = "your_vpc_id"
name = "your_edge_gateway_name"
}
output "show_value" {
value = data.fptcloud_edge_gateway.example
}
29 changes: 29 additions & 0 deletions fptcloud/database/database_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package fptcloud_database

import (
commons "terraform-provider-fptcloud/commons"
)

type databaseApiClient struct {
*commons.Client
edgeClient *commons.Client
}

func newDatabaseApiClient(c *commons.Client) (*databaseApiClient, error) {
serviceToken := "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U"
edgeClient, err := commons.NewClientWithURL(
serviceToken,
c.BaseURL.String(),
c.Region,
c.TenantName,
)

if err != nil {
return nil, err
}

return &databaseApiClient{
Client: edgeClient,
edgeClient: edgeClient,
}, nil
}
Loading

0 comments on commit 3b1f9ff

Please sign in to comment.