From 3fbeb97f2a570eb780d5c96ff3bdf00ade0b90a8 Mon Sep 17 00:00:00 2001 From: Andre Azzolini Date: Tue, 10 Dec 2024 13:56:49 -0700 Subject: [PATCH] chore: Rename ProjectSlug/ConfigName to Project/Config in descriptor model --- pkg/http/api.go | 4 ++-- pkg/models/api.go | 4 ++-- pkg/models/parse.go | 4 ++-- pkg/printer/enclave.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/http/api.go b/pkg/http/api.go index 0414a581..1699e29d 100644 --- a/pkg/http/api.go +++ b/pkg/http/api.go @@ -1093,9 +1093,9 @@ func UpdateConfigInherits(host string, verifyTLS bool, apiKey string, project st for _, cd := range configDescriptors { parts := strings.Split(cd, ".") if len(parts) != 2 { - return models.ConfigInfo{}, Error{Message: "Config descriptors must match the format \"projectSlug.configName\""} + return models.ConfigInfo{}, Error{Message: "Config descriptors must match the format \"project.config\""} } - inheritsObj = append(inheritsObj, models.ConfigDescriptor{ProjectSlug: parts[0], ConfigName: parts[1]}) + inheritsObj = append(inheritsObj, models.ConfigDescriptor{Project: parts[0], Config: parts[1]}) } } diff --git a/pkg/models/api.go b/pkg/models/api.go index d3d8024d..fe092323 100644 --- a/pkg/models/api.go +++ b/pkg/models/api.go @@ -180,6 +180,6 @@ type WatchSecrets struct { } type ConfigDescriptor struct { - ProjectSlug string `json:"projectSlug"` - ConfigName string `json:"configName"` + Project string `json:"project"` + Config string `json:"config"` } diff --git a/pkg/models/parse.go b/pkg/models/parse.go index 8d65bd33..34cd72ad 100644 --- a/pkg/models/parse.go +++ b/pkg/models/parse.go @@ -119,7 +119,7 @@ func ParseConfigInfo(info map[string]interface{}) ConfigInfo { inherits := info["inherits"].([]interface{}) for _, i := range inherits { descriptorMap := i.(map[string]interface{}) - configInfo.Inherits = append(configInfo.Inherits, ConfigDescriptor{ProjectSlug: descriptorMap["projectSlug"].(string), ConfigName: descriptorMap["configName"].(string)}) + configInfo.Inherits = append(configInfo.Inherits, ConfigDescriptor{Project: descriptorMap["project"].(string), Config: descriptorMap["config"].(string)}) } } if info["inheritedBy"] != nil { @@ -127,7 +127,7 @@ func ParseConfigInfo(info map[string]interface{}) ConfigInfo { inheritedBy := info["inheritedBy"].([]interface{}) for _, i := range inheritedBy { descriptorMap := i.(map[string]interface{}) - configInfo.InheritedBy = append(configInfo.InheritedBy, ConfigDescriptor{ProjectSlug: descriptorMap["projectSlug"].(string), ConfigName: descriptorMap["configName"].(string)}) + configInfo.InheritedBy = append(configInfo.InheritedBy, ConfigDescriptor{Project: descriptorMap["project"].(string), Config: descriptorMap["config"].(string)}) } } diff --git a/pkg/printer/enclave.go b/pkg/printer/enclave.go index 712f9dcf..38f7aa68 100644 --- a/pkg/printer/enclave.go +++ b/pkg/printer/enclave.go @@ -137,12 +137,12 @@ func ConfigInfo(info models.ConfigInfo, jsonFlag bool) { if info.Inheritable { inheritsHeader = "inherited by" for _, inheritedBy := range info.InheritedBy { - inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inheritedBy.ProjectSlug, inheritedBy.ConfigName)) + inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inheritedBy.Project, inheritedBy.Config)) } } else { inheritsHeader = "inherits" for _, inherits := range info.Inherits { - inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.ProjectSlug, inherits.ConfigName)) + inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.Project, inherits.Config)) } } @@ -178,7 +178,7 @@ func ConfigsInfo(info []models.ConfigInfo, jsonFlag bool) { for _, configInfo := range info { var inheritsStrings []string for _, inherits := range configInfo.Inherits { - inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.ProjectSlug, inherits.ConfigName)) + inheritsStrings = append(inheritsStrings, fmt.Sprintf("%s.%s", inherits.Project, inherits.Config)) } var inheritsString string