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

Function fetch_policy

crates/openshell-core/src/grpc_client.rs:566–574  ·  view source on GitHub ↗

Fetch sandbox policy from `OpenShell` server via gRPC. Returns `Ok(Some(policy))` when the server has a policy configured, or `Ok(None)` when the sandbox was created without a policy (the sandbox should discover one from disk or use the restrictive default).

(endpoint: &str, sandbox_id: &str)

Source from the content-addressed store, hash-verified

564/// or `Ok(None)` when the sandbox was created without a policy (the sandbox
565/// should discover one from disk or use the restrictive default).
566pub async fn fetch_policy(endpoint: &str, sandbox_id: &str) -> Result<Option<ProtoSandboxPolicy>> {
567 debug!(endpoint = %endpoint, sandbox_id = %sandbox_id, "Connecting to OpenShell server");
568
569 let mut client = connect(endpoint).await?;
570
571 debug!("Connected, fetching sandbox policy");
572
573 fetch_policy_with_client(&mut client, sandbox_id).await
574}
575
576/// Fetch sandbox policy using an existing client connection.
577async fn fetch_policy_with_client(

Callers 1

load_policyFunction · 0.85

Calls 2

connectFunction · 0.85
fetch_policy_with_clientFunction · 0.85

Tested by

no test coverage detected