Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: Min Min <jamsman94@gmail.com>
  • Loading branch information
jamsman94 committed Nov 29, 2024
1 parent 1e747aa commit 8b50906
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkg/microservice/aslan/core/common/service/sae/sae.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ func validateSAE(args *commonmodels.SAE) error {
return nil
}

type saeKV struct {
Name string `json:"name"`
Value string `json:"value"`
ValueFrom string `json:"valueFrom"`
ConfigMapID string `json:"configMapId"`
Key string `json:"key"`
}

// CreateKVMap takes a string and de-serialize it into a struct that we can use
func CreateKVMap(kv *string) (map[string]*commonmodels.SAEKV, error) {
envList := make([]*commonmodels.SAEKV, 0)
envList := make([]*saeKV, 0)
err := json.Unmarshal([]byte(tea.StringValue(kv)), &envList)
if err != nil {
return nil, err
Expand All @@ -122,7 +130,13 @@ func CreateKVMap(kv *string) (map[string]*commonmodels.SAEKV, error) {
resp := make(map[string]*commonmodels.SAEKV)

for _, env := range envList {
resp[env.Key] = env
resp[env.Key] = &commonmodels.SAEKV{
Name: env.Name,
Value: env.Value,
ValueFrom: env.ValueFrom,
ConfigMapID: env.ConfigMapID,
Key: env.Key,
}
}

return resp, nil
Expand Down

0 comments on commit 8b50906

Please sign in to comment.