1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17#[derive(Clone, Debug)]
19pub struct CreateReplicationPolicyParams {
20 pub policy: models::ReplicationPolicy,
22 pub x_request_id: Option<String>
24}
25
26#[derive(Clone, Debug)]
28pub struct DeleteReplicationPolicyParams {
29 pub id: i64,
31 pub x_request_id: Option<String>
33}
34
35#[derive(Clone, Debug)]
37pub struct GetReplicationExecutionParams {
38 pub id: i64,
40 pub x_request_id: Option<String>
42}
43
44#[derive(Clone, Debug)]
46pub struct GetReplicationLogParams {
47 pub id: i64,
49 pub task_id: i64,
51 pub x_request_id: Option<String>
53}
54
55#[derive(Clone, Debug)]
57pub struct GetReplicationPolicyParams {
58 pub id: i64,
60 pub x_request_id: Option<String>
62}
63
64#[derive(Clone, Debug)]
66pub struct ListReplicationExecutionsParams {
67 pub x_request_id: Option<String>,
69 pub sort: Option<String>,
71 pub page: Option<i64>,
73 pub page_size: Option<i64>,
75 pub policy_id: Option<i32>,
77 pub status: Option<String>,
79 pub trigger: Option<String>
81}
82
83#[derive(Clone, Debug)]
85pub struct ListReplicationPoliciesParams {
86 pub x_request_id: Option<String>,
88 pub q: Option<String>,
90 pub sort: Option<String>,
92 pub page: Option<i64>,
94 pub page_size: Option<i64>,
96 pub name: Option<String>
98}
99
100#[derive(Clone, Debug)]
102pub struct ListReplicationTasksParams {
103 pub id: i64,
105 pub x_request_id: Option<String>,
107 pub sort: Option<String>,
109 pub page: Option<i64>,
111 pub page_size: Option<i64>,
113 pub status: Option<String>,
115 pub resource_type: Option<String>
117}
118
119#[derive(Clone, Debug)]
121pub struct StartReplicationParams {
122 pub execution: models::StartReplicationExecution,
124 pub x_request_id: Option<String>
126}
127
128#[derive(Clone, Debug)]
130pub struct StopReplicationParams {
131 pub id: i64,
133 pub x_request_id: Option<String>
135}
136
137#[derive(Clone, Debug)]
139pub struct UpdateReplicationPolicyParams {
140 pub id: i64,
142 pub policy: models::ReplicationPolicy,
144 pub x_request_id: Option<String>
146}
147
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum CreateReplicationPolicyError {
153 Status400(models::Errors),
154 Status401(models::Errors),
155 Status403(models::Errors),
156 Status409(models::Errors),
157 Status500(models::Errors),
158 UnknownValue(serde_json::Value),
159}
160
161#[derive(Debug, Clone, Serialize, Deserialize)]
163#[serde(untagged)]
164pub enum DeleteReplicationPolicyError {
165 Status401(models::Errors),
166 Status403(models::Errors),
167 Status404(models::Errors),
168 Status412(models::Errors),
169 Status500(models::Errors),
170 UnknownValue(serde_json::Value),
171}
172
173#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum GetReplicationExecutionError {
177 Status401(models::Errors),
178 Status403(models::Errors),
179 Status404(models::Errors),
180 Status500(models::Errors),
181 UnknownValue(serde_json::Value),
182}
183
184#[derive(Debug, Clone, Serialize, Deserialize)]
186#[serde(untagged)]
187pub enum GetReplicationLogError {
188 Status401(models::Errors),
189 Status403(models::Errors),
190 Status404(models::Errors),
191 Status500(models::Errors),
192 UnknownValue(serde_json::Value),
193}
194
195#[derive(Debug, Clone, Serialize, Deserialize)]
197#[serde(untagged)]
198pub enum GetReplicationPolicyError {
199 Status401(models::Errors),
200 Status403(models::Errors),
201 Status500(models::Errors),
202 UnknownValue(serde_json::Value),
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum ListReplicationExecutionsError {
209 Status401(models::Errors),
210 Status403(models::Errors),
211 Status500(models::Errors),
212 UnknownValue(serde_json::Value),
213}
214
215#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum ListReplicationPoliciesError {
219 Status401(models::Errors),
220 Status403(models::Errors),
221 Status500(models::Errors),
222 UnknownValue(serde_json::Value),
223}
224
225#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum ListReplicationTasksError {
229 Status401(models::Errors),
230 Status403(models::Errors),
231 Status500(models::Errors),
232 UnknownValue(serde_json::Value),
233}
234
235#[derive(Debug, Clone, Serialize, Deserialize)]
237#[serde(untagged)]
238pub enum StartReplicationError {
239 Status400(models::Errors),
240 Status401(models::Errors),
241 Status403(models::Errors),
242 Status500(models::Errors),
243 UnknownValue(serde_json::Value),
244}
245
246#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum StopReplicationError {
250 Status401(models::Errors),
251 Status403(models::Errors),
252 Status404(models::Errors),
253 Status500(models::Errors),
254 UnknownValue(serde_json::Value),
255}
256
257#[derive(Debug, Clone, Serialize, Deserialize)]
259#[serde(untagged)]
260pub enum UpdateReplicationPolicyError {
261 Status401(models::Errors),
262 Status403(models::Errors),
263 Status404(models::Errors),
264 Status409(models::Errors),
265 Status500(models::Errors),
266 UnknownValue(serde_json::Value),
267}
268
269
270pub async fn create_replication_policy(configuration: &configuration::Configuration, params: CreateReplicationPolicyParams) -> Result<(), Error<CreateReplicationPolicyError>> {
272
273 let uri_str = format!("{}/replication/policies", configuration.base_path);
274 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
275
276 if let Some(ref user_agent) = configuration.user_agent {
277 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
278 }
279 if let Some(param_value) = params.x_request_id {
280 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
281 }
282 if let Some(ref auth_conf) = configuration.basic_auth {
283 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
284 };
285 req_builder = req_builder.json(¶ms.policy);
286
287 let req = req_builder.build()?;
288 let resp = configuration.client.execute(req).await?;
289
290 let status = resp.status();
291
292 if !status.is_client_error() && !status.is_server_error() {
293 Ok(())
294 } else {
295 let content = resp.text().await?;
296 let entity: Option<CreateReplicationPolicyError> = serde_json::from_str(&content).ok();
297 Err(Error::ResponseError(ResponseContent { status, content, entity }))
298 }
299}
300
301pub async fn delete_replication_policy(configuration: &configuration::Configuration, params: DeleteReplicationPolicyParams) -> Result<(), Error<DeleteReplicationPolicyError>> {
303
304 let uri_str = format!("{}/replication/policies/{id}", configuration.base_path, id=params.id);
305 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
306
307 if let Some(ref user_agent) = configuration.user_agent {
308 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
309 }
310 if let Some(param_value) = params.x_request_id {
311 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
312 }
313 if let Some(ref auth_conf) = configuration.basic_auth {
314 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
315 };
316
317 let req = req_builder.build()?;
318 let resp = configuration.client.execute(req).await?;
319
320 let status = resp.status();
321
322 if !status.is_client_error() && !status.is_server_error() {
323 Ok(())
324 } else {
325 let content = resp.text().await?;
326 let entity: Option<DeleteReplicationPolicyError> = serde_json::from_str(&content).ok();
327 Err(Error::ResponseError(ResponseContent { status, content, entity }))
328 }
329}
330
331pub async fn get_replication_execution(configuration: &configuration::Configuration, params: GetReplicationExecutionParams) -> Result<models::ReplicationExecution, Error<GetReplicationExecutionError>> {
333
334 let uri_str = format!("{}/replication/executions/{id}", configuration.base_path, id=params.id);
335 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
336
337 if let Some(ref user_agent) = configuration.user_agent {
338 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
339 }
340 if let Some(param_value) = params.x_request_id {
341 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
342 }
343 if let Some(ref auth_conf) = configuration.basic_auth {
344 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
345 };
346
347 let req = req_builder.build()?;
348 let resp = configuration.client.execute(req).await?;
349
350 let status = resp.status();
351 let content_type = resp
352 .headers()
353 .get("content-type")
354 .and_then(|v| v.to_str().ok())
355 .unwrap_or("application/octet-stream");
356 let content_type = super::ContentType::from(content_type);
357
358 if !status.is_client_error() && !status.is_server_error() {
359 let content = resp.text().await?;
360 match content_type {
361 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
362 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplicationExecution`"))),
363 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReplicationExecution`")))),
364 }
365 } else {
366 let content = resp.text().await?;
367 let entity: Option<GetReplicationExecutionError> = serde_json::from_str(&content).ok();
368 Err(Error::ResponseError(ResponseContent { status, content, entity }))
369 }
370}
371
372pub async fn get_replication_log(configuration: &configuration::Configuration, params: GetReplicationLogParams) -> Result<String, Error<GetReplicationLogError>> {
374
375 let uri_str = format!("{}/replication/executions/{id}/tasks/{task_id}/log", configuration.base_path, id=params.id, task_id=params.task_id);
376 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
377
378 if let Some(ref user_agent) = configuration.user_agent {
379 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
380 }
381 if let Some(param_value) = params.x_request_id {
382 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
383 }
384 if let Some(ref auth_conf) = configuration.basic_auth {
385 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
386 };
387
388 let req = req_builder.build()?;
389 let resp = configuration.client.execute(req).await?;
390
391 let status = resp.status();
392 let content_type = resp
393 .headers()
394 .get("content-type")
395 .and_then(|v| v.to_str().ok())
396 .unwrap_or("application/octet-stream");
397 let content_type = super::ContentType::from(content_type);
398
399 if !status.is_client_error() && !status.is_server_error() {
400 let content = resp.text().await?;
401 match content_type {
402 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
403 ContentType::Text => return Ok(content),
404 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
405 }
406 } else {
407 let content = resp.text().await?;
408 let entity: Option<GetReplicationLogError> = serde_json::from_str(&content).ok();
409 Err(Error::ResponseError(ResponseContent { status, content, entity }))
410 }
411}
412
413pub async fn get_replication_policy(configuration: &configuration::Configuration, params: GetReplicationPolicyParams) -> Result<models::ReplicationPolicy, Error<GetReplicationPolicyError>> {
415
416 let uri_str = format!("{}/replication/policies/{id}", configuration.base_path, id=params.id);
417 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
418
419 if let Some(ref user_agent) = configuration.user_agent {
420 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
421 }
422 if let Some(param_value) = params.x_request_id {
423 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
424 }
425 if let Some(ref auth_conf) = configuration.basic_auth {
426 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
427 };
428
429 let req = req_builder.build()?;
430 let resp = configuration.client.execute(req).await?;
431
432 let status = resp.status();
433 let content_type = resp
434 .headers()
435 .get("content-type")
436 .and_then(|v| v.to_str().ok())
437 .unwrap_or("application/octet-stream");
438 let content_type = super::ContentType::from(content_type);
439
440 if !status.is_client_error() && !status.is_server_error() {
441 let content = resp.text().await?;
442 match content_type {
443 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
444 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReplicationPolicy`"))),
445 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReplicationPolicy`")))),
446 }
447 } else {
448 let content = resp.text().await?;
449 let entity: Option<GetReplicationPolicyError> = serde_json::from_str(&content).ok();
450 Err(Error::ResponseError(ResponseContent { status, content, entity }))
451 }
452}
453
454pub async fn list_replication_executions(configuration: &configuration::Configuration, params: ListReplicationExecutionsParams) -> Result<Vec<models::ReplicationExecution>, Error<ListReplicationExecutionsError>> {
456
457 let uri_str = format!("{}/replication/executions", configuration.base_path);
458 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
459
460 if let Some(ref param_value) = params.sort {
461 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
462 }
463 if let Some(ref param_value) = params.page {
464 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
465 }
466 if let Some(ref param_value) = params.page_size {
467 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
468 }
469 if let Some(ref param_value) = params.policy_id {
470 req_builder = req_builder.query(&[("policy_id", ¶m_value.to_string())]);
471 }
472 if let Some(ref param_value) = params.status {
473 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
474 }
475 if let Some(ref param_value) = params.trigger {
476 req_builder = req_builder.query(&[("trigger", ¶m_value.to_string())]);
477 }
478 if let Some(ref user_agent) = configuration.user_agent {
479 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
480 }
481 if let Some(param_value) = params.x_request_id {
482 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
483 }
484 if let Some(ref auth_conf) = configuration.basic_auth {
485 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
486 };
487
488 let req = req_builder.build()?;
489 let resp = configuration.client.execute(req).await?;
490
491 let status = resp.status();
492 let content_type = resp
493 .headers()
494 .get("content-type")
495 .and_then(|v| v.to_str().ok())
496 .unwrap_or("application/octet-stream");
497 let content_type = super::ContentType::from(content_type);
498
499 if !status.is_client_error() && !status.is_server_error() {
500 let content = resp.text().await?;
501 match content_type {
502 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
503 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ReplicationExecution>`"))),
504 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ReplicationExecution>`")))),
505 }
506 } else {
507 let content = resp.text().await?;
508 let entity: Option<ListReplicationExecutionsError> = serde_json::from_str(&content).ok();
509 Err(Error::ResponseError(ResponseContent { status, content, entity }))
510 }
511}
512
513pub async fn list_replication_policies(configuration: &configuration::Configuration, params: ListReplicationPoliciesParams) -> Result<Vec<models::ReplicationPolicy>, Error<ListReplicationPoliciesError>> {
515
516 let uri_str = format!("{}/replication/policies", configuration.base_path);
517 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
518
519 if let Some(ref param_value) = params.q {
520 req_builder = req_builder.query(&[("q", ¶m_value.to_string())]);
521 }
522 if let Some(ref param_value) = params.sort {
523 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
524 }
525 if let Some(ref param_value) = params.page {
526 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
527 }
528 if let Some(ref param_value) = params.page_size {
529 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
530 }
531 if let Some(ref param_value) = params.name {
532 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
533 }
534 if let Some(ref user_agent) = configuration.user_agent {
535 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
536 }
537 if let Some(param_value) = params.x_request_id {
538 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
539 }
540 if let Some(ref auth_conf) = configuration.basic_auth {
541 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
542 };
543
544 let req = req_builder.build()?;
545 let resp = configuration.client.execute(req).await?;
546
547 let status = resp.status();
548 let content_type = resp
549 .headers()
550 .get("content-type")
551 .and_then(|v| v.to_str().ok())
552 .unwrap_or("application/octet-stream");
553 let content_type = super::ContentType::from(content_type);
554
555 if !status.is_client_error() && !status.is_server_error() {
556 let content = resp.text().await?;
557 match content_type {
558 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
559 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ReplicationPolicy>`"))),
560 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ReplicationPolicy>`")))),
561 }
562 } else {
563 let content = resp.text().await?;
564 let entity: Option<ListReplicationPoliciesError> = serde_json::from_str(&content).ok();
565 Err(Error::ResponseError(ResponseContent { status, content, entity }))
566 }
567}
568
569pub async fn list_replication_tasks(configuration: &configuration::Configuration, params: ListReplicationTasksParams) -> Result<Vec<models::ReplicationTask>, Error<ListReplicationTasksError>> {
571
572 let uri_str = format!("{}/replication/executions/{id}/tasks", configuration.base_path, id=params.id);
573 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
574
575 if let Some(ref param_value) = params.sort {
576 req_builder = req_builder.query(&[("sort", ¶m_value.to_string())]);
577 }
578 if let Some(ref param_value) = params.page {
579 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
580 }
581 if let Some(ref param_value) = params.page_size {
582 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
583 }
584 if let Some(ref param_value) = params.status {
585 req_builder = req_builder.query(&[("status", ¶m_value.to_string())]);
586 }
587 if let Some(ref param_value) = params.resource_type {
588 req_builder = req_builder.query(&[("resource_type", ¶m_value.to_string())]);
589 }
590 if let Some(ref user_agent) = configuration.user_agent {
591 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
592 }
593 if let Some(param_value) = params.x_request_id {
594 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
595 }
596 if let Some(ref auth_conf) = configuration.basic_auth {
597 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
598 };
599
600 let req = req_builder.build()?;
601 let resp = configuration.client.execute(req).await?;
602
603 let status = resp.status();
604 let content_type = resp
605 .headers()
606 .get("content-type")
607 .and_then(|v| v.to_str().ok())
608 .unwrap_or("application/octet-stream");
609 let content_type = super::ContentType::from(content_type);
610
611 if !status.is_client_error() && !status.is_server_error() {
612 let content = resp.text().await?;
613 match content_type {
614 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
615 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ReplicationTask>`"))),
616 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ReplicationTask>`")))),
617 }
618 } else {
619 let content = resp.text().await?;
620 let entity: Option<ListReplicationTasksError> = serde_json::from_str(&content).ok();
621 Err(Error::ResponseError(ResponseContent { status, content, entity }))
622 }
623}
624
625pub async fn start_replication(configuration: &configuration::Configuration, params: StartReplicationParams) -> Result<(), Error<StartReplicationError>> {
627
628 let uri_str = format!("{}/replication/executions", configuration.base_path);
629 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
630
631 if let Some(ref user_agent) = configuration.user_agent {
632 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
633 }
634 if let Some(param_value) = params.x_request_id {
635 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
636 }
637 if let Some(ref auth_conf) = configuration.basic_auth {
638 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
639 };
640 req_builder = req_builder.json(¶ms.execution);
641
642 let req = req_builder.build()?;
643 let resp = configuration.client.execute(req).await?;
644
645 let status = resp.status();
646
647 if !status.is_client_error() && !status.is_server_error() {
648 Ok(())
649 } else {
650 let content = resp.text().await?;
651 let entity: Option<StartReplicationError> = serde_json::from_str(&content).ok();
652 Err(Error::ResponseError(ResponseContent { status, content, entity }))
653 }
654}
655
656pub async fn stop_replication(configuration: &configuration::Configuration, params: StopReplicationParams) -> Result<(), Error<StopReplicationError>> {
658
659 let uri_str = format!("{}/replication/executions/{id}", configuration.base_path, id=params.id);
660 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
661
662 if let Some(ref user_agent) = configuration.user_agent {
663 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
664 }
665 if let Some(param_value) = params.x_request_id {
666 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
667 }
668 if let Some(ref auth_conf) = configuration.basic_auth {
669 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
670 };
671
672 let req = req_builder.build()?;
673 let resp = configuration.client.execute(req).await?;
674
675 let status = resp.status();
676
677 if !status.is_client_error() && !status.is_server_error() {
678 Ok(())
679 } else {
680 let content = resp.text().await?;
681 let entity: Option<StopReplicationError> = serde_json::from_str(&content).ok();
682 Err(Error::ResponseError(ResponseContent { status, content, entity }))
683 }
684}
685
686pub async fn update_replication_policy(configuration: &configuration::Configuration, params: UpdateReplicationPolicyParams) -> Result<(), Error<UpdateReplicationPolicyError>> {
688
689 let uri_str = format!("{}/replication/policies/{id}", configuration.base_path, id=params.id);
690 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
691
692 if let Some(ref user_agent) = configuration.user_agent {
693 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
694 }
695 if let Some(param_value) = params.x_request_id {
696 req_builder = req_builder.header("X-Request-Id", param_value.to_string());
697 }
698 if let Some(ref auth_conf) = configuration.basic_auth {
699 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
700 };
701 req_builder = req_builder.json(¶ms.policy);
702
703 let req = req_builder.build()?;
704 let resp = configuration.client.execute(req).await?;
705
706 let status = resp.status();
707
708 if !status.is_client_error() && !status.is_server_error() {
709 Ok(())
710 } else {
711 let content = resp.text().await?;
712 let entity: Option<UpdateReplicationPolicyError> = serde_json::from_str(&content).ok();
713 Err(Error::ResponseError(ResponseContent { status, content, entity }))
714 }
715}
716