func CELValueToMapStrList(data ref.Val) (map[string][]string, error) {
	mapStrType := reflect.TypeOf(map[string]interface{}{})
	mapStrRaw, err := data.ConvertToNative(mapStrType)
	if err != nil {
		return nil, err
	}
	mapStrIface := mapStrRaw.(map[string]interface{})
	mapStrListStr := make(map[string][]string, len(mapStrIface))
	for k, v := range mapStrIface {
		switch val := v.(type) {
		case string:
			mapStrListStr[k] = []string{val}
		case types.String:
			mapStrListStr[k] = []string{string(val)}
		case []string:
			mapStrListStr[k] = val
		case []ref.Val:
			convVals := make([]string, len(val))
			for i, elem := range val {
				strVal, ok := elem.(types.String)
				if !ok {
					return nil, fmt.Errorf("unsupported value type in header match: %T", val)
				}
				convVals[i] = string(strVal)
			}
			mapStrListStr[k] = convVals
		default:
			return nil, fmt.Errorf("unsupported value type in header match: %T", val)
		}
	}
	return mapStrListStr, nil
}
// CELValueToMapStrList converts a CEL value to a map[string][]string
//
// Earlier validation stages should guarantee that the value has this type
// at compile time, and that the runtime value type is map[string]interface{}.
// The reason for the slight difference in value type is that CEL allows for
// map literals containing heterogeneous values, in this case string and list
// of string.
CELValueToMapStrList converts a CEL value to a map[string][]string

Earlier validation stages should guarantee that the value has this type
at compile time, and that the runtime value type is map[string]interface{}.
The reason for the slight difference in value type is that CEL allows for
map literals containing heterogeneous values, in this case string and list
of string.
// CELValueToMapStrList converts a CEL value to a map [ string ] [] string // // Earlier validation stages should guarantee that the value has this type // at compile time and that the runtime value type is map [ string ] interface {} . // The reason for the slight difference in value type is that CEL allows for // map literals containing heterogeneous values in this case string and list // of string .
func CELValueToMapStrList(data ref.Val) (map[string][]string, error) {
	mapStrType := reflect.TypeOf(map[string]interface{}{})
	mapStrRaw, err := data.ConvertToNative(mapStrType)
	if err != nil {
		return nil, err
	}
	mapStrIface := mapStrRaw.(map[string]interface{})
	mapStrListStr := make(map[string][]string, len(mapStrIface))
	for k, v := range mapStrIface {
		switch val := v.(type) {
		case string:
			mapStrListStr[k] = []string{val}
		case types.String:
			mapStrListStr[k] = []string{string(val)}
		case []string:
			mapStrListStr[k] = val
		case []ref.Val:
			convVals := make([]string, len(val))
			for i, elem := range val {
				strVal, ok := elem.(types.String)
				if !ok {
					return nil, fmt.Errorf("unsupported value type in header match: %T", val)
				}
				convVals[i] = string(strVal)
			}
			mapStrListStr[k] = convVals
		default:
			return nil, fmt.Errorf("unsupported value type in header match: %T", val)
		}
	}
	return mapStrListStr, nil
}
func CELValueToMapStrList ( data ref . Val ) ( map [ string ] [ ] string , error ) { mapStrType := reflect . TypeOf ( map [ string ] interface { } { } ) mapStrRaw , err := data . ConvertToNative ( mapStrType ) if err != nil { return nil , err } mapStrIface := mapStrRaw . ( map [ string ] interface { } ) mapStrListStr := make ( map [ string ] [ ] string , len ( mapStrIface ) ) for k , v := range mapStrIface { switch val := v . ( type ) { case string : mapStrListStr [ k ] = [ ] string { val } case types . String : mapStrListStr [ k ] = [ ] string { string ( val ) } case [ ] string : mapStrListStr [ k ] = val case [ ] ref . Val : convVals := make ( [ ] string , len ( val ) ) for i , elem := range val { strVal , ok := elem . ( types . String ) if ! ok { return nil , fmt . Errorf ( " " , val ) } convVals [ i ] = string ( strVal ) } mapStrListStr [ k ] = convVals default : return nil , fmt . Errorf ( " " , val ) } } return mapStrListStr , nil }
CELValueToMapStrList converts a CEL value to a map[string][]string
CELValueToMapStrList converts a CEL value to a map [ string ] [] string