MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / l7_matchers_to_json

Function l7_matchers_to_json

crates/openshell-supervisor-network/src/opa.rs:1084–1100  ·  view source on GitHub ↗
(
    matchers: &std::collections::HashMap<String, openshell_core::proto::L7QueryMatcher>,
)

Source from the content-addressed store, hash-verified

1082}
1083
1084fn 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///

Callers 1

proto_to_opa_data_jsonFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected