Skip to main content

proxmox_api/generated/nodes/node/apt/
update.rs

1#[derive(Debug, Clone)]
2pub struct UpdateClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> UpdateClient<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, "/update"),
14        }
15    }
16}
17impl<T> UpdateClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List available updates."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Modify\"])"]
24    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
25        let path = self.path.to_string();
26        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
27        Ok(optional_vec.unwrap_or_default())
28    }
29}
30impl<T> UpdateClient<T>
31where
32    T: crate::client::Client,
33{
34    #[doc = "This is used to resynchronize the package index files from their sources (apt-get update)."]
35    #[doc = ""]
36    #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Modify\"])"]
37    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
38        let path = self.path.to_string();
39        self.client.post(&path, &params).await
40    }
41}
42impl GetOutputItems {
43    pub fn new(
44        arch: Arch,
45        description: String,
46        origin: String,
47        package: String,
48        priority: String,
49        section: String,
50        title: String,
51        version: String,
52    ) -> Self {
53        Self {
54            arch,
55            description,
56            origin,
57            package,
58            priority,
59            section,
60            title,
61            version,
62            notifystatus: ::std::default::Default::default(),
63            oldversion: ::std::default::Default::default(),
64            additional_properties: ::std::default::Default::default(),
65        }
66    }
67}
68#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
69pub struct GetOutputItems {
70    #[serde(rename = "Arch")]
71    #[doc = "Package Architecture."]
72    #[doc = ""]
73    pub arch: Arch,
74    #[serde(rename = "Description")]
75    #[doc = "Package description."]
76    #[doc = ""]
77    pub description: String,
78    #[serde(rename = "NotifyStatus")]
79    #[serde(skip_serializing_if = "Option::is_none", default)]
80    #[doc = "Version for which PVE has already sent an update notification for."]
81    #[doc = ""]
82    pub notifystatus: Option<String>,
83    #[serde(rename = "OldVersion")]
84    #[serde(skip_serializing_if = "Option::is_none", default)]
85    #[doc = "Old version currently installed."]
86    #[doc = ""]
87    pub oldversion: Option<String>,
88    #[serde(rename = "Origin")]
89    #[doc = "Package origin, e.g., 'Proxmox' or 'Debian'."]
90    #[doc = ""]
91    pub origin: String,
92    #[serde(rename = "Package")]
93    #[doc = "Package name."]
94    #[doc = ""]
95    pub package: String,
96    #[serde(rename = "Priority")]
97    #[doc = "Package priority."]
98    #[doc = ""]
99    pub priority: String,
100    #[serde(rename = "Section")]
101    #[doc = "Package section."]
102    #[doc = ""]
103    pub section: String,
104    #[serde(rename = "Title")]
105    #[doc = "Package title."]
106    #[doc = ""]
107    pub title: String,
108    #[serde(rename = "Version")]
109    #[doc = "New version to be updated to."]
110    #[doc = ""]
111    pub version: String,
112    #[serde(
113        flatten,
114        default,
115        skip_serializing_if = "::std::collections::HashMap::is_empty"
116    )]
117    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
118}
119#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
120pub struct PostParams {
121    #[serde(
122        serialize_with = "crate::types::serialize_bool_optional",
123        deserialize_with = "crate::types::deserialize_bool_optional"
124    )]
125    #[serde(skip_serializing_if = "Option::is_none", default)]
126    #[doc = "Send notification about new packages."]
127    #[doc = ""]
128    pub notify: Option<bool>,
129    #[serde(
130        serialize_with = "crate::types::serialize_bool_optional",
131        deserialize_with = "crate::types::deserialize_bool_optional"
132    )]
133    #[serde(skip_serializing_if = "Option::is_none", default)]
134    #[doc = "Only produces output suitable for logging, omitting progress indicators."]
135    #[doc = ""]
136    pub quiet: Option<bool>,
137    #[serde(
138        flatten,
139        default,
140        skip_serializing_if = "::std::collections::HashMap::is_empty"
141    )]
142    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
143}
144#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
145#[doc = "Package Architecture."]
146#[doc = ""]
147pub enum Arch {
148    #[serde(rename = "all")]
149    All,
150    #[serde(rename = "amd64")]
151    Amd64,
152    #[serde(rename = "arm64")]
153    Arm64,
154    #[serde(rename = "armhf")]
155    Armhf,
156    #[serde(rename = "ppc64el")]
157    Ppc64el,
158    #[serde(rename = "risc64")]
159    Risc64,
160    #[serde(rename = "s390x")]
161    S390x,
162}
163impl TryFrom<&str> for Arch {
164    type Error = String;
165    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
166        match value {
167            "all" => Ok(Self::All),
168            "amd64" => Ok(Self::Amd64),
169            "arm64" => Ok(Self::Arm64),
170            "armhf" => Ok(Self::Armhf),
171            "ppc64el" => Ok(Self::Ppc64el),
172            "risc64" => Ok(Self::Risc64),
173            "s390x" => Ok(Self::S390x),
174            v => Err(format!("Unknown variant {v}")),
175        }
176    }
177}