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

Function handle_update_provider

crates/openshell-server/src/grpc/provider.rs:1890–1928  ·  view source on GitHub ↗
(
    state: &Arc<ServerState>,
    request: Request<UpdateProviderRequest>,
)

Source from the content-addressed store, hash-verified

1888}
1889
1890pub(super) async fn handle_update_provider(
1891 state: &Arc<ServerState>,
1892 request: Request<UpdateProviderRequest>,
1893) -> Result<Response<ProviderResponse>, Status> {
1894 let req = request.into_inner();
1895 let Some(mut provider) = req.provider else {
1896 emit_provider_lifecycle(
1897 "custom",
1898 LifecycleOperation::Update,
1899 TelemetryOutcome::Failure,
1900 );
1901 return Err(Status::invalid_argument("provider is required"));
1902 };
1903 let provider_type = provider.r#type.clone();
1904 provider
1905 .credential_expires_at_ms
1906 .extend(req.credential_expires_at_ms);
1907 let result = update_provider_record(state.store.as_ref(), provider).await;
1908 match result {
1909 Ok(provider) => {
1910 emit_provider_lifecycle(
1911 &provider.r#type,
1912 LifecycleOperation::Update,
1913 TelemetryOutcome::Success,
1914 );
1915 Ok(Response::new(ProviderResponse {
1916 provider: Some(provider),
1917 }))
1918 }
1919 Err(err) => {
1920 emit_provider_lifecycle(
1921 &provider_type,
1922 LifecycleOperation::Update,
1923 TelemetryOutcome::Failure,
1924 );
1925 Err(err)
1926 }
1927 }
1928}
1929
1930pub(super) async fn handle_get_provider_refresh_status(
1931 state: &Arc<ServerState>,

Calls 2

update_provider_recordFunction · 0.85
emit_provider_lifecycleFunction · 0.70

Tested by

no test coverage detected