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

Function sandbox_id_from_object

crates/openshell-driver-kubernetes/src/driver.rs:867–880  ·  view source on GitHub ↗
(obj: &DynamicObject)

Source from the content-addressed store, hash-verified

865}
866
867fn sandbox_id_from_object(obj: &DynamicObject) -> Result<String, String> {
868 if let Some(labels) = obj.metadata.labels.as_ref()
869 && let Some(id) = labels.get(LABEL_SANDBOX_ID)
870 {
871 return Ok(id.clone());
872 }
873
874 let name = obj.metadata.name.clone().unwrap_or_default();
875 if let Some(id) = name.strip_prefix("sandbox-") {
876 return Ok(id.to_string());
877 }
878
879 Err("sandbox id not found on object".to_string())
880}
881
882fn sandbox_from_object(namespace: &str, obj: DynamicObject) -> Result<Sandbox, String> {
883 let id = sandbox_id_from_object(&obj)?;

Callers 1

sandbox_from_objectFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected