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

Function fetch_provider_environment

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

Fetch provider environment variables for a sandbox from `OpenShell` server via gRPC. Returns a map of environment variable names to values derived from provider credentials configured on the sandbox. Returns an empty map if the sandbox has no providers or the call fails.

(
    endpoint: &str,
    sandbox_id: &str,
)

Source from the content-addressed store, hash-verified

667/// credentials configured on the sandbox. Returns an empty map if the sandbox
668/// has no providers or the call fails.
669pub async fn fetch_provider_environment(
670 endpoint: &str,
671 sandbox_id: &str,
672) -> Result<ProviderEnvironmentResult> {
673 debug!(endpoint = %endpoint, sandbox_id = %sandbox_id, "Fetching provider environment");
674
675 let mut client = connect(endpoint).await?;
676
677 let response = client
678 .get_sandbox_provider_environment(GetSandboxProviderEnvironmentRequest {
679 sandbox_id: sandbox_id.to_string(),
680 })
681 .await
682 .into_diagnostic()?;
683
684 let inner = response.into_inner();
685 Ok(ProviderEnvironmentResult {
686 environment: inner.environment,
687 provider_env_revision: inner.provider_env_revision,
688 credential_expires_at_ms: inner.credential_expires_at_ms,
689 dynamic_credentials: inner.dynamic_credentials,
690 })
691}
692
693/// A reusable gRPC client for the `OpenShell` service.
694///

Callers 2

run_sandboxFunction · 0.85
run_policy_poll_loopFunction · 0.85

Calls 2

connectFunction · 0.85

Tested by

no test coverage detected