proxmox_api/generated/nodes/node/
subscription.rs

1pub struct SubscriptionClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> SubscriptionClient<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, "/subscription"),
13        }
14    }
15}
16impl<T> SubscriptionClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Delete subscription key of this node."]
21    pub fn delete(&self) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &())
24    }
25}
26impl<T> SubscriptionClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Read subscription info."]
31    pub fn get(&self) -> Result<GetOutput, T::Error> {
32        let path = self.path.to_string();
33        self.client.get(&path, &())
34    }
35}
36impl<T> SubscriptionClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Update subscription info."]
41    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
42        let path = self.path.to_string();
43        self.client.post(&path, &params)
44    }
45}
46impl<T> SubscriptionClient<T>
47where
48    T: crate::client::Client,
49{
50    #[doc = "Set subscription key."]
51    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
52        let path = self.path.to_string();
53        self.client.put(&path, &params)
54    }
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
57pub struct GetOutput {
58    #[serde(
59        flatten,
60        default,
61        skip_serializing_if = "::std::collections::HashMap::is_empty"
62    )]
63    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
64}
65#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
66pub struct PostParams {
67    #[serde(
68        serialize_with = "crate::types::serialize_bool_optional",
69        deserialize_with = "crate::types::deserialize_bool_optional"
70    )]
71    #[serde(skip_serializing_if = "Option::is_none", default)]
72    #[doc = "Always connect to server, even if local cache is still valid."]
73    pub force: 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}
81impl PutParams {
82    pub fn new(key: String) -> Self {
83        Self {
84            key,
85            additional_properties: Default::default(),
86        }
87    }
88}
89#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
90pub struct PutParams {
91    #[doc = "Proxmox VE subscription key"]
92    pub key: String,
93    #[serde(
94        flatten,
95        default,
96        skip_serializing_if = "::std::collections::HashMap::is_empty"
97    )]
98    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
99}