proxmox_api/generated/nodes/node/ceph/
cmd_safety.rs

1pub struct CmdSafetyClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> CmdSafetyClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}{}", parent_path, "/cmd-safety"),
13        }
14    }
15}
16impl<T> CmdSafetyClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Heuristical check if it is safe to perform an action."]
21    pub fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
22        let path = self.path.to_string();
23        self.client.get(&path, &params)
24    }
25}
26impl GetOutput {
27    pub fn new(safe: bool) -> Self {
28        Self {
29            safe,
30            status: Default::default(),
31            additional_properties: Default::default(),
32        }
33    }
34}
35#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
36pub struct GetOutput {
37    #[serde(
38        serialize_with = "crate::types::serialize_bool",
39        deserialize_with = "crate::types::deserialize_bool"
40    )]
41    #[doc = "If it is safe to run the command."]
42    pub safe: bool,
43    #[serde(skip_serializing_if = "Option::is_none", default)]
44    #[doc = "Status message given by Ceph."]
45    pub status: Option<String>,
46    #[serde(
47        flatten,
48        default,
49        skip_serializing_if = "::std::collections::HashMap::is_empty"
50    )]
51    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
52}
53impl GetParams {
54    pub fn new(action: Action, id: String, service: Service) -> Self {
55        Self {
56            action,
57            id,
58            service,
59            additional_properties: Default::default(),
60        }
61    }
62}
63#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
64pub struct GetParams {
65    #[doc = "Action to check"]
66    pub action: Action,
67    #[doc = "ID of the service"]
68    pub id: String,
69    #[doc = "Service type"]
70    pub service: Service,
71    #[serde(
72        flatten,
73        default,
74        skip_serializing_if = "::std::collections::HashMap::is_empty"
75    )]
76    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
77}
78#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
79pub enum Action {
80    #[serde(rename = "destroy")]
81    Destroy,
82    #[serde(rename = "stop")]
83    Stop,
84}
85#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
86pub enum Service {
87    #[serde(rename = "mds")]
88    Mds,
89    #[serde(rename = "mon")]
90    Mon,
91    #[serde(rename = "osd")]
92    Osd,
93}