(
matchers: &std::collections::HashMap<String, openshell_core::proto::L7QueryMatcher>,
)
| 1082 | } |
| 1083 | |
| 1084 | fn l7_matchers_to_json( |
| 1085 | matchers: &std::collections::HashMap<String, openshell_core::proto::L7QueryMatcher>, |
| 1086 | ) -> serde_json::Map<String, serde_json::Value> { |
| 1087 | matchers |
| 1088 | .iter() |
| 1089 | .map(|(key, matcher)| { |
| 1090 | let mut matcher_json = serde_json::json!({}); |
| 1091 | if !matcher.glob.is_empty() { |
| 1092 | matcher_json["glob"] = matcher.glob.clone().into(); |
| 1093 | } |
| 1094 | if !matcher.any.is_empty() { |
| 1095 | matcher_json["any"] = matcher.any.clone().into(); |
| 1096 | } |
| 1097 | (key.clone(), matcher_json) |
| 1098 | }) |
| 1099 | .collect() |
| 1100 | } |
| 1101 | |
| 1102 | /// Convert typed proto policy fields to JSON suitable for `engine.add_data_json()`. |
| 1103 | /// |
no test coverage detected