github.com/sentienttechnologies/studio-go-runner@v0.0.0-20201118202441-6d21f2ced8ee/internal/types/k8sstate_enumer.go (about) 1 // Code generated by "enumer -type K8sState -trimprefix K8s"; DO NOT EDIT. 2 3 package types 4 5 import ( 6 "fmt" 7 ) 8 9 const _K8sStateName = "UnknownRunningDrainAndTerminateDrainAndSuspend" 10 11 var _K8sStateIndex = [...]uint8{0, 7, 14, 31, 46} 12 13 func (i K8sState) String() string { 14 if i < 0 || i >= K8sState(len(_K8sStateIndex)-1) { 15 return fmt.Sprintf("K8sState(%d)", i) 16 } 17 return _K8sStateName[_K8sStateIndex[i]:_K8sStateIndex[i+1]] 18 } 19 20 var _K8sStateValues = []K8sState{0, 1, 2, 3} 21 22 var _K8sStateNameToValueMap = map[string]K8sState{ 23 _K8sStateName[0:7]: 0, 24 _K8sStateName[7:14]: 1, 25 _K8sStateName[14:31]: 2, 26 _K8sStateName[31:46]: 3, 27 } 28 29 // K8sStateString retrieves an enum value from the enum constants string name. 30 // Throws an error if the param is not part of the enum. 31 func K8sStateString(s string) (K8sState, error) { 32 if val, ok := _K8sStateNameToValueMap[s]; ok { 33 return val, nil 34 } 35 return 0, fmt.Errorf("%s does not belong to K8sState values", s) 36 } 37 38 // K8sStateValues returns all values of the enum 39 func K8sStateValues() []K8sState { 40 return _K8sStateValues 41 } 42 43 // IsAK8sState returns "true" if the value is listed in the enum definition. "false" otherwise 44 func (i K8sState) IsAK8sState() bool { 45 for _, v := range _K8sStateValues { 46 if i == v { 47 return true 48 } 49 } 50 return false 51 }