pkg/components/openebs-storage-class: fix names
"Storageclass" is not a correct name according to Go naming convention,
which use camel case, so this commit fixes it to StorageClass etc.
Also fix some whitespace issue.
@@ -34,18 +34,19 @@ const (
poolName = "openebs-storage-pool"
)
-type Storageclass struct {
+type StorageClass struct {
Name string `hcl:"name,label"`
ReplicaCount int `hcl:"replica_count,optional"`
Default bool `hcl:"default,optional"`
Disks []string `hcl:"disks,optional"`
}
+
type component struct {
- Storageclasses []Storageclass `hcl:"storage-class,block"`
+ StorageClasses []StorageClass `hcl:"storage-class,block"`
}
-func defaultStorageClass() Storageclass {
- return Storageclass{
+func defaultStorageClass() StorageClass {
+ return StorageClass{
// Name of the storage class
Name: "openebs-cstor-disk-replica-3",
// Default replica count value is set to 3
@@ -62,7 +63,7 @@ func defaultStorageClass() Storageclass {
//nolint:golint
func NewConfig() *component {
return &component{
- Storageclasses: []Storageclass{},
+ StorageClasses: []StorageClass{},
}
}
@@ -75,8 +76,8 @@ func (c *component) LoadConfig(configBody *hcl.Body, evalContext *hcl.EvalContex
return diagnostics
}
// if empty config body is provided, default component storage details are still preserved.
- if len(c.Storageclasses) == 0 {
- c.Storageclasses = append(c.Storageclasses, defaultStorageClass())
+ if len(c.StorageClasses) == 0 {
+ c.StorageClasses = append(c.StorageClasses, defaultStorageClass())
}
if err := c.validateConfig(); err != nil {
@@ -94,7 +95,7 @@ func (c *component) LoadConfig(configBody *hcl.Body, evalContext *hcl.EvalContex
func (c *component) validateConfig() error {
maxDefaultStorageClass := 0
- for _, sc := range c.Storageclasses {
+ for _, sc := range c.StorageClasses {
if sc.Default == true {
maxDefaultStorageClass++
}
@@ -121,7 +122,7 @@ func (c *component) RenderManifests() (map[string]string, error) {
var manifestsMap = make(map[string]string)
- for _, sc := range c.Storageclasses {
+ for _, sc := range c.StorageClasses {
var scBuffer bytes.Buffer
var spBuffer bytes.Buffer
