podman_rest_client/v5/apis/
manifests.rs1use crate::api_common::config::HasConfig;
2use crate::api_common::request;
3use crate::api_common::Error;
4use http::request::Builder;
5use std::future::Future;
6use std::pin::Pin;
7pub trait Manifests: HasConfig + Send + Sync {
8 fn manifest_delete_libpod<'a>(
16 &'a self,
17 name: &'a str,
18 ) -> Pin<
19 Box<
20 dyn Future<Output = Result<crate::v5::models::LibpodImagesRemoveReport, Error>>
21 + Send
22 + 'a,
23 >,
24 > {
25 Box::pin(request::execute_request_json(
26 self.get_config(),
27 move |mut req_builder: Builder| {
28 req_builder = req_builder.method("DELETE");
29 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
30 let mut request_path = request_url.path().to_owned();
31 if request_path.ends_with('/') {
32 request_path.pop();
33 }
34 request_path.push_str("/libpod/manifests/{name}");
35 request_path = request_path.replace("{name}", name);
36 request_url.set_path(&request_path);
37 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
38 req_builder = req_builder.uri(hyper_uri);
39 Ok(req_builder.body(String::new())?)
40 },
41 ))
42 }
43 fn manifest_create_libpod<'a>(
49 &'a self,
50 name: &'a str,
51 params: Option<crate::v5::params::ManifestCreateLibpod<'a>>,
52 options: crate::v5::models::ManifestModifyOptions,
53 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::IdResponse, Error>> + Send + 'a>>
54 {
55 Box::pin(request::execute_request_json(
56 self.get_config(),
57 move |mut req_builder: Builder| {
58 req_builder = req_builder.method("POST");
59 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
60 let mut request_path = request_url.path().to_owned();
61 if request_path.ends_with('/') {
62 request_path.pop();
63 }
64 request_path.push_str("/libpod/manifests/{name}");
65 request_path = request_path.replace("{name}", name);
66 request_url.set_path(&request_path);
67 if let Some(params) = ¶ms {
68 let mut query_pairs = request_url.query_pairs_mut();
69 query_pairs.append_pair("images", params.images);
70 if let Some(all) = params.all {
71 query_pairs.append_pair("all", &all.to_string());
72 }
73 if let Some(amend) = params.amend {
74 query_pairs.append_pair("amend", &amend.to_string());
75 }
76 }
77 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
78 req_builder = req_builder.uri(hyper_uri);
79 let body = serde_json::to_string(&options)?;
80 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
81 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
82 Ok(req_builder.body(body)?)
83 },
84 ))
85 }
86 fn manifest_modify_libpod<'a>(
96 &'a self,
97 name: &'a str,
98 params: Option<crate::v5::params::ManifestModifyLibpod>,
99 options: crate::v5::models::ManifestModifyOptions,
100 ) -> Pin<
101 Box<
102 dyn Future<Output = Result<crate::v5::models::ManifestModifyReport, Error>> + Send + 'a,
103 >,
104 > {
105 Box::pin(request::execute_request_json(
106 self.get_config(),
107 move |mut req_builder: Builder| {
108 req_builder = req_builder.method("GET");
109 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
110 let mut request_path = request_url.path().to_owned();
111 if request_path.ends_with('/') {
112 request_path.pop();
113 }
114 request_path.push_str("/libpod/manifests/{name}");
115 request_path = request_path.replace("{name}", name);
116 request_url.set_path(&request_path);
117 if let Some(params) = ¶ms {
118 let mut query_pairs = request_url.query_pairs_mut();
119 if let Some(tls_verify) = params.tls_verify {
120 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
121 }
122 }
123 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
124 req_builder = req_builder.uri(hyper_uri);
125 let body = serde_json::to_string(&options)?;
126 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
127 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
128 Ok(req_builder.body(body)?)
129 },
130 ))
131 }
132 fn manifest_add_libpod<'a>(
140 &'a self,
141 name: &'a str,
142 options: crate::v5::models::ManifestAddOptions,
143 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::IdResponse, Error>> + Send + 'a>>
144 {
145 Box::pin(request::execute_request_json(
146 self.get_config(),
147 move |mut req_builder: Builder| {
148 req_builder = req_builder.method("POST");
149 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
150 let mut request_path = request_url.path().to_owned();
151 if request_path.ends_with('/') {
152 request_path.pop();
153 }
154 request_path.push_str("/libpod/manifests/{name}/add");
155 request_path = request_path.replace("{name}", name);
156 request_url.set_path(&request_path);
157 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
158 req_builder = req_builder.uri(hyper_uri);
159 let body = serde_json::to_string(&options)?;
160 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
161 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
162 Ok(req_builder.body(body)?)
163 },
164 ))
165 }
166 fn manifest_exists_libpod<'a>(
174 &'a self,
175 name: &'a str,
176 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
177 Box::pin(request::execute_request_unit(
178 self.get_config(),
179 move |mut req_builder: Builder| {
180 req_builder = req_builder.method("GET");
181 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
182 let mut request_path = request_url.path().to_owned();
183 if request_path.ends_with('/') {
184 request_path.pop();
185 }
186 request_path.push_str("/libpod/manifests/{name}/exists");
187 request_path = request_path.replace("{name}", name);
188 request_url.set_path(&request_path);
189 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
190 req_builder = req_builder.uri(hyper_uri);
191 Ok(req_builder.body(String::new())?)
192 },
193 ))
194 }
195 fn manifest_inspect_libpod<'a>(
201 &'a self,
202 name: &'a str,
203 params: Option<crate::v5::params::ManifestInspectLibpod>,
204 ) -> Pin<
205 Box<dyn Future<Output = Result<crate::v5::models::Schema2ListPublic, Error>> + Send + 'a>,
206 > {
207 Box::pin(request::execute_request_json(
208 self.get_config(),
209 move |mut req_builder: Builder| {
210 req_builder = req_builder.method("GET");
211 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
212 let mut request_path = request_url.path().to_owned();
213 if request_path.ends_with('/') {
214 request_path.pop();
215 }
216 request_path.push_str("/libpod/manifests/{name}/json");
217 request_path = request_path.replace("{name}", name);
218 request_url.set_path(&request_path);
219 if let Some(params) = ¶ms {
220 let mut query_pairs = request_url.query_pairs_mut();
221 if let Some(tls_verify) = params.tls_verify {
222 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
223 }
224 }
225 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
226 req_builder = req_builder.uri(hyper_uri);
227 Ok(req_builder.body(String::new())?)
228 },
229 ))
230 }
231 fn manifest_push_v_3_libpod<'a>(
239 &'a self,
240 name: &'a str,
241 params: Option<crate::v5::params::ManifestPushV3Libpod<'a>>,
242 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::IdResponse, Error>> + Send + 'a>>
243 {
244 Box::pin(request::execute_request_json(
245 self.get_config(),
246 move |mut req_builder: Builder| {
247 req_builder = req_builder.method("POST");
248 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
249 let mut request_path = request_url.path().to_owned();
250 if request_path.ends_with('/') {
251 request_path.pop();
252 }
253 request_path.push_str("/libpod/manifests/{name}/push");
254 request_path = request_path.replace("{name}", name);
255 request_url.set_path(&request_path);
256 if let Some(params) = ¶ms {
257 let mut query_pairs = request_url.query_pairs_mut();
258 query_pairs.append_pair("destination", params.destination);
259 if let Some(all) = params.all {
260 query_pairs.append_pair("all", &all.to_string());
261 }
262 }
263 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
264 req_builder = req_builder.uri(hyper_uri);
265 Ok(req_builder.body(String::new())?)
266 },
267 ))
268 }
269 fn manifest_push_libpod<'a>(
277 &'a self,
278 name: &'a str,
279 destination: &'a str,
280 params: Option<crate::v5::params::ManifestPushLibpod<'a>>,
281 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::IdResponse, Error>> + Send + 'a>>
282 {
283 Box::pin(request::execute_request_json(
284 self.get_config(),
285 move |mut req_builder: Builder| {
286 req_builder = req_builder.method("POST");
287 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
288 let mut request_path = request_url.path().to_owned();
289 if request_path.ends_with('/') {
290 request_path.pop();
291 }
292 request_path.push_str("/libpod/manifests/{name}/registry/{destination}");
293 request_path = request_path.replace("{name}", name);
294 request_path = request_path.replace("{destination}", destination);
295 request_url.set_path(&request_path);
296 if let Some(params) = ¶ms {
297 let mut query_pairs = request_url.query_pairs_mut();
298 if let Some(add_compression) = ¶ms.add_compression {
299 for value in add_compression {
300 query_pairs.append_pair("addCompression", &value.to_string());
301 }
302 }
303 if let Some(force_compression_format) = params.force_compression_format {
304 query_pairs.append_pair(
305 "forceCompressionFormat",
306 &force_compression_format.to_string(),
307 );
308 }
309 if let Some(all) = params.all {
310 query_pairs.append_pair("all", &all.to_string());
311 }
312 if let Some(tls_verify) = params.tls_verify {
313 query_pairs.append_pair("tlsVerify", &tls_verify.to_string());
314 }
315 if let Some(quiet) = params.quiet {
316 query_pairs.append_pair("quiet", &quiet.to_string());
317 }
318 }
319 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
320 req_builder = req_builder.uri(hyper_uri);
321 Ok(req_builder.body(String::new())?)
322 },
323 ))
324 }
325}