podman_autogen_api/apis/
volumes_api.rs

1/*
2 * supports a RESTful API for the Libpod library
3 *
4 * This documentation describes the Podman v2.x+ RESTful API. It consists of a Docker-compatible API and a Libpod API providing support for Podman’s unique features such as pods.  To start the service and keep it running for 5,000 seconds (-t 0 runs forever):  podman system service -t 5000 &  You can then use cURL on the socket using requests documented below.  NOTE: if you install the package podman-docker, it will create a symbolic link for /run/docker.sock to /run/podman/podman.sock  NOTE: Some fields in the API response JSON are encoded as omitempty, which means that if said field has a zero value, they will not be encoded in the API response. This is a feature to help reduce the size of the JSON responses returned via the API.  NOTE: Due to the limitations of [go-swagger](https://github.com/go-swagger/go-swagger), some field values that have a complex type show up as null in the docs as well as in the API responses. This is because the zero value for the field type is null. The field description in the docs will state what type the field is expected to be for such cases.  See podman-system-service(1) for more information.  Quick Examples:  'podman info'  curl --unix-socket /run/podman/podman.sock http://d/v5.0.0/libpod/info  'podman pull quay.io/containers/podman'  curl -XPOST --unix-socket /run/podman/podman.sock -v 'http://d/v5.0.0/images/create?fromImage=quay.io%2Fcontainers%2Fpodman'  'podman list images'  curl --unix-socket /run/podman/podman.sock -v 'http://d/v5.0.0/libpod/images/json' | jq
5 *
6 * The version of the OpenAPI document: 5.0.0
7 * Contact: podman@lists.podman.io
8 * Generated by: https://openapi-generator.tech
9 */
10
11use 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 VolumesApiClient<C: Connect>
26where
27    C: Clone + std::marker::Send + Sync + 'static,
28{
29    configuration: Arc<configuration::Configuration<C>>,
30}
31
32impl<C: Connect> VolumesApiClient<C>
33where
34    C: Clone + std::marker::Send + Sync,
35{
36    pub fn new(configuration: Arc<configuration::Configuration<C>>) -> VolumesApiClient<C> {
37        VolumesApiClient { configuration }
38    }
39}
40
41pub trait VolumesApi: Send + Sync {
42    fn volume_create_libpod(
43        &self,
44        create: Option<models::VolumeCreateOptions>,
45    ) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>>;
46    fn volume_delete_libpod(
47        &self,
48        name: &str,
49        force: Option<bool>,
50    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
51    fn volume_exists_libpod(
52        &self,
53        name: &str,
54    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
55    fn volume_inspect_libpod(
56        &self,
57        name: &str,
58    ) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>>;
59    fn volume_list_libpod(
60        &self,
61        filters: Option<&str>,
62    ) -> Pin<Box<dyn Future<Output = Result<Vec<models::VolumeConfigResponse>, Error>> + Send>>;
63    fn volume_prune_libpod(
64        &self,
65        filters: Option<&str>,
66    ) -> Pin<Box<dyn Future<Output = Result<Vec<models::PruneReport>, Error>> + Send>>;
67}
68
69impl<C: Connect> VolumesApi for VolumesApiClient<C>
70where
71    C: Clone + std::marker::Send + Sync,
72{
73    #[allow(unused_mut)]
74    fn volume_create_libpod(
75        &self,
76        create: Option<models::VolumeCreateOptions>,
77    ) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>> {
78        let mut req = __internal_request::Request::new(
79            hyper::Method::POST,
80            "/libpod/volumes/create".to_string(),
81        );
82        req = req.with_body_param(create);
83
84        req.execute(self.configuration.borrow())
85    }
86
87    #[allow(unused_mut)]
88    fn volume_delete_libpod(
89        &self,
90        name: &str,
91        force: Option<bool>,
92    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
93        let mut req = __internal_request::Request::new(
94            hyper::Method::DELETE,
95            "/libpod/volumes/{name}".to_string(),
96        );
97        if let Some(ref s) = force {
98            let query_value = s.to_string();
99            req = req.with_query_param("force".to_string(), query_value);
100        }
101        req = req.with_path_param("name".to_string(), name.to_string());
102        req = req.returns_nothing();
103
104        req.execute(self.configuration.borrow())
105    }
106
107    #[allow(unused_mut)]
108    fn volume_exists_libpod(
109        &self,
110        name: &str,
111    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
112        let mut req = __internal_request::Request::new(
113            hyper::Method::GET,
114            "/libpod/volumes/{name}/exists".to_string(),
115        );
116        req = req.with_path_param("name".to_string(), name.to_string());
117        req = req.returns_nothing();
118
119        req.execute(self.configuration.borrow())
120    }
121
122    #[allow(unused_mut)]
123    fn volume_inspect_libpod(
124        &self,
125        name: &str,
126    ) -> Pin<Box<dyn Future<Output = Result<models::VolumeConfigResponse, Error>> + Send>> {
127        let mut req = __internal_request::Request::new(
128            hyper::Method::GET,
129            "/libpod/volumes/{name}/json".to_string(),
130        );
131        req = req.with_path_param("name".to_string(), name.to_string());
132
133        req.execute(self.configuration.borrow())
134    }
135
136    #[allow(unused_mut)]
137    fn volume_list_libpod(
138        &self,
139        filters: Option<&str>,
140    ) -> Pin<Box<dyn Future<Output = Result<Vec<models::VolumeConfigResponse>, Error>> + Send>>
141    {
142        let mut req = __internal_request::Request::new(
143            hyper::Method::GET,
144            "/libpod/volumes/json".to_string(),
145        );
146        if let Some(ref s) = filters {
147            let query_value = s.to_string();
148            req = req.with_query_param("filters".to_string(), query_value);
149        }
150
151        req.execute(self.configuration.borrow())
152    }
153
154    #[allow(unused_mut)]
155    fn volume_prune_libpod(
156        &self,
157        filters: Option<&str>,
158    ) -> Pin<Box<dyn Future<Output = Result<Vec<models::PruneReport>, Error>> + Send>> {
159        let mut req = __internal_request::Request::new(
160            hyper::Method::POST,
161            "/libpod/volumes/prune".to_string(),
162        );
163        if let Some(ref s) = filters {
164            let query_value = s.to_string();
165            req = req.with_query_param("filters".to_string(), query_value);
166        }
167
168        req.execute(self.configuration.borrow())
169    }
170}