MCPcopy Create free account
hub / github.com/cel-expr/cel-go / locationCodeEnvOption

Function locationCodeEnvOption

conformance/policy/policy_conformance_test.go:153–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151}
152
153func locationCodeEnvOption() cel.EnvOption {
154 return cel.Function("locationCode",
155 cel.Overload("locationCode_string", []*cel.Type{cel.StringType}, cel.StringType,
156 cel.UnaryBinding(func(ip ref.Val) ref.Val {
157 switch ip.(types.String) {
158 case "10.0.0.1":
159 return types.String("us")
160 case "10.0.0.2":
161 return types.String("de")
162 default:
163 return types.String("ir")
164 }
165 })))
166}
167
168func k8sParserOpts() policy.ParserOption {
169 return func(p *policy.Parser) (*policy.Parser, error) {

Callers 1

runTestSuiteFunction · 0.70

Calls 4

FunctionFunction · 0.92
OverloadFunction · 0.92
UnaryBindingFunction · 0.92
StringTypeAlias · 0.92

Tested by

no test coverage detected