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 DefaultApiClient<C: Connect>
26where
27 C: Clone + std::marker::Send + Sync + 'static,
28{
29 configuration: Arc<configuration::Configuration<C>>,
30}
31
32impl<C: Connect> DefaultApiClient<C>
33where
34 C: Clone + std::marker::Send + Sync,
35{
36 pub fn new(configuration: Arc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
37 DefaultApiClient { configuration }
38 }
39}
40
41pub trait DefaultApi: Send + Sync {
42 fn boot_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
43 fn create_vm(
44 &self,
45 vm_config: models::VmConfig,
46 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
47 fn delete_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
48 fn pause_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
49 fn power_button_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
50 fn reboot_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
51 fn resume_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
52 fn shutdown_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
53 fn shutdown_vmm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
54 fn vm_add_device_put(
55 &self,
56 device_config: models::DeviceConfig,
57 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
58 fn vm_add_disk_put(
59 &self,
60 disk_config: models::DiskConfig,
61 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
62 fn vm_add_fs_put(
63 &self,
64 fs_config: models::FsConfig,
65 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
66 fn vm_add_net_put(
67 &self,
68 net_config: models::NetConfig,
69 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
70 fn vm_add_pmem_put(
71 &self,
72 pmem_config: models::PmemConfig,
73 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
74 fn vm_add_user_device_put(
75 &self,
76 vm_add_user_device: models::VmAddUserDevice,
77 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
78 fn vm_add_vdpa_put(
79 &self,
80 vdpa_config: models::VdpaConfig,
81 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
82 fn vm_add_vsock_put(
83 &self,
84 vsock_config: models::VsockConfig,
85 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>>;
86 fn vm_coredump_put(
87 &self,
88 vm_coredump_data: models::VmCoredumpData,
89 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
90 fn vm_counters_get(
91 &self,
92 ) -> Pin<
93 Box<
94 dyn Future<
95 Output = Result<
96 std::collections::HashMap<String, std::collections::HashMap<String, i64>>,
97 Error,
98 >,
99 > + Send,
100 >,
101 >;
102 fn vm_info_get(&self) -> Pin<Box<dyn Future<Output = Result<models::VmInfo, Error>> + Send>>;
103 fn vm_receive_migration_put(
104 &self,
105 receive_migration_data: models::ReceiveMigrationData,
106 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
107 fn vm_remove_device_put(
108 &self,
109 vm_remove_device: models::VmRemoveDevice,
110 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
111 fn vm_resize_put(
112 &self,
113 vm_resize: models::VmResize,
114 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
115 fn vm_resize_zone_put(
116 &self,
117 vm_resize_zone: models::VmResizeZone,
118 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
119 fn vm_restore_put(
120 &self,
121 restore_config: models::RestoreConfig,
122 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
123 fn vm_send_migration_put(
124 &self,
125 send_migration_data: models::SendMigrationData,
126 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
127 fn vm_snapshot_put(
128 &self,
129 vm_snapshot_config: models::VmSnapshotConfig,
130 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
131 fn vmm_nmi_put(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
132 fn vmm_ping_get(
133 &self,
134 ) -> Pin<Box<dyn Future<Output = Result<models::VmmPingResponse, Error>> + Send>>;
135}
136
137impl<C: Connect> DefaultApi for DefaultApiClient<C>
138where
139 C: Clone + std::marker::Send + Sync,
140{
141 #[allow(unused_mut)]
142 fn boot_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
143 let mut req = __internal_request::Request::new(hyper::Method::PUT, "/vm.boot".to_string());
144 req = req.returns_nothing();
145
146 req.execute(self.configuration.borrow())
147 }
148
149 #[allow(unused_mut)]
150 fn create_vm(
151 &self,
152 vm_config: models::VmConfig,
153 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
154 let mut req =
155 __internal_request::Request::new(hyper::Method::PUT, "/vm.create".to_string());
156 req = req.with_body_param(vm_config);
157 req = req.returns_nothing();
158
159 req.execute(self.configuration.borrow())
160 }
161
162 #[allow(unused_mut)]
163 fn delete_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
164 let mut req =
165 __internal_request::Request::new(hyper::Method::PUT, "/vm.delete".to_string());
166 req = req.returns_nothing();
167
168 req.execute(self.configuration.borrow())
169 }
170
171 #[allow(unused_mut)]
172 fn pause_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
173 let mut req = __internal_request::Request::new(hyper::Method::PUT, "/vm.pause".to_string());
174 req = req.returns_nothing();
175
176 req.execute(self.configuration.borrow())
177 }
178
179 #[allow(unused_mut)]
180 fn power_button_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
181 let mut req =
182 __internal_request::Request::new(hyper::Method::PUT, "/vm.power-button".to_string());
183 req = req.returns_nothing();
184
185 req.execute(self.configuration.borrow())
186 }
187
188 #[allow(unused_mut)]
189 fn reboot_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
190 let mut req =
191 __internal_request::Request::new(hyper::Method::PUT, "/vm.reboot".to_string());
192 req = req.returns_nothing();
193
194 req.execute(self.configuration.borrow())
195 }
196
197 #[allow(unused_mut)]
198 fn resume_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
199 let mut req =
200 __internal_request::Request::new(hyper::Method::PUT, "/vm.resume".to_string());
201 req = req.returns_nothing();
202
203 req.execute(self.configuration.borrow())
204 }
205
206 #[allow(unused_mut)]
207 fn shutdown_vm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
208 let mut req =
209 __internal_request::Request::new(hyper::Method::PUT, "/vm.shutdown".to_string());
210 req = req.returns_nothing();
211
212 req.execute(self.configuration.borrow())
213 }
214
215 #[allow(unused_mut)]
216 fn shutdown_vmm(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
217 let mut req =
218 __internal_request::Request::new(hyper::Method::PUT, "/vmm.shutdown".to_string());
219 req = req.returns_nothing();
220
221 req.execute(self.configuration.borrow())
222 }
223
224 #[allow(unused_mut)]
225 fn vm_add_device_put(
226 &self,
227 device_config: models::DeviceConfig,
228 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
229 let mut req =
230 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-device".to_string());
231 req = req.with_body_param(device_config);
232
233 req.execute(self.configuration.borrow())
234 }
235
236 #[allow(unused_mut)]
237 fn vm_add_disk_put(
238 &self,
239 disk_config: models::DiskConfig,
240 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
241 let mut req =
242 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-disk".to_string());
243 req = req.with_body_param(disk_config);
244
245 req.execute(self.configuration.borrow())
246 }
247
248 #[allow(unused_mut)]
249 fn vm_add_fs_put(
250 &self,
251 fs_config: models::FsConfig,
252 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
253 let mut req =
254 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-fs".to_string());
255 req = req.with_body_param(fs_config);
256
257 req.execute(self.configuration.borrow())
258 }
259
260 #[allow(unused_mut)]
261 fn vm_add_net_put(
262 &self,
263 net_config: models::NetConfig,
264 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
265 let mut req =
266 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-net".to_string());
267 req = req.with_body_param(net_config);
268
269 req.execute(self.configuration.borrow())
270 }
271
272 #[allow(unused_mut)]
273 fn vm_add_pmem_put(
274 &self,
275 pmem_config: models::PmemConfig,
276 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
277 let mut req =
278 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-pmem".to_string());
279 req = req.with_body_param(pmem_config);
280
281 req.execute(self.configuration.borrow())
282 }
283
284 #[allow(unused_mut)]
285 fn vm_add_user_device_put(
286 &self,
287 vm_add_user_device: models::VmAddUserDevice,
288 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
289 let mut req =
290 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-user-device".to_string());
291 req = req.with_body_param(vm_add_user_device);
292
293 req.execute(self.configuration.borrow())
294 }
295
296 #[allow(unused_mut)]
297 fn vm_add_vdpa_put(
298 &self,
299 vdpa_config: models::VdpaConfig,
300 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
301 let mut req =
302 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-vdpa".to_string());
303 req = req.with_body_param(vdpa_config);
304
305 req.execute(self.configuration.borrow())
306 }
307
308 #[allow(unused_mut)]
309 fn vm_add_vsock_put(
310 &self,
311 vsock_config: models::VsockConfig,
312 ) -> Pin<Box<dyn Future<Output = Result<models::PciDeviceInfo, Error>> + Send>> {
313 let mut req =
314 __internal_request::Request::new(hyper::Method::PUT, "/vm.add-vsock".to_string());
315 req = req.with_body_param(vsock_config);
316
317 req.execute(self.configuration.borrow())
318 }
319
320 #[allow(unused_mut)]
321 fn vm_coredump_put(
322 &self,
323 vm_coredump_data: models::VmCoredumpData,
324 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
325 let mut req =
326 __internal_request::Request::new(hyper::Method::PUT, "/vm.coredump".to_string());
327 req = req.with_body_param(vm_coredump_data);
328 req = req.returns_nothing();
329
330 req.execute(self.configuration.borrow())
331 }
332
333 #[allow(unused_mut)]
334 fn vm_counters_get(
335 &self,
336 ) -> Pin<
337 Box<
338 dyn Future<
339 Output = Result<
340 std::collections::HashMap<String, std::collections::HashMap<String, i64>>,
341 Error,
342 >,
343 > + Send,
344 >,
345 > {
346 let mut req =
347 __internal_request::Request::new(hyper::Method::GET, "/vm.counters".to_string());
348
349 req.execute(self.configuration.borrow())
350 }
351
352 #[allow(unused_mut)]
353 fn vm_info_get(&self) -> Pin<Box<dyn Future<Output = Result<models::VmInfo, Error>> + Send>> {
354 let mut req = __internal_request::Request::new(hyper::Method::GET, "/vm.info".to_string());
355
356 req.execute(self.configuration.borrow())
357 }
358
359 #[allow(unused_mut)]
360 fn vm_receive_migration_put(
361 &self,
362 receive_migration_data: models::ReceiveMigrationData,
363 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
364 let mut req = __internal_request::Request::new(
365 hyper::Method::PUT,
366 "/vm.receive-migration".to_string(),
367 );
368 req = req.with_body_param(receive_migration_data);
369 req = req.returns_nothing();
370
371 req.execute(self.configuration.borrow())
372 }
373
374 #[allow(unused_mut)]
375 fn vm_remove_device_put(
376 &self,
377 vm_remove_device: models::VmRemoveDevice,
378 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
379 let mut req =
380 __internal_request::Request::new(hyper::Method::PUT, "/vm.remove-device".to_string());
381 req = req.with_body_param(vm_remove_device);
382 req = req.returns_nothing();
383
384 req.execute(self.configuration.borrow())
385 }
386
387 #[allow(unused_mut)]
388 fn vm_resize_put(
389 &self,
390 vm_resize: models::VmResize,
391 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
392 let mut req =
393 __internal_request::Request::new(hyper::Method::PUT, "/vm.resize".to_string());
394 req = req.with_body_param(vm_resize);
395 req = req.returns_nothing();
396
397 req.execute(self.configuration.borrow())
398 }
399
400 #[allow(unused_mut)]
401 fn vm_resize_zone_put(
402 &self,
403 vm_resize_zone: models::VmResizeZone,
404 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
405 let mut req =
406 __internal_request::Request::new(hyper::Method::PUT, "/vm.resize-zone".to_string());
407 req = req.with_body_param(vm_resize_zone);
408 req = req.returns_nothing();
409
410 req.execute(self.configuration.borrow())
411 }
412
413 #[allow(unused_mut)]
414 fn vm_restore_put(
415 &self,
416 restore_config: models::RestoreConfig,
417 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
418 let mut req =
419 __internal_request::Request::new(hyper::Method::PUT, "/vm.restore".to_string());
420 req = req.with_body_param(restore_config);
421 req = req.returns_nothing();
422
423 req.execute(self.configuration.borrow())
424 }
425
426 #[allow(unused_mut)]
427 fn vm_send_migration_put(
428 &self,
429 send_migration_data: models::SendMigrationData,
430 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
431 let mut req =
432 __internal_request::Request::new(hyper::Method::PUT, "/vm.send-migration".to_string());
433 req = req.with_body_param(send_migration_data);
434 req = req.returns_nothing();
435
436 req.execute(self.configuration.borrow())
437 }
438
439 #[allow(unused_mut)]
440 fn vm_snapshot_put(
441 &self,
442 vm_snapshot_config: models::VmSnapshotConfig,
443 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
444 let mut req =
445 __internal_request::Request::new(hyper::Method::PUT, "/vm.snapshot".to_string());
446 req = req.with_body_param(vm_snapshot_config);
447 req = req.returns_nothing();
448
449 req.execute(self.configuration.borrow())
450 }
451
452 #[allow(unused_mut)]
453 fn vmm_nmi_put(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
454 let mut req = __internal_request::Request::new(hyper::Method::PUT, "/vmm.nmi".to_string());
455 req = req.returns_nothing();
456
457 req.execute(self.configuration.borrow())
458 }
459
460 #[allow(unused_mut)]
461 fn vmm_ping_get(
462 &self,
463 ) -> Pin<Box<dyn Future<Output = Result<models::VmmPingResponse, Error>> + Send>> {
464 let mut req = __internal_request::Request::new(hyper::Method::GET, "/vmm.ping".to_string());
465
466 req.execute(self.configuration.borrow())
467 }
468}