podman_rest_client/v5/apis/
secrets_compat.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 SecretsCompat: HasConfig + Send + Sync {
8 fn secret_list<'a>(
14 &'a self,
15 params: Option<crate::v5::params::SecretList<'a>>,
16 ) -> Pin<
17 Box<
18 dyn Future<Output = Result<Vec<crate::v5::models::SecretInfoReportCompat>, Error>>
19 + Send
20 + 'a,
21 >,
22 > {
23 Box::pin(request::execute_request_json(
24 self.get_config(),
25 move |mut req_builder: Builder| {
26 req_builder = req_builder.method("GET");
27 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
28 let mut request_path = request_url.path().to_owned();
29 if request_path.ends_with('/') {
30 request_path.pop();
31 }
32 request_path.push_str("/secrets");
33 request_url.set_path(&request_path);
34 if let Some(params) = ¶ms {
35 let mut query_pairs = request_url.query_pairs_mut();
36 if let Some(filters) = params.filters {
37 query_pairs.append_pair("filters", filters);
38 }
39 }
40 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
41 req_builder = req_builder.uri(hyper_uri);
42 Ok(req_builder.body(String::new())?)
43 },
44 ))
45 }
46 fn secret_delete<'a>(
50 &'a self,
51 name: &'a str,
52 ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> {
53 Box::pin(request::execute_request_unit(
54 self.get_config(),
55 move |mut req_builder: Builder| {
56 req_builder = req_builder.method("DELETE");
57 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
58 let mut request_path = request_url.path().to_owned();
59 if request_path.ends_with('/') {
60 request_path.pop();
61 }
62 request_path.push_str("/secrets/{name}");
63 request_path = request_path.replace("{name}", name);
64 request_url.set_path(&request_path);
65 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
66 req_builder = req_builder.uri(hyper_uri);
67 Ok(req_builder.body(String::new())?)
68 },
69 ))
70 }
71 fn secret_inspect<'a>(
75 &'a self,
76 name: &'a str,
77 ) -> Pin<
78 Box<
79 dyn Future<Output = Result<crate::v5::models::SecretInfoReportCompat, Error>>
80 + Send
81 + 'a,
82 >,
83 > {
84 Box::pin(request::execute_request_json(
85 self.get_config(),
86 move |mut req_builder: Builder| {
87 req_builder = req_builder.method("GET");
88 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
89 let mut request_path = request_url.path().to_owned();
90 if request_path.ends_with('/') {
91 request_path.pop();
92 }
93 request_path.push_str("/secrets/{name}");
94 request_path = request_path.replace("{name}", name);
95 request_url.set_path(&request_path);
96 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
97 req_builder = req_builder.uri(hyper_uri);
98 Ok(req_builder.body(String::new())?)
99 },
100 ))
101 }
102 fn secret_create<'a>(
106 &'a self,
107 create: crate::v5::models::SecretCreate,
108 ) -> Pin<
109 Box<
110 dyn Future<Output = Result<crate::v5::models::SecretCreateResponse, Error>> + Send + 'a,
111 >,
112 > {
113 Box::pin(request::execute_request_json(
114 self.get_config(),
115 move |mut req_builder: Builder| {
116 req_builder = req_builder.method("POST");
117 let mut request_url = url::Url::parse(self.get_config().get_base_path())?;
118 let mut request_path = request_url.path().to_owned();
119 if request_path.ends_with('/') {
120 request_path.pop();
121 }
122 request_path.push_str("/secrets/create");
123 request_url.set_path(&request_path);
124 let hyper_uri: hyper::Uri = request_url.as_str().parse()?;
125 req_builder = req_builder.uri(hyper_uri);
126 let body = serde_json::to_string(&create)?;
127 req_builder = req_builder.header(hyper::header::CONTENT_TYPE, "application/json");
128 req_builder = req_builder.header(hyper::header::CONTENT_LENGTH, body.len());
129 Ok(req_builder.body(body)?)
130 },
131 ))
132 }
133}