Skip to main content

proxmox_api/generated/cluster/sdn/
lock.rs

1#[derive(Debug, Clone)]
2pub struct LockClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> LockClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}{}", parent_path, "/lock"),
14        }
15    }
16}
17impl<T> LockClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Release global lock for SDN configuration"]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/sdn\", [\"SDN.Allocate\"])"]
24    pub async fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
25        let path = self.path.to_string();
26        self.client.delete(&path, &params).await
27    }
28}
29impl<T> LockClient<T>
30where
31    T: crate::client::Client,
32{
33    #[doc = "Acquire global lock for SDN configuration"]
34    #[doc = ""]
35    #[doc = "Permission check: perm(\"/sdn\", [\"SDN.Allocate\"])"]
36    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
37        let path = self.path.to_string();
38        self.client.post(&path, &params).await
39    }
40}
41#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
42pub struct DeleteParams {
43    #[serde(
44        serialize_with = "crate::types::serialize_bool_optional",
45        deserialize_with = "crate::types::deserialize_bool_optional"
46    )]
47    #[serde(skip_serializing_if = "Option::is_none", default)]
48    #[doc = "if true, allow releasing lock without providing the token"]
49    #[doc = ""]
50    pub force: Option<bool>,
51    #[serde(rename = "lock-token")]
52    #[serde(skip_serializing_if = "Option::is_none", default)]
53    #[doc = "the token for unlocking the global SDN configuration"]
54    #[doc = ""]
55    pub lock_token: Option<String>,
56    #[serde(
57        flatten,
58        default,
59        skip_serializing_if = "::std::collections::HashMap::is_empty"
60    )]
61    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
62}
63#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
64pub struct PostParams {
65    #[serde(rename = "allow-pending")]
66    #[serde(
67        serialize_with = "crate::types::serialize_bool_optional",
68        deserialize_with = "crate::types::deserialize_bool_optional"
69    )]
70    #[serde(skip_serializing_if = "Option::is_none", default)]
71    #[doc = "if true, allow acquiring lock even though there are pending changes"]
72    #[doc = ""]
73    pub allow_pending: Option<bool>,
74    #[serde(
75        flatten,
76        default,
77        skip_serializing_if = "::std::collections::HashMap::is_empty"
78    )]
79    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
80}