| 5076 | } |
| 5077 | |
| 5078 | pub async fn provider_profile_export_text( |
| 5079 | server: &str, |
| 5080 | id: &str, |
| 5081 | output: &str, |
| 5082 | tls: &TlsOptions, |
| 5083 | ) -> Result<String> { |
| 5084 | let mut client = grpc_client(server, tls).await?; |
| 5085 | let response = client |
| 5086 | .get_provider_profile(GetProviderProfileRequest { id: id.to_string() }) |
| 5087 | .await |
| 5088 | .into_diagnostic()?; |
| 5089 | let profile = response |
| 5090 | .into_inner() |
| 5091 | .profile |
| 5092 | .ok_or_else(|| miette!("provider profile '{id}' not found"))?; |
| 5093 | let profile = ProviderTypeProfile::from_proto(&profile); |
| 5094 | |
| 5095 | match output { |
| 5096 | "json" => profile_to_json(&profile).into_diagnostic(), |
| 5097 | "yaml" => profile_to_yaml(&profile).into_diagnostic(), |
| 5098 | "table" => Err(miette!( |
| 5099 | "profile export supports '-o yaml' and '-o json'; table output is not supported" |
| 5100 | )), |
| 5101 | _ => Err(miette!("unsupported output format: {output}")), |
| 5102 | } |
| 5103 | } |
| 5104 | |
| 5105 | pub async fn provider_profile_import( |
| 5106 | server: &str, |