Skip to content

Commit

Permalink
Addressed review
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM committed Jan 19, 2024
1 parent 4fd38ca commit 4ed4288
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions client/macros.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ func (h *V1Client) CreateMacros(uid string, macros *models.V1Macros) (string, er
return "", err
}
}

return h.GetMacrosId(uid), nil
macrosId, err := h.GetMacrosId(uid)
if err != nil {
return "", err
}
return macrosId, nil
}

func (h *V1Client) GetTFMacrosV2(tfMacrosMap map[string]interface{}, projectUID string) ([]*models.V1Macro, error) {
Expand Down Expand Up @@ -136,16 +139,16 @@ func (h *V1Client) DeleteMacros(uid string, body *models.V1Macros) error {
return nil
}

func (h *V1Client) GetMacrosId(uid string) string {
var hash string
func (h *V1Client) GetMacrosId(uid string) (string, error) {
hashId := ""
if uid != "" {
hash = fmt.Sprintf("%s-%s-%s", "project", "macros", uid)
hashId = fmt.Sprintf("%s-%s-%s", "project", "macros", uid)
} else {
tenantID, err := h.GetTenantUID()
if err != nil {
return ""
return "", err
}
hash = fmt.Sprintf("%s-%s-%s", "tenant", "macros", tenantID)
hashId = fmt.Sprintf("%s-%s-%s", "tenant", "macros", tenantID)
}
return hash
return hashId, nil
}

0 comments on commit 4ed4288

Please sign in to comment.