icinga2_api/api/action/
restart_process.rs1use serde::{Deserialize, Serialize};
6
7use crate::types::action::StatusResponse;
8use crate::types::query::ResultsWrapper;
9use crate::types::rest::{RestApiEndpoint, RestApiResponse};
10
11#[derive(Debug, Clone, derive_builder::Builder, Serialize, Deserialize)]
13pub struct RestartProcess {}
14
15impl RestartProcess {
16 #[must_use]
20 pub fn builder() -> RestartProcessBuilder {
21 RestartProcessBuilder::default()
22 }
23}
24
25impl RestApiEndpoint for RestartProcess {
26 type RequestBody = RestartProcess;
27
28 fn method(&self) -> Result<reqwest::Method, crate::error::Error> {
29 Ok(reqwest::Method::POST)
30 }
31
32 fn url(&self, base_url: &url::Url) -> Result<url::Url, crate::error::Error> {
33 base_url
34 .join("v1/actions/restart-process")
35 .map_err(crate::error::Error::CouldNotParseUrlFragment)
36 }
37
38 fn request_body(
39 &self,
40 ) -> Result<Option<std::borrow::Cow<Self::RequestBody>>, crate::error::Error>
41 where
42 Self::RequestBody: Clone + serde::Serialize + std::fmt::Debug,
43 {
44 Ok(Some(std::borrow::Cow::Borrowed(self)))
45 }
46}
47
48impl RestApiResponse<RestartProcess> for ResultsWrapper<StatusResponse> {}