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

Function get_object_str

crates/openshell-supervisor-network/src/l7/mod.rs:333–345  ·  view source on GitHub ↗

Extract a string value from a regorus object.

(val: &regorus::Value, key: &str)

Source from the content-addressed store, hash-verified

331
332/// Extract a string value from a regorus object.
333fn get_object_str(val: &regorus::Value, key: &str) -> Option<String> {
334 let key_val = regorus::Value::String(key.into());
335 match val {
336 regorus::Value::Object(map) => match map.get(&key_val) {
337 Some(regorus::Value::String(s)) => {
338 let s = s.to_string();
339 if s.is_empty() { None } else { Some(s) }
340 }
341 _ => None,
342 },
343 _ => None,
344 }
345}
346
347fn endpoint_has_graphql_policy(val: &regorus::Value) -> bool {
348 has_non_empty_object_field(val, "graphql_persisted_queries")

Callers 2

parse_l7_configFunction · 0.85
parse_tls_modeFunction · 0.85

Calls 2

getMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected