alias.go 439 B

1234567891011121314151617
  1. package allocation
  2. import (
  3. "github.com/opencost/opencost/core/pkg/opencost"
  4. )
  5. // ResolveAliasLabelKey resolves an alias field (department, environment, owner,
  6. // product, team) to its configured label key.
  7. func ResolveAliasLabelKey(field string, lc *opencost.LabelConfig) (string, bool) {
  8. if lc == nil {
  9. lc = opencost.NewLabelConfig()
  10. }
  11. labelConfigMap := lc.Map()
  12. value, ok := labelConfigMap[field+"_label"]
  13. return value, ok
  14. }