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

Method from_proto

crates/openshell-providers/src/profiles.rs:327–363  ·  view source on GitHub ↗
(profile: &ProviderProfile)

Source from the content-addressed store, hash-verified

325impl ProviderTypeProfile {
326 #[must_use]
327 pub fn from_proto(profile: &ProviderProfile) -> Self {
328 Self {
329 id: profile.id.clone(),
330 resource_version: profile.resource_version,
331 display_name: profile.display_name.clone(),
332 description: profile.description.clone(),
333 category: ProviderProfileCategory::try_from(profile.category)
334 .unwrap_or(ProviderProfileCategory::Other),
335 credentials: profile
336 .credentials
337 .iter()
338 .map(|credential| CredentialProfile {
339 name: credential.name.clone(),
340 description: credential.description.clone(),
341 env_vars: credential.env_vars.clone(),
342 required: credential.required,
343 auth_style: credential.auth_style.clone(),
344 header_name: credential.header_name.clone(),
345 query_param: credential.query_param.clone(),
346 refresh: credential
347 .refresh
348 .as_ref()
349 .map(credential_refresh_from_proto),
350 path_template: credential.path_template.clone(),
351 token_grant: credential.token_grant.as_ref().map(token_grant_from_proto),
352 })
353 .collect(),
354 endpoints: profile.endpoints.iter().map(endpoint_from_proto).collect(),
355 binaries: profile.binaries.iter().map(binary_from_proto).collect(),
356 inference_capable: profile.inference_capable,
357 discovery: profile
358 .discovery
359 .as_ref()
360 .map(discovery_from_proto)
361 .unwrap_or_default(),
362 }
363 }
364
365 #[must_use]
366 pub fn credential_env_vars(&self) -> Vec<&str> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected