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

Function platform_config_struct

crates/openshell-driver-kubernetes/src/driver.rs:2112–2123  ·  view source on GitHub ↗

Extract a nested Struct value from the template's `platform_config`, converting it to `serde_json::Value`.

(template: &SandboxTemplate, key: &str)

Source from the content-addressed store, hash-verified

2110/// Extract a nested Struct value from the template's `platform_config`,
2111/// converting it to `serde_json::Value`.
2112fn platform_config_struct(template: &SandboxTemplate, key: &str) -> Option<serde_json::Value> {
2113 let config = template.platform_config.as_ref()?;
2114 let value = config.fields.get(key)?;
2115 let json = value_to_json(value);
2116 // Return None for null/empty objects so callers can distinguish
2117 // "field absent" from "field present but empty".
2118 match &json {
2119 serde_json::Value::Null => None,
2120 serde_json::Value::Object(m) if m.is_empty() => None,
2121 _ => Some(json),
2122 }
2123}
2124
2125fn status_from_object(obj: &DynamicObject) -> Option<SandboxStatus> {
2126 let status = obj.data.get("status")?;

Calls 3

value_to_jsonFunction · 0.85
getMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected