From c5ffc14d37c13c5cf835f440158bdf5de70d5a74 Mon Sep 17 00:00:00 2001 From: ducvm29 Date: Thu, 26 Sep 2024 14:56:53 +0700 Subject: [PATCH] Add descriptions --- fptcloud/dfke/datasource_dfke.go | 75 +++++++++++++++++++++----------- fptcloud/dfke/resource_dfke.go | 44 +++++++++++++++---- fptcloud/mfke/resource_mfke.go | 17 ++++++-- 3 files changed, 98 insertions(+), 38 deletions(-) diff --git a/fptcloud/dfke/datasource_dfke.go b/fptcloud/dfke/datasource_dfke.go index 4e46018..9fa13de 100644 --- a/fptcloud/dfke/datasource_dfke.go +++ b/fptcloud/dfke/datasource_dfke.go @@ -69,83 +69,108 @@ func (d *datasourceDedicatedKubernetesEngine) Schema(ctx context.Context, reques Description: "Retrieves information about dedicated FKE clusters", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "UUID of the cluster", }, "vpc_id": schema.StringAttribute{ - Required: true, + Required: true, + Description: "VPC ID", }, "cluster_id": schema.StringAttribute{ Required: true, Description: "Cluster ID, as shown on the dashboard, usually has a length of 8 characters", }, "cluster_name": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Cluster name", }, "k8s_version": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Kubernetes version", }, "master_type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "ID of the flavor of master node", }, "master_count": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "Number of master node", }, "master_disk_size": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "Master node disk capacity in GB", }, "worker_type": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "ID of the flavor of worker node", }, "worker_disk_size": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "Worker node disk capacity in GB", }, "network_id": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Network UUID", }, "lb_size": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Load balancer size", }, "pod_network": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Pod network in CIDR notation", }, "service_network": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Service network in CIDR notation", }, "network_node_prefix": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "Network node prefix", }, "max_pod_per_node": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "Max pods per node", }, "nfs_status": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "NFS status", }, "nfs_disk_size": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "NFS disk size", }, "storage_policy": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Storage policy", }, "edge_id": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Edge ID", }, "scale_min": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "Minimum number of nodes for autoscaling", }, "scale_max": schema.Int64Attribute{ - Computed: true, + Computed: true, + Description: "Maximum number of nodes for autoscaling", }, "node_dns": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "DNS server of nodes", }, "ip_public_firewall": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "IP public firewall", }, "ip_private_firewall": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "IP private firewall", }, "region_id": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Region ID", }, }, } diff --git a/fptcloud/dfke/resource_dfke.go b/fptcloud/dfke/resource_dfke.go index 3750996..4396d5f 100644 --- a/fptcloud/dfke/resource_dfke.go +++ b/fptcloud/dfke/resource_dfke.go @@ -221,65 +221,82 @@ func (r *resourceDedicatedKubernetesEngine) Schema(ctx context.Context, request Description: "Manage dedicated FKE clusters.", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Cluster UUID", }, "cluster_id": schema.StringAttribute{ - Computed: true, + Computed: true, + Description: "Cluster slug", }, "cluster_name": schema.StringAttribute{ - Required: true, + Required: true, + Description: "Cluster name", }, "k8s_version": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Kubernetes version", }, "master_type": schema.StringAttribute{ - Required: true, + Required: true, + Description: "Flavor ID of master node", }, "master_count": schema.Int64Attribute{ Required: true, PlanModifiers: forceNewPlanModifiersInt, + Description: "Number of master nodes", }, "master_disk_size": schema.Int64Attribute{ - Required: true, + Required: true, + Description: "Disk size of master node in GB", }, "worker_type": schema.StringAttribute{ - Required: true, + Required: true, + Description: "Flavor ID of worker node", }, "worker_disk_size": schema.Int64Attribute{ - Required: true, + Required: true, + Description: "Disk size of worker node in GB", }, "network_id": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Disk size of worker node in GB", }, "lb_size": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Load balancer size", }, "pod_network": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Pod network in CIDR notation", }, "service_network": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Service network in CIDR notation", }, "network_node_prefix": schema.Int64Attribute{ Required: true, PlanModifiers: forceNewPlanModifiersInt, + Description: "Network node prefix", }, "max_pod_per_node": schema.Int64Attribute{ Required: true, PlanModifiers: forceNewPlanModifiersInt, + Description: "Max pods per node", }, "nfs_status": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "NFS status", }, "nfs_disk_size": schema.Int64Attribute{ Required: true, PlanModifiers: forceNewPlanModifiersInt, + Description: "NFS disk size", }, //"public_key": schema.StringAttribute{ // Required:true, @@ -288,40 +305,49 @@ func (r *resourceDedicatedKubernetesEngine) Schema(ctx context.Context, request "storage_policy": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Storage policy", }, "edge_id": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Edge ID", }, //"upstream_dns": schema.Int64Attribute{ // Required:true, // PlanModifiers: forceNewPlanModifiersInt, //}, "scale_min": schema.Int64Attribute{ - Required: true, + Required: true, + Description: "Minimum number of nodes for autoscaling", }, "scale_max": schema.Int64Attribute{ - Required: true, + Required: true, + Description: "Maximum number of nodes for autoscaling", }, "node_dns": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "DNS server of nodes", }, "ip_public_firewall": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "IP public firewall", }, "ip_private_firewall": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "IP private firewall", }, "vpc_id": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "VPC ID", }, "region_id": schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: "Region ID", }, }, } diff --git a/fptcloud/mfke/resource_mfke.go b/fptcloud/mfke/resource_mfke.go index 359685a..b7c636e 100644 --- a/fptcloud/mfke/resource_mfke.go +++ b/fptcloud/mfke/resource_mfke.go @@ -288,6 +288,7 @@ func (r *resourceManagedKubernetesEngine) topFields() map[string]schema.Attribut topLevelAttributes[attribute] = schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: descriptions[attribute], } } @@ -295,14 +296,17 @@ func (r *resourceManagedKubernetesEngine) topFields() map[string]schema.Attribut topLevelAttributes[attribute] = schema.Int64Attribute{ Required: true, PlanModifiers: forceNewPlanModifiersInt, + Description: descriptions[attribute], } } topLevelAttributes["k8s_version"] = schema.StringAttribute{ - Required: true, + Required: true, + Description: descriptions["k8s_version"], } topLevelAttributes["network_node_prefix"] = schema.Int64Attribute{ - Required: true, + Required: true, + Description: descriptions["network_node_prefix"], } return topLevelAttributes @@ -327,6 +331,7 @@ func (r *resourceManagedKubernetesEngine) poolFields() map[string]schema.Attribu poolLevelAttributes[attribute] = schema.StringAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersString, + Description: descriptions[attribute], } } @@ -334,6 +339,7 @@ func (r *resourceManagedKubernetesEngine) poolFields() map[string]schema.Attribu poolLevelAttributes[attribute] = schema.Int64Attribute{ Required: true, PlanModifiers: forceNewPlanModifiersInt, + Description: descriptions[attribute], } } @@ -341,15 +347,18 @@ func (r *resourceManagedKubernetesEngine) poolFields() map[string]schema.Attribu poolLevelAttributes[attribute] = schema.BoolAttribute{ Required: true, PlanModifiers: forceNewPlanModifiersBool, + Description: descriptions[attribute], } } poolLevelAttributes["scale_min"] = schema.Int64Attribute{ - Required: true, + Required: true, + Description: descriptions["scale_min"], } poolLevelAttributes["scale_max"] = schema.Int64Attribute{ - Required: true, + Required: true, + Description: descriptions["scale_max"], } return poolLevelAttributes