...

Source file src/edge-infra.dev/pkg/edge/api/utils/helm_helper.go

Documentation: edge-infra.dev/pkg/edge/api/utils

     1  package utils
     2  
     3  import (
     4  	"errors"
     5  
     6  	"edge-infra.dev/pkg/edge/api/graph/model"
     7  )
     8  
     9  // ToInjectableConfigmap converts a string value to an injectableConfigmap type.
    10  func ToInjectableConfigmap(val string) (model.InjectableConfigmaps, error) {
    11  	switch val {
    12  	case "edge-info":
    13  		return model.InjectableConfigmapsEdgeInfo, nil
    14  	case "bsl-info":
    15  		return model.InjectableConfigmapsBSLInfo, nil
    16  	default:
    17  		return "", errors.New("value not an injectable configmap type")
    18  	}
    19  }
    20  
    21  // FromInjectableConfigmap converts from an injectableConfigmap type to a string value.
    22  func FromInjectableConfigmap(val model.InjectableConfigmaps) (string, error) {
    23  	switch val {
    24  	case model.InjectableConfigmapsEdgeInfo:
    25  		return "edge-info", nil
    26  	case model.InjectableConfigmapsBSLInfo:
    27  		return "bsl-info", nil
    28  	default:
    29  		return "", errors.New("value not an injectable configmap type")
    30  	}
    31  }
    32  

View as plain text