1use std::borrow::Borrow;
12#[allow(unused_imports)]
13use std::option::Option;
14use std::pin::Pin;
15use std::sync::Arc;
16
17use futures::Future;
18use hyper;
19use hyper_util::client::legacy::connect::Connect;
20
21use super::request as __internal_request;
22use super::{configuration, Error};
23use crate::models;
24
25pub struct ManifestsApiClient<C: Connect>
26where
27 C: Clone + std::marker::Send + Sync + 'static,
28{
29 configuration: Arc<configuration::Configuration<C>>,
30}
31
32impl<C: Connect> ManifestsApiClient<C>
33where
34 C: Clone + std::marker::Send + Sync,
35{
36 pub fn new(configuration: Arc<configuration::Configuration<C>>) -> ManifestsApiClient<C> {
37 ManifestsApiClient { configuration }
38 }
39}
40
41pub trait ManifestsApi: Send + Sync {
42 fn manifest_add_libpod(
43 &self,
44 name: &str,
45 options: Option<models::ManifestAddOptions>,
46 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>>;
47 fn manifest_create_libpod(
48 &self,
49 name: &str,
50 images: &str,
51 all: Option<bool>,
52 amend: Option<bool>,
53 options: Option<models::ManifestModifyOptions>,
54 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>>;
55 fn manifest_delete_libpod(
56 &self,
57 name: &str,
58 ) -> Pin<Box<dyn Future<Output = Result<models::LibpodImagesRemoveReport, Error>> + Send>>;
59 fn manifest_exists_libpod(
60 &self,
61 name: &str,
62 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
63 fn manifest_inspect_libpod(
64 &self,
65 name: &str,
66 tls_verify: Option<bool>,
67 ) -> Pin<Box<dyn Future<Output = Result<models::Schema2ListPublic, Error>> + Send>>;
68 fn manifest_modify_libpod(
69 &self,
70 name: &str,
71 options: models::ManifestModifyOptions,
72 tls_verify: Option<bool>,
73 ) -> Pin<Box<dyn Future<Output = Result<models::ManifestModifyReport, Error>> + Send>>;
74 fn manifest_push_libpod(
75 &self,
76 name: &str,
77 destination: &str,
78 add_compression: Option<Vec<String>>,
79 force_compression_format: Option<bool>,
80 all: Option<bool>,
81 tls_verify: Option<bool>,
82 quiet: Option<bool>,
83 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>>;
84 fn manifest_push_v3_libpod(
85 &self,
86 name: &str,
87 destination: &str,
88 all: Option<bool>,
89 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>>;
90}
91
92impl<C: Connect> ManifestsApi for ManifestsApiClient<C>
93where
94 C: Clone + std::marker::Send + Sync,
95{
96 #[allow(unused_mut)]
97 fn manifest_add_libpod(
98 &self,
99 name: &str,
100 options: Option<models::ManifestAddOptions>,
101 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>> {
102 let mut req = __internal_request::Request::new(
103 hyper::Method::POST,
104 "/libpod/manifests/{name}/add".to_string(),
105 );
106 req = req.with_path_param("name".to_string(), name.to_string());
107 req = req.with_body_param(options);
108
109 req.execute(self.configuration.borrow())
110 }
111
112 #[allow(unused_mut)]
113 fn manifest_create_libpod(
114 &self,
115 name: &str,
116 images: &str,
117 all: Option<bool>,
118 amend: Option<bool>,
119 options: Option<models::ManifestModifyOptions>,
120 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>> {
121 let mut req = __internal_request::Request::new(
122 hyper::Method::POST,
123 "/libpod/manifests/{name}".to_string(),
124 );
125 req = req.with_query_param("images".to_string(), images.to_string());
126 if let Some(ref s) = all {
127 let query_value = s.to_string();
128 req = req.with_query_param("all".to_string(), query_value);
129 }
130 if let Some(ref s) = amend {
131 let query_value = s.to_string();
132 req = req.with_query_param("amend".to_string(), query_value);
133 }
134 req = req.with_path_param("name".to_string(), name.to_string());
135 req = req.with_body_param(options);
136
137 req.execute(self.configuration.borrow())
138 }
139
140 #[allow(unused_mut)]
141 fn manifest_delete_libpod(
142 &self,
143 name: &str,
144 ) -> Pin<Box<dyn Future<Output = Result<models::LibpodImagesRemoveReport, Error>> + Send>> {
145 let mut req = __internal_request::Request::new(
146 hyper::Method::DELETE,
147 "/libpod/manifests/{name}".to_string(),
148 );
149 req = req.with_path_param("name".to_string(), name.to_string());
150
151 req.execute(self.configuration.borrow())
152 }
153
154 #[allow(unused_mut)]
155 fn manifest_exists_libpod(
156 &self,
157 name: &str,
158 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
159 let mut req = __internal_request::Request::new(
160 hyper::Method::GET,
161 "/libpod/manifests/{name}/exists".to_string(),
162 );
163 req = req.with_path_param("name".to_string(), name.to_string());
164 req = req.returns_nothing();
165
166 req.execute(self.configuration.borrow())
167 }
168
169 #[allow(unused_mut)]
170 fn manifest_inspect_libpod(
171 &self,
172 name: &str,
173 tls_verify: Option<bool>,
174 ) -> Pin<Box<dyn Future<Output = Result<models::Schema2ListPublic, Error>> + Send>> {
175 let mut req = __internal_request::Request::new(
176 hyper::Method::GET,
177 "/libpod/manifests/{name}/json".to_string(),
178 );
179 if let Some(ref s) = tls_verify {
180 let query_value = s.to_string();
181 req = req.with_query_param("tlsVerify".to_string(), query_value);
182 }
183 req = req.with_path_param("name".to_string(), name.to_string());
184
185 req.execute(self.configuration.borrow())
186 }
187
188 #[allow(unused_mut)]
189 fn manifest_modify_libpod(
190 &self,
191 name: &str,
192 options: models::ManifestModifyOptions,
193 tls_verify: Option<bool>,
194 ) -> Pin<Box<dyn Future<Output = Result<models::ManifestModifyReport, Error>> + Send>> {
195 let mut req = __internal_request::Request::new(
196 hyper::Method::PUT,
197 "/libpod/manifests/{name}".to_string(),
198 );
199 if let Some(ref s) = tls_verify {
200 let query_value = s.to_string();
201 req = req.with_query_param("tlsVerify".to_string(), query_value);
202 }
203 req = req.with_path_param("name".to_string(), name.to_string());
204 req = req.with_body_param(options);
205
206 req.execute(self.configuration.borrow())
207 }
208
209 #[allow(unused_mut)]
210 fn manifest_push_libpod(
211 &self,
212 name: &str,
213 destination: &str,
214 add_compression: Option<Vec<String>>,
215 force_compression_format: Option<bool>,
216 all: Option<bool>,
217 tls_verify: Option<bool>,
218 quiet: Option<bool>,
219 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>> {
220 let mut req = __internal_request::Request::new(
221 hyper::Method::POST,
222 "/libpod/manifests/{name}/registry/{destination}".to_string(),
223 );
224 if let Some(ref s) = add_compression {
225 let query_value = s
226 .iter()
227 .map(|s| s.to_string())
228 .collect::<Vec<String>>()
229 .join(",");
230 req = req.with_query_param("addCompression".to_string(), query_value);
231 }
232 if let Some(ref s) = force_compression_format {
233 let query_value = s.to_string();
234 req = req.with_query_param("forceCompressionFormat".to_string(), query_value);
235 }
236 if let Some(ref s) = all {
237 let query_value = s.to_string();
238 req = req.with_query_param("all".to_string(), query_value);
239 }
240 if let Some(ref s) = tls_verify {
241 let query_value = s.to_string();
242 req = req.with_query_param("tlsVerify".to_string(), query_value);
243 }
244 if let Some(ref s) = quiet {
245 let query_value = s.to_string();
246 req = req.with_query_param("quiet".to_string(), query_value);
247 }
248 req = req.with_path_param("name".to_string(), name.to_string());
249 req = req.with_path_param("destination".to_string(), destination.to_string());
250
251 req.execute(self.configuration.borrow())
252 }
253
254 #[allow(unused_mut)]
255 fn manifest_push_v3_libpod(
256 &self,
257 name: &str,
258 destination: &str,
259 all: Option<bool>,
260 ) -> Pin<Box<dyn Future<Output = Result<models::IdResponse, Error>> + Send>> {
261 let mut req = __internal_request::Request::new(
262 hyper::Method::POST,
263 "/libpod/manifests/{name}/push".to_string(),
264 );
265 req = req.with_query_param("destination".to_string(), destination.to_string());
266 if let Some(ref s) = all {
267 let query_value = s.to_string();
268 req = req.with_query_param("all".to_string(), query_value);
269 }
270 req = req.with_path_param("name".to_string(), name.to_string());
271
272 req.execute(self.configuration.borrow())
273 }
274}