use std::sync::Arc; use axum::extract::{Path, State}; use axum::{Extension, Json}; use lib::model::ValidShardedId; use lib::types::{ProjectId, RequestId}; use proto::scheduler_proto::CancelTriggerRequest; use crate::errors::ApiError; use crate::model::Trigger; use crate::AppState; #[tracing::instrument(skip(state))] pub(crate) async fn cancel( state: State>, Path(name): Path, Extension(project): Extension>, Extension(request_id): Extension, ) -> Result, ApiError> { let mut scheduler = state .scheduler_clients .get_client(&request_id, &project) .await?; let trigger = scheduler .cancel_trigger(CancelTriggerRequest { name }) .await? .into_inner() .trigger .unwrap(); let trigger: Trigger = trigger.into(); Ok(Json(trigger)) }