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

Function sync_policy_with_client

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

Sync a locally-discovered policy using an existing client connection.

(
    client: &mut OpenShellClient<AuthedChannel>,
    sandbox: &str,
    policy: &ProtoSandboxPolicy,
)

Source from the content-addressed store, hash-verified

599
600/// Sync a locally-discovered policy using an existing client connection.
601async fn sync_policy_with_client(
602 client: &mut OpenShellClient<AuthedChannel>,
603 sandbox: &str,
604 policy: &ProtoSandboxPolicy,
605) -> Result<()> {
606 client
607 .update_config(UpdateConfigRequest {
608 name: sandbox.to_string(),
609 policy: Some(policy.clone()),
610 setting_key: String::new(),
611 setting_value: None,
612 delete_setting: false,
613 global: false,
614 merge_operations: vec![],
615 expected_resource_version: 0,
616 })
617 .await
618 .into_diagnostic()
619 .wrap_err("failed to sync policy to server")?;
620
621 Ok(())
622}
623
624/// Discover and sync policy using a single gRPC connection.
625///

Callers 2

discover_and_sync_policyFunction · 0.85
sync_policyFunction · 0.85

Calls 1

update_configMethod · 0.45

Tested by

no test coverage detected