1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateAzureTriggerError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteAzureSubscriptionError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteAzureTriggerError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum ExistsAzureTriggerError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetAzureTriggerError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum ListAzureBasicTopicsError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ListAzureNamespaceSubscriptionsError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ListAzureNamespaceTopicsError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ListAzureNamespacesError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ListAzureTriggersError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum SetAzureTriggerModeError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum TestAzureConnectionError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum UpdateAzureTriggerError {
106 UnknownValue(serde_json::Value),
107}
108
109
110pub async fn create_azure_trigger(configuration: &configuration::Configuration, workspace: &str, azure_trigger_data: models::AzureTriggerData) -> Result<String, Error<CreateAzureTriggerError>> {
111 let local_var_configuration = configuration;
112
113 let local_var_client = &local_var_configuration.client;
114
115 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
116 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
117
118 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
119 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
120 }
121 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
122 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
123 };
124 local_var_req_builder = local_var_req_builder.json(&azure_trigger_data);
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(&local_var_content).map_err(Error::from)
134 } else {
135 let local_var_entity: Option<CreateAzureTriggerError> = crate::from_str_patched(&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 delete_azure_subscription(configuration: &configuration::Configuration, workspace: &str, path: &str, azure_delete_subscription: models::AzureDeleteSubscription) -> Result<String, Error<DeleteAzureSubscriptionError>> {
142 let local_var_configuration = configuration;
143
144 let local_var_client = &local_var_configuration.client;
145
146 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/subscriptions/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
147 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
148
149 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
150 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
151 }
152 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
153 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
154 };
155 local_var_req_builder = local_var_req_builder.json(&azure_delete_subscription);
156
157 let local_var_req = local_var_req_builder.build()?;
158 let local_var_resp = local_var_client.execute(local_var_req).await?;
159
160 let local_var_status = local_var_resp.status();
161 let local_var_content = local_var_resp.text().await?;
162
163 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
164 crate::from_str_patched(&local_var_content).map_err(Error::from)
165 } else {
166 let local_var_entity: Option<DeleteAzureSubscriptionError> = crate::from_str_patched(&local_var_content).ok();
167 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
168 Err(Error::ResponseError(local_var_error))
169 }
170}
171
172pub async fn delete_azure_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteAzureTriggerError>> {
173 let local_var_configuration = configuration;
174
175 let local_var_client = &local_var_configuration.client;
176
177 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
178 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
179
180 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
181 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
182 }
183 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
184 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
185 };
186
187 let local_var_req = local_var_req_builder.build()?;
188 let local_var_resp = local_var_client.execute(local_var_req).await?;
189
190 let local_var_status = local_var_resp.status();
191 let local_var_content = local_var_resp.text().await?;
192
193 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
194 crate::from_str_patched(&local_var_content).map_err(Error::from)
195 } else {
196 let local_var_entity: Option<DeleteAzureTriggerError> = crate::from_str_patched(&local_var_content).ok();
197 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
198 Err(Error::ResponseError(local_var_error))
199 }
200}
201
202pub async fn exists_azure_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsAzureTriggerError>> {
203 let local_var_configuration = configuration;
204
205 let local_var_client = &local_var_configuration.client;
206
207 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
208 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
209
210 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
211 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
212 }
213 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
214 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
215 };
216
217 let local_var_req = local_var_req_builder.build()?;
218 let local_var_resp = local_var_client.execute(local_var_req).await?;
219
220 let local_var_status = local_var_resp.status();
221 let local_var_content = local_var_resp.text().await?;
222
223 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
224 crate::from_str_patched(&local_var_content).map_err(Error::from)
225 } else {
226 let local_var_entity: Option<ExistsAzureTriggerError> = crate::from_str_patched(&local_var_content).ok();
227 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
228 Err(Error::ResponseError(local_var_error))
229 }
230}
231
232pub async fn get_azure_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<models::AzureTrigger, Error<GetAzureTriggerError>> {
233 let local_var_configuration = configuration;
234
235 let local_var_client = &local_var_configuration.client;
236
237 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
238 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
239
240 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
241 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
242 }
243 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
244 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
245 };
246
247 let local_var_req = local_var_req_builder.build()?;
248 let local_var_resp = local_var_client.execute(local_var_req).await?;
249
250 let local_var_status = local_var_resp.status();
251 let local_var_content = local_var_resp.text().await?;
252
253 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
254 crate::from_str_patched(&local_var_content).map_err(Error::from)
255 } else {
256 let local_var_entity: Option<GetAzureTriggerError> = crate::from_str_patched(&local_var_content).ok();
257 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
258 Err(Error::ResponseError(local_var_error))
259 }
260}
261
262pub async fn list_azure_basic_topics(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::AzureArmResource>, Error<ListAzureBasicTopicsError>> {
263 let local_var_configuration = configuration;
264
265 let local_var_client = &local_var_configuration.client;
266
267 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/basic/topics/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
268 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
269
270 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
271 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
272 }
273 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
274 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
275 };
276
277 let local_var_req = local_var_req_builder.build()?;
278 let local_var_resp = local_var_client.execute(local_var_req).await?;
279
280 let local_var_status = local_var_resp.status();
281 let local_var_content = local_var_resp.text().await?;
282
283 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
284 crate::from_str_patched(&local_var_content).map_err(Error::from)
285 } else {
286 let local_var_entity: Option<ListAzureBasicTopicsError> = crate::from_str_patched(&local_var_content).ok();
287 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
288 Err(Error::ResponseError(local_var_error))
289 }
290}
291
292pub async fn list_azure_namespace_subscriptions(configuration: &configuration::Configuration, workspace: &str, path: &str, azure_list_subscriptions: models::AzureListSubscriptions) -> Result<Vec<serde_json::Value>, Error<ListAzureNamespaceSubscriptionsError>> {
293 let local_var_configuration = configuration;
294
295 let local_var_client = &local_var_configuration.client;
296
297 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/namespaces/subscriptions/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
298 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
299
300 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
301 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
302 }
303 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
304 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
305 };
306 local_var_req_builder = local_var_req_builder.json(&azure_list_subscriptions);
307
308 let local_var_req = local_var_req_builder.build()?;
309 let local_var_resp = local_var_client.execute(local_var_req).await?;
310
311 let local_var_status = local_var_resp.status();
312 let local_var_content = local_var_resp.text().await?;
313
314 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
315 crate::from_str_patched(&local_var_content).map_err(Error::from)
316 } else {
317 let local_var_entity: Option<ListAzureNamespaceSubscriptionsError> = crate::from_str_patched(&local_var_content).ok();
318 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
319 Err(Error::ResponseError(local_var_error))
320 }
321}
322
323pub async fn list_azure_namespace_topics(configuration: &configuration::Configuration, workspace: &str, path: &str, azure_list_topics: models::AzureListTopics) -> Result<Vec<serde_json::Value>, Error<ListAzureNamespaceTopicsError>> {
324 let local_var_configuration = configuration;
325
326 let local_var_client = &local_var_configuration.client;
327
328 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/namespaces/topics/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
329 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
330
331 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
332 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
333 }
334 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
335 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
336 };
337 local_var_req_builder = local_var_req_builder.json(&azure_list_topics);
338
339 let local_var_req = local_var_req_builder.build()?;
340 let local_var_resp = local_var_client.execute(local_var_req).await?;
341
342 let local_var_status = local_var_resp.status();
343 let local_var_content = local_var_resp.text().await?;
344
345 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
346 crate::from_str_patched(&local_var_content).map_err(Error::from)
347 } else {
348 let local_var_entity: Option<ListAzureNamespaceTopicsError> = crate::from_str_patched(&local_var_content).ok();
349 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
350 Err(Error::ResponseError(local_var_error))
351 }
352}
353
354pub async fn list_azure_namespaces(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<Vec<models::AzureArmResource>, Error<ListAzureNamespacesError>> {
355 let local_var_configuration = configuration;
356
357 let local_var_client = &local_var_configuration.client;
358
359 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/namespaces/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
360 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
361
362 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
363 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
364 }
365 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
366 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
367 };
368
369 let local_var_req = local_var_req_builder.build()?;
370 let local_var_resp = local_var_client.execute(local_var_req).await?;
371
372 let local_var_status = local_var_resp.status();
373 let local_var_content = local_var_resp.text().await?;
374
375 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
376 crate::from_str_patched(&local_var_content).map_err(Error::from)
377 } else {
378 let local_var_entity: Option<ListAzureNamespacesError> = crate::from_str_patched(&local_var_content).ok();
379 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
380 Err(Error::ResponseError(local_var_error))
381 }
382}
383
384pub async fn list_azure_triggers(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, path: Option<&str>, is_flow: Option<bool>, path_start: Option<&str>) -> Result<Vec<models::AzureTrigger>, Error<ListAzureTriggersError>> {
385 let local_var_configuration = configuration;
386
387 let local_var_client = &local_var_configuration.client;
388
389 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
390 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
391
392 if let Some(ref local_var_str) = page {
393 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
394 }
395 if let Some(ref local_var_str) = per_page {
396 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
397 }
398 if let Some(ref local_var_str) = path {
399 local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
400 }
401 if let Some(ref local_var_str) = is_flow {
402 local_var_req_builder = local_var_req_builder.query(&[("is_flow", &local_var_str.to_string())]);
403 }
404 if let Some(ref local_var_str) = path_start {
405 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
406 }
407 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
408 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
409 }
410 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
411 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
412 };
413
414 let local_var_req = local_var_req_builder.build()?;
415 let local_var_resp = local_var_client.execute(local_var_req).await?;
416
417 let local_var_status = local_var_resp.status();
418 let local_var_content = local_var_resp.text().await?;
419
420 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
421 crate::from_str_patched(&local_var_content).map_err(Error::from)
422 } else {
423 let local_var_entity: Option<ListAzureTriggersError> = crate::from_str_patched(&local_var_content).ok();
424 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
425 Err(Error::ResponseError(local_var_error))
426 }
427}
428
429pub async fn set_azure_trigger_mode(configuration: &configuration::Configuration, workspace: &str, path: &str, set_http_trigger_mode_request: models::SetHttpTriggerModeRequest) -> Result<String, Error<SetAzureTriggerModeError>> {
430 let local_var_configuration = configuration;
431
432 let local_var_client = &local_var_configuration.client;
433
434 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/setmode/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
435 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
436
437 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
438 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
439 }
440 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
441 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
442 };
443 local_var_req_builder = local_var_req_builder.json(&set_http_trigger_mode_request);
444
445 let local_var_req = local_var_req_builder.build()?;
446 let local_var_resp = local_var_client.execute(local_var_req).await?;
447
448 let local_var_status = local_var_resp.status();
449 let local_var_content = local_var_resp.text().await?;
450
451 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
452 crate::from_str_patched(&local_var_content).map_err(Error::from)
453 } else {
454 let local_var_entity: Option<SetAzureTriggerModeError> = crate::from_str_patched(&local_var_content).ok();
455 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
456 Err(Error::ResponseError(local_var_error))
457 }
458}
459
460pub async fn test_azure_connection(configuration: &configuration::Configuration, workspace: &str, test_azure_connection: models::TestAzureConnection) -> Result<String, Error<TestAzureConnectionError>> {
461 let local_var_configuration = configuration;
462
463 let local_var_client = &local_var_configuration.client;
464
465 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/test", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
466 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
467
468 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
469 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
470 }
471 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
472 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
473 };
474 local_var_req_builder = local_var_req_builder.json(&test_azure_connection);
475
476 let local_var_req = local_var_req_builder.build()?;
477 let local_var_resp = local_var_client.execute(local_var_req).await?;
478
479 let local_var_status = local_var_resp.status();
480 let local_var_content = local_var_resp.text().await?;
481
482 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
483 crate::from_str_patched(&local_var_content).map_err(Error::from)
484 } else {
485 let local_var_entity: Option<TestAzureConnectionError> = crate::from_str_patched(&local_var_content).ok();
486 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
487 Err(Error::ResponseError(local_var_error))
488 }
489}
490
491pub async fn update_azure_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str, azure_trigger_data: models::AzureTriggerData) -> Result<String, Error<UpdateAzureTriggerError>> {
492 let local_var_configuration = configuration;
493
494 let local_var_client = &local_var_configuration.client;
495
496 let local_var_uri_str = format!("{}/w/{workspace}/azure_triggers/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
497 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
498
499 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
500 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
501 }
502 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
503 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
504 };
505 local_var_req_builder = local_var_req_builder.json(&azure_trigger_data);
506
507 let local_var_req = local_var_req_builder.build()?;
508 let local_var_resp = local_var_client.execute(local_var_req).await?;
509
510 let local_var_status = local_var_resp.status();
511 let local_var_content = local_var_resp.text().await?;
512
513 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
514 crate::from_str_patched(&local_var_content).map_err(Error::from)
515 } else {
516 let local_var_entity: Option<UpdateAzureTriggerError> = crate::from_str_patched(&local_var_content).ok();
517 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
518 Err(Error::ResponseError(local_var_error))
519 }
520}
521