package utils import ( "errors" "edge-infra.dev/pkg/edge/api/graph/model" ) // ToInjectableConfigmap converts a string value to an injectableConfigmap type. func ToInjectableConfigmap(val string) (model.InjectableConfigmaps, error) { switch val { case "edge-info": return model.InjectableConfigmapsEdgeInfo, nil case "bsl-info": return model.InjectableConfigmapsBSLInfo, nil default: return "", errors.New("value not an injectable configmap type") } } // FromInjectableConfigmap converts from an injectableConfigmap type to a string value. func FromInjectableConfigmap(val model.InjectableConfigmaps) (string, error) { switch val { case model.InjectableConfigmapsEdgeInfo: return "edge-info", nil case model.InjectableConfigmapsBSLInfo: return "bsl-info", nil default: return "", errors.New("value not an injectable configmap type") } }