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

Function provider_profile_import

crates/openshell-cli/src/run.rs:5105–5144  ·  view source on GitHub ↗
(
    server: &str,
    file: Option<&Path>,
    from: Option<&Path>,
    tls: &TlsOptions,
)

Source from the content-addressed store, hash-verified

5103}
5104
5105pub async fn provider_profile_import(
5106 server: &str,
5107 file: Option<&Path>,
5108 from: Option<&Path>,
5109 tls: &TlsOptions,
5110) -> Result<()> {
5111 let (items, mut diagnostics) = load_profile_import_items(file, from)?;
5112 if items.is_empty() && diagnostics.is_empty() {
5113 return Err(miette!("no provider profile files found"));
5114 }
5115 if profile_diagnostics_have_errors(&diagnostics) {
5116 print_profile_diagnostics(&diagnostics);
5117 return Err(miette!("provider profile import failed"));
5118 }
5119
5120 let mut client = grpc_client(server, tls).await?;
5121 if !items.is_empty() {
5122 let response = client
5123 .import_provider_profiles(ImportProviderProfilesRequest { profiles: items })
5124 .await
5125 .into_diagnostic()?
5126 .into_inner();
5127 diagnostics.extend(response.diagnostics);
5128 if response.imported {
5129 println!(
5130 "Imported {} provider profile{}.",
5131 response.profiles.len(),
5132 if response.profiles.len() == 1 {
5133 ""
5134 } else {
5135 "s"
5136 }
5137 );
5138 return Ok(());
5139 }
5140 }
5141
5142 print_profile_diagnostics(&diagnostics);
5143 Err(miette!("provider profile import failed"))
5144}
5145
5146pub async fn provider_profile_update(
5147 server: &str,

Calls 6

grpc_clientFunction · 0.85
is_emptyMethod · 0.45