1use super::*;
4
5impl CfsTrait for StaticBackendDispatcher {
6 type T = Pin<Box<dyn AsyncBufRead + Send>>;
7
8 async fn get_cfs_health(&self) -> Result<(), Error> {
9 dispatch!(self, get_cfs_health)
10 }
11
12 async fn get_session_logs_stream(
13 &self,
14 token: &str,
15 site_name: &str,
16 cfs_session_name: &str,
17 timestamps: bool,
18 k8s: &K8sDetails,
19 ) -> Result<Pin<Box<dyn AsyncBufRead + Send>>, Error> {
20 dispatch!(
21 self,
22 get_session_logs_stream,
23 token,
24 site_name,
25 cfs_session_name,
26 timestamps,
27 k8s
28 )
29 }
30
31 async fn get_session_logs_stream_by_xname(
32 &self,
33 auth_token: &str,
34 site_name: &str,
35 xname: &str,
36 timestamps: bool,
37 k8s: &K8sDetails,
38 ) -> Result<Pin<Box<dyn AsyncBufRead + Send>>, Error> {
39 dispatch!(
40 self,
41 get_session_logs_stream_by_xname,
42 auth_token,
43 site_name,
44 xname,
45 timestamps,
46 k8s
47 )
48 }
49
50 async fn post_session(
51 &self,
52 token: &str,
53 session: &CfsSessionPostRequest,
54 ) -> Result<CfsSessionGetResponse, Error> {
55 dispatch!(self, post_session, token, session)
56 }
57
58 async fn get_sessions(
59 &self,
60 auth_token: &str,
61 session_name_opt: Option<&String>,
62 limit_opt: Option<u8>,
63 after_id_opt: Option<String>,
64 min_age_opt: Option<String>,
65 max_age_opt: Option<String>,
66 status_opt: Option<String>,
67 name_contains_opt: Option<String>,
68 is_succeded_opt: Option<bool>,
69 tags_opt: Option<String>,
70 ) -> Result<Vec<CfsSessionGetResponse>, Error> {
71 dispatch!(
72 self,
73 get_sessions,
74 auth_token,
75 session_name_opt,
76 limit_opt,
77 after_id_opt,
78 min_age_opt,
79 max_age_opt,
80 status_opt,
81 name_contains_opt,
82 is_succeded_opt,
83 tags_opt
84 )
85 }
86
87 async fn get_and_filter_sessions(
88 &self,
89 token: &str,
90 group_name_vec: Vec<String>,
91 xname_vec: Vec<&str>,
92 min_age_opt: Option<&String>,
93 max_age_opt: Option<&String>,
94 type_opt: Option<&String>,
95 status_opt: Option<&String>,
96 cfs_session_name_opt: Option<&String>,
97 limit_number_opt: Option<&u8>,
98 is_succeded_opt: Option<bool>,
99 ) -> Result<Vec<CfsSessionGetResponse>, Error> {
100 dispatch!(
101 self,
102 get_and_filter_sessions,
103 token,
104 group_name_vec,
105 xname_vec,
106 min_age_opt,
107 max_age_opt,
108 type_opt,
109 status_opt,
110 cfs_session_name_opt,
111 limit_number_opt,
112 is_succeded_opt
113 )
114 }
115
116 async fn delete_and_cancel_session(
117 &self,
118 token: &str,
119 group_available_vec: &[Group],
120 cfs_session: &CfsSessionGetResponse,
121 cfs_component_vec: &[CfsComponent],
122 bss_bootparameter_vec: &[BootParameters],
123 dry_run: bool,
124 ) -> Result<(), Error> {
125 dispatch!(
126 self,
127 delete_and_cancel_session,
128 token,
129 group_available_vec,
130 cfs_session,
131 cfs_component_vec,
132 bss_bootparameter_vec,
133 dry_run
134 )
135 }
136
137 async fn create_configuration_from_repos(
138 &self,
139 gitea_token: &str,
140 gitea_base_url: &str,
141 repo_name_vec: &[&str],
142 local_git_commit_vec: &[&str],
143 playbook_file_name_opt: Option<&str>,
144 ) -> Result<CfsConfigurationRequest, Error> {
145 dispatch!(
146 self,
147 create_configuration_from_repos,
148 gitea_token,
149 gitea_base_url,
150 repo_name_vec,
151 local_git_commit_vec,
152 playbook_file_name_opt
153 )
154 }
155
156 async fn get_configuration(
157 &self,
158 auth_token: &str,
159 cfs_configuration_name_opt: Option<&String>,
160 ) -> Result<Vec<CfsConfigurationResponse>, Error> {
161 dispatch!(
162 self,
163 get_configuration,
164 auth_token,
165 cfs_configuration_name_opt
166 )
167 }
168
169 async fn get_and_filter_configuration(
170 &self,
171 auth_token: &str,
172 configuration_name: Option<&str>,
173 configuration_name_pattern: Option<&str>,
174 group_name_vec: &[String],
175 since_opt: Option<NaiveDateTime>,
176 until_opt: Option<NaiveDateTime>,
177 limit_number_opt: Option<&u8>,
178 ) -> Result<Vec<CfsConfigurationResponse>, Error> {
179 dispatch!(
180 self,
181 get_and_filter_configuration,
182 auth_token,
183 configuration_name,
184 configuration_name_pattern,
185 group_name_vec,
186 since_opt,
187 until_opt,
188 limit_number_opt
189 )
190 }
191
192 async fn get_configuration_layer_details(
193 &self,
194 gitea_base_url: &str,
195 gitea_token: &str,
196 layer: Layer,
197 site_name: &str,
198 ) -> Result<LayerDetails, Error> {
199 dispatch!(
200 self,
201 get_configuration_layer_details,
202 gitea_base_url,
203 gitea_token,
204 layer,
205 site_name
206 )
207 }
208
209 async fn update_runtime_configuration(
210 &self,
211 auth_token: &str,
212 xnames: &[String],
213 desired_configuration: &str,
214 enabled: bool,
215 ) -> Result<(), Error> {
216 dispatch!(
217 self,
218 update_runtime_configuration,
219 auth_token,
220 xnames,
221 desired_configuration,
222 enabled
223 )
224 }
225
226 async fn put_configuration(
227 &self,
228 token: &str,
229 configuration: &CfsConfigurationRequest,
230 configuration_name: &str,
231 overwrite: bool,
232 ) -> Result<CfsConfigurationResponse, Error> {
233 dispatch!(
234 self,
235 put_configuration,
236 token,
237 configuration,
238 configuration_name,
239 overwrite
240 )
241 }
242
243 async fn get_derivatives(
244 &self,
245 auth_token: &str,
246 configuration_name: &str,
247 ) -> Result<
248 (
249 Option<Vec<CfsSessionGetResponse>>,
250 Option<Vec<BosSessionTemplate>>,
251 Option<Vec<Image>>,
252 ),
253 Error,
254 > {
255 dispatch!(self, get_derivatives, auth_token, configuration_name)
256 }
257
258 async fn get_cfs_components(
259 &self,
260 token: &str,
261 configuration_name: Option<&str>,
262 components_ids: Option<&str>,
263 status: Option<&str>,
264 ) -> Result<Vec<CfsComponent>, Error> {
265 dispatch!(
266 self,
267 get_cfs_components,
268 token,
269 configuration_name,
270 components_ids,
271 status
272 )
273 }
274}