podman_rest_client/v5/apis/
secrets.rs1use crate::api_common::config::HasConfig;
2use crate::api_common::request;
3use crate::api_common::Error;
4use http::request::Builder;
5use std::future::Future;
6use std::pin::Pin;
7pub trait Secrets: HasConfig + Send + Sync {
8 fn secret_delete_libpod<'a>(
12 &'a self,
13 name: &'a str,
14 params: Option<crate::v5::params::SecretDeleteLibpod>,
15 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
16 Box::pin(request::execute_request_unit(
17 self.get_config(),
18 move |mut req_builder: Builder| {
19 req_builder = req_builder.method("DELETE");
20 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
21 let mut request_path = request_url.path().to_owned();
22 if request_path.ends_with('/') {
23 request_path.pop();
24 }
25 request_path.push_str("/libpod/secrets/{name}");
26 request_path = request_path.replace("{name}", name);
27 request_url.set_path(&request_path);
28 if let Some(params) = ¶ms {
29 let mut query_pairs = request_url.query_pairs_mut();
30 if let Some(all) = params.all {
31 query_pairs.append_pair("all", &all.to_string());
32 }
33 }
34 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
35 req_builder = req_builder.uri(hyper_uri);
36 Ok(req_builder.body(String::new())?)
37 },
38 ))
39 }
40 fn secret_exists_libpod<'a>(
44 &'a self,
45 name: &'a str,
46 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
47 Box::pin(request::execute_request_unit(
48 self.get_config(),
49 move |mut req_builder: Builder| {
50 req_builder = req_builder.method("GET");
51 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
52 let mut request_path = request_url.path().to_owned();
53 if request_path.ends_with('/') {
54 request_path.pop();
55 }
56 request_path.push_str("/libpod/secrets/{name}/exists");
57 request_path = request_path.replace("{name}", name);
58 request_url.set_path(&request_path);
59 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
60 req_builder = req_builder.uri(hyper_uri);
61 Ok(req_builder.body(String::new())?)
62 },
63 ))
64 }
65 fn secret_inspect_libpod<'a>(
69 &'a self,
70 name: &'a str,
71 params: Option<crate::v5::params::SecretInspectLibpod>,
72 ) -> Pin<Box<dyn Future<Output = Result<crate::v5::models::SecretInfoReport, Error>> + Send + 'a>>
73 {
74 Box::pin(request::execute_request_json(
75 self.get_config(),
76 move |mut req_builder: Builder| {
77 req_builder = req_builder.method("GET");
78 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
79 let mut request_path = request_url.path().to_owned();
80 if request_path.ends_with('/') {
81 request_path.pop();
82 }
83 request_path.push_str("/libpod/secrets/{name}/json");
84 request_path = request_path.replace("{name}", name);
85 request_url.set_path(&request_path);
86 if let Some(params) = ¶ms {
87 let mut query_pairs = request_url.query_pairs_mut();
88 if let Some(showsecret) = params.showsecret {
89 query_pairs.append_pair("showsecret", &showsecret.to_string());
90 }
91 }
92 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
93 req_builder = req_builder.uri(hyper_uri);
94 Ok(req_builder.body(String::new())?)
95 },
96 ))
97 }
98 fn secret_create_libpod<'a>(
102 &'a self,
103 params: Option<crate::v5::params::SecretCreateLibpod<'a>>,
104 request: String,
105 ) -> Pin<
106 Box<
107 dyn Future<Output = Result<crate::v5::models::SecretCreateResponse, Error>> + Send + 'a,
108 >,
109 > {
110 Box::pin(request::execute_request_json(
111 self.get_config(),
112 move |mut req_builder: Builder| {
113 req_builder = req_builder.method("POST");
114 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
115 let mut request_path = request_url.path().to_owned();
116 if request_path.ends_with('/') {
117 request_path.pop();
118 }
119 request_path.push_str("/libpod/secrets/create");
120 request_url.set_path(&request_path);
121 if let Some(params) = ¶ms {
122 let mut query_pairs = request_url.query_pairs_mut();
123 query_pairs.append_pair("name", params.name);
124 if let Some(driver) = params.driver {
125 query_pairs.append_pair("driver", driver);
126 }
127 if let Some(driveropts) = params.driveropts {
128 query_pairs.append_pair("driveropts", driveropts);
129 }
130 if let Some(labels) = params.labels {
131 query_pairs.append_pair("labels", labels);
132 }
133 }
134 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
135 req_builder = req_builder.uri(hyper_uri);
136 let body = serde_json::to_string(&request)?;
137 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
138 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
139 Ok(req_builder.body(body)?)
140 },
141 ))
142 }
143 fn secret_list_libpod<'a>(
149 &'a self,
150 params: Option<crate::v5::params::SecretListLibpod<'a>>,
151 ) -> Pin<
152 Box<
153 dyn Future<Output = Result<Vec<crate::v5::models::SecretInfoReport>, Error>>
154 + Send
155 + 'a,
156 >,
157 > {
158 Box::pin(request::execute_request_json(
159 self.get_config(),
160 move |mut req_builder: Builder| {
161 req_builder = req_builder.method("GET");
162 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
163 let mut request_path = request_url.path().to_owned();
164 if request_path.ends_with('/') {
165 request_path.pop();
166 }
167 request_path.push_str("/libpod/secrets/json");
168 request_url.set_path(&request_path);
169 if let Some(params) = ¶ms {
170 let mut query_pairs = request_url.query_pairs_mut();
171 if let Some(filters) = params.filters {
172 query_pairs.append_pair("filters", filters);
173 }
174 }
175 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
176 req_builder = req_builder.uri(hyper_uri);
177 Ok(req_builder.body(String::new())?)
178 },
179 ))
180 }
181}