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

1pub struct RepositoriesClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> RepositoriesClient<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, "/repositories"),
13        }
14    }
15}
16impl<T> RepositoriesClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Get APT repository information."]
21    pub fn get(&self) -> Result<GetOutput, T::Error> {
22        let path = self.path.to_string();
23        self.client.get(&path, &())
24    }
25}
26impl<T> RepositoriesClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Change the properties of a repository. Currently only allows enabling/disabling."]
31    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
32        let path = self.path.to_string();
33        self.client.post(&path, &params)
34    }
35}
36impl<T> RepositoriesClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Add a standard repository to the configuration"]
41    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
42        let path = self.path.to_string();
43        self.client.put(&path, &params)
44    }
45}
46impl ErrorsGetOutputErrorsItems {
47    pub fn new(error: String, path: String) -> Self {
48        Self {
49            error,
50            path,
51            additional_properties: Default::default(),
52        }
53    }
54}
55#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
56pub struct ErrorsGetOutputErrorsItems {
57    #[doc = "The error message"]
58    pub error: String,
59    #[doc = "Path to the problematic file."]
60    pub path: String,
61    #[serde(
62        flatten,
63        default,
64        skip_serializing_if = "::std::collections::HashMap::is_empty"
65    )]
66    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
67}
68impl FilesGetOutputFilesItems {
69    pub fn new(
70        digest: Vec<u64>,
71        file_type: FileType,
72        path: String,
73        repositories: Vec<RepositoriesGetOutputFilesItemsRepositoriesItems>,
74    ) -> Self {
75        Self {
76            digest,
77            file_type,
78            path,
79            repositories,
80            additional_properties: Default::default(),
81        }
82    }
83}
84#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
85pub struct FilesGetOutputFilesItems {
86    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
87    #[doc = "Digest of the file as bytes."]
88    pub digest: Vec<u64>,
89    #[serde(rename = "file-type")]
90    #[doc = "Format of the file."]
91    pub file_type: FileType,
92    #[doc = "Path to the problematic file."]
93    pub path: String,
94    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
95    #[doc = "The parsed repositories."]
96    pub repositories: Vec<RepositoriesGetOutputFilesItemsRepositoriesItems>,
97    #[serde(
98        flatten,
99        default,
100        skip_serializing_if = "::std::collections::HashMap::is_empty"
101    )]
102    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
103}
104impl GetOutput {
105    pub fn new(
106        digest: String,
107        errors: Vec<ErrorsGetOutputErrorsItems>,
108        files: Vec<FilesGetOutputFilesItems>,
109        infos: Vec<InfosGetOutputInfosItems>,
110        standard_repos: Vec<StandardReposGetOutputStandardReposItems>,
111    ) -> Self {
112        Self {
113            digest,
114            errors,
115            files,
116            infos,
117            standard_repos,
118            additional_properties: Default::default(),
119        }
120    }
121}
122#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
123pub struct GetOutput {
124    #[doc = "Common digest of all files."]
125    pub digest: String,
126    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
127    #[doc = "List of problematic repository files."]
128    pub errors: Vec<ErrorsGetOutputErrorsItems>,
129    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
130    #[doc = "List of parsed repository files."]
131    pub files: Vec<FilesGetOutputFilesItems>,
132    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
133    #[doc = "Additional information/warnings for APT repositories."]
134    pub infos: Vec<InfosGetOutputInfosItems>,
135    #[serde(rename = "standard-repos")]
136    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
137    #[doc = "List of standard repositories and their configuration status"]
138    pub standard_repos: Vec<StandardReposGetOutputStandardReposItems>,
139    #[serde(
140        flatten,
141        default,
142        skip_serializing_if = "::std::collections::HashMap::is_empty"
143    )]
144    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
145}
146impl InfosGetOutputInfosItems {
147    pub fn new(index: String, kind: String, message: String, path: String) -> Self {
148        Self {
149            index,
150            kind,
151            message,
152            path,
153            property: Default::default(),
154            additional_properties: Default::default(),
155        }
156    }
157}
158#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
159pub struct InfosGetOutputInfosItems {
160    #[doc = "Index of the associated repository within the file."]
161    pub index: String,
162    #[doc = "Kind of the information (e.g. warning)."]
163    pub kind: String,
164    #[doc = "Information message."]
165    pub message: String,
166    #[doc = "Path to the associated file."]
167    pub path: String,
168    #[serde(skip_serializing_if = "Option::is_none", default)]
169    #[doc = "Property from which the info originates."]
170    pub property: Option<String>,
171    #[serde(
172        flatten,
173        default,
174        skip_serializing_if = "::std::collections::HashMap::is_empty"
175    )]
176    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
177}
178impl OptionsGetOutputFilesItemsRepositoriesItemsOptionsItems {
179    pub fn new(key: String, values: Vec<String>) -> Self {
180        Self {
181            key,
182            values,
183            additional_properties: Default::default(),
184        }
185    }
186}
187#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
188pub struct OptionsGetOutputFilesItemsRepositoriesItemsOptionsItems {
189    #[serde(rename = "Key")]
190    pub key: String,
191    #[serde(rename = "Values")]
192    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
193    pub values: Vec<String>,
194    #[serde(
195        flatten,
196        default,
197        skip_serializing_if = "::std::collections::HashMap::is_empty"
198    )]
199    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
200}
201impl PostParams {
202    pub fn new(index: u64, path: String) -> Self {
203        Self {
204            index,
205            path,
206            digest: Default::default(),
207            enabled: Default::default(),
208            additional_properties: Default::default(),
209        }
210    }
211}
212#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
213pub struct PostParams {
214    #[serde(skip_serializing_if = "Option::is_none", default)]
215    #[doc = "Digest to detect modifications."]
216    pub digest: Option<String>,
217    #[serde(
218        serialize_with = "crate::types::serialize_bool_optional",
219        deserialize_with = "crate::types::deserialize_bool_optional"
220    )]
221    #[serde(skip_serializing_if = "Option::is_none", default)]
222    #[doc = "Whether the repository should be enabled or not."]
223    pub enabled: Option<bool>,
224    #[serde(
225        serialize_with = "crate::types::serialize_int",
226        deserialize_with = "crate::types::deserialize_int"
227    )]
228    #[doc = "Index within the file (starting from 0)."]
229    pub index: u64,
230    #[doc = "Path to the containing file."]
231    pub path: String,
232    #[serde(
233        flatten,
234        default,
235        skip_serializing_if = "::std::collections::HashMap::is_empty"
236    )]
237    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
238}
239impl PutParams {
240    pub fn new(handle: String) -> Self {
241        Self {
242            handle,
243            digest: Default::default(),
244            additional_properties: Default::default(),
245        }
246    }
247}
248#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
249pub struct PutParams {
250    #[serde(skip_serializing_if = "Option::is_none", default)]
251    #[doc = "Digest to detect modifications."]
252    pub digest: Option<String>,
253    #[doc = "Handle that identifies a repository."]
254    pub handle: String,
255    #[serde(
256        flatten,
257        default,
258        skip_serializing_if = "::std::collections::HashMap::is_empty"
259    )]
260    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
261}
262impl RepositoriesGetOutputFilesItemsRepositoriesItems {
263    pub fn new(
264        enabled: bool,
265        filetype: FileType,
266        suites: Vec<String>,
267        types: Vec<Types>,
268        uris: Vec<String>,
269    ) -> Self {
270        Self {
271            enabled,
272            filetype,
273            suites,
274            types,
275            uris,
276            comment: Default::default(),
277            components: Default::default(),
278            options: Default::default(),
279            additional_properties: Default::default(),
280        }
281    }
282}
283#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
284pub struct RepositoriesGetOutputFilesItemsRepositoriesItems {
285    #[serde(rename = "Comment")]
286    #[serde(skip_serializing_if = "Option::is_none", default)]
287    #[doc = "Associated comment"]
288    pub comment: Option<String>,
289    #[serde(rename = "Components")]
290    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
291    #[doc = "List of repository components"]
292    pub components: Vec<String>,
293    #[serde(rename = "Enabled")]
294    #[serde(
295        serialize_with = "crate::types::serialize_bool",
296        deserialize_with = "crate::types::deserialize_bool"
297    )]
298    #[doc = "Whether the repository is enabled or not"]
299    pub enabled: bool,
300    #[serde(rename = "FileType")]
301    #[doc = "Format of the defining file."]
302    pub filetype: FileType,
303    #[serde(rename = "Options")]
304    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
305    #[doc = "Additional options"]
306    pub options: Vec<OptionsGetOutputFilesItemsRepositoriesItemsOptionsItems>,
307    #[serde(rename = "Suites")]
308    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
309    #[doc = "List of package distribuitions"]
310    pub suites: Vec<String>,
311    #[serde(rename = "Types")]
312    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
313    #[doc = "List of package types."]
314    pub types: Vec<Types>,
315    #[serde(rename = "URIs")]
316    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
317    #[doc = "List of repository URIs."]
318    pub uris: Vec<String>,
319    #[serde(
320        flatten,
321        default,
322        skip_serializing_if = "::std::collections::HashMap::is_empty"
323    )]
324    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
325}
326impl StandardReposGetOutputStandardReposItems {
327    pub fn new(handle: String, name: String) -> Self {
328        Self {
329            handle,
330            name,
331            status: Default::default(),
332            additional_properties: Default::default(),
333        }
334    }
335}
336#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
337pub struct StandardReposGetOutputStandardReposItems {
338    #[doc = "Handle to identify the repository."]
339    pub handle: String,
340    #[doc = "Full name of the repository."]
341    pub name: String,
342    #[serde(
343        serialize_with = "crate::types::serialize_bool_optional",
344        deserialize_with = "crate::types::deserialize_bool_optional"
345    )]
346    #[serde(skip_serializing_if = "Option::is_none", default)]
347    #[doc = "Indicating enabled/disabled status, if the repository is configured."]
348    pub status: Option<bool>,
349    #[serde(
350        flatten,
351        default,
352        skip_serializing_if = "::std::collections::HashMap::is_empty"
353    )]
354    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
355}
356#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
357pub enum FileType {
358    #[serde(rename = "list")]
359    List,
360    #[serde(rename = "sources")]
361    Sources,
362}
363#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
364pub enum Types {
365    #[serde(rename = "deb")]
366    Deb,
367    #[serde(rename = "deb-src")]
368    DebSrc,
369}