nomad_client_rs/api/
allocation.rs1use reqwest::Method;
2
3use crate::api::allocation::models::AllocationRestartRequest;
4use crate::{ClientError, NomadClient};
5
6impl NomadClient {
7 pub async fn allocation_restart(
8 &self,
9 alloc_id: &str,
10 req: &AllocationRestartRequest,
11 ) -> Result<(), ClientError> {
12 let req = self
13 .request(
14 Method::POST,
15 &format!("/client/allocation/{}/restart", alloc_id),
16 )
17 .json(req);
18
19 self.send::<()>(req).await
20 }
21}
22
23pub mod models {
24 use serde::{Deserialize, Serialize};
25
26 #[derive(Debug, Default, Serialize)]
27 #[serde(rename_all = "camelCase")]
28 pub struct AllocationRestartRequest {
29 pub task_name: Option<String>,
30 pub all_tasks: Option<bool>,
31 }
32
33 #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
34 pub struct AllocStopResponse {
35 #[serde(rename = "EvalID", skip_serializing_if = "Option::is_none")]
36 pub eval_id: Option<String>,
37 #[serde(rename = "Index", skip_serializing_if = "Option::is_none")]
38 pub index: Option<i32>,
39 }
40}