Skip to main content

windmill_api/apis/
config_api.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.881.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`delete_config`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteConfigError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_autoscaling_diagnostics`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetAutoscalingDiagnosticsError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_config`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetConfigError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`list_all_dedicated_with_deps`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ListAllDedicatedWithDepsError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`list_all_workspace_dependencies`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ListAllWorkspaceDependenciesError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`list_autoscaling_events`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ListAutoscalingEventsError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`list_available_python_versions`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ListAvailablePythonVersionsError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`list_configs`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ListConfigsError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`list_worker_groups`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ListWorkerGroupsError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`native_kubernetes_autoscaling_healthcheck`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum NativeKubernetesAutoscalingHealthcheckError {
85    Status400(String),
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`set_autoscaling_recording`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum SetAutoscalingRecordingError {
93    UnknownValue(serde_json::Value),
94}
95
96/// struct for typed errors of method [`test_autoscaling`]
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum TestAutoscalingError {
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`update_config`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum UpdateConfigError {
107    UnknownValue(serde_json::Value),
108}
109
110
111pub async fn delete_config(configuration: &configuration::Configuration, name: &str) -> Result<String, Error<DeleteConfigError>> {
112    let local_var_configuration = configuration;
113
114    let local_var_client = &local_var_configuration.client;
115
116    let local_var_uri_str = format!("{}/configs/update/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name));
117    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
118
119    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
120        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
121    }
122    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
123        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
124    };
125
126    let local_var_req = local_var_req_builder.build()?;
127    let local_var_resp = local_var_client.execute(local_var_req).await?;
128
129    let local_var_status = local_var_resp.status();
130    let local_var_content = local_var_resp.text().await?;
131
132    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
133        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
134    } else {
135        let local_var_entity: Option<DeleteConfigError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
136        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
137        Err(Error::ResponseError(local_var_error))
138    }
139}
140
141pub async fn get_autoscaling_diagnostics(configuration: &configuration::Configuration, worker_group: &str, include_decisions: Option<bool>) -> Result<models::AutoscalingDiagnostics, Error<GetAutoscalingDiagnosticsError>> {
142    let local_var_configuration = configuration;
143
144    let local_var_client = &local_var_configuration.client;
145
146    let local_var_uri_str = format!("{}/configs/autoscaling_diagnostics/{worker_group}", local_var_configuration.base_path, worker_group=crate::apis::urlencode(worker_group));
147    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
148
149    if let Some(ref local_var_str) = include_decisions {
150        local_var_req_builder = local_var_req_builder.query(&[("include_decisions", &local_var_str.to_string())]);
151    }
152    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
153        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
154    }
155    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
156        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
157    };
158
159    let local_var_req = local_var_req_builder.build()?;
160    let local_var_resp = local_var_client.execute(local_var_req).await?;
161
162    let local_var_status = local_var_resp.status();
163    let local_var_content = local_var_resp.text().await?;
164
165    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
166        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
167    } else {
168        let local_var_entity: Option<GetAutoscalingDiagnosticsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
169        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
170        Err(Error::ResponseError(local_var_error))
171    }
172}
173
174pub async fn get_config(configuration: &configuration::Configuration, name: &str) -> Result<models::Configs, Error<GetConfigError>> {
175    let local_var_configuration = configuration;
176
177    let local_var_client = &local_var_configuration.client;
178
179    let local_var_uri_str = format!("{}/configs/get/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name));
180    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
181
182    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
183        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
184    }
185    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
186        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
187    };
188
189    let local_var_req = local_var_req_builder.build()?;
190    let local_var_resp = local_var_client.execute(local_var_req).await?;
191
192    let local_var_status = local_var_resp.status();
193    let local_var_content = local_var_resp.text().await?;
194
195    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
196        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
197    } else {
198        let local_var_entity: Option<GetConfigError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
199        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
200        Err(Error::ResponseError(local_var_error))
201    }
202}
203
204pub async fn list_all_dedicated_with_deps(configuration: &configuration::Configuration, ) -> Result<Vec<models::ListAllDedicatedWithDeps200ResponseInner>, Error<ListAllDedicatedWithDepsError>> {
205    let local_var_configuration = configuration;
206
207    let local_var_client = &local_var_configuration.client;
208
209    let local_var_uri_str = format!("{}/configs/list_all_dedicated_with_deps", local_var_configuration.base_path);
210    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
211
212    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
213        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
214    }
215    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
216        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
217    };
218
219    let local_var_req = local_var_req_builder.build()?;
220    let local_var_resp = local_var_client.execute(local_var_req).await?;
221
222    let local_var_status = local_var_resp.status();
223    let local_var_content = local_var_resp.text().await?;
224
225    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
226        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
227    } else {
228        let local_var_entity: Option<ListAllDedicatedWithDepsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
229        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
230        Err(Error::ResponseError(local_var_error))
231    }
232}
233
234pub async fn list_all_workspace_dependencies(configuration: &configuration::Configuration, ) -> Result<Vec<models::ListAllWorkspaceDependencies200ResponseInner>, Error<ListAllWorkspaceDependenciesError>> {
235    let local_var_configuration = configuration;
236
237    let local_var_client = &local_var_configuration.client;
238
239    let local_var_uri_str = format!("{}/configs/list_all_workspace_dependencies", local_var_configuration.base_path);
240    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
241
242    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
243        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
244    }
245    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
246        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
247    };
248
249    let local_var_req = local_var_req_builder.build()?;
250    let local_var_resp = local_var_client.execute(local_var_req).await?;
251
252    let local_var_status = local_var_resp.status();
253    let local_var_content = local_var_resp.text().await?;
254
255    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
256        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
257    } else {
258        let local_var_entity: Option<ListAllWorkspaceDependenciesError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
259        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
260        Err(Error::ResponseError(local_var_error))
261    }
262}
263
264pub async fn list_autoscaling_events(configuration: &configuration::Configuration, worker_group: &str, page: Option<i32>, per_page: Option<i32>) -> Result<Vec<models::AutoscalingEvent>, Error<ListAutoscalingEventsError>> {
265    let local_var_configuration = configuration;
266
267    let local_var_client = &local_var_configuration.client;
268
269    let local_var_uri_str = format!("{}/configs/list_autoscaling_events/{worker_group}", local_var_configuration.base_path, worker_group=crate::apis::urlencode(worker_group));
270    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
271
272    if let Some(ref local_var_str) = page {
273        local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
274    }
275    if let Some(ref local_var_str) = per_page {
276        local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
277    }
278    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
279        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
280    }
281    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
282        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
283    };
284
285    let local_var_req = local_var_req_builder.build()?;
286    let local_var_resp = local_var_client.execute(local_var_req).await?;
287
288    let local_var_status = local_var_resp.status();
289    let local_var_content = local_var_resp.text().await?;
290
291    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
292        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
293    } else {
294        let local_var_entity: Option<ListAutoscalingEventsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
295        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
296        Err(Error::ResponseError(local_var_error))
297    }
298}
299
300pub async fn list_available_python_versions(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<ListAvailablePythonVersionsError>> {
301    let local_var_configuration = configuration;
302
303    let local_var_client = &local_var_configuration.client;
304
305    let local_var_uri_str = format!("{}/configs/list_available_python_versions", local_var_configuration.base_path);
306    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
307
308    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
309        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
310    }
311    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
312        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
313    };
314
315    let local_var_req = local_var_req_builder.build()?;
316    let local_var_resp = local_var_client.execute(local_var_req).await?;
317
318    let local_var_status = local_var_resp.status();
319    let local_var_content = local_var_resp.text().await?;
320
321    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
322        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
323    } else {
324        let local_var_entity: Option<ListAvailablePythonVersionsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
325        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
326        Err(Error::ResponseError(local_var_error))
327    }
328}
329
330pub async fn list_configs(configuration: &configuration::Configuration, ) -> Result<Vec<models::Config>, Error<ListConfigsError>> {
331    let local_var_configuration = configuration;
332
333    let local_var_client = &local_var_configuration.client;
334
335    let local_var_uri_str = format!("{}/configs/list", local_var_configuration.base_path);
336    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
337
338    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
339        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
340    }
341    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
342        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
343    };
344
345    let local_var_req = local_var_req_builder.build()?;
346    let local_var_resp = local_var_client.execute(local_var_req).await?;
347
348    let local_var_status = local_var_resp.status();
349    let local_var_content = local_var_resp.text().await?;
350
351    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
352        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
353    } else {
354        let local_var_entity: Option<ListConfigsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
355        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
356        Err(Error::ResponseError(local_var_error))
357    }
358}
359
360pub async fn list_worker_groups(configuration: &configuration::Configuration, ) -> Result<Vec<models::ListWorkerGroups200ResponseInner>, Error<ListWorkerGroupsError>> {
361    let local_var_configuration = configuration;
362
363    let local_var_client = &local_var_configuration.client;
364
365    let local_var_uri_str = format!("{}/configs/list_worker_groups", local_var_configuration.base_path);
366    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
367
368    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
369        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
370    }
371    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
372        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
373    };
374
375    let local_var_req = local_var_req_builder.build()?;
376    let local_var_resp = local_var_client.execute(local_var_req).await?;
377
378    let local_var_status = local_var_resp.status();
379    let local_var_content = local_var_resp.text().await?;
380
381    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
382        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
383    } else {
384        let local_var_entity: Option<ListWorkerGroupsError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
385        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
386        Err(Error::ResponseError(local_var_error))
387    }
388}
389
390pub async fn native_kubernetes_autoscaling_healthcheck(configuration: &configuration::Configuration, ) -> Result<(), Error<NativeKubernetesAutoscalingHealthcheckError>> {
391    let local_var_configuration = configuration;
392
393    let local_var_client = &local_var_configuration.client;
394
395    let local_var_uri_str = format!("{}/configs/native_kubernetes_autoscaling_healthcheck", local_var_configuration.base_path);
396    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
397
398    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
399        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
400    }
401    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
402        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
403    };
404
405    let local_var_req = local_var_req_builder.build()?;
406    let local_var_resp = local_var_client.execute(local_var_req).await?;
407
408    let local_var_status = local_var_resp.status();
409    let local_var_content = local_var_resp.text().await?;
410
411    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
412        Ok(())
413    } else {
414        let local_var_entity: Option<NativeKubernetesAutoscalingHealthcheckError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
415        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
416        Err(Error::ResponseError(local_var_error))
417    }
418}
419
420pub async fn set_autoscaling_recording(configuration: &configuration::Configuration, worker_group: &str, set_autoscaling_recording_request: models::SetAutoscalingRecordingRequest) -> Result<String, Error<SetAutoscalingRecordingError>> {
421    let local_var_configuration = configuration;
422
423    let local_var_client = &local_var_configuration.client;
424
425    let local_var_uri_str = format!("{}/configs/autoscaling_recording/{worker_group}", local_var_configuration.base_path, worker_group=crate::apis::urlencode(worker_group));
426    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
427
428    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
429        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
430    }
431    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
432        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
433    };
434    local_var_req_builder = local_var_req_builder.json(&set_autoscaling_recording_request);
435
436    let local_var_req = local_var_req_builder.build()?;
437    let local_var_resp = local_var_client.execute(local_var_req).await?;
438
439    let local_var_status = local_var_resp.status();
440    let local_var_content = local_var_resp.text().await?;
441
442    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
443        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
444    } else {
445        let local_var_entity: Option<SetAutoscalingRecordingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
446        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
447        Err(Error::ResponseError(local_var_error))
448    }
449}
450
451pub async fn test_autoscaling(configuration: &configuration::Configuration, worker_group: &str, test_autoscaling_request: models::TestAutoscalingRequest) -> Result<models::TestAutoscaling200Response, Error<TestAutoscalingError>> {
452    let local_var_configuration = configuration;
453
454    let local_var_client = &local_var_configuration.client;
455
456    let local_var_uri_str = format!("{}/configs/test_autoscaling/{worker_group}", local_var_configuration.base_path, worker_group=crate::apis::urlencode(worker_group));
457    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
458
459    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
460        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
461    }
462    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
463        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
464    };
465    local_var_req_builder = local_var_req_builder.json(&test_autoscaling_request);
466
467    let local_var_req = local_var_req_builder.build()?;
468    let local_var_resp = local_var_client.execute(local_var_req).await?;
469
470    let local_var_status = local_var_resp.status();
471    let local_var_content = local_var_resp.text().await?;
472
473    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
474        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
475    } else {
476        let local_var_entity: Option<TestAutoscalingError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
477        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
478        Err(Error::ResponseError(local_var_error))
479    }
480}
481
482pub async fn update_config(configuration: &configuration::Configuration, name: &str, body: Option<serde_json::Value>) -> Result<String, Error<UpdateConfigError>> {
483    let local_var_configuration = configuration;
484
485    let local_var_client = &local_var_configuration.client;
486
487    let local_var_uri_str = format!("{}/configs/update/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(name));
488    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
489
490    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
491        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
492    }
493    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
494        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
495    };
496    local_var_req_builder = local_var_req_builder.json(&body);
497
498    let local_var_req = local_var_req_builder.build()?;
499    let local_var_resp = local_var_client.execute(local_var_req).await?;
500
501    let local_var_status = local_var_resp.status();
502    let local_var_content = local_var_resp.text().await?;
503
504    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
505        crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).map_err(Error::from)
506    } else {
507        let local_var_entity: Option<UpdateConfigError> = crate::from_str_patched/* Externally injected from /build.nu */(&local_var_content).ok();
508        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
509        Err(Error::ResponseError(local_var_error))
510    }
511}
512