Skip to content

Commit

Permalink
Add descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ducvm29 committed Sep 26, 2024
1 parent 91ab11c commit c5ffc14
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 38 deletions.
75 changes: 50 additions & 25 deletions fptcloud/dfke/datasource_dfke.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
}
Expand Down
44 changes: 35 additions & 9 deletions fptcloud/dfke/resource_dfke.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
},
},
}
Expand Down
17 changes: 13 additions & 4 deletions fptcloud/mfke/resource_mfke.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,25 @@ func (r *resourceManagedKubernetesEngine) topFields() map[string]schema.Attribut
topLevelAttributes[attribute] = schema.StringAttribute{
Required: true,
PlanModifiers: forceNewPlanModifiersString,
Description: descriptions[attribute],
}
}

for _, attribute := range requiredInts {
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
Expand All @@ -327,29 +331,34 @@ func (r *resourceManagedKubernetesEngine) poolFields() map[string]schema.Attribu
poolLevelAttributes[attribute] = schema.StringAttribute{
Required: true,
PlanModifiers: forceNewPlanModifiersString,
Description: descriptions[attribute],
}
}

for _, attribute := range requiredInts {
poolLevelAttributes[attribute] = schema.Int64Attribute{
Required: true,
PlanModifiers: forceNewPlanModifiersInt,
Description: descriptions[attribute],
}
}

for _, attribute := range requiredBool {
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
Expand Down

0 comments on commit c5ffc14

Please sign in to comment.