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 CreateGcpTriggerError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteGcpSubscriptionError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum DeleteGcpSubscriptionWithDefaultCredentialsError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteGcpTriggerError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum ExistsGcpTriggerError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetGcpTriggerError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum ListAllTGoogleTopicSubscriptionsError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum ListAllTGoogleTopicSubscriptionsWithDefaultCredentialsError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum ListGcpTriggersError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ListGoogleTopicsError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ListGoogleTopicsWithDefaultCredentialsError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum SetGcpTriggerModeError {
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum TestGcpConnectionError {
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum UpdateGcpTriggerError {
113 UnknownValue(serde_json::Value),
114}
115
116
117pub async fn create_gcp_trigger(configuration: &configuration::Configuration, workspace: &str, gcp_trigger_data: models::GcpTriggerData) -> Result<String, Error<CreateGcpTriggerError>> {
118 let local_var_configuration = configuration;
119
120 let local_var_client = &local_var_configuration.client;
121
122 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/create", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
123 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
124
125 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
126 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
127 }
128 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
129 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
130 };
131 local_var_req_builder = local_var_req_builder.json(&gcp_trigger_data);
132
133 let local_var_req = local_var_req_builder.build()?;
134 let local_var_resp = local_var_client.execute(local_var_req).await?;
135
136 let local_var_status = local_var_resp.status();
137 let local_var_content = local_var_resp.text().await?;
138
139 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
140 crate::from_str_patched(&local_var_content).map_err(Error::from)
141 } else {
142 let local_var_entity: Option<CreateGcpTriggerError> = crate::from_str_patched(&local_var_content).ok();
143 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
144 Err(Error::ResponseError(local_var_error))
145 }
146}
147
148pub async fn delete_gcp_subscription(configuration: &configuration::Configuration, workspace: &str, path: &str, delete_gcp_subscription: models::DeleteGcpSubscription) -> Result<String, Error<DeleteGcpSubscriptionError>> {
149 let local_var_configuration = configuration;
150
151 let local_var_client = &local_var_configuration.client;
152
153 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/subscriptions/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
154 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
155
156 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
157 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
158 }
159 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
160 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
161 };
162 local_var_req_builder = local_var_req_builder.json(&delete_gcp_subscription);
163
164 let local_var_req = local_var_req_builder.build()?;
165 let local_var_resp = local_var_client.execute(local_var_req).await?;
166
167 let local_var_status = local_var_resp.status();
168 let local_var_content = local_var_resp.text().await?;
169
170 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
171 crate::from_str_patched(&local_var_content).map_err(Error::from)
172 } else {
173 let local_var_entity: Option<DeleteGcpSubscriptionError> = crate::from_str_patched(&local_var_content).ok();
174 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
175 Err(Error::ResponseError(local_var_error))
176 }
177}
178
179pub async fn delete_gcp_subscription_with_default_credentials(configuration: &configuration::Configuration, workspace: &str, delete_gcp_subscription: models::DeleteGcpSubscription) -> Result<String, Error<DeleteGcpSubscriptionWithDefaultCredentialsError>> {
180 let local_var_configuration = configuration;
181
182 let local_var_client = &local_var_configuration.client;
183
184 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/subscriptions/delete", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
185 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
186
187 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
188 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
189 }
190 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
191 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
192 };
193 local_var_req_builder = local_var_req_builder.json(&delete_gcp_subscription);
194
195 let local_var_req = local_var_req_builder.build()?;
196 let local_var_resp = local_var_client.execute(local_var_req).await?;
197
198 let local_var_status = local_var_resp.status();
199 let local_var_content = local_var_resp.text().await?;
200
201 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
202 crate::from_str_patched(&local_var_content).map_err(Error::from)
203 } else {
204 let local_var_entity: Option<DeleteGcpSubscriptionWithDefaultCredentialsError> = crate::from_str_patched(&local_var_content).ok();
205 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
206 Err(Error::ResponseError(local_var_error))
207 }
208}
209
210pub async fn delete_gcp_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<String, Error<DeleteGcpTriggerError>> {
211 let local_var_configuration = configuration;
212
213 let local_var_client = &local_var_configuration.client;
214
215 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/delete/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
216 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
217
218 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
219 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
220 }
221 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
222 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
223 };
224
225 let local_var_req = local_var_req_builder.build()?;
226 let local_var_resp = local_var_client.execute(local_var_req).await?;
227
228 let local_var_status = local_var_resp.status();
229 let local_var_content = local_var_resp.text().await?;
230
231 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
232 crate::from_str_patched(&local_var_content).map_err(Error::from)
233 } else {
234 let local_var_entity: Option<DeleteGcpTriggerError> = crate::from_str_patched(&local_var_content).ok();
235 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
236 Err(Error::ResponseError(local_var_error))
237 }
238}
239
240pub async fn exists_gcp_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str) -> Result<bool, Error<ExistsGcpTriggerError>> {
241 let local_var_configuration = configuration;
242
243 let local_var_client = &local_var_configuration.client;
244
245 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/exists/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
246 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
247
248 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
249 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
250 }
251 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
252 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
253 };
254
255 let local_var_req = local_var_req_builder.build()?;
256 let local_var_resp = local_var_client.execute(local_var_req).await?;
257
258 let local_var_status = local_var_resp.status();
259 let local_var_content = local_var_resp.text().await?;
260
261 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
262 crate::from_str_patched(&local_var_content).map_err(Error::from)
263 } else {
264 let local_var_entity: Option<ExistsGcpTriggerError> = crate::from_str_patched(&local_var_content).ok();
265 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
266 Err(Error::ResponseError(local_var_error))
267 }
268}
269
270pub async fn get_gcp_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str, get_draft: Option<bool>) -> Result<models::GetGcpTrigger200Response, Error<GetGcpTriggerError>> {
271 let local_var_configuration = configuration;
272
273 let local_var_client = &local_var_configuration.client;
274
275 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/get/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
276 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
277
278 if let Some(ref local_var_str) = get_draft {
279 local_var_req_builder = local_var_req_builder.query(&[("get_draft", &local_var_str.to_string())]);
280 }
281 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
282 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
283 }
284 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
285 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
286 };
287
288 let local_var_req = local_var_req_builder.build()?;
289 let local_var_resp = local_var_client.execute(local_var_req).await?;
290
291 let local_var_status = local_var_resp.status();
292 let local_var_content = local_var_resp.text().await?;
293
294 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
295 crate::from_str_patched(&local_var_content).map_err(Error::from)
296 } else {
297 let local_var_entity: Option<GetGcpTriggerError> = crate::from_str_patched(&local_var_content).ok();
298 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
299 Err(Error::ResponseError(local_var_error))
300 }
301}
302
303pub async fn list_all_t_google_topic_subscriptions(configuration: &configuration::Configuration, workspace: &str, path: &str, get_all_topic_subscription: models::GetAllTopicSubscription) -> Result<Vec<String>, Error<ListAllTGoogleTopicSubscriptionsError>> {
304 let local_var_configuration = configuration;
305
306 let local_var_client = &local_var_configuration.client;
307
308 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/subscriptions/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
309 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
310
311 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
312 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
313 }
314 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
315 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
316 };
317 local_var_req_builder = local_var_req_builder.json(&get_all_topic_subscription);
318
319 let local_var_req = local_var_req_builder.build()?;
320 let local_var_resp = local_var_client.execute(local_var_req).await?;
321
322 let local_var_status = local_var_resp.status();
323 let local_var_content = local_var_resp.text().await?;
324
325 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
326 crate::from_str_patched(&local_var_content).map_err(Error::from)
327 } else {
328 let local_var_entity: Option<ListAllTGoogleTopicSubscriptionsError> = crate::from_str_patched(&local_var_content).ok();
329 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
330 Err(Error::ResponseError(local_var_error))
331 }
332}
333
334pub async fn list_all_t_google_topic_subscriptions_with_default_credentials(configuration: &configuration::Configuration, workspace: &str, get_all_topic_subscription: models::GetAllTopicSubscription) -> Result<Vec<String>, Error<ListAllTGoogleTopicSubscriptionsWithDefaultCredentialsError>> {
335 let local_var_configuration = configuration;
336
337 let local_var_client = &local_var_configuration.client;
338
339 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/subscriptions/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
340 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
341
342 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
343 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
344 }
345 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
346 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
347 };
348 local_var_req_builder = local_var_req_builder.json(&get_all_topic_subscription);
349
350 let local_var_req = local_var_req_builder.build()?;
351 let local_var_resp = local_var_client.execute(local_var_req).await?;
352
353 let local_var_status = local_var_resp.status();
354 let local_var_content = local_var_resp.text().await?;
355
356 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
357 crate::from_str_patched(&local_var_content).map_err(Error::from)
358 } else {
359 let local_var_entity: Option<ListAllTGoogleTopicSubscriptionsWithDefaultCredentialsError> = crate::from_str_patched(&local_var_content).ok();
360 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
361 Err(Error::ResponseError(local_var_error))
362 }
363}
364
365pub async fn list_gcp_triggers(configuration: &configuration::Configuration, workspace: &str, page: Option<i32>, per_page: Option<i32>, path: Option<&str>, is_flow: Option<bool>, path_start: Option<&str>, label: Option<&str>, include_draft_only: Option<bool>) -> Result<Vec<models::GcpTrigger>, Error<ListGcpTriggersError>> {
366 let local_var_configuration = configuration;
367
368 let local_var_client = &local_var_configuration.client;
369
370 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
371 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
372
373 if let Some(ref local_var_str) = page {
374 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
375 }
376 if let Some(ref local_var_str) = per_page {
377 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
378 }
379 if let Some(ref local_var_str) = path {
380 local_var_req_builder = local_var_req_builder.query(&[("path", &local_var_str.to_string())]);
381 }
382 if let Some(ref local_var_str) = is_flow {
383 local_var_req_builder = local_var_req_builder.query(&[("is_flow", &local_var_str.to_string())]);
384 }
385 if let Some(ref local_var_str) = path_start {
386 local_var_req_builder = local_var_req_builder.query(&[("path_start", &local_var_str.to_string())]);
387 }
388 if let Some(ref local_var_str) = label {
389 local_var_req_builder = local_var_req_builder.query(&[("label", &local_var_str.to_string())]);
390 }
391 if let Some(ref local_var_str) = include_draft_only {
392 local_var_req_builder = local_var_req_builder.query(&[("include_draft_only", &local_var_str.to_string())]);
393 }
394 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
395 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
396 }
397 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
398 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
399 };
400
401 let local_var_req = local_var_req_builder.build()?;
402 let local_var_resp = local_var_client.execute(local_var_req).await?;
403
404 let local_var_status = local_var_resp.status();
405 let local_var_content = local_var_resp.text().await?;
406
407 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
408 crate::from_str_patched(&local_var_content).map_err(Error::from)
409 } else {
410 let local_var_entity: Option<ListGcpTriggersError> = crate::from_str_patched(&local_var_content).ok();
411 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
412 Err(Error::ResponseError(local_var_error))
413 }
414}
415
416pub async fn list_google_topics(configuration: &configuration::Configuration, workspace: &str, path: &str, project_id: Option<&str>) -> Result<Vec<String>, Error<ListGoogleTopicsError>> {
417 let local_var_configuration = configuration;
418
419 let local_var_client = &local_var_configuration.client;
420
421 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/topics/list/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
422 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
423
424 if let Some(ref local_var_str) = project_id {
425 local_var_req_builder = local_var_req_builder.query(&[("project_id", &local_var_str.to_string())]);
426 }
427 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
428 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
429 }
430 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
431 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
432 };
433
434 let local_var_req = local_var_req_builder.build()?;
435 let local_var_resp = local_var_client.execute(local_var_req).await?;
436
437 let local_var_status = local_var_resp.status();
438 let local_var_content = local_var_resp.text().await?;
439
440 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
441 crate::from_str_patched(&local_var_content).map_err(Error::from)
442 } else {
443 let local_var_entity: Option<ListGoogleTopicsError> = crate::from_str_patched(&local_var_content).ok();
444 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
445 Err(Error::ResponseError(local_var_error))
446 }
447}
448
449pub async fn list_google_topics_with_default_credentials(configuration: &configuration::Configuration, workspace: &str, project_id: Option<&str>) -> Result<Vec<String>, Error<ListGoogleTopicsWithDefaultCredentialsError>> {
450 let local_var_configuration = configuration;
451
452 let local_var_client = &local_var_configuration.client;
453
454 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/topics/list", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
455 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
456
457 if let Some(ref local_var_str) = project_id {
458 local_var_req_builder = local_var_req_builder.query(&[("project_id", &local_var_str.to_string())]);
459 }
460 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
461 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
462 }
463 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
464 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
465 };
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(&local_var_content).map_err(Error::from)
475 } else {
476 let local_var_entity: Option<ListGoogleTopicsWithDefaultCredentialsError> = crate::from_str_patched(&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 set_gcp_trigger_mode(configuration: &configuration::Configuration, workspace: &str, path: &str, set_http_trigger_mode_request: models::SetHttpTriggerModeRequest) -> Result<String, Error<SetGcpTriggerModeError>> {
483 let local_var_configuration = configuration;
484
485 let local_var_client = &local_var_configuration.client;
486
487 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/setmode/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
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(&set_http_trigger_mode_request);
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(&local_var_content).map_err(Error::from)
506 } else {
507 let local_var_entity: Option<SetGcpTriggerModeError> = crate::from_str_patched(&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
513pub async fn test_gcp_connection(configuration: &configuration::Configuration, workspace: &str, test_kafka_connection_request: models::TestKafkaConnectionRequest) -> Result<String, Error<TestGcpConnectionError>> {
514 let local_var_configuration = configuration;
515
516 let local_var_client = &local_var_configuration.client;
517
518 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/test", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace));
519 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
520
521 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
522 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
523 }
524 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
525 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
526 };
527 local_var_req_builder = local_var_req_builder.json(&test_kafka_connection_request);
528
529 let local_var_req = local_var_req_builder.build()?;
530 let local_var_resp = local_var_client.execute(local_var_req).await?;
531
532 let local_var_status = local_var_resp.status();
533 let local_var_content = local_var_resp.text().await?;
534
535 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
536 crate::from_str_patched(&local_var_content).map_err(Error::from)
537 } else {
538 let local_var_entity: Option<TestGcpConnectionError> = crate::from_str_patched(&local_var_content).ok();
539 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
540 Err(Error::ResponseError(local_var_error))
541 }
542}
543
544pub async fn update_gcp_trigger(configuration: &configuration::Configuration, workspace: &str, path: &str, gcp_trigger_data: models::GcpTriggerData) -> Result<String, Error<UpdateGcpTriggerError>> {
545 let local_var_configuration = configuration;
546
547 let local_var_client = &local_var_configuration.client;
548
549 let local_var_uri_str = format!("{}/w/{workspace}/gcp_triggers/update/{path}", local_var_configuration.base_path, workspace=crate::apis::urlencode(workspace), path=crate::apis::urlencode(path));
550 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
551
552 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
553 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
554 }
555 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
556 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
557 };
558 local_var_req_builder = local_var_req_builder.json(&gcp_trigger_data);
559
560 let local_var_req = local_var_req_builder.build()?;
561 let local_var_resp = local_var_client.execute(local_var_req).await?;
562
563 let local_var_status = local_var_resp.status();
564 let local_var_content = local_var_resp.text().await?;
565
566 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
567 crate::from_str_patched(&local_var_content).map_err(Error::from)
568 } else {
569 let local_var_entity: Option<UpdateGcpTriggerError> = crate::from_str_patched(&local_var_content).ok();
570 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
571 Err(Error::ResponseError(local_var_error))
572 }
573}
574