MCPcopy Index your code
hub / github.com/cortexlabs/cortex / checkNoCortexResources

Function checkNoCortexResources

pkg/lib/configreader/interface.go:94–121  ·  view source on GitHub ↗
(obj interface{})

Source from the content-addressed store, hash-verified

92}
93
94func checkNoCortexResources(obj interface{}) error {
95 if objStr, ok := obj.(string); ok {
96 if resourceName, ok := yaml.ExtractAtSymbolText(objStr); ok {
97 return ErrorCortexResourceNotAllowed(resourceName)
98 }
99 }
100
101 if objSlice, ok := cast.InterfaceToInterfaceSlice(obj); ok {
102 for i, objItem := range objSlice {
103 if err := checkNoCortexResources(objItem); err != nil {
104 return errors.Wrap(err, s.Index(i))
105 }
106 }
107 }
108
109 if objMap, ok := cast.InterfaceToInterfaceInterfaceMap(obj); ok {
110 for k, v := range objMap {
111 if err := checkNoCortexResources(k); err != nil {
112 return err
113 }
114 if err := checkNoCortexResources(v); err != nil {
115 return errors.Wrap(err, s.UserStrStripped(k))
116 }
117 }
118 }
119
120 return nil
121}
122
123func checkOnlyCortexResources(obj interface{}) error {
124 if objStr, ok := obj.(string); ok {

Callers 5

validateInterfaceFunction · 0.85
validateInterfaceMapFunction · 0.85
ValidateStringValFunction · 0.85
validateInterfaceMapListFunction · 0.85
validateStringListFunction · 0.85

Calls 4

WrapFunction · 0.92

Tested by

no test coverage detected