podman_autogen_api/apis/
secrets_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 SecretsApiClient<C: Connect>
26where
27    C: Clone + std::marker::Send + Sync + 'static,
28{
29    configuration: Arc<configuration::Configuration<C>>,
30}
31
32impl<C: Connect> SecretsApiClient<C>
33where
34    C: Clone + std::marker::Send + Sync,
35{
36    pub fn new(configuration: Arc<configuration::Configuration<C>>) -> SecretsApiClient<C> {
37        SecretsApiClient { configuration }
38    }
39}
40
41pub trait SecretsApi: Send + Sync {
42    fn secret_create_libpod(
43        &self,
44        name: &str,
45        driver: Option<&str>,
46        driveropts: Option<&str>,
47        labels: Option<&str>,
48        request: Option<&str>,
49    ) -> Pin<Box<dyn Future<Output = Result<models::SecretCreateLibpod201Response, Error>> + Send>>;
50    fn secret_delete_libpod(
51        &self,
52        name: &str,
53        all: Option<bool>,
54    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
55    fn secret_exists_libpod(
56        &self,
57        name: &str,
58    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
59    fn secret_inspect_libpod(
60        &self,
61        name: &str,
62        showsecret: Option<bool>,
63    ) -> Pin<Box<dyn Future<Output = Result<models::SecretInfoReport, Error>> + Send>>;
64    fn secret_list_libpod(
65        &self,
66        filters: Option<&str>,
67    ) -> Pin<Box<dyn Future<Output = Result<Vec<models::SecretInfoReport>, Error>> + Send>>;
68}
69
70impl<C: Connect> SecretsApi for SecretsApiClient<C>
71where
72    C: Clone + std::marker::Send + Sync,
73{
74    #[allow(unused_mut)]
75    fn secret_create_libpod(
76        &self,
77        name: &str,
78        driver: Option<&str>,
79        driveropts: Option<&str>,
80        labels: Option<&str>,
81        request: Option<&str>,
82    ) -> Pin<Box<dyn Future<Output = Result<models::SecretCreateLibpod201Response, Error>> + Send>>
83    {
84        let mut req = __internal_request::Request::new(
85            hyper::Method::POST,
86            "/libpod/secrets/create".to_string(),
87        );
88        req = req.with_query_param("name".to_string(), name.to_string());
89        if let Some(ref s) = driver {
90            let query_value = s.to_string();
91            req = req.with_query_param("driver".to_string(), query_value);
92        }
93        if let Some(ref s) = driveropts {
94            let query_value = s.to_string();
95            req = req.with_query_param("driveropts".to_string(), query_value);
96        }
97        if let Some(ref s) = labels {
98            let query_value = s.to_string();
99            req = req.with_query_param("labels".to_string(), query_value);
100        }
101        req = req.with_body_param(request);
102
103        req.execute(self.configuration.borrow())
104    }
105
106    #[allow(unused_mut)]
107    fn secret_delete_libpod(
108        &self,
109        name: &str,
110        all: Option<bool>,
111    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
112        let mut req = __internal_request::Request::new(
113            hyper::Method::DELETE,
114            "/libpod/secrets/{name}".to_string(),
115        );
116        if let Some(ref s) = all {
117            let query_value = s.to_string();
118            req = req.with_query_param("all".to_string(), query_value);
119        }
120        req = req.with_path_param("name".to_string(), name.to_string());
121        req = req.returns_nothing();
122
123        req.execute(self.configuration.borrow())
124    }
125
126    #[allow(unused_mut)]
127    fn secret_exists_libpod(
128        &self,
129        name: &str,
130    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
131        let mut req = __internal_request::Request::new(
132            hyper::Method::GET,
133            "/libpod/secrets/{name}/exists".to_string(),
134        );
135        req = req.with_path_param("name".to_string(), name.to_string());
136        req = req.returns_nothing();
137
138        req.execute(self.configuration.borrow())
139    }
140
141    #[allow(unused_mut)]
142    fn secret_inspect_libpod(
143        &self,
144        name: &str,
145        showsecret: Option<bool>,
146    ) -> Pin<Box<dyn Future<Output = Result<models::SecretInfoReport, Error>> + Send>> {
147        let mut req = __internal_request::Request::new(
148            hyper::Method::GET,
149            "/libpod/secrets/{name}/json".to_string(),
150        );
151        if let Some(ref s) = showsecret {
152            let query_value = s.to_string();
153            req = req.with_query_param("showsecret".to_string(), query_value);
154        }
155        req = req.with_path_param("name".to_string(), name.to_string());
156
157        req.execute(self.configuration.borrow())
158    }
159
160    #[allow(unused_mut)]
161    fn secret_list_libpod(
162        &self,
163        filters: Option<&str>,
164    ) -> Pin<Box<dyn Future<Output = Result<Vec<models::SecretInfoReport>, Error>> + Send>> {
165        let mut req = __internal_request::Request::new(
166            hyper::Method::GET,
167            "/libpod/secrets/json".to_string(),
168        );
169        if let Some(ref s) = filters {
170            let query_value = s.to_string();
171            req = req.with_query_param("filters".to_string(), query_value);
172        }
173
174        req.execute(self.configuration.borrow())
175    }
176}