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

Function condition_from_value

crates/openshell-driver-kubernetes/src/driver.rs:2166–2187  ·  view source on GitHub ↗
(value: &serde_json::Value)

Source from the content-addressed store, hash-verified

2164}
2165
2166fn condition_from_value(value: &serde_json::Value) -> Option<SandboxCondition> {
2167 let obj = value.as_object()?;
2168 Some(SandboxCondition {
2169 r#type: obj.get("type")?.as_str()?.to_string(),
2170 status: obj.get("status")?.as_str()?.to_string(),
2171 reason: obj
2172 .get("reason")
2173 .and_then(|val| val.as_str())
2174 .unwrap_or_default()
2175 .to_string(),
2176 message: obj
2177 .get("message")
2178 .and_then(|val| val.as_str())
2179 .unwrap_or_default()
2180 .to_string(),
2181 last_transition_time: obj
2182 .get("lastTransitionTime")
2183 .and_then(|val| val.as_str())
2184 .unwrap_or_default()
2185 .to_string(),
2186 })
2187}
2188
2189#[cfg(test)]
2190mod tests {

Callers

nothing calls this directly

Calls 2

as_strMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected