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