1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum PoliciesAllCacheClearCreateError {
20 Status400(),
21 Status403(models::GenericError),
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum PoliciesAllCacheInfoRetrieveError {
29 Status400(models::ValidationError),
30 Status403(models::GenericError),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum PoliciesAllDestroyError {
38 Status400(models::ValidationError),
39 Status403(models::GenericError),
40 UnknownValue(serde_json::Value),
41}
42
43#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(untagged)]
46pub enum PoliciesAllListError {
47 Status400(models::ValidationError),
48 Status403(models::GenericError),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum PoliciesAllRetrieveError {
56 Status400(models::ValidationError),
57 Status403(models::GenericError),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum PoliciesAllTestCreateError {
65 Status400(),
66 Status403(models::GenericError),
67 UnknownValue(serde_json::Value),
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum PoliciesAllTypesListError {
74 Status400(models::ValidationError),
75 Status403(models::GenericError),
76 UnknownValue(serde_json::Value),
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum PoliciesAllUsedByListError {
83 Status400(models::ValidationError),
84 Status403(models::GenericError),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PoliciesBindingsCreateError {
92 Status400(models::ValidationError),
93 Status403(models::GenericError),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum PoliciesBindingsDestroyError {
101 Status400(models::ValidationError),
102 Status403(models::GenericError),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum PoliciesBindingsListError {
110 Status400(models::ValidationError),
111 Status403(models::GenericError),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum PoliciesBindingsPartialUpdateError {
119 Status400(models::ValidationError),
120 Status403(models::GenericError),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum PoliciesBindingsRetrieveError {
128 Status400(models::ValidationError),
129 Status403(models::GenericError),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum PoliciesBindingsUpdateError {
137 Status400(models::ValidationError),
138 Status403(models::GenericError),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum PoliciesBindingsUsedByListError {
146 Status400(models::ValidationError),
147 Status403(models::GenericError),
148 UnknownValue(serde_json::Value),
149}
150
151#[derive(Debug, Clone, Serialize, Deserialize)]
153#[serde(untagged)]
154pub enum PoliciesDummyCreateError {
155 Status400(models::ValidationError),
156 Status403(models::GenericError),
157 UnknownValue(serde_json::Value),
158}
159
160#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum PoliciesDummyDestroyError {
164 Status400(models::ValidationError),
165 Status403(models::GenericError),
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum PoliciesDummyListError {
173 Status400(models::ValidationError),
174 Status403(models::GenericError),
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum PoliciesDummyPartialUpdateError {
182 Status400(models::ValidationError),
183 Status403(models::GenericError),
184 UnknownValue(serde_json::Value),
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum PoliciesDummyRetrieveError {
191 Status400(models::ValidationError),
192 Status403(models::GenericError),
193 UnknownValue(serde_json::Value),
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize)]
198#[serde(untagged)]
199pub enum PoliciesDummyUpdateError {
200 Status400(models::ValidationError),
201 Status403(models::GenericError),
202 UnknownValue(serde_json::Value),
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum PoliciesDummyUsedByListError {
209 Status400(models::ValidationError),
210 Status403(models::GenericError),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum PoliciesEventMatcherCreateError {
218 Status400(models::ValidationError),
219 Status403(models::GenericError),
220 UnknownValue(serde_json::Value),
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum PoliciesEventMatcherDestroyError {
227 Status400(models::ValidationError),
228 Status403(models::GenericError),
229 UnknownValue(serde_json::Value),
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize)]
234#[serde(untagged)]
235pub enum PoliciesEventMatcherListError {
236 Status400(models::ValidationError),
237 Status403(models::GenericError),
238 UnknownValue(serde_json::Value),
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum PoliciesEventMatcherPartialUpdateError {
245 Status400(models::ValidationError),
246 Status403(models::GenericError),
247 UnknownValue(serde_json::Value),
248}
249
250#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum PoliciesEventMatcherRetrieveError {
254 Status400(models::ValidationError),
255 Status403(models::GenericError),
256 UnknownValue(serde_json::Value),
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum PoliciesEventMatcherUpdateError {
263 Status400(models::ValidationError),
264 Status403(models::GenericError),
265 UnknownValue(serde_json::Value),
266}
267
268#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum PoliciesEventMatcherUsedByListError {
272 Status400(models::ValidationError),
273 Status403(models::GenericError),
274 UnknownValue(serde_json::Value),
275}
276
277#[derive(Debug, Clone, Serialize, Deserialize)]
279#[serde(untagged)]
280pub enum PoliciesExpressionCreateError {
281 Status400(models::ValidationError),
282 Status403(models::GenericError),
283 UnknownValue(serde_json::Value),
284}
285
286#[derive(Debug, Clone, Serialize, Deserialize)]
288#[serde(untagged)]
289pub enum PoliciesExpressionDestroyError {
290 Status400(models::ValidationError),
291 Status403(models::GenericError),
292 UnknownValue(serde_json::Value),
293}
294
295#[derive(Debug, Clone, Serialize, Deserialize)]
297#[serde(untagged)]
298pub enum PoliciesExpressionListError {
299 Status400(models::ValidationError),
300 Status403(models::GenericError),
301 UnknownValue(serde_json::Value),
302}
303
304#[derive(Debug, Clone, Serialize, Deserialize)]
306#[serde(untagged)]
307pub enum PoliciesExpressionPartialUpdateError {
308 Status400(models::ValidationError),
309 Status403(models::GenericError),
310 UnknownValue(serde_json::Value),
311}
312
313#[derive(Debug, Clone, Serialize, Deserialize)]
315#[serde(untagged)]
316pub enum PoliciesExpressionRetrieveError {
317 Status400(models::ValidationError),
318 Status403(models::GenericError),
319 UnknownValue(serde_json::Value),
320}
321
322#[derive(Debug, Clone, Serialize, Deserialize)]
324#[serde(untagged)]
325pub enum PoliciesExpressionUpdateError {
326 Status400(models::ValidationError),
327 Status403(models::GenericError),
328 UnknownValue(serde_json::Value),
329}
330
331#[derive(Debug, Clone, Serialize, Deserialize)]
333#[serde(untagged)]
334pub enum PoliciesExpressionUsedByListError {
335 Status400(models::ValidationError),
336 Status403(models::GenericError),
337 UnknownValue(serde_json::Value),
338}
339
340#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum PoliciesGeoipCreateError {
344 Status400(models::ValidationError),
345 Status403(models::GenericError),
346 UnknownValue(serde_json::Value),
347}
348
349#[derive(Debug, Clone, Serialize, Deserialize)]
351#[serde(untagged)]
352pub enum PoliciesGeoipDestroyError {
353 Status400(models::ValidationError),
354 Status403(models::GenericError),
355 UnknownValue(serde_json::Value),
356}
357
358#[derive(Debug, Clone, Serialize, Deserialize)]
360#[serde(untagged)]
361pub enum PoliciesGeoipIso3166ListError {
362 Status400(models::ValidationError),
363 Status403(models::GenericError),
364 UnknownValue(serde_json::Value),
365}
366
367#[derive(Debug, Clone, Serialize, Deserialize)]
369#[serde(untagged)]
370pub enum PoliciesGeoipListError {
371 Status400(models::ValidationError),
372 Status403(models::GenericError),
373 UnknownValue(serde_json::Value),
374}
375
376#[derive(Debug, Clone, Serialize, Deserialize)]
378#[serde(untagged)]
379pub enum PoliciesGeoipPartialUpdateError {
380 Status400(models::ValidationError),
381 Status403(models::GenericError),
382 UnknownValue(serde_json::Value),
383}
384
385#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum PoliciesGeoipRetrieveError {
389 Status400(models::ValidationError),
390 Status403(models::GenericError),
391 UnknownValue(serde_json::Value),
392}
393
394#[derive(Debug, Clone, Serialize, Deserialize)]
396#[serde(untagged)]
397pub enum PoliciesGeoipUpdateError {
398 Status400(models::ValidationError),
399 Status403(models::GenericError),
400 UnknownValue(serde_json::Value),
401}
402
403#[derive(Debug, Clone, Serialize, Deserialize)]
405#[serde(untagged)]
406pub enum PoliciesGeoipUsedByListError {
407 Status400(models::ValidationError),
408 Status403(models::GenericError),
409 UnknownValue(serde_json::Value),
410}
411
412#[derive(Debug, Clone, Serialize, Deserialize)]
414#[serde(untagged)]
415pub enum PoliciesPasswordCreateError {
416 Status400(models::ValidationError),
417 Status403(models::GenericError),
418 UnknownValue(serde_json::Value),
419}
420
421#[derive(Debug, Clone, Serialize, Deserialize)]
423#[serde(untagged)]
424pub enum PoliciesPasswordDestroyError {
425 Status400(models::ValidationError),
426 Status403(models::GenericError),
427 UnknownValue(serde_json::Value),
428}
429
430#[derive(Debug, Clone, Serialize, Deserialize)]
432#[serde(untagged)]
433pub enum PoliciesPasswordExpiryCreateError {
434 Status400(models::ValidationError),
435 Status403(models::GenericError),
436 UnknownValue(serde_json::Value),
437}
438
439#[derive(Debug, Clone, Serialize, Deserialize)]
441#[serde(untagged)]
442pub enum PoliciesPasswordExpiryDestroyError {
443 Status400(models::ValidationError),
444 Status403(models::GenericError),
445 UnknownValue(serde_json::Value),
446}
447
448#[derive(Debug, Clone, Serialize, Deserialize)]
450#[serde(untagged)]
451pub enum PoliciesPasswordExpiryListError {
452 Status400(models::ValidationError),
453 Status403(models::GenericError),
454 UnknownValue(serde_json::Value),
455}
456
457#[derive(Debug, Clone, Serialize, Deserialize)]
459#[serde(untagged)]
460pub enum PoliciesPasswordExpiryPartialUpdateError {
461 Status400(models::ValidationError),
462 Status403(models::GenericError),
463 UnknownValue(serde_json::Value),
464}
465
466#[derive(Debug, Clone, Serialize, Deserialize)]
468#[serde(untagged)]
469pub enum PoliciesPasswordExpiryRetrieveError {
470 Status400(models::ValidationError),
471 Status403(models::GenericError),
472 UnknownValue(serde_json::Value),
473}
474
475#[derive(Debug, Clone, Serialize, Deserialize)]
477#[serde(untagged)]
478pub enum PoliciesPasswordExpiryUpdateError {
479 Status400(models::ValidationError),
480 Status403(models::GenericError),
481 UnknownValue(serde_json::Value),
482}
483
484#[derive(Debug, Clone, Serialize, Deserialize)]
486#[serde(untagged)]
487pub enum PoliciesPasswordExpiryUsedByListError {
488 Status400(models::ValidationError),
489 Status403(models::GenericError),
490 UnknownValue(serde_json::Value),
491}
492
493#[derive(Debug, Clone, Serialize, Deserialize)]
495#[serde(untagged)]
496pub enum PoliciesPasswordListError {
497 Status400(models::ValidationError),
498 Status403(models::GenericError),
499 UnknownValue(serde_json::Value),
500}
501
502#[derive(Debug, Clone, Serialize, Deserialize)]
504#[serde(untagged)]
505pub enum PoliciesPasswordPartialUpdateError {
506 Status400(models::ValidationError),
507 Status403(models::GenericError),
508 UnknownValue(serde_json::Value),
509}
510
511#[derive(Debug, Clone, Serialize, Deserialize)]
513#[serde(untagged)]
514pub enum PoliciesPasswordRetrieveError {
515 Status400(models::ValidationError),
516 Status403(models::GenericError),
517 UnknownValue(serde_json::Value),
518}
519
520#[derive(Debug, Clone, Serialize, Deserialize)]
522#[serde(untagged)]
523pub enum PoliciesPasswordUpdateError {
524 Status400(models::ValidationError),
525 Status403(models::GenericError),
526 UnknownValue(serde_json::Value),
527}
528
529#[derive(Debug, Clone, Serialize, Deserialize)]
531#[serde(untagged)]
532pub enum PoliciesPasswordUsedByListError {
533 Status400(models::ValidationError),
534 Status403(models::GenericError),
535 UnknownValue(serde_json::Value),
536}
537
538#[derive(Debug, Clone, Serialize, Deserialize)]
540#[serde(untagged)]
541pub enum PoliciesReputationCreateError {
542 Status400(models::ValidationError),
543 Status403(models::GenericError),
544 UnknownValue(serde_json::Value),
545}
546
547#[derive(Debug, Clone, Serialize, Deserialize)]
549#[serde(untagged)]
550pub enum PoliciesReputationDestroyError {
551 Status400(models::ValidationError),
552 Status403(models::GenericError),
553 UnknownValue(serde_json::Value),
554}
555
556#[derive(Debug, Clone, Serialize, Deserialize)]
558#[serde(untagged)]
559pub enum PoliciesReputationListError {
560 Status400(models::ValidationError),
561 Status403(models::GenericError),
562 UnknownValue(serde_json::Value),
563}
564
565#[derive(Debug, Clone, Serialize, Deserialize)]
567#[serde(untagged)]
568pub enum PoliciesReputationPartialUpdateError {
569 Status400(models::ValidationError),
570 Status403(models::GenericError),
571 UnknownValue(serde_json::Value),
572}
573
574#[derive(Debug, Clone, Serialize, Deserialize)]
576#[serde(untagged)]
577pub enum PoliciesReputationRetrieveError {
578 Status400(models::ValidationError),
579 Status403(models::GenericError),
580 UnknownValue(serde_json::Value),
581}
582
583#[derive(Debug, Clone, Serialize, Deserialize)]
585#[serde(untagged)]
586pub enum PoliciesReputationScoresDestroyError {
587 Status400(models::ValidationError),
588 Status403(models::GenericError),
589 UnknownValue(serde_json::Value),
590}
591
592#[derive(Debug, Clone, Serialize, Deserialize)]
594#[serde(untagged)]
595pub enum PoliciesReputationScoresListError {
596 Status400(models::ValidationError),
597 Status403(models::GenericError),
598 UnknownValue(serde_json::Value),
599}
600
601#[derive(Debug, Clone, Serialize, Deserialize)]
603#[serde(untagged)]
604pub enum PoliciesReputationScoresRetrieveError {
605 Status400(models::ValidationError),
606 Status403(models::GenericError),
607 UnknownValue(serde_json::Value),
608}
609
610#[derive(Debug, Clone, Serialize, Deserialize)]
612#[serde(untagged)]
613pub enum PoliciesReputationScoresUsedByListError {
614 Status400(models::ValidationError),
615 Status403(models::GenericError),
616 UnknownValue(serde_json::Value),
617}
618
619#[derive(Debug, Clone, Serialize, Deserialize)]
621#[serde(untagged)]
622pub enum PoliciesReputationUpdateError {
623 Status400(models::ValidationError),
624 Status403(models::GenericError),
625 UnknownValue(serde_json::Value),
626}
627
628#[derive(Debug, Clone, Serialize, Deserialize)]
630#[serde(untagged)]
631pub enum PoliciesReputationUsedByListError {
632 Status400(models::ValidationError),
633 Status403(models::GenericError),
634 UnknownValue(serde_json::Value),
635}
636
637#[derive(Debug, Clone, Serialize, Deserialize)]
639#[serde(untagged)]
640pub enum PoliciesUniquePasswordCreateError {
641 Status400(models::ValidationError),
642 Status403(models::GenericError),
643 UnknownValue(serde_json::Value),
644}
645
646#[derive(Debug, Clone, Serialize, Deserialize)]
648#[serde(untagged)]
649pub enum PoliciesUniquePasswordDestroyError {
650 Status400(models::ValidationError),
651 Status403(models::GenericError),
652 UnknownValue(serde_json::Value),
653}
654
655#[derive(Debug, Clone, Serialize, Deserialize)]
657#[serde(untagged)]
658pub enum PoliciesUniquePasswordListError {
659 Status400(models::ValidationError),
660 Status403(models::GenericError),
661 UnknownValue(serde_json::Value),
662}
663
664#[derive(Debug, Clone, Serialize, Deserialize)]
666#[serde(untagged)]
667pub enum PoliciesUniquePasswordPartialUpdateError {
668 Status400(models::ValidationError),
669 Status403(models::GenericError),
670 UnknownValue(serde_json::Value),
671}
672
673#[derive(Debug, Clone, Serialize, Deserialize)]
675#[serde(untagged)]
676pub enum PoliciesUniquePasswordRetrieveError {
677 Status400(models::ValidationError),
678 Status403(models::GenericError),
679 UnknownValue(serde_json::Value),
680}
681
682#[derive(Debug, Clone, Serialize, Deserialize)]
684#[serde(untagged)]
685pub enum PoliciesUniquePasswordUpdateError {
686 Status400(models::ValidationError),
687 Status403(models::GenericError),
688 UnknownValue(serde_json::Value),
689}
690
691#[derive(Debug, Clone, Serialize, Deserialize)]
693#[serde(untagged)]
694pub enum PoliciesUniquePasswordUsedByListError {
695 Status400(models::ValidationError),
696 Status403(models::GenericError),
697 UnknownValue(serde_json::Value),
698}
699
700pub async fn policies_all_cache_clear_create(
702 configuration: &configuration::Configuration,
703) -> Result<(), Error<PoliciesAllCacheClearCreateError>> {
704 let uri_str = format!("{}/policies/all/cache_clear/", configuration.base_path);
705 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
706
707 if let Some(ref user_agent) = configuration.user_agent {
708 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
709 }
710 if let Some(ref token) = configuration.bearer_access_token {
711 req_builder = req_builder.bearer_auth(token.to_owned());
712 };
713
714 let req = req_builder.build()?;
715 let resp = configuration.client.execute(req).await?;
716
717 let status = resp.status();
718
719 if !status.is_client_error() && !status.is_server_error() {
720 Ok(())
721 } else {
722 let content = resp.text().await?;
723 let entity: Option<PoliciesAllCacheClearCreateError> = serde_json::from_str(&content).ok();
724 Err(Error::ResponseError(ResponseContent {
725 status,
726 content,
727 entity,
728 }))
729 }
730}
731
732pub async fn policies_all_cache_info_retrieve(
734 configuration: &configuration::Configuration,
735) -> Result<models::Cache, Error<PoliciesAllCacheInfoRetrieveError>> {
736 let uri_str = format!("{}/policies/all/cache_info/", configuration.base_path);
737 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
738
739 if let Some(ref user_agent) = configuration.user_agent {
740 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
741 }
742 if let Some(ref token) = configuration.bearer_access_token {
743 req_builder = req_builder.bearer_auth(token.to_owned());
744 };
745
746 let req = req_builder.build()?;
747 let resp = configuration.client.execute(req).await?;
748
749 let status = resp.status();
750 let content_type = resp
751 .headers()
752 .get("content-type")
753 .and_then(|v| v.to_str().ok())
754 .unwrap_or("application/octet-stream");
755 let content_type = super::ContentType::from(content_type);
756
757 if !status.is_client_error() && !status.is_server_error() {
758 let content = resp.text().await?;
759 match content_type {
760 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
761 ContentType::Text => {
762 return Err(Error::from(serde_json::Error::custom(
763 "Received `text/plain` content type response that cannot be converted to `models::Cache`",
764 )))
765 }
766 ContentType::Unsupported(unknown_type) => {
767 return Err(Error::from(serde_json::Error::custom(format!(
768 "Received `{unknown_type}` content type response that cannot be converted to `models::Cache`"
769 ))))
770 }
771 }
772 } else {
773 let content = resp.text().await?;
774 let entity: Option<PoliciesAllCacheInfoRetrieveError> = serde_json::from_str(&content).ok();
775 Err(Error::ResponseError(ResponseContent {
776 status,
777 content,
778 entity,
779 }))
780 }
781}
782
783pub async fn policies_all_destroy(
785 configuration: &configuration::Configuration,
786 policy_uuid: &str,
787) -> Result<(), Error<PoliciesAllDestroyError>> {
788 let p_path_policy_uuid = policy_uuid;
790
791 let uri_str = format!(
792 "{}/policies/all/{policy_uuid}/",
793 configuration.base_path,
794 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
795 );
796 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
797
798 if let Some(ref user_agent) = configuration.user_agent {
799 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
800 }
801 if let Some(ref token) = configuration.bearer_access_token {
802 req_builder = req_builder.bearer_auth(token.to_owned());
803 };
804
805 let req = req_builder.build()?;
806 let resp = configuration.client.execute(req).await?;
807
808 let status = resp.status();
809
810 if !status.is_client_error() && !status.is_server_error() {
811 Ok(())
812 } else {
813 let content = resp.text().await?;
814 let entity: Option<PoliciesAllDestroyError> = serde_json::from_str(&content).ok();
815 Err(Error::ResponseError(ResponseContent {
816 status,
817 content,
818 entity,
819 }))
820 }
821}
822
823pub async fn policies_all_list(
825 configuration: &configuration::Configuration,
826 bindings__isnull: Option<bool>,
827 ordering: Option<&str>,
828 page: Option<i32>,
829 page_size: Option<i32>,
830 promptstage__isnull: Option<bool>,
831 search: Option<&str>,
832) -> Result<models::PaginatedPolicyList, Error<PoliciesAllListError>> {
833 let p_query_bindings__isnull = bindings__isnull;
835 let p_query_ordering = ordering;
836 let p_query_page = page;
837 let p_query_page_size = page_size;
838 let p_query_promptstage__isnull = promptstage__isnull;
839 let p_query_search = search;
840
841 let uri_str = format!("{}/policies/all/", configuration.base_path);
842 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
843
844 if let Some(ref param_value) = p_query_bindings__isnull {
845 req_builder = req_builder.query(&[("bindings__isnull", ¶m_value.to_string())]);
846 }
847 if let Some(ref param_value) = p_query_ordering {
848 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
849 }
850 if let Some(ref param_value) = p_query_page {
851 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
852 }
853 if let Some(ref param_value) = p_query_page_size {
854 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
855 }
856 if let Some(ref param_value) = p_query_promptstage__isnull {
857 req_builder = req_builder.query(&[("promptstage__isnull", ¶m_value.to_string())]);
858 }
859 if let Some(ref param_value) = p_query_search {
860 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
861 }
862 if let Some(ref user_agent) = configuration.user_agent {
863 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
864 }
865 if let Some(ref token) = configuration.bearer_access_token {
866 req_builder = req_builder.bearer_auth(token.to_owned());
867 };
868
869 let req = req_builder.build()?;
870 let resp = configuration.client.execute(req).await?;
871
872 let status = resp.status();
873 let content_type = resp
874 .headers()
875 .get("content-type")
876 .and_then(|v| v.to_str().ok())
877 .unwrap_or("application/octet-stream");
878 let content_type = super::ContentType::from(content_type);
879
880 if !status.is_client_error() && !status.is_server_error() {
881 let content = resp.text().await?;
882 match content_type {
883 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
884 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedPolicyList`"))),
885 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::PaginatedPolicyList`")))),
886 }
887 } else {
888 let content = resp.text().await?;
889 let entity: Option<PoliciesAllListError> = serde_json::from_str(&content).ok();
890 Err(Error::ResponseError(ResponseContent {
891 status,
892 content,
893 entity,
894 }))
895 }
896}
897
898pub async fn policies_all_retrieve(
900 configuration: &configuration::Configuration,
901 policy_uuid: &str,
902) -> Result<models::Policy, Error<PoliciesAllRetrieveError>> {
903 let p_path_policy_uuid = policy_uuid;
905
906 let uri_str = format!(
907 "{}/policies/all/{policy_uuid}/",
908 configuration.base_path,
909 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
910 );
911 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
912
913 if let Some(ref user_agent) = configuration.user_agent {
914 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
915 }
916 if let Some(ref token) = configuration.bearer_access_token {
917 req_builder = req_builder.bearer_auth(token.to_owned());
918 };
919
920 let req = req_builder.build()?;
921 let resp = configuration.client.execute(req).await?;
922
923 let status = resp.status();
924 let content_type = resp
925 .headers()
926 .get("content-type")
927 .and_then(|v| v.to_str().ok())
928 .unwrap_or("application/octet-stream");
929 let content_type = super::ContentType::from(content_type);
930
931 if !status.is_client_error() && !status.is_server_error() {
932 let content = resp.text().await?;
933 match content_type {
934 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
935 ContentType::Text => {
936 return Err(Error::from(serde_json::Error::custom(
937 "Received `text/plain` content type response that cannot be converted to `models::Policy`",
938 )))
939 }
940 ContentType::Unsupported(unknown_type) => {
941 return Err(Error::from(serde_json::Error::custom(format!(
942 "Received `{unknown_type}` content type response that cannot be converted to `models::Policy`"
943 ))))
944 }
945 }
946 } else {
947 let content = resp.text().await?;
948 let entity: Option<PoliciesAllRetrieveError> = serde_json::from_str(&content).ok();
949 Err(Error::ResponseError(ResponseContent {
950 status,
951 content,
952 entity,
953 }))
954 }
955}
956
957pub async fn policies_all_test_create(
959 configuration: &configuration::Configuration,
960 policy_uuid: &str,
961 policy_test_request: models::PolicyTestRequest,
962) -> Result<models::PolicyTestResult, Error<PoliciesAllTestCreateError>> {
963 let p_path_policy_uuid = policy_uuid;
965 let p_body_policy_test_request = policy_test_request;
966
967 let uri_str = format!(
968 "{}/policies/all/{policy_uuid}/test/",
969 configuration.base_path,
970 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
971 );
972 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
973
974 if let Some(ref user_agent) = configuration.user_agent {
975 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
976 }
977 if let Some(ref token) = configuration.bearer_access_token {
978 req_builder = req_builder.bearer_auth(token.to_owned());
979 };
980 req_builder = req_builder.json(&p_body_policy_test_request);
981
982 let req = req_builder.build()?;
983 let resp = configuration.client.execute(req).await?;
984
985 let status = resp.status();
986 let content_type = resp
987 .headers()
988 .get("content-type")
989 .and_then(|v| v.to_str().ok())
990 .unwrap_or("application/octet-stream");
991 let content_type = super::ContentType::from(content_type);
992
993 if !status.is_client_error() && !status.is_server_error() {
994 let content = resp.text().await?;
995 match content_type {
996 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
997 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PolicyTestResult`"))),
998 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::PolicyTestResult`")))),
999 }
1000 } else {
1001 let content = resp.text().await?;
1002 let entity: Option<PoliciesAllTestCreateError> = serde_json::from_str(&content).ok();
1003 Err(Error::ResponseError(ResponseContent {
1004 status,
1005 content,
1006 entity,
1007 }))
1008 }
1009}
1010
1011pub async fn policies_all_types_list(
1013 configuration: &configuration::Configuration,
1014) -> Result<Vec<models::TypeCreate>, Error<PoliciesAllTypesListError>> {
1015 let uri_str = format!("{}/policies/all/types/", configuration.base_path);
1016 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1017
1018 if let Some(ref user_agent) = configuration.user_agent {
1019 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1020 }
1021 if let Some(ref token) = configuration.bearer_access_token {
1022 req_builder = req_builder.bearer_auth(token.to_owned());
1023 };
1024
1025 let req = req_builder.build()?;
1026 let resp = configuration.client.execute(req).await?;
1027
1028 let status = resp.status();
1029 let content_type = resp
1030 .headers()
1031 .get("content-type")
1032 .and_then(|v| v.to_str().ok())
1033 .unwrap_or("application/octet-stream");
1034 let content_type = super::ContentType::from(content_type);
1035
1036 if !status.is_client_error() && !status.is_server_error() {
1037 let content = resp.text().await?;
1038 match content_type {
1039 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1040 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TypeCreate>`"))),
1041 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::TypeCreate>`")))),
1042 }
1043 } else {
1044 let content = resp.text().await?;
1045 let entity: Option<PoliciesAllTypesListError> = serde_json::from_str(&content).ok();
1046 Err(Error::ResponseError(ResponseContent {
1047 status,
1048 content,
1049 entity,
1050 }))
1051 }
1052}
1053
1054pub async fn policies_all_used_by_list(
1056 configuration: &configuration::Configuration,
1057 policy_uuid: &str,
1058) -> Result<Vec<models::UsedBy>, Error<PoliciesAllUsedByListError>> {
1059 let p_path_policy_uuid = policy_uuid;
1061
1062 let uri_str = format!(
1063 "{}/policies/all/{policy_uuid}/used_by/",
1064 configuration.base_path,
1065 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
1066 );
1067 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1068
1069 if let Some(ref user_agent) = configuration.user_agent {
1070 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1071 }
1072 if let Some(ref token) = configuration.bearer_access_token {
1073 req_builder = req_builder.bearer_auth(token.to_owned());
1074 };
1075
1076 let req = req_builder.build()?;
1077 let resp = configuration.client.execute(req).await?;
1078
1079 let status = resp.status();
1080 let content_type = resp
1081 .headers()
1082 .get("content-type")
1083 .and_then(|v| v.to_str().ok())
1084 .unwrap_or("application/octet-stream");
1085 let content_type = super::ContentType::from(content_type);
1086
1087 if !status.is_client_error() && !status.is_server_error() {
1088 let content = resp.text().await?;
1089 match content_type {
1090 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1091 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1092 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::UsedBy>`")))),
1093 }
1094 } else {
1095 let content = resp.text().await?;
1096 let entity: Option<PoliciesAllUsedByListError> = serde_json::from_str(&content).ok();
1097 Err(Error::ResponseError(ResponseContent {
1098 status,
1099 content,
1100 entity,
1101 }))
1102 }
1103}
1104
1105pub async fn policies_bindings_create(
1107 configuration: &configuration::Configuration,
1108 policy_binding_request: models::PolicyBindingRequest,
1109) -> Result<models::PolicyBinding, Error<PoliciesBindingsCreateError>> {
1110 let p_body_policy_binding_request = policy_binding_request;
1112
1113 let uri_str = format!("{}/policies/bindings/", configuration.base_path);
1114 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1115
1116 if let Some(ref user_agent) = configuration.user_agent {
1117 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1118 }
1119 if let Some(ref token) = configuration.bearer_access_token {
1120 req_builder = req_builder.bearer_auth(token.to_owned());
1121 };
1122 req_builder = req_builder.json(&p_body_policy_binding_request);
1123
1124 let req = req_builder.build()?;
1125 let resp = configuration.client.execute(req).await?;
1126
1127 let status = resp.status();
1128 let content_type = resp
1129 .headers()
1130 .get("content-type")
1131 .and_then(|v| v.to_str().ok())
1132 .unwrap_or("application/octet-stream");
1133 let content_type = super::ContentType::from(content_type);
1134
1135 if !status.is_client_error() && !status.is_server_error() {
1136 let content = resp.text().await?;
1137 match content_type {
1138 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1139 ContentType::Text => {
1140 return Err(Error::from(serde_json::Error::custom(
1141 "Received `text/plain` content type response that cannot be converted to `models::PolicyBinding`",
1142 )))
1143 }
1144 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1145 "Received `{unknown_type}` content type response that cannot be converted to `models::PolicyBinding`"
1146 )))),
1147 }
1148 } else {
1149 let content = resp.text().await?;
1150 let entity: Option<PoliciesBindingsCreateError> = serde_json::from_str(&content).ok();
1151 Err(Error::ResponseError(ResponseContent {
1152 status,
1153 content,
1154 entity,
1155 }))
1156 }
1157}
1158
1159pub async fn policies_bindings_destroy(
1161 configuration: &configuration::Configuration,
1162 policy_binding_uuid: &str,
1163) -> Result<(), Error<PoliciesBindingsDestroyError>> {
1164 let p_path_policy_binding_uuid = policy_binding_uuid;
1166
1167 let uri_str = format!(
1168 "{}/policies/bindings/{policy_binding_uuid}/",
1169 configuration.base_path,
1170 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
1171 );
1172 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1173
1174 if let Some(ref user_agent) = configuration.user_agent {
1175 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1176 }
1177 if let Some(ref token) = configuration.bearer_access_token {
1178 req_builder = req_builder.bearer_auth(token.to_owned());
1179 };
1180
1181 let req = req_builder.build()?;
1182 let resp = configuration.client.execute(req).await?;
1183
1184 let status = resp.status();
1185
1186 if !status.is_client_error() && !status.is_server_error() {
1187 Ok(())
1188 } else {
1189 let content = resp.text().await?;
1190 let entity: Option<PoliciesBindingsDestroyError> = serde_json::from_str(&content).ok();
1191 Err(Error::ResponseError(ResponseContent {
1192 status,
1193 content,
1194 entity,
1195 }))
1196 }
1197}
1198
1199pub async fn policies_bindings_list(
1201 configuration: &configuration::Configuration,
1202 enabled: Option<bool>,
1203 order: Option<i32>,
1204 ordering: Option<&str>,
1205 page: Option<i32>,
1206 page_size: Option<i32>,
1207 policy: Option<&str>,
1208 policy__isnull: Option<bool>,
1209 search: Option<&str>,
1210 target: Option<&str>,
1211 target_in: Option<Vec<uuid::Uuid>>,
1212 timeout: Option<i32>,
1213) -> Result<models::PaginatedPolicyBindingList, Error<PoliciesBindingsListError>> {
1214 let p_query_enabled = enabled;
1216 let p_query_order = order;
1217 let p_query_ordering = ordering;
1218 let p_query_page = page;
1219 let p_query_page_size = page_size;
1220 let p_query_policy = policy;
1221 let p_query_policy__isnull = policy__isnull;
1222 let p_query_search = search;
1223 let p_query_target = target;
1224 let p_query_target_in = target_in;
1225 let p_query_timeout = timeout;
1226
1227 let uri_str = format!("{}/policies/bindings/", configuration.base_path);
1228 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1229
1230 if let Some(ref param_value) = p_query_enabled {
1231 req_builder = req_builder.query(&[("enabled", ¶m_value.to_string())]);
1232 }
1233 if let Some(ref param_value) = p_query_order {
1234 req_builder = req_builder.query(&[("order", ¶m_value.to_string())]);
1235 }
1236 if let Some(ref param_value) = p_query_ordering {
1237 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1238 }
1239 if let Some(ref param_value) = p_query_page {
1240 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1241 }
1242 if let Some(ref param_value) = p_query_page_size {
1243 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1244 }
1245 if let Some(ref param_value) = p_query_policy {
1246 req_builder = req_builder.query(&[("policy", ¶m_value.to_string())]);
1247 }
1248 if let Some(ref param_value) = p_query_policy__isnull {
1249 req_builder = req_builder.query(&[("policy__isnull", ¶m_value.to_string())]);
1250 }
1251 if let Some(ref param_value) = p_query_search {
1252 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1253 }
1254 if let Some(ref param_value) = p_query_target {
1255 req_builder = req_builder.query(&[("target", ¶m_value.to_string())]);
1256 }
1257 if let Some(ref param_value) = p_query_target_in {
1258 req_builder = match "multi" {
1259 "multi" => req_builder.query(
1260 ¶m_value
1261 .into_iter()
1262 .map(|p| ("target_in".to_owned(), p.to_string()))
1263 .collect::<Vec<(std::string::String, std::string::String)>>(),
1264 ),
1265 _ => req_builder.query(&[(
1266 "target_in",
1267 ¶m_value
1268 .into_iter()
1269 .map(|p| p.to_string())
1270 .collect::<Vec<String>>()
1271 .join(",")
1272 .to_string(),
1273 )]),
1274 };
1275 }
1276 if let Some(ref param_value) = p_query_timeout {
1277 req_builder = req_builder.query(&[("timeout", ¶m_value.to_string())]);
1278 }
1279 if let Some(ref user_agent) = configuration.user_agent {
1280 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1281 }
1282 if let Some(ref token) = configuration.bearer_access_token {
1283 req_builder = req_builder.bearer_auth(token.to_owned());
1284 };
1285
1286 let req = req_builder.build()?;
1287 let resp = configuration.client.execute(req).await?;
1288
1289 let status = resp.status();
1290 let content_type = resp
1291 .headers()
1292 .get("content-type")
1293 .and_then(|v| v.to_str().ok())
1294 .unwrap_or("application/octet-stream");
1295 let content_type = super::ContentType::from(content_type);
1296
1297 if !status.is_client_error() && !status.is_server_error() {
1298 let content = resp.text().await?;
1299 match content_type {
1300 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1301 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedPolicyBindingList`"))),
1302 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::PaginatedPolicyBindingList`")))),
1303 }
1304 } else {
1305 let content = resp.text().await?;
1306 let entity: Option<PoliciesBindingsListError> = serde_json::from_str(&content).ok();
1307 Err(Error::ResponseError(ResponseContent {
1308 status,
1309 content,
1310 entity,
1311 }))
1312 }
1313}
1314
1315pub async fn policies_bindings_partial_update(
1317 configuration: &configuration::Configuration,
1318 policy_binding_uuid: &str,
1319 patched_policy_binding_request: Option<models::PatchedPolicyBindingRequest>,
1320) -> Result<models::PolicyBinding, Error<PoliciesBindingsPartialUpdateError>> {
1321 let p_path_policy_binding_uuid = policy_binding_uuid;
1323 let p_body_patched_policy_binding_request = patched_policy_binding_request;
1324
1325 let uri_str = format!(
1326 "{}/policies/bindings/{policy_binding_uuid}/",
1327 configuration.base_path,
1328 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
1329 );
1330 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1331
1332 if let Some(ref user_agent) = configuration.user_agent {
1333 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1334 }
1335 if let Some(ref token) = configuration.bearer_access_token {
1336 req_builder = req_builder.bearer_auth(token.to_owned());
1337 };
1338 req_builder = req_builder.json(&p_body_patched_policy_binding_request);
1339
1340 let req = req_builder.build()?;
1341 let resp = configuration.client.execute(req).await?;
1342
1343 let status = resp.status();
1344 let content_type = resp
1345 .headers()
1346 .get("content-type")
1347 .and_then(|v| v.to_str().ok())
1348 .unwrap_or("application/octet-stream");
1349 let content_type = super::ContentType::from(content_type);
1350
1351 if !status.is_client_error() && !status.is_server_error() {
1352 let content = resp.text().await?;
1353 match content_type {
1354 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1355 ContentType::Text => {
1356 return Err(Error::from(serde_json::Error::custom(
1357 "Received `text/plain` content type response that cannot be converted to `models::PolicyBinding`",
1358 )))
1359 }
1360 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1361 "Received `{unknown_type}` content type response that cannot be converted to `models::PolicyBinding`"
1362 )))),
1363 }
1364 } else {
1365 let content = resp.text().await?;
1366 let entity: Option<PoliciesBindingsPartialUpdateError> = serde_json::from_str(&content).ok();
1367 Err(Error::ResponseError(ResponseContent {
1368 status,
1369 content,
1370 entity,
1371 }))
1372 }
1373}
1374
1375pub async fn policies_bindings_retrieve(
1377 configuration: &configuration::Configuration,
1378 policy_binding_uuid: &str,
1379) -> Result<models::PolicyBinding, Error<PoliciesBindingsRetrieveError>> {
1380 let p_path_policy_binding_uuid = policy_binding_uuid;
1382
1383 let uri_str = format!(
1384 "{}/policies/bindings/{policy_binding_uuid}/",
1385 configuration.base_path,
1386 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
1387 );
1388 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1389
1390 if let Some(ref user_agent) = configuration.user_agent {
1391 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1392 }
1393 if let Some(ref token) = configuration.bearer_access_token {
1394 req_builder = req_builder.bearer_auth(token.to_owned());
1395 };
1396
1397 let req = req_builder.build()?;
1398 let resp = configuration.client.execute(req).await?;
1399
1400 let status = resp.status();
1401 let content_type = resp
1402 .headers()
1403 .get("content-type")
1404 .and_then(|v| v.to_str().ok())
1405 .unwrap_or("application/octet-stream");
1406 let content_type = super::ContentType::from(content_type);
1407
1408 if !status.is_client_error() && !status.is_server_error() {
1409 let content = resp.text().await?;
1410 match content_type {
1411 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1412 ContentType::Text => {
1413 return Err(Error::from(serde_json::Error::custom(
1414 "Received `text/plain` content type response that cannot be converted to `models::PolicyBinding`",
1415 )))
1416 }
1417 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1418 "Received `{unknown_type}` content type response that cannot be converted to `models::PolicyBinding`"
1419 )))),
1420 }
1421 } else {
1422 let content = resp.text().await?;
1423 let entity: Option<PoliciesBindingsRetrieveError> = serde_json::from_str(&content).ok();
1424 Err(Error::ResponseError(ResponseContent {
1425 status,
1426 content,
1427 entity,
1428 }))
1429 }
1430}
1431
1432pub async fn policies_bindings_update(
1434 configuration: &configuration::Configuration,
1435 policy_binding_uuid: &str,
1436 policy_binding_request: models::PolicyBindingRequest,
1437) -> Result<models::PolicyBinding, Error<PoliciesBindingsUpdateError>> {
1438 let p_path_policy_binding_uuid = policy_binding_uuid;
1440 let p_body_policy_binding_request = policy_binding_request;
1441
1442 let uri_str = format!(
1443 "{}/policies/bindings/{policy_binding_uuid}/",
1444 configuration.base_path,
1445 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
1446 );
1447 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1448
1449 if let Some(ref user_agent) = configuration.user_agent {
1450 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1451 }
1452 if let Some(ref token) = configuration.bearer_access_token {
1453 req_builder = req_builder.bearer_auth(token.to_owned());
1454 };
1455 req_builder = req_builder.json(&p_body_policy_binding_request);
1456
1457 let req = req_builder.build()?;
1458 let resp = configuration.client.execute(req).await?;
1459
1460 let status = resp.status();
1461 let content_type = resp
1462 .headers()
1463 .get("content-type")
1464 .and_then(|v| v.to_str().ok())
1465 .unwrap_or("application/octet-stream");
1466 let content_type = super::ContentType::from(content_type);
1467
1468 if !status.is_client_error() && !status.is_server_error() {
1469 let content = resp.text().await?;
1470 match content_type {
1471 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1472 ContentType::Text => {
1473 return Err(Error::from(serde_json::Error::custom(
1474 "Received `text/plain` content type response that cannot be converted to `models::PolicyBinding`",
1475 )))
1476 }
1477 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
1478 "Received `{unknown_type}` content type response that cannot be converted to `models::PolicyBinding`"
1479 )))),
1480 }
1481 } else {
1482 let content = resp.text().await?;
1483 let entity: Option<PoliciesBindingsUpdateError> = serde_json::from_str(&content).ok();
1484 Err(Error::ResponseError(ResponseContent {
1485 status,
1486 content,
1487 entity,
1488 }))
1489 }
1490}
1491
1492pub async fn policies_bindings_used_by_list(
1494 configuration: &configuration::Configuration,
1495 policy_binding_uuid: &str,
1496) -> Result<Vec<models::UsedBy>, Error<PoliciesBindingsUsedByListError>> {
1497 let p_path_policy_binding_uuid = policy_binding_uuid;
1499
1500 let uri_str = format!(
1501 "{}/policies/bindings/{policy_binding_uuid}/used_by/",
1502 configuration.base_path,
1503 policy_binding_uuid = crate::apis::urlencode(p_path_policy_binding_uuid)
1504 );
1505 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1506
1507 if let Some(ref user_agent) = configuration.user_agent {
1508 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1509 }
1510 if let Some(ref token) = configuration.bearer_access_token {
1511 req_builder = req_builder.bearer_auth(token.to_owned());
1512 };
1513
1514 let req = req_builder.build()?;
1515 let resp = configuration.client.execute(req).await?;
1516
1517 let status = resp.status();
1518 let content_type = resp
1519 .headers()
1520 .get("content-type")
1521 .and_then(|v| v.to_str().ok())
1522 .unwrap_or("application/octet-stream");
1523 let content_type = super::ContentType::from(content_type);
1524
1525 if !status.is_client_error() && !status.is_server_error() {
1526 let content = resp.text().await?;
1527 match content_type {
1528 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1529 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1530 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::UsedBy>`")))),
1531 }
1532 } else {
1533 let content = resp.text().await?;
1534 let entity: Option<PoliciesBindingsUsedByListError> = serde_json::from_str(&content).ok();
1535 Err(Error::ResponseError(ResponseContent {
1536 status,
1537 content,
1538 entity,
1539 }))
1540 }
1541}
1542
1543pub async fn policies_dummy_create(
1545 configuration: &configuration::Configuration,
1546 dummy_policy_request: models::DummyPolicyRequest,
1547) -> Result<models::DummyPolicy, Error<PoliciesDummyCreateError>> {
1548 let p_body_dummy_policy_request = dummy_policy_request;
1550
1551 let uri_str = format!("{}/policies/dummy/", configuration.base_path);
1552 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1553
1554 if let Some(ref user_agent) = configuration.user_agent {
1555 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1556 }
1557 if let Some(ref token) = configuration.bearer_access_token {
1558 req_builder = req_builder.bearer_auth(token.to_owned());
1559 };
1560 req_builder = req_builder.json(&p_body_dummy_policy_request);
1561
1562 let req = req_builder.build()?;
1563 let resp = configuration.client.execute(req).await?;
1564
1565 let status = resp.status();
1566 let content_type = resp
1567 .headers()
1568 .get("content-type")
1569 .and_then(|v| v.to_str().ok())
1570 .unwrap_or("application/octet-stream");
1571 let content_type = super::ContentType::from(content_type);
1572
1573 if !status.is_client_error() && !status.is_server_error() {
1574 let content = resp.text().await?;
1575 match content_type {
1576 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1577 ContentType::Text => {
1578 return Err(Error::from(serde_json::Error::custom(
1579 "Received `text/plain` content type response that cannot be converted to `models::DummyPolicy`",
1580 )))
1581 }
1582 ContentType::Unsupported(unknown_type) => {
1583 return Err(Error::from(serde_json::Error::custom(format!(
1584 "Received `{unknown_type}` content type response that cannot be converted to `models::DummyPolicy`"
1585 ))))
1586 }
1587 }
1588 } else {
1589 let content = resp.text().await?;
1590 let entity: Option<PoliciesDummyCreateError> = serde_json::from_str(&content).ok();
1591 Err(Error::ResponseError(ResponseContent {
1592 status,
1593 content,
1594 entity,
1595 }))
1596 }
1597}
1598
1599pub async fn policies_dummy_destroy(
1601 configuration: &configuration::Configuration,
1602 policy_uuid: &str,
1603) -> Result<(), Error<PoliciesDummyDestroyError>> {
1604 let p_path_policy_uuid = policy_uuid;
1606
1607 let uri_str = format!(
1608 "{}/policies/dummy/{policy_uuid}/",
1609 configuration.base_path,
1610 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
1611 );
1612 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1613
1614 if let Some(ref user_agent) = configuration.user_agent {
1615 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1616 }
1617 if let Some(ref token) = configuration.bearer_access_token {
1618 req_builder = req_builder.bearer_auth(token.to_owned());
1619 };
1620
1621 let req = req_builder.build()?;
1622 let resp = configuration.client.execute(req).await?;
1623
1624 let status = resp.status();
1625
1626 if !status.is_client_error() && !status.is_server_error() {
1627 Ok(())
1628 } else {
1629 let content = resp.text().await?;
1630 let entity: Option<PoliciesDummyDestroyError> = serde_json::from_str(&content).ok();
1631 Err(Error::ResponseError(ResponseContent {
1632 status,
1633 content,
1634 entity,
1635 }))
1636 }
1637}
1638
1639pub async fn policies_dummy_list(
1641 configuration: &configuration::Configuration,
1642 created: Option<String>,
1643 execution_logging: Option<bool>,
1644 last_updated: Option<String>,
1645 name: Option<&str>,
1646 ordering: Option<&str>,
1647 page: Option<i32>,
1648 page_size: Option<i32>,
1649 policy_uuid: Option<&str>,
1650 result: Option<bool>,
1651 search: Option<&str>,
1652 wait_max: Option<i32>,
1653 wait_min: Option<i32>,
1654) -> Result<models::PaginatedDummyPolicyList, Error<PoliciesDummyListError>> {
1655 let p_query_created = created;
1657 let p_query_execution_logging = execution_logging;
1658 let p_query_last_updated = last_updated;
1659 let p_query_name = name;
1660 let p_query_ordering = ordering;
1661 let p_query_page = page;
1662 let p_query_page_size = page_size;
1663 let p_query_policy_uuid = policy_uuid;
1664 let p_query_result = result;
1665 let p_query_search = search;
1666 let p_query_wait_max = wait_max;
1667 let p_query_wait_min = wait_min;
1668
1669 let uri_str = format!("{}/policies/dummy/", configuration.base_path);
1670 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1671
1672 if let Some(ref param_value) = p_query_created {
1673 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
1674 }
1675 if let Some(ref param_value) = p_query_execution_logging {
1676 req_builder = req_builder.query(&[("execution_logging", ¶m_value.to_string())]);
1677 }
1678 if let Some(ref param_value) = p_query_last_updated {
1679 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
1680 }
1681 if let Some(ref param_value) = p_query_name {
1682 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
1683 }
1684 if let Some(ref param_value) = p_query_ordering {
1685 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
1686 }
1687 if let Some(ref param_value) = p_query_page {
1688 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
1689 }
1690 if let Some(ref param_value) = p_query_page_size {
1691 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1692 }
1693 if let Some(ref param_value) = p_query_policy_uuid {
1694 req_builder = req_builder.query(&[("policy_uuid", ¶m_value.to_string())]);
1695 }
1696 if let Some(ref param_value) = p_query_result {
1697 req_builder = req_builder.query(&[("result", ¶m_value.to_string())]);
1698 }
1699 if let Some(ref param_value) = p_query_search {
1700 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
1701 }
1702 if let Some(ref param_value) = p_query_wait_max {
1703 req_builder = req_builder.query(&[("wait_max", ¶m_value.to_string())]);
1704 }
1705 if let Some(ref param_value) = p_query_wait_min {
1706 req_builder = req_builder.query(&[("wait_min", ¶m_value.to_string())]);
1707 }
1708 if let Some(ref user_agent) = configuration.user_agent {
1709 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1710 }
1711 if let Some(ref token) = configuration.bearer_access_token {
1712 req_builder = req_builder.bearer_auth(token.to_owned());
1713 };
1714
1715 let req = req_builder.build()?;
1716 let resp = configuration.client.execute(req).await?;
1717
1718 let status = resp.status();
1719 let content_type = resp
1720 .headers()
1721 .get("content-type")
1722 .and_then(|v| v.to_str().ok())
1723 .unwrap_or("application/octet-stream");
1724 let content_type = super::ContentType::from(content_type);
1725
1726 if !status.is_client_error() && !status.is_server_error() {
1727 let content = resp.text().await?;
1728 match content_type {
1729 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1730 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedDummyPolicyList`"))),
1731 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::PaginatedDummyPolicyList`")))),
1732 }
1733 } else {
1734 let content = resp.text().await?;
1735 let entity: Option<PoliciesDummyListError> = serde_json::from_str(&content).ok();
1736 Err(Error::ResponseError(ResponseContent {
1737 status,
1738 content,
1739 entity,
1740 }))
1741 }
1742}
1743
1744pub async fn policies_dummy_partial_update(
1746 configuration: &configuration::Configuration,
1747 policy_uuid: &str,
1748 patched_dummy_policy_request: Option<models::PatchedDummyPolicyRequest>,
1749) -> Result<models::DummyPolicy, Error<PoliciesDummyPartialUpdateError>> {
1750 let p_path_policy_uuid = policy_uuid;
1752 let p_body_patched_dummy_policy_request = patched_dummy_policy_request;
1753
1754 let uri_str = format!(
1755 "{}/policies/dummy/{policy_uuid}/",
1756 configuration.base_path,
1757 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
1758 );
1759 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1760
1761 if let Some(ref user_agent) = configuration.user_agent {
1762 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1763 }
1764 if let Some(ref token) = configuration.bearer_access_token {
1765 req_builder = req_builder.bearer_auth(token.to_owned());
1766 };
1767 req_builder = req_builder.json(&p_body_patched_dummy_policy_request);
1768
1769 let req = req_builder.build()?;
1770 let resp = configuration.client.execute(req).await?;
1771
1772 let status = resp.status();
1773 let content_type = resp
1774 .headers()
1775 .get("content-type")
1776 .and_then(|v| v.to_str().ok())
1777 .unwrap_or("application/octet-stream");
1778 let content_type = super::ContentType::from(content_type);
1779
1780 if !status.is_client_error() && !status.is_server_error() {
1781 let content = resp.text().await?;
1782 match content_type {
1783 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1784 ContentType::Text => {
1785 return Err(Error::from(serde_json::Error::custom(
1786 "Received `text/plain` content type response that cannot be converted to `models::DummyPolicy`",
1787 )))
1788 }
1789 ContentType::Unsupported(unknown_type) => {
1790 return Err(Error::from(serde_json::Error::custom(format!(
1791 "Received `{unknown_type}` content type response that cannot be converted to `models::DummyPolicy`"
1792 ))))
1793 }
1794 }
1795 } else {
1796 let content = resp.text().await?;
1797 let entity: Option<PoliciesDummyPartialUpdateError> = serde_json::from_str(&content).ok();
1798 Err(Error::ResponseError(ResponseContent {
1799 status,
1800 content,
1801 entity,
1802 }))
1803 }
1804}
1805
1806pub async fn policies_dummy_retrieve(
1808 configuration: &configuration::Configuration,
1809 policy_uuid: &str,
1810) -> Result<models::DummyPolicy, Error<PoliciesDummyRetrieveError>> {
1811 let p_path_policy_uuid = policy_uuid;
1813
1814 let uri_str = format!(
1815 "{}/policies/dummy/{policy_uuid}/",
1816 configuration.base_path,
1817 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
1818 );
1819 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1820
1821 if let Some(ref user_agent) = configuration.user_agent {
1822 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1823 }
1824 if let Some(ref token) = configuration.bearer_access_token {
1825 req_builder = req_builder.bearer_auth(token.to_owned());
1826 };
1827
1828 let req = req_builder.build()?;
1829 let resp = configuration.client.execute(req).await?;
1830
1831 let status = resp.status();
1832 let content_type = resp
1833 .headers()
1834 .get("content-type")
1835 .and_then(|v| v.to_str().ok())
1836 .unwrap_or("application/octet-stream");
1837 let content_type = super::ContentType::from(content_type);
1838
1839 if !status.is_client_error() && !status.is_server_error() {
1840 let content = resp.text().await?;
1841 match content_type {
1842 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1843 ContentType::Text => {
1844 return Err(Error::from(serde_json::Error::custom(
1845 "Received `text/plain` content type response that cannot be converted to `models::DummyPolicy`",
1846 )))
1847 }
1848 ContentType::Unsupported(unknown_type) => {
1849 return Err(Error::from(serde_json::Error::custom(format!(
1850 "Received `{unknown_type}` content type response that cannot be converted to `models::DummyPolicy`"
1851 ))))
1852 }
1853 }
1854 } else {
1855 let content = resp.text().await?;
1856 let entity: Option<PoliciesDummyRetrieveError> = serde_json::from_str(&content).ok();
1857 Err(Error::ResponseError(ResponseContent {
1858 status,
1859 content,
1860 entity,
1861 }))
1862 }
1863}
1864
1865pub async fn policies_dummy_update(
1867 configuration: &configuration::Configuration,
1868 policy_uuid: &str,
1869 dummy_policy_request: models::DummyPolicyRequest,
1870) -> Result<models::DummyPolicy, Error<PoliciesDummyUpdateError>> {
1871 let p_path_policy_uuid = policy_uuid;
1873 let p_body_dummy_policy_request = dummy_policy_request;
1874
1875 let uri_str = format!(
1876 "{}/policies/dummy/{policy_uuid}/",
1877 configuration.base_path,
1878 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
1879 );
1880 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1881
1882 if let Some(ref user_agent) = configuration.user_agent {
1883 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1884 }
1885 if let Some(ref token) = configuration.bearer_access_token {
1886 req_builder = req_builder.bearer_auth(token.to_owned());
1887 };
1888 req_builder = req_builder.json(&p_body_dummy_policy_request);
1889
1890 let req = req_builder.build()?;
1891 let resp = configuration.client.execute(req).await?;
1892
1893 let status = resp.status();
1894 let content_type = resp
1895 .headers()
1896 .get("content-type")
1897 .and_then(|v| v.to_str().ok())
1898 .unwrap_or("application/octet-stream");
1899 let content_type = super::ContentType::from(content_type);
1900
1901 if !status.is_client_error() && !status.is_server_error() {
1902 let content = resp.text().await?;
1903 match content_type {
1904 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1905 ContentType::Text => {
1906 return Err(Error::from(serde_json::Error::custom(
1907 "Received `text/plain` content type response that cannot be converted to `models::DummyPolicy`",
1908 )))
1909 }
1910 ContentType::Unsupported(unknown_type) => {
1911 return Err(Error::from(serde_json::Error::custom(format!(
1912 "Received `{unknown_type}` content type response that cannot be converted to `models::DummyPolicy`"
1913 ))))
1914 }
1915 }
1916 } else {
1917 let content = resp.text().await?;
1918 let entity: Option<PoliciesDummyUpdateError> = serde_json::from_str(&content).ok();
1919 Err(Error::ResponseError(ResponseContent {
1920 status,
1921 content,
1922 entity,
1923 }))
1924 }
1925}
1926
1927pub async fn policies_dummy_used_by_list(
1929 configuration: &configuration::Configuration,
1930 policy_uuid: &str,
1931) -> Result<Vec<models::UsedBy>, Error<PoliciesDummyUsedByListError>> {
1932 let p_path_policy_uuid = policy_uuid;
1934
1935 let uri_str = format!(
1936 "{}/policies/dummy/{policy_uuid}/used_by/",
1937 configuration.base_path,
1938 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
1939 );
1940 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1941
1942 if let Some(ref user_agent) = configuration.user_agent {
1943 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1944 }
1945 if let Some(ref token) = configuration.bearer_access_token {
1946 req_builder = req_builder.bearer_auth(token.to_owned());
1947 };
1948
1949 let req = req_builder.build()?;
1950 let resp = configuration.client.execute(req).await?;
1951
1952 let status = resp.status();
1953 let content_type = resp
1954 .headers()
1955 .get("content-type")
1956 .and_then(|v| v.to_str().ok())
1957 .unwrap_or("application/octet-stream");
1958 let content_type = super::ContentType::from(content_type);
1959
1960 if !status.is_client_error() && !status.is_server_error() {
1961 let content = resp.text().await?;
1962 match content_type {
1963 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1964 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
1965 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::UsedBy>`")))),
1966 }
1967 } else {
1968 let content = resp.text().await?;
1969 let entity: Option<PoliciesDummyUsedByListError> = serde_json::from_str(&content).ok();
1970 Err(Error::ResponseError(ResponseContent {
1971 status,
1972 content,
1973 entity,
1974 }))
1975 }
1976}
1977
1978pub async fn policies_event_matcher_create(
1980 configuration: &configuration::Configuration,
1981 event_matcher_policy_request: models::EventMatcherPolicyRequest,
1982) -> Result<models::EventMatcherPolicy, Error<PoliciesEventMatcherCreateError>> {
1983 let p_body_event_matcher_policy_request = event_matcher_policy_request;
1985
1986 let uri_str = format!("{}/policies/event_matcher/", configuration.base_path);
1987 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1988
1989 if let Some(ref user_agent) = configuration.user_agent {
1990 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1991 }
1992 if let Some(ref token) = configuration.bearer_access_token {
1993 req_builder = req_builder.bearer_auth(token.to_owned());
1994 };
1995 req_builder = req_builder.json(&p_body_event_matcher_policy_request);
1996
1997 let req = req_builder.build()?;
1998 let resp = configuration.client.execute(req).await?;
1999
2000 let status = resp.status();
2001 let content_type = resp
2002 .headers()
2003 .get("content-type")
2004 .and_then(|v| v.to_str().ok())
2005 .unwrap_or("application/octet-stream");
2006 let content_type = super::ContentType::from(content_type);
2007
2008 if !status.is_client_error() && !status.is_server_error() {
2009 let content = resp.text().await?;
2010 match content_type {
2011 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2012 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EventMatcherPolicy`"))),
2013 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::EventMatcherPolicy`")))),
2014 }
2015 } else {
2016 let content = resp.text().await?;
2017 let entity: Option<PoliciesEventMatcherCreateError> = serde_json::from_str(&content).ok();
2018 Err(Error::ResponseError(ResponseContent {
2019 status,
2020 content,
2021 entity,
2022 }))
2023 }
2024}
2025
2026pub async fn policies_event_matcher_destroy(
2028 configuration: &configuration::Configuration,
2029 policy_uuid: &str,
2030) -> Result<(), Error<PoliciesEventMatcherDestroyError>> {
2031 let p_path_policy_uuid = policy_uuid;
2033
2034 let uri_str = format!(
2035 "{}/policies/event_matcher/{policy_uuid}/",
2036 configuration.base_path,
2037 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2038 );
2039 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2040
2041 if let Some(ref user_agent) = configuration.user_agent {
2042 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2043 }
2044 if let Some(ref token) = configuration.bearer_access_token {
2045 req_builder = req_builder.bearer_auth(token.to_owned());
2046 };
2047
2048 let req = req_builder.build()?;
2049 let resp = configuration.client.execute(req).await?;
2050
2051 let status = resp.status();
2052
2053 if !status.is_client_error() && !status.is_server_error() {
2054 Ok(())
2055 } else {
2056 let content = resp.text().await?;
2057 let entity: Option<PoliciesEventMatcherDestroyError> = serde_json::from_str(&content).ok();
2058 Err(Error::ResponseError(ResponseContent {
2059 status,
2060 content,
2061 entity,
2062 }))
2063 }
2064}
2065
2066pub async fn policies_event_matcher_list(
2068 configuration: &configuration::Configuration,
2069 action: Option<&str>,
2070 app: Option<&str>,
2071 client_ip: Option<&str>,
2072 created: Option<String>,
2073 execution_logging: Option<bool>,
2074 last_updated: Option<String>,
2075 model: Option<&str>,
2076 name: Option<&str>,
2077 ordering: Option<&str>,
2078 page: Option<i32>,
2079 page_size: Option<i32>,
2080 policy_uuid: Option<&str>,
2081 search: Option<&str>,
2082) -> Result<models::PaginatedEventMatcherPolicyList, Error<PoliciesEventMatcherListError>> {
2083 let p_query_action = action;
2085 let p_query_app = app;
2086 let p_query_client_ip = client_ip;
2087 let p_query_created = created;
2088 let p_query_execution_logging = execution_logging;
2089 let p_query_last_updated = last_updated;
2090 let p_query_model = model;
2091 let p_query_name = name;
2092 let p_query_ordering = ordering;
2093 let p_query_page = page;
2094 let p_query_page_size = page_size;
2095 let p_query_policy_uuid = policy_uuid;
2096 let p_query_search = search;
2097
2098 let uri_str = format!("{}/policies/event_matcher/", configuration.base_path);
2099 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2100
2101 if let Some(ref param_value) = p_query_action {
2102 req_builder = req_builder.query(&[("action", ¶m_value.to_string())]);
2103 }
2104 if let Some(ref param_value) = p_query_app {
2105 req_builder = req_builder.query(&[("app", ¶m_value.to_string())]);
2106 }
2107 if let Some(ref param_value) = p_query_client_ip {
2108 req_builder = req_builder.query(&[("client_ip", ¶m_value.to_string())]);
2109 }
2110 if let Some(ref param_value) = p_query_created {
2111 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
2112 }
2113 if let Some(ref param_value) = p_query_execution_logging {
2114 req_builder = req_builder.query(&[("execution_logging", ¶m_value.to_string())]);
2115 }
2116 if let Some(ref param_value) = p_query_last_updated {
2117 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
2118 }
2119 if let Some(ref param_value) = p_query_model {
2120 req_builder = req_builder.query(&[("model", ¶m_value.to_string())]);
2121 }
2122 if let Some(ref param_value) = p_query_name {
2123 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2124 }
2125 if let Some(ref param_value) = p_query_ordering {
2126 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2127 }
2128 if let Some(ref param_value) = p_query_page {
2129 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2130 }
2131 if let Some(ref param_value) = p_query_page_size {
2132 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2133 }
2134 if let Some(ref param_value) = p_query_policy_uuid {
2135 req_builder = req_builder.query(&[("policy_uuid", ¶m_value.to_string())]);
2136 }
2137 if let Some(ref param_value) = p_query_search {
2138 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2139 }
2140 if let Some(ref user_agent) = configuration.user_agent {
2141 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2142 }
2143 if let Some(ref token) = configuration.bearer_access_token {
2144 req_builder = req_builder.bearer_auth(token.to_owned());
2145 };
2146
2147 let req = req_builder.build()?;
2148 let resp = configuration.client.execute(req).await?;
2149
2150 let status = resp.status();
2151 let content_type = resp
2152 .headers()
2153 .get("content-type")
2154 .and_then(|v| v.to_str().ok())
2155 .unwrap_or("application/octet-stream");
2156 let content_type = super::ContentType::from(content_type);
2157
2158 if !status.is_client_error() && !status.is_server_error() {
2159 let content = resp.text().await?;
2160 match content_type {
2161 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2162 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedEventMatcherPolicyList`"))),
2163 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::PaginatedEventMatcherPolicyList`")))),
2164 }
2165 } else {
2166 let content = resp.text().await?;
2167 let entity: Option<PoliciesEventMatcherListError> = serde_json::from_str(&content).ok();
2168 Err(Error::ResponseError(ResponseContent {
2169 status,
2170 content,
2171 entity,
2172 }))
2173 }
2174}
2175
2176pub async fn policies_event_matcher_partial_update(
2178 configuration: &configuration::Configuration,
2179 policy_uuid: &str,
2180 patched_event_matcher_policy_request: Option<models::PatchedEventMatcherPolicyRequest>,
2181) -> Result<models::EventMatcherPolicy, Error<PoliciesEventMatcherPartialUpdateError>> {
2182 let p_path_policy_uuid = policy_uuid;
2184 let p_body_patched_event_matcher_policy_request = patched_event_matcher_policy_request;
2185
2186 let uri_str = format!(
2187 "{}/policies/event_matcher/{policy_uuid}/",
2188 configuration.base_path,
2189 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2190 );
2191 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2192
2193 if let Some(ref user_agent) = configuration.user_agent {
2194 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2195 }
2196 if let Some(ref token) = configuration.bearer_access_token {
2197 req_builder = req_builder.bearer_auth(token.to_owned());
2198 };
2199 req_builder = req_builder.json(&p_body_patched_event_matcher_policy_request);
2200
2201 let req = req_builder.build()?;
2202 let resp = configuration.client.execute(req).await?;
2203
2204 let status = resp.status();
2205 let content_type = resp
2206 .headers()
2207 .get("content-type")
2208 .and_then(|v| v.to_str().ok())
2209 .unwrap_or("application/octet-stream");
2210 let content_type = super::ContentType::from(content_type);
2211
2212 if !status.is_client_error() && !status.is_server_error() {
2213 let content = resp.text().await?;
2214 match content_type {
2215 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2216 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EventMatcherPolicy`"))),
2217 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::EventMatcherPolicy`")))),
2218 }
2219 } else {
2220 let content = resp.text().await?;
2221 let entity: Option<PoliciesEventMatcherPartialUpdateError> = serde_json::from_str(&content).ok();
2222 Err(Error::ResponseError(ResponseContent {
2223 status,
2224 content,
2225 entity,
2226 }))
2227 }
2228}
2229
2230pub async fn policies_event_matcher_retrieve(
2232 configuration: &configuration::Configuration,
2233 policy_uuid: &str,
2234) -> Result<models::EventMatcherPolicy, Error<PoliciesEventMatcherRetrieveError>> {
2235 let p_path_policy_uuid = policy_uuid;
2237
2238 let uri_str = format!(
2239 "{}/policies/event_matcher/{policy_uuid}/",
2240 configuration.base_path,
2241 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2242 );
2243 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2244
2245 if let Some(ref user_agent) = configuration.user_agent {
2246 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2247 }
2248 if let Some(ref token) = configuration.bearer_access_token {
2249 req_builder = req_builder.bearer_auth(token.to_owned());
2250 };
2251
2252 let req = req_builder.build()?;
2253 let resp = configuration.client.execute(req).await?;
2254
2255 let status = resp.status();
2256 let content_type = resp
2257 .headers()
2258 .get("content-type")
2259 .and_then(|v| v.to_str().ok())
2260 .unwrap_or("application/octet-stream");
2261 let content_type = super::ContentType::from(content_type);
2262
2263 if !status.is_client_error() && !status.is_server_error() {
2264 let content = resp.text().await?;
2265 match content_type {
2266 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2267 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EventMatcherPolicy`"))),
2268 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::EventMatcherPolicy`")))),
2269 }
2270 } else {
2271 let content = resp.text().await?;
2272 let entity: Option<PoliciesEventMatcherRetrieveError> = serde_json::from_str(&content).ok();
2273 Err(Error::ResponseError(ResponseContent {
2274 status,
2275 content,
2276 entity,
2277 }))
2278 }
2279}
2280
2281pub async fn policies_event_matcher_update(
2283 configuration: &configuration::Configuration,
2284 policy_uuid: &str,
2285 event_matcher_policy_request: models::EventMatcherPolicyRequest,
2286) -> Result<models::EventMatcherPolicy, Error<PoliciesEventMatcherUpdateError>> {
2287 let p_path_policy_uuid = policy_uuid;
2289 let p_body_event_matcher_policy_request = event_matcher_policy_request;
2290
2291 let uri_str = format!(
2292 "{}/policies/event_matcher/{policy_uuid}/",
2293 configuration.base_path,
2294 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2295 );
2296 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2297
2298 if let Some(ref user_agent) = configuration.user_agent {
2299 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2300 }
2301 if let Some(ref token) = configuration.bearer_access_token {
2302 req_builder = req_builder.bearer_auth(token.to_owned());
2303 };
2304 req_builder = req_builder.json(&p_body_event_matcher_policy_request);
2305
2306 let req = req_builder.build()?;
2307 let resp = configuration.client.execute(req).await?;
2308
2309 let status = resp.status();
2310 let content_type = resp
2311 .headers()
2312 .get("content-type")
2313 .and_then(|v| v.to_str().ok())
2314 .unwrap_or("application/octet-stream");
2315 let content_type = super::ContentType::from(content_type);
2316
2317 if !status.is_client_error() && !status.is_server_error() {
2318 let content = resp.text().await?;
2319 match content_type {
2320 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2321 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EventMatcherPolicy`"))),
2322 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::EventMatcherPolicy`")))),
2323 }
2324 } else {
2325 let content = resp.text().await?;
2326 let entity: Option<PoliciesEventMatcherUpdateError> = serde_json::from_str(&content).ok();
2327 Err(Error::ResponseError(ResponseContent {
2328 status,
2329 content,
2330 entity,
2331 }))
2332 }
2333}
2334
2335pub async fn policies_event_matcher_used_by_list(
2337 configuration: &configuration::Configuration,
2338 policy_uuid: &str,
2339) -> Result<Vec<models::UsedBy>, Error<PoliciesEventMatcherUsedByListError>> {
2340 let p_path_policy_uuid = policy_uuid;
2342
2343 let uri_str = format!(
2344 "{}/policies/event_matcher/{policy_uuid}/used_by/",
2345 configuration.base_path,
2346 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2347 );
2348 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2349
2350 if let Some(ref user_agent) = configuration.user_agent {
2351 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2352 }
2353 if let Some(ref token) = configuration.bearer_access_token {
2354 req_builder = req_builder.bearer_auth(token.to_owned());
2355 };
2356
2357 let req = req_builder.build()?;
2358 let resp = configuration.client.execute(req).await?;
2359
2360 let status = resp.status();
2361 let content_type = resp
2362 .headers()
2363 .get("content-type")
2364 .and_then(|v| v.to_str().ok())
2365 .unwrap_or("application/octet-stream");
2366 let content_type = super::ContentType::from(content_type);
2367
2368 if !status.is_client_error() && !status.is_server_error() {
2369 let content = resp.text().await?;
2370 match content_type {
2371 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2372 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2373 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::UsedBy>`")))),
2374 }
2375 } else {
2376 let content = resp.text().await?;
2377 let entity: Option<PoliciesEventMatcherUsedByListError> = serde_json::from_str(&content).ok();
2378 Err(Error::ResponseError(ResponseContent {
2379 status,
2380 content,
2381 entity,
2382 }))
2383 }
2384}
2385
2386pub async fn policies_expression_create(
2388 configuration: &configuration::Configuration,
2389 expression_policy_request: models::ExpressionPolicyRequest,
2390) -> Result<models::ExpressionPolicy, Error<PoliciesExpressionCreateError>> {
2391 let p_body_expression_policy_request = expression_policy_request;
2393
2394 let uri_str = format!("{}/policies/expression/", configuration.base_path);
2395 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2396
2397 if let Some(ref user_agent) = configuration.user_agent {
2398 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2399 }
2400 if let Some(ref token) = configuration.bearer_access_token {
2401 req_builder = req_builder.bearer_auth(token.to_owned());
2402 };
2403 req_builder = req_builder.json(&p_body_expression_policy_request);
2404
2405 let req = req_builder.build()?;
2406 let resp = configuration.client.execute(req).await?;
2407
2408 let status = resp.status();
2409 let content_type = resp
2410 .headers()
2411 .get("content-type")
2412 .and_then(|v| v.to_str().ok())
2413 .unwrap_or("application/octet-stream");
2414 let content_type = super::ContentType::from(content_type);
2415
2416 if !status.is_client_error() && !status.is_server_error() {
2417 let content = resp.text().await?;
2418 match content_type {
2419 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2420 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ExpressionPolicy`"))),
2421 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::ExpressionPolicy`")))),
2422 }
2423 } else {
2424 let content = resp.text().await?;
2425 let entity: Option<PoliciesExpressionCreateError> = serde_json::from_str(&content).ok();
2426 Err(Error::ResponseError(ResponseContent {
2427 status,
2428 content,
2429 entity,
2430 }))
2431 }
2432}
2433
2434pub async fn policies_expression_destroy(
2436 configuration: &configuration::Configuration,
2437 policy_uuid: &str,
2438) -> Result<(), Error<PoliciesExpressionDestroyError>> {
2439 let p_path_policy_uuid = policy_uuid;
2441
2442 let uri_str = format!(
2443 "{}/policies/expression/{policy_uuid}/",
2444 configuration.base_path,
2445 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2446 );
2447 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2448
2449 if let Some(ref user_agent) = configuration.user_agent {
2450 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2451 }
2452 if let Some(ref token) = configuration.bearer_access_token {
2453 req_builder = req_builder.bearer_auth(token.to_owned());
2454 };
2455
2456 let req = req_builder.build()?;
2457 let resp = configuration.client.execute(req).await?;
2458
2459 let status = resp.status();
2460
2461 if !status.is_client_error() && !status.is_server_error() {
2462 Ok(())
2463 } else {
2464 let content = resp.text().await?;
2465 let entity: Option<PoliciesExpressionDestroyError> = serde_json::from_str(&content).ok();
2466 Err(Error::ResponseError(ResponseContent {
2467 status,
2468 content,
2469 entity,
2470 }))
2471 }
2472}
2473
2474pub async fn policies_expression_list(
2476 configuration: &configuration::Configuration,
2477 created: Option<String>,
2478 execution_logging: Option<bool>,
2479 expression: Option<&str>,
2480 last_updated: Option<String>,
2481 name: Option<&str>,
2482 ordering: Option<&str>,
2483 page: Option<i32>,
2484 page_size: Option<i32>,
2485 policy_uuid: Option<&str>,
2486 search: Option<&str>,
2487) -> Result<models::PaginatedExpressionPolicyList, Error<PoliciesExpressionListError>> {
2488 let p_query_created = created;
2490 let p_query_execution_logging = execution_logging;
2491 let p_query_expression = expression;
2492 let p_query_last_updated = last_updated;
2493 let p_query_name = name;
2494 let p_query_ordering = ordering;
2495 let p_query_page = page;
2496 let p_query_page_size = page_size;
2497 let p_query_policy_uuid = policy_uuid;
2498 let p_query_search = search;
2499
2500 let uri_str = format!("{}/policies/expression/", configuration.base_path);
2501 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2502
2503 if let Some(ref param_value) = p_query_created {
2504 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
2505 }
2506 if let Some(ref param_value) = p_query_execution_logging {
2507 req_builder = req_builder.query(&[("execution_logging", ¶m_value.to_string())]);
2508 }
2509 if let Some(ref param_value) = p_query_expression {
2510 req_builder = req_builder.query(&[("expression", ¶m_value.to_string())]);
2511 }
2512 if let Some(ref param_value) = p_query_last_updated {
2513 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
2514 }
2515 if let Some(ref param_value) = p_query_name {
2516 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2517 }
2518 if let Some(ref param_value) = p_query_ordering {
2519 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2520 }
2521 if let Some(ref param_value) = p_query_page {
2522 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2523 }
2524 if let Some(ref param_value) = p_query_page_size {
2525 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2526 }
2527 if let Some(ref param_value) = p_query_policy_uuid {
2528 req_builder = req_builder.query(&[("policy_uuid", ¶m_value.to_string())]);
2529 }
2530 if let Some(ref param_value) = p_query_search {
2531 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2532 }
2533 if let Some(ref user_agent) = configuration.user_agent {
2534 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2535 }
2536 if let Some(ref token) = configuration.bearer_access_token {
2537 req_builder = req_builder.bearer_auth(token.to_owned());
2538 };
2539
2540 let req = req_builder.build()?;
2541 let resp = configuration.client.execute(req).await?;
2542
2543 let status = resp.status();
2544 let content_type = resp
2545 .headers()
2546 .get("content-type")
2547 .and_then(|v| v.to_str().ok())
2548 .unwrap_or("application/octet-stream");
2549 let content_type = super::ContentType::from(content_type);
2550
2551 if !status.is_client_error() && !status.is_server_error() {
2552 let content = resp.text().await?;
2553 match content_type {
2554 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2555 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedExpressionPolicyList`"))),
2556 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::PaginatedExpressionPolicyList`")))),
2557 }
2558 } else {
2559 let content = resp.text().await?;
2560 let entity: Option<PoliciesExpressionListError> = serde_json::from_str(&content).ok();
2561 Err(Error::ResponseError(ResponseContent {
2562 status,
2563 content,
2564 entity,
2565 }))
2566 }
2567}
2568
2569pub async fn policies_expression_partial_update(
2571 configuration: &configuration::Configuration,
2572 policy_uuid: &str,
2573 patched_expression_policy_request: Option<models::PatchedExpressionPolicyRequest>,
2574) -> Result<models::ExpressionPolicy, Error<PoliciesExpressionPartialUpdateError>> {
2575 let p_path_policy_uuid = policy_uuid;
2577 let p_body_patched_expression_policy_request = patched_expression_policy_request;
2578
2579 let uri_str = format!(
2580 "{}/policies/expression/{policy_uuid}/",
2581 configuration.base_path,
2582 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2583 );
2584 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
2585
2586 if let Some(ref user_agent) = configuration.user_agent {
2587 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2588 }
2589 if let Some(ref token) = configuration.bearer_access_token {
2590 req_builder = req_builder.bearer_auth(token.to_owned());
2591 };
2592 req_builder = req_builder.json(&p_body_patched_expression_policy_request);
2593
2594 let req = req_builder.build()?;
2595 let resp = configuration.client.execute(req).await?;
2596
2597 let status = resp.status();
2598 let content_type = resp
2599 .headers()
2600 .get("content-type")
2601 .and_then(|v| v.to_str().ok())
2602 .unwrap_or("application/octet-stream");
2603 let content_type = super::ContentType::from(content_type);
2604
2605 if !status.is_client_error() && !status.is_server_error() {
2606 let content = resp.text().await?;
2607 match content_type {
2608 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2609 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ExpressionPolicy`"))),
2610 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::ExpressionPolicy`")))),
2611 }
2612 } else {
2613 let content = resp.text().await?;
2614 let entity: Option<PoliciesExpressionPartialUpdateError> = serde_json::from_str(&content).ok();
2615 Err(Error::ResponseError(ResponseContent {
2616 status,
2617 content,
2618 entity,
2619 }))
2620 }
2621}
2622
2623pub async fn policies_expression_retrieve(
2625 configuration: &configuration::Configuration,
2626 policy_uuid: &str,
2627) -> Result<models::ExpressionPolicy, Error<PoliciesExpressionRetrieveError>> {
2628 let p_path_policy_uuid = policy_uuid;
2630
2631 let uri_str = format!(
2632 "{}/policies/expression/{policy_uuid}/",
2633 configuration.base_path,
2634 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2635 );
2636 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2637
2638 if let Some(ref user_agent) = configuration.user_agent {
2639 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2640 }
2641 if let Some(ref token) = configuration.bearer_access_token {
2642 req_builder = req_builder.bearer_auth(token.to_owned());
2643 };
2644
2645 let req = req_builder.build()?;
2646 let resp = configuration.client.execute(req).await?;
2647
2648 let status = resp.status();
2649 let content_type = resp
2650 .headers()
2651 .get("content-type")
2652 .and_then(|v| v.to_str().ok())
2653 .unwrap_or("application/octet-stream");
2654 let content_type = super::ContentType::from(content_type);
2655
2656 if !status.is_client_error() && !status.is_server_error() {
2657 let content = resp.text().await?;
2658 match content_type {
2659 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2660 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ExpressionPolicy`"))),
2661 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::ExpressionPolicy`")))),
2662 }
2663 } else {
2664 let content = resp.text().await?;
2665 let entity: Option<PoliciesExpressionRetrieveError> = serde_json::from_str(&content).ok();
2666 Err(Error::ResponseError(ResponseContent {
2667 status,
2668 content,
2669 entity,
2670 }))
2671 }
2672}
2673
2674pub async fn policies_expression_update(
2676 configuration: &configuration::Configuration,
2677 policy_uuid: &str,
2678 expression_policy_request: models::ExpressionPolicyRequest,
2679) -> Result<models::ExpressionPolicy, Error<PoliciesExpressionUpdateError>> {
2680 let p_path_policy_uuid = policy_uuid;
2682 let p_body_expression_policy_request = expression_policy_request;
2683
2684 let uri_str = format!(
2685 "{}/policies/expression/{policy_uuid}/",
2686 configuration.base_path,
2687 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2688 );
2689 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2690
2691 if let Some(ref user_agent) = configuration.user_agent {
2692 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2693 }
2694 if let Some(ref token) = configuration.bearer_access_token {
2695 req_builder = req_builder.bearer_auth(token.to_owned());
2696 };
2697 req_builder = req_builder.json(&p_body_expression_policy_request);
2698
2699 let req = req_builder.build()?;
2700 let resp = configuration.client.execute(req).await?;
2701
2702 let status = resp.status();
2703 let content_type = resp
2704 .headers()
2705 .get("content-type")
2706 .and_then(|v| v.to_str().ok())
2707 .unwrap_or("application/octet-stream");
2708 let content_type = super::ContentType::from(content_type);
2709
2710 if !status.is_client_error() && !status.is_server_error() {
2711 let content = resp.text().await?;
2712 match content_type {
2713 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2714 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ExpressionPolicy`"))),
2715 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::ExpressionPolicy`")))),
2716 }
2717 } else {
2718 let content = resp.text().await?;
2719 let entity: Option<PoliciesExpressionUpdateError> = serde_json::from_str(&content).ok();
2720 Err(Error::ResponseError(ResponseContent {
2721 status,
2722 content,
2723 entity,
2724 }))
2725 }
2726}
2727
2728pub async fn policies_expression_used_by_list(
2730 configuration: &configuration::Configuration,
2731 policy_uuid: &str,
2732) -> Result<Vec<models::UsedBy>, Error<PoliciesExpressionUsedByListError>> {
2733 let p_path_policy_uuid = policy_uuid;
2735
2736 let uri_str = format!(
2737 "{}/policies/expression/{policy_uuid}/used_by/",
2738 configuration.base_path,
2739 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2740 );
2741 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2742
2743 if let Some(ref user_agent) = configuration.user_agent {
2744 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2745 }
2746 if let Some(ref token) = configuration.bearer_access_token {
2747 req_builder = req_builder.bearer_auth(token.to_owned());
2748 };
2749
2750 let req = req_builder.build()?;
2751 let resp = configuration.client.execute(req).await?;
2752
2753 let status = resp.status();
2754 let content_type = resp
2755 .headers()
2756 .get("content-type")
2757 .and_then(|v| v.to_str().ok())
2758 .unwrap_or("application/octet-stream");
2759 let content_type = super::ContentType::from(content_type);
2760
2761 if !status.is_client_error() && !status.is_server_error() {
2762 let content = resp.text().await?;
2763 match content_type {
2764 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2765 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
2766 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::UsedBy>`")))),
2767 }
2768 } else {
2769 let content = resp.text().await?;
2770 let entity: Option<PoliciesExpressionUsedByListError> = serde_json::from_str(&content).ok();
2771 Err(Error::ResponseError(ResponseContent {
2772 status,
2773 content,
2774 entity,
2775 }))
2776 }
2777}
2778
2779pub async fn policies_geoip_create(
2781 configuration: &configuration::Configuration,
2782 geo_ip_policy_request: models::GeoIpPolicyRequest,
2783) -> Result<models::GeoIpPolicy, Error<PoliciesGeoipCreateError>> {
2784 let p_body_geo_ip_policy_request = geo_ip_policy_request;
2786
2787 let uri_str = format!("{}/policies/geoip/", configuration.base_path);
2788 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
2789
2790 if let Some(ref user_agent) = configuration.user_agent {
2791 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2792 }
2793 if let Some(ref token) = configuration.bearer_access_token {
2794 req_builder = req_builder.bearer_auth(token.to_owned());
2795 };
2796 req_builder = req_builder.json(&p_body_geo_ip_policy_request);
2797
2798 let req = req_builder.build()?;
2799 let resp = configuration.client.execute(req).await?;
2800
2801 let status = resp.status();
2802 let content_type = resp
2803 .headers()
2804 .get("content-type")
2805 .and_then(|v| v.to_str().ok())
2806 .unwrap_or("application/octet-stream");
2807 let content_type = super::ContentType::from(content_type);
2808
2809 if !status.is_client_error() && !status.is_server_error() {
2810 let content = resp.text().await?;
2811 match content_type {
2812 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2813 ContentType::Text => {
2814 return Err(Error::from(serde_json::Error::custom(
2815 "Received `text/plain` content type response that cannot be converted to `models::GeoIpPolicy`",
2816 )))
2817 }
2818 ContentType::Unsupported(unknown_type) => {
2819 return Err(Error::from(serde_json::Error::custom(format!(
2820 "Received `{unknown_type}` content type response that cannot be converted to `models::GeoIpPolicy`"
2821 ))))
2822 }
2823 }
2824 } else {
2825 let content = resp.text().await?;
2826 let entity: Option<PoliciesGeoipCreateError> = serde_json::from_str(&content).ok();
2827 Err(Error::ResponseError(ResponseContent {
2828 status,
2829 content,
2830 entity,
2831 }))
2832 }
2833}
2834
2835pub async fn policies_geoip_destroy(
2837 configuration: &configuration::Configuration,
2838 policy_uuid: &str,
2839) -> Result<(), Error<PoliciesGeoipDestroyError>> {
2840 let p_path_policy_uuid = policy_uuid;
2842
2843 let uri_str = format!(
2844 "{}/policies/geoip/{policy_uuid}/",
2845 configuration.base_path,
2846 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
2847 );
2848 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
2849
2850 if let Some(ref user_agent) = configuration.user_agent {
2851 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2852 }
2853 if let Some(ref token) = configuration.bearer_access_token {
2854 req_builder = req_builder.bearer_auth(token.to_owned());
2855 };
2856
2857 let req = req_builder.build()?;
2858 let resp = configuration.client.execute(req).await?;
2859
2860 let status = resp.status();
2861
2862 if !status.is_client_error() && !status.is_server_error() {
2863 Ok(())
2864 } else {
2865 let content = resp.text().await?;
2866 let entity: Option<PoliciesGeoipDestroyError> = serde_json::from_str(&content).ok();
2867 Err(Error::ResponseError(ResponseContent {
2868 status,
2869 content,
2870 entity,
2871 }))
2872 }
2873}
2874
2875pub async fn policies_geoip_iso3166_list(
2877 configuration: &configuration::Configuration,
2878) -> Result<Vec<models::DetailedCountry>, Error<PoliciesGeoipIso3166ListError>> {
2879 let uri_str = format!("{}/policies/geoip_iso3166/", configuration.base_path);
2880 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2881
2882 if let Some(ref user_agent) = configuration.user_agent {
2883 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2884 }
2885 if let Some(ref token) = configuration.bearer_access_token {
2886 req_builder = req_builder.bearer_auth(token.to_owned());
2887 };
2888
2889 let req = req_builder.build()?;
2890 let resp = configuration.client.execute(req).await?;
2891
2892 let status = resp.status();
2893 let content_type = resp
2894 .headers()
2895 .get("content-type")
2896 .and_then(|v| v.to_str().ok())
2897 .unwrap_or("application/octet-stream");
2898 let content_type = super::ContentType::from(content_type);
2899
2900 if !status.is_client_error() && !status.is_server_error() {
2901 let content = resp.text().await?;
2902 match content_type {
2903 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2904 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::DetailedCountry>`"))),
2905 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::DetailedCountry>`")))),
2906 }
2907 } else {
2908 let content = resp.text().await?;
2909 let entity: Option<PoliciesGeoipIso3166ListError> = serde_json::from_str(&content).ok();
2910 Err(Error::ResponseError(ResponseContent {
2911 status,
2912 content,
2913 entity,
2914 }))
2915 }
2916}
2917
2918pub async fn policies_geoip_list(
2920 configuration: &configuration::Configuration,
2921 name: Option<&str>,
2922 ordering: Option<&str>,
2923 page: Option<i32>,
2924 page_size: Option<i32>,
2925 search: Option<&str>,
2926) -> Result<models::PaginatedGeoIpPolicyList, Error<PoliciesGeoipListError>> {
2927 let p_query_name = name;
2929 let p_query_ordering = ordering;
2930 let p_query_page = page;
2931 let p_query_page_size = page_size;
2932 let p_query_search = search;
2933
2934 let uri_str = format!("{}/policies/geoip/", configuration.base_path);
2935 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2936
2937 if let Some(ref param_value) = p_query_name {
2938 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
2939 }
2940 if let Some(ref param_value) = p_query_ordering {
2941 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
2942 }
2943 if let Some(ref param_value) = p_query_page {
2944 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
2945 }
2946 if let Some(ref param_value) = p_query_page_size {
2947 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
2948 }
2949 if let Some(ref param_value) = p_query_search {
2950 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
2951 }
2952 if let Some(ref user_agent) = configuration.user_agent {
2953 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2954 }
2955 if let Some(ref token) = configuration.bearer_access_token {
2956 req_builder = req_builder.bearer_auth(token.to_owned());
2957 };
2958
2959 let req = req_builder.build()?;
2960 let resp = configuration.client.execute(req).await?;
2961
2962 let status = resp.status();
2963 let content_type = resp
2964 .headers()
2965 .get("content-type")
2966 .and_then(|v| v.to_str().ok())
2967 .unwrap_or("application/octet-stream");
2968 let content_type = super::ContentType::from(content_type);
2969
2970 if !status.is_client_error() && !status.is_server_error() {
2971 let content = resp.text().await?;
2972 match content_type {
2973 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2974 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedGeoIpPolicyList`"))),
2975 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::PaginatedGeoIpPolicyList`")))),
2976 }
2977 } else {
2978 let content = resp.text().await?;
2979 let entity: Option<PoliciesGeoipListError> = serde_json::from_str(&content).ok();
2980 Err(Error::ResponseError(ResponseContent {
2981 status,
2982 content,
2983 entity,
2984 }))
2985 }
2986}
2987
2988pub async fn policies_geoip_partial_update(
2990 configuration: &configuration::Configuration,
2991 policy_uuid: &str,
2992 patched_geo_ip_policy_request: Option<models::PatchedGeoIpPolicyRequest>,
2993) -> Result<models::GeoIpPolicy, Error<PoliciesGeoipPartialUpdateError>> {
2994 let p_path_policy_uuid = policy_uuid;
2996 let p_body_patched_geo_ip_policy_request = patched_geo_ip_policy_request;
2997
2998 let uri_str = format!(
2999 "{}/policies/geoip/{policy_uuid}/",
3000 configuration.base_path,
3001 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3002 );
3003 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3004
3005 if let Some(ref user_agent) = configuration.user_agent {
3006 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3007 }
3008 if let Some(ref token) = configuration.bearer_access_token {
3009 req_builder = req_builder.bearer_auth(token.to_owned());
3010 };
3011 req_builder = req_builder.json(&p_body_patched_geo_ip_policy_request);
3012
3013 let req = req_builder.build()?;
3014 let resp = configuration.client.execute(req).await?;
3015
3016 let status = resp.status();
3017 let content_type = resp
3018 .headers()
3019 .get("content-type")
3020 .and_then(|v| v.to_str().ok())
3021 .unwrap_or("application/octet-stream");
3022 let content_type = super::ContentType::from(content_type);
3023
3024 if !status.is_client_error() && !status.is_server_error() {
3025 let content = resp.text().await?;
3026 match content_type {
3027 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3028 ContentType::Text => {
3029 return Err(Error::from(serde_json::Error::custom(
3030 "Received `text/plain` content type response that cannot be converted to `models::GeoIpPolicy`",
3031 )))
3032 }
3033 ContentType::Unsupported(unknown_type) => {
3034 return Err(Error::from(serde_json::Error::custom(format!(
3035 "Received `{unknown_type}` content type response that cannot be converted to `models::GeoIpPolicy`"
3036 ))))
3037 }
3038 }
3039 } else {
3040 let content = resp.text().await?;
3041 let entity: Option<PoliciesGeoipPartialUpdateError> = serde_json::from_str(&content).ok();
3042 Err(Error::ResponseError(ResponseContent {
3043 status,
3044 content,
3045 entity,
3046 }))
3047 }
3048}
3049
3050pub async fn policies_geoip_retrieve(
3052 configuration: &configuration::Configuration,
3053 policy_uuid: &str,
3054) -> Result<models::GeoIpPolicy, Error<PoliciesGeoipRetrieveError>> {
3055 let p_path_policy_uuid = policy_uuid;
3057
3058 let uri_str = format!(
3059 "{}/policies/geoip/{policy_uuid}/",
3060 configuration.base_path,
3061 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3062 );
3063 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3064
3065 if let Some(ref user_agent) = configuration.user_agent {
3066 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3067 }
3068 if let Some(ref token) = configuration.bearer_access_token {
3069 req_builder = req_builder.bearer_auth(token.to_owned());
3070 };
3071
3072 let req = req_builder.build()?;
3073 let resp = configuration.client.execute(req).await?;
3074
3075 let status = resp.status();
3076 let content_type = resp
3077 .headers()
3078 .get("content-type")
3079 .and_then(|v| v.to_str().ok())
3080 .unwrap_or("application/octet-stream");
3081 let content_type = super::ContentType::from(content_type);
3082
3083 if !status.is_client_error() && !status.is_server_error() {
3084 let content = resp.text().await?;
3085 match content_type {
3086 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3087 ContentType::Text => {
3088 return Err(Error::from(serde_json::Error::custom(
3089 "Received `text/plain` content type response that cannot be converted to `models::GeoIpPolicy`",
3090 )))
3091 }
3092 ContentType::Unsupported(unknown_type) => {
3093 return Err(Error::from(serde_json::Error::custom(format!(
3094 "Received `{unknown_type}` content type response that cannot be converted to `models::GeoIpPolicy`"
3095 ))))
3096 }
3097 }
3098 } else {
3099 let content = resp.text().await?;
3100 let entity: Option<PoliciesGeoipRetrieveError> = serde_json::from_str(&content).ok();
3101 Err(Error::ResponseError(ResponseContent {
3102 status,
3103 content,
3104 entity,
3105 }))
3106 }
3107}
3108
3109pub async fn policies_geoip_update(
3111 configuration: &configuration::Configuration,
3112 policy_uuid: &str,
3113 geo_ip_policy_request: models::GeoIpPolicyRequest,
3114) -> Result<models::GeoIpPolicy, Error<PoliciesGeoipUpdateError>> {
3115 let p_path_policy_uuid = policy_uuid;
3117 let p_body_geo_ip_policy_request = geo_ip_policy_request;
3118
3119 let uri_str = format!(
3120 "{}/policies/geoip/{policy_uuid}/",
3121 configuration.base_path,
3122 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3123 );
3124 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3125
3126 if let Some(ref user_agent) = configuration.user_agent {
3127 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3128 }
3129 if let Some(ref token) = configuration.bearer_access_token {
3130 req_builder = req_builder.bearer_auth(token.to_owned());
3131 };
3132 req_builder = req_builder.json(&p_body_geo_ip_policy_request);
3133
3134 let req = req_builder.build()?;
3135 let resp = configuration.client.execute(req).await?;
3136
3137 let status = resp.status();
3138 let content_type = resp
3139 .headers()
3140 .get("content-type")
3141 .and_then(|v| v.to_str().ok())
3142 .unwrap_or("application/octet-stream");
3143 let content_type = super::ContentType::from(content_type);
3144
3145 if !status.is_client_error() && !status.is_server_error() {
3146 let content = resp.text().await?;
3147 match content_type {
3148 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3149 ContentType::Text => {
3150 return Err(Error::from(serde_json::Error::custom(
3151 "Received `text/plain` content type response that cannot be converted to `models::GeoIpPolicy`",
3152 )))
3153 }
3154 ContentType::Unsupported(unknown_type) => {
3155 return Err(Error::from(serde_json::Error::custom(format!(
3156 "Received `{unknown_type}` content type response that cannot be converted to `models::GeoIpPolicy`"
3157 ))))
3158 }
3159 }
3160 } else {
3161 let content = resp.text().await?;
3162 let entity: Option<PoliciesGeoipUpdateError> = serde_json::from_str(&content).ok();
3163 Err(Error::ResponseError(ResponseContent {
3164 status,
3165 content,
3166 entity,
3167 }))
3168 }
3169}
3170
3171pub async fn policies_geoip_used_by_list(
3173 configuration: &configuration::Configuration,
3174 policy_uuid: &str,
3175) -> Result<Vec<models::UsedBy>, Error<PoliciesGeoipUsedByListError>> {
3176 let p_path_policy_uuid = policy_uuid;
3178
3179 let uri_str = format!(
3180 "{}/policies/geoip/{policy_uuid}/used_by/",
3181 configuration.base_path,
3182 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3183 );
3184 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3185
3186 if let Some(ref user_agent) = configuration.user_agent {
3187 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3188 }
3189 if let Some(ref token) = configuration.bearer_access_token {
3190 req_builder = req_builder.bearer_auth(token.to_owned());
3191 };
3192
3193 let req = req_builder.build()?;
3194 let resp = configuration.client.execute(req).await?;
3195
3196 let status = resp.status();
3197 let content_type = resp
3198 .headers()
3199 .get("content-type")
3200 .and_then(|v| v.to_str().ok())
3201 .unwrap_or("application/octet-stream");
3202 let content_type = super::ContentType::from(content_type);
3203
3204 if !status.is_client_error() && !status.is_server_error() {
3205 let content = resp.text().await?;
3206 match content_type {
3207 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3208 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
3209 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::UsedBy>`")))),
3210 }
3211 } else {
3212 let content = resp.text().await?;
3213 let entity: Option<PoliciesGeoipUsedByListError> = serde_json::from_str(&content).ok();
3214 Err(Error::ResponseError(ResponseContent {
3215 status,
3216 content,
3217 entity,
3218 }))
3219 }
3220}
3221
3222pub async fn policies_password_create(
3224 configuration: &configuration::Configuration,
3225 password_policy_request: models::PasswordPolicyRequest,
3226) -> Result<models::PasswordPolicy, Error<PoliciesPasswordCreateError>> {
3227 let p_body_password_policy_request = password_policy_request;
3229
3230 let uri_str = format!("{}/policies/password/", configuration.base_path);
3231 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3232
3233 if let Some(ref user_agent) = configuration.user_agent {
3234 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3235 }
3236 if let Some(ref token) = configuration.bearer_access_token {
3237 req_builder = req_builder.bearer_auth(token.to_owned());
3238 };
3239 req_builder = req_builder.json(&p_body_password_policy_request);
3240
3241 let req = req_builder.build()?;
3242 let resp = configuration.client.execute(req).await?;
3243
3244 let status = resp.status();
3245 let content_type = resp
3246 .headers()
3247 .get("content-type")
3248 .and_then(|v| v.to_str().ok())
3249 .unwrap_or("application/octet-stream");
3250 let content_type = super::ContentType::from(content_type);
3251
3252 if !status.is_client_error() && !status.is_server_error() {
3253 let content = resp.text().await?;
3254 match content_type {
3255 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3256 ContentType::Text => {
3257 return Err(Error::from(serde_json::Error::custom(
3258 "Received `text/plain` content type response that cannot be converted to `models::PasswordPolicy`",
3259 )))
3260 }
3261 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3262 "Received `{unknown_type}` content type response that cannot be converted to `models::PasswordPolicy`"
3263 )))),
3264 }
3265 } else {
3266 let content = resp.text().await?;
3267 let entity: Option<PoliciesPasswordCreateError> = serde_json::from_str(&content).ok();
3268 Err(Error::ResponseError(ResponseContent {
3269 status,
3270 content,
3271 entity,
3272 }))
3273 }
3274}
3275
3276pub async fn policies_password_destroy(
3278 configuration: &configuration::Configuration,
3279 policy_uuid: &str,
3280) -> Result<(), Error<PoliciesPasswordDestroyError>> {
3281 let p_path_policy_uuid = policy_uuid;
3283
3284 let uri_str = format!(
3285 "{}/policies/password/{policy_uuid}/",
3286 configuration.base_path,
3287 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3288 );
3289 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3290
3291 if let Some(ref user_agent) = configuration.user_agent {
3292 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3293 }
3294 if let Some(ref token) = configuration.bearer_access_token {
3295 req_builder = req_builder.bearer_auth(token.to_owned());
3296 };
3297
3298 let req = req_builder.build()?;
3299 let resp = configuration.client.execute(req).await?;
3300
3301 let status = resp.status();
3302
3303 if !status.is_client_error() && !status.is_server_error() {
3304 Ok(())
3305 } else {
3306 let content = resp.text().await?;
3307 let entity: Option<PoliciesPasswordDestroyError> = serde_json::from_str(&content).ok();
3308 Err(Error::ResponseError(ResponseContent {
3309 status,
3310 content,
3311 entity,
3312 }))
3313 }
3314}
3315
3316pub async fn policies_password_expiry_create(
3318 configuration: &configuration::Configuration,
3319 password_expiry_policy_request: models::PasswordExpiryPolicyRequest,
3320) -> Result<models::PasswordExpiryPolicy, Error<PoliciesPasswordExpiryCreateError>> {
3321 let p_body_password_expiry_policy_request = password_expiry_policy_request;
3323
3324 let uri_str = format!("{}/policies/password_expiry/", configuration.base_path);
3325 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
3326
3327 if let Some(ref user_agent) = configuration.user_agent {
3328 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3329 }
3330 if let Some(ref token) = configuration.bearer_access_token {
3331 req_builder = req_builder.bearer_auth(token.to_owned());
3332 };
3333 req_builder = req_builder.json(&p_body_password_expiry_policy_request);
3334
3335 let req = req_builder.build()?;
3336 let resp = configuration.client.execute(req).await?;
3337
3338 let status = resp.status();
3339 let content_type = resp
3340 .headers()
3341 .get("content-type")
3342 .and_then(|v| v.to_str().ok())
3343 .unwrap_or("application/octet-stream");
3344 let content_type = super::ContentType::from(content_type);
3345
3346 if !status.is_client_error() && !status.is_server_error() {
3347 let content = resp.text().await?;
3348 match content_type {
3349 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3350 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PasswordExpiryPolicy`"))),
3351 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::PasswordExpiryPolicy`")))),
3352 }
3353 } else {
3354 let content = resp.text().await?;
3355 let entity: Option<PoliciesPasswordExpiryCreateError> = serde_json::from_str(&content).ok();
3356 Err(Error::ResponseError(ResponseContent {
3357 status,
3358 content,
3359 entity,
3360 }))
3361 }
3362}
3363
3364pub async fn policies_password_expiry_destroy(
3366 configuration: &configuration::Configuration,
3367 policy_uuid: &str,
3368) -> Result<(), Error<PoliciesPasswordExpiryDestroyError>> {
3369 let p_path_policy_uuid = policy_uuid;
3371
3372 let uri_str = format!(
3373 "{}/policies/password_expiry/{policy_uuid}/",
3374 configuration.base_path,
3375 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3376 );
3377 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
3378
3379 if let Some(ref user_agent) = configuration.user_agent {
3380 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3381 }
3382 if let Some(ref token) = configuration.bearer_access_token {
3383 req_builder = req_builder.bearer_auth(token.to_owned());
3384 };
3385
3386 let req = req_builder.build()?;
3387 let resp = configuration.client.execute(req).await?;
3388
3389 let status = resp.status();
3390
3391 if !status.is_client_error() && !status.is_server_error() {
3392 Ok(())
3393 } else {
3394 let content = resp.text().await?;
3395 let entity: Option<PoliciesPasswordExpiryDestroyError> = serde_json::from_str(&content).ok();
3396 Err(Error::ResponseError(ResponseContent {
3397 status,
3398 content,
3399 entity,
3400 }))
3401 }
3402}
3403
3404pub async fn policies_password_expiry_list(
3406 configuration: &configuration::Configuration,
3407 created: Option<String>,
3408 days: Option<i32>,
3409 deny_only: Option<bool>,
3410 execution_logging: Option<bool>,
3411 last_updated: Option<String>,
3412 name: Option<&str>,
3413 ordering: Option<&str>,
3414 page: Option<i32>,
3415 page_size: Option<i32>,
3416 policy_uuid: Option<&str>,
3417 search: Option<&str>,
3418) -> Result<models::PaginatedPasswordExpiryPolicyList, Error<PoliciesPasswordExpiryListError>> {
3419 let p_query_created = created;
3421 let p_query_days = days;
3422 let p_query_deny_only = deny_only;
3423 let p_query_execution_logging = execution_logging;
3424 let p_query_last_updated = last_updated;
3425 let p_query_name = name;
3426 let p_query_ordering = ordering;
3427 let p_query_page = page;
3428 let p_query_page_size = page_size;
3429 let p_query_policy_uuid = policy_uuid;
3430 let p_query_search = search;
3431
3432 let uri_str = format!("{}/policies/password_expiry/", configuration.base_path);
3433 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3434
3435 if let Some(ref param_value) = p_query_created {
3436 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
3437 }
3438 if let Some(ref param_value) = p_query_days {
3439 req_builder = req_builder.query(&[("days", ¶m_value.to_string())]);
3440 }
3441 if let Some(ref param_value) = p_query_deny_only {
3442 req_builder = req_builder.query(&[("deny_only", ¶m_value.to_string())]);
3443 }
3444 if let Some(ref param_value) = p_query_execution_logging {
3445 req_builder = req_builder.query(&[("execution_logging", ¶m_value.to_string())]);
3446 }
3447 if let Some(ref param_value) = p_query_last_updated {
3448 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
3449 }
3450 if let Some(ref param_value) = p_query_name {
3451 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
3452 }
3453 if let Some(ref param_value) = p_query_ordering {
3454 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
3455 }
3456 if let Some(ref param_value) = p_query_page {
3457 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3458 }
3459 if let Some(ref param_value) = p_query_page_size {
3460 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
3461 }
3462 if let Some(ref param_value) = p_query_policy_uuid {
3463 req_builder = req_builder.query(&[("policy_uuid", ¶m_value.to_string())]);
3464 }
3465 if let Some(ref param_value) = p_query_search {
3466 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
3467 }
3468 if let Some(ref user_agent) = configuration.user_agent {
3469 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3470 }
3471 if let Some(ref token) = configuration.bearer_access_token {
3472 req_builder = req_builder.bearer_auth(token.to_owned());
3473 };
3474
3475 let req = req_builder.build()?;
3476 let resp = configuration.client.execute(req).await?;
3477
3478 let status = resp.status();
3479 let content_type = resp
3480 .headers()
3481 .get("content-type")
3482 .and_then(|v| v.to_str().ok())
3483 .unwrap_or("application/octet-stream");
3484 let content_type = super::ContentType::from(content_type);
3485
3486 if !status.is_client_error() && !status.is_server_error() {
3487 let content = resp.text().await?;
3488 match content_type {
3489 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3490 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedPasswordExpiryPolicyList`"))),
3491 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::PaginatedPasswordExpiryPolicyList`")))),
3492 }
3493 } else {
3494 let content = resp.text().await?;
3495 let entity: Option<PoliciesPasswordExpiryListError> = serde_json::from_str(&content).ok();
3496 Err(Error::ResponseError(ResponseContent {
3497 status,
3498 content,
3499 entity,
3500 }))
3501 }
3502}
3503
3504pub async fn policies_password_expiry_partial_update(
3506 configuration: &configuration::Configuration,
3507 policy_uuid: &str,
3508 patched_password_expiry_policy_request: Option<models::PatchedPasswordExpiryPolicyRequest>,
3509) -> Result<models::PasswordExpiryPolicy, Error<PoliciesPasswordExpiryPartialUpdateError>> {
3510 let p_path_policy_uuid = policy_uuid;
3512 let p_body_patched_password_expiry_policy_request = patched_password_expiry_policy_request;
3513
3514 let uri_str = format!(
3515 "{}/policies/password_expiry/{policy_uuid}/",
3516 configuration.base_path,
3517 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3518 );
3519 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3520
3521 if let Some(ref user_agent) = configuration.user_agent {
3522 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3523 }
3524 if let Some(ref token) = configuration.bearer_access_token {
3525 req_builder = req_builder.bearer_auth(token.to_owned());
3526 };
3527 req_builder = req_builder.json(&p_body_patched_password_expiry_policy_request);
3528
3529 let req = req_builder.build()?;
3530 let resp = configuration.client.execute(req).await?;
3531
3532 let status = resp.status();
3533 let content_type = resp
3534 .headers()
3535 .get("content-type")
3536 .and_then(|v| v.to_str().ok())
3537 .unwrap_or("application/octet-stream");
3538 let content_type = super::ContentType::from(content_type);
3539
3540 if !status.is_client_error() && !status.is_server_error() {
3541 let content = resp.text().await?;
3542 match content_type {
3543 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3544 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PasswordExpiryPolicy`"))),
3545 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::PasswordExpiryPolicy`")))),
3546 }
3547 } else {
3548 let content = resp.text().await?;
3549 let entity: Option<PoliciesPasswordExpiryPartialUpdateError> = serde_json::from_str(&content).ok();
3550 Err(Error::ResponseError(ResponseContent {
3551 status,
3552 content,
3553 entity,
3554 }))
3555 }
3556}
3557
3558pub async fn policies_password_expiry_retrieve(
3560 configuration: &configuration::Configuration,
3561 policy_uuid: &str,
3562) -> Result<models::PasswordExpiryPolicy, Error<PoliciesPasswordExpiryRetrieveError>> {
3563 let p_path_policy_uuid = policy_uuid;
3565
3566 let uri_str = format!(
3567 "{}/policies/password_expiry/{policy_uuid}/",
3568 configuration.base_path,
3569 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3570 );
3571 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3572
3573 if let Some(ref user_agent) = configuration.user_agent {
3574 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3575 }
3576 if let Some(ref token) = configuration.bearer_access_token {
3577 req_builder = req_builder.bearer_auth(token.to_owned());
3578 };
3579
3580 let req = req_builder.build()?;
3581 let resp = configuration.client.execute(req).await?;
3582
3583 let status = resp.status();
3584 let content_type = resp
3585 .headers()
3586 .get("content-type")
3587 .and_then(|v| v.to_str().ok())
3588 .unwrap_or("application/octet-stream");
3589 let content_type = super::ContentType::from(content_type);
3590
3591 if !status.is_client_error() && !status.is_server_error() {
3592 let content = resp.text().await?;
3593 match content_type {
3594 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3595 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PasswordExpiryPolicy`"))),
3596 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::PasswordExpiryPolicy`")))),
3597 }
3598 } else {
3599 let content = resp.text().await?;
3600 let entity: Option<PoliciesPasswordExpiryRetrieveError> = serde_json::from_str(&content).ok();
3601 Err(Error::ResponseError(ResponseContent {
3602 status,
3603 content,
3604 entity,
3605 }))
3606 }
3607}
3608
3609pub async fn policies_password_expiry_update(
3611 configuration: &configuration::Configuration,
3612 policy_uuid: &str,
3613 password_expiry_policy_request: models::PasswordExpiryPolicyRequest,
3614) -> Result<models::PasswordExpiryPolicy, Error<PoliciesPasswordExpiryUpdateError>> {
3615 let p_path_policy_uuid = policy_uuid;
3617 let p_body_password_expiry_policy_request = password_expiry_policy_request;
3618
3619 let uri_str = format!(
3620 "{}/policies/password_expiry/{policy_uuid}/",
3621 configuration.base_path,
3622 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3623 );
3624 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3625
3626 if let Some(ref user_agent) = configuration.user_agent {
3627 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3628 }
3629 if let Some(ref token) = configuration.bearer_access_token {
3630 req_builder = req_builder.bearer_auth(token.to_owned());
3631 };
3632 req_builder = req_builder.json(&p_body_password_expiry_policy_request);
3633
3634 let req = req_builder.build()?;
3635 let resp = configuration.client.execute(req).await?;
3636
3637 let status = resp.status();
3638 let content_type = resp
3639 .headers()
3640 .get("content-type")
3641 .and_then(|v| v.to_str().ok())
3642 .unwrap_or("application/octet-stream");
3643 let content_type = super::ContentType::from(content_type);
3644
3645 if !status.is_client_error() && !status.is_server_error() {
3646 let content = resp.text().await?;
3647 match content_type {
3648 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3649 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PasswordExpiryPolicy`"))),
3650 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::PasswordExpiryPolicy`")))),
3651 }
3652 } else {
3653 let content = resp.text().await?;
3654 let entity: Option<PoliciesPasswordExpiryUpdateError> = serde_json::from_str(&content).ok();
3655 Err(Error::ResponseError(ResponseContent {
3656 status,
3657 content,
3658 entity,
3659 }))
3660 }
3661}
3662
3663pub async fn policies_password_expiry_used_by_list(
3665 configuration: &configuration::Configuration,
3666 policy_uuid: &str,
3667) -> Result<Vec<models::UsedBy>, Error<PoliciesPasswordExpiryUsedByListError>> {
3668 let p_path_policy_uuid = policy_uuid;
3670
3671 let uri_str = format!(
3672 "{}/policies/password_expiry/{policy_uuid}/used_by/",
3673 configuration.base_path,
3674 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3675 );
3676 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3677
3678 if let Some(ref user_agent) = configuration.user_agent {
3679 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3680 }
3681 if let Some(ref token) = configuration.bearer_access_token {
3682 req_builder = req_builder.bearer_auth(token.to_owned());
3683 };
3684
3685 let req = req_builder.build()?;
3686 let resp = configuration.client.execute(req).await?;
3687
3688 let status = resp.status();
3689 let content_type = resp
3690 .headers()
3691 .get("content-type")
3692 .and_then(|v| v.to_str().ok())
3693 .unwrap_or("application/octet-stream");
3694 let content_type = super::ContentType::from(content_type);
3695
3696 if !status.is_client_error() && !status.is_server_error() {
3697 let content = resp.text().await?;
3698 match content_type {
3699 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3700 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
3701 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::UsedBy>`")))),
3702 }
3703 } else {
3704 let content = resp.text().await?;
3705 let entity: Option<PoliciesPasswordExpiryUsedByListError> = serde_json::from_str(&content).ok();
3706 Err(Error::ResponseError(ResponseContent {
3707 status,
3708 content,
3709 entity,
3710 }))
3711 }
3712}
3713
3714pub async fn policies_password_list(
3716 configuration: &configuration::Configuration,
3717 amount_digits: Option<i32>,
3718 amount_lowercase: Option<i32>,
3719 amount_symbols: Option<i32>,
3720 amount_uppercase: Option<i32>,
3721 check_have_i_been_pwned: Option<bool>,
3722 check_static_rules: Option<bool>,
3723 check_zxcvbn: Option<bool>,
3724 created: Option<String>,
3725 error_message: Option<&str>,
3726 execution_logging: Option<bool>,
3727 hibp_allowed_count: Option<i32>,
3728 last_updated: Option<String>,
3729 length_min: Option<i32>,
3730 name: Option<&str>,
3731 ordering: Option<&str>,
3732 page: Option<i32>,
3733 page_size: Option<i32>,
3734 password_field: Option<&str>,
3735 policy_uuid: Option<&str>,
3736 search: Option<&str>,
3737 symbol_charset: Option<&str>,
3738 zxcvbn_score_threshold: Option<i32>,
3739) -> Result<models::PaginatedPasswordPolicyList, Error<PoliciesPasswordListError>> {
3740 let p_query_amount_digits = amount_digits;
3742 let p_query_amount_lowercase = amount_lowercase;
3743 let p_query_amount_symbols = amount_symbols;
3744 let p_query_amount_uppercase = amount_uppercase;
3745 let p_query_check_have_i_been_pwned = check_have_i_been_pwned;
3746 let p_query_check_static_rules = check_static_rules;
3747 let p_query_check_zxcvbn = check_zxcvbn;
3748 let p_query_created = created;
3749 let p_query_error_message = error_message;
3750 let p_query_execution_logging = execution_logging;
3751 let p_query_hibp_allowed_count = hibp_allowed_count;
3752 let p_query_last_updated = last_updated;
3753 let p_query_length_min = length_min;
3754 let p_query_name = name;
3755 let p_query_ordering = ordering;
3756 let p_query_page = page;
3757 let p_query_page_size = page_size;
3758 let p_query_password_field = password_field;
3759 let p_query_policy_uuid = policy_uuid;
3760 let p_query_search = search;
3761 let p_query_symbol_charset = symbol_charset;
3762 let p_query_zxcvbn_score_threshold = zxcvbn_score_threshold;
3763
3764 let uri_str = format!("{}/policies/password/", configuration.base_path);
3765 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3766
3767 if let Some(ref param_value) = p_query_amount_digits {
3768 req_builder = req_builder.query(&[("amount_digits", ¶m_value.to_string())]);
3769 }
3770 if let Some(ref param_value) = p_query_amount_lowercase {
3771 req_builder = req_builder.query(&[("amount_lowercase", ¶m_value.to_string())]);
3772 }
3773 if let Some(ref param_value) = p_query_amount_symbols {
3774 req_builder = req_builder.query(&[("amount_symbols", ¶m_value.to_string())]);
3775 }
3776 if let Some(ref param_value) = p_query_amount_uppercase {
3777 req_builder = req_builder.query(&[("amount_uppercase", ¶m_value.to_string())]);
3778 }
3779 if let Some(ref param_value) = p_query_check_have_i_been_pwned {
3780 req_builder = req_builder.query(&[("check_have_i_been_pwned", ¶m_value.to_string())]);
3781 }
3782 if let Some(ref param_value) = p_query_check_static_rules {
3783 req_builder = req_builder.query(&[("check_static_rules", ¶m_value.to_string())]);
3784 }
3785 if let Some(ref param_value) = p_query_check_zxcvbn {
3786 req_builder = req_builder.query(&[("check_zxcvbn", ¶m_value.to_string())]);
3787 }
3788 if let Some(ref param_value) = p_query_created {
3789 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
3790 }
3791 if let Some(ref param_value) = p_query_error_message {
3792 req_builder = req_builder.query(&[("error_message", ¶m_value.to_string())]);
3793 }
3794 if let Some(ref param_value) = p_query_execution_logging {
3795 req_builder = req_builder.query(&[("execution_logging", ¶m_value.to_string())]);
3796 }
3797 if let Some(ref param_value) = p_query_hibp_allowed_count {
3798 req_builder = req_builder.query(&[("hibp_allowed_count", ¶m_value.to_string())]);
3799 }
3800 if let Some(ref param_value) = p_query_last_updated {
3801 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
3802 }
3803 if let Some(ref param_value) = p_query_length_min {
3804 req_builder = req_builder.query(&[("length_min", ¶m_value.to_string())]);
3805 }
3806 if let Some(ref param_value) = p_query_name {
3807 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
3808 }
3809 if let Some(ref param_value) = p_query_ordering {
3810 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
3811 }
3812 if let Some(ref param_value) = p_query_page {
3813 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
3814 }
3815 if let Some(ref param_value) = p_query_page_size {
3816 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
3817 }
3818 if let Some(ref param_value) = p_query_password_field {
3819 req_builder = req_builder.query(&[("password_field", ¶m_value.to_string())]);
3820 }
3821 if let Some(ref param_value) = p_query_policy_uuid {
3822 req_builder = req_builder.query(&[("policy_uuid", ¶m_value.to_string())]);
3823 }
3824 if let Some(ref param_value) = p_query_search {
3825 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
3826 }
3827 if let Some(ref param_value) = p_query_symbol_charset {
3828 req_builder = req_builder.query(&[("symbol_charset", ¶m_value.to_string())]);
3829 }
3830 if let Some(ref param_value) = p_query_zxcvbn_score_threshold {
3831 req_builder = req_builder.query(&[("zxcvbn_score_threshold", ¶m_value.to_string())]);
3832 }
3833 if let Some(ref user_agent) = configuration.user_agent {
3834 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3835 }
3836 if let Some(ref token) = configuration.bearer_access_token {
3837 req_builder = req_builder.bearer_auth(token.to_owned());
3838 };
3839
3840 let req = req_builder.build()?;
3841 let resp = configuration.client.execute(req).await?;
3842
3843 let status = resp.status();
3844 let content_type = resp
3845 .headers()
3846 .get("content-type")
3847 .and_then(|v| v.to_str().ok())
3848 .unwrap_or("application/octet-stream");
3849 let content_type = super::ContentType::from(content_type);
3850
3851 if !status.is_client_error() && !status.is_server_error() {
3852 let content = resp.text().await?;
3853 match content_type {
3854 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3855 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedPasswordPolicyList`"))),
3856 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::PaginatedPasswordPolicyList`")))),
3857 }
3858 } else {
3859 let content = resp.text().await?;
3860 let entity: Option<PoliciesPasswordListError> = serde_json::from_str(&content).ok();
3861 Err(Error::ResponseError(ResponseContent {
3862 status,
3863 content,
3864 entity,
3865 }))
3866 }
3867}
3868
3869pub async fn policies_password_partial_update(
3871 configuration: &configuration::Configuration,
3872 policy_uuid: &str,
3873 patched_password_policy_request: Option<models::PatchedPasswordPolicyRequest>,
3874) -> Result<models::PasswordPolicy, Error<PoliciesPasswordPartialUpdateError>> {
3875 let p_path_policy_uuid = policy_uuid;
3877 let p_body_patched_password_policy_request = patched_password_policy_request;
3878
3879 let uri_str = format!(
3880 "{}/policies/password/{policy_uuid}/",
3881 configuration.base_path,
3882 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3883 );
3884 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
3885
3886 if let Some(ref user_agent) = configuration.user_agent {
3887 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3888 }
3889 if let Some(ref token) = configuration.bearer_access_token {
3890 req_builder = req_builder.bearer_auth(token.to_owned());
3891 };
3892 req_builder = req_builder.json(&p_body_patched_password_policy_request);
3893
3894 let req = req_builder.build()?;
3895 let resp = configuration.client.execute(req).await?;
3896
3897 let status = resp.status();
3898 let content_type = resp
3899 .headers()
3900 .get("content-type")
3901 .and_then(|v| v.to_str().ok())
3902 .unwrap_or("application/octet-stream");
3903 let content_type = super::ContentType::from(content_type);
3904
3905 if !status.is_client_error() && !status.is_server_error() {
3906 let content = resp.text().await?;
3907 match content_type {
3908 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3909 ContentType::Text => {
3910 return Err(Error::from(serde_json::Error::custom(
3911 "Received `text/plain` content type response that cannot be converted to `models::PasswordPolicy`",
3912 )))
3913 }
3914 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3915 "Received `{unknown_type}` content type response that cannot be converted to `models::PasswordPolicy`"
3916 )))),
3917 }
3918 } else {
3919 let content = resp.text().await?;
3920 let entity: Option<PoliciesPasswordPartialUpdateError> = serde_json::from_str(&content).ok();
3921 Err(Error::ResponseError(ResponseContent {
3922 status,
3923 content,
3924 entity,
3925 }))
3926 }
3927}
3928
3929pub async fn policies_password_retrieve(
3931 configuration: &configuration::Configuration,
3932 policy_uuid: &str,
3933) -> Result<models::PasswordPolicy, Error<PoliciesPasswordRetrieveError>> {
3934 let p_path_policy_uuid = policy_uuid;
3936
3937 let uri_str = format!(
3938 "{}/policies/password/{policy_uuid}/",
3939 configuration.base_path,
3940 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
3941 );
3942 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3943
3944 if let Some(ref user_agent) = configuration.user_agent {
3945 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3946 }
3947 if let Some(ref token) = configuration.bearer_access_token {
3948 req_builder = req_builder.bearer_auth(token.to_owned());
3949 };
3950
3951 let req = req_builder.build()?;
3952 let resp = configuration.client.execute(req).await?;
3953
3954 let status = resp.status();
3955 let content_type = resp
3956 .headers()
3957 .get("content-type")
3958 .and_then(|v| v.to_str().ok())
3959 .unwrap_or("application/octet-stream");
3960 let content_type = super::ContentType::from(content_type);
3961
3962 if !status.is_client_error() && !status.is_server_error() {
3963 let content = resp.text().await?;
3964 match content_type {
3965 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3966 ContentType::Text => {
3967 return Err(Error::from(serde_json::Error::custom(
3968 "Received `text/plain` content type response that cannot be converted to `models::PasswordPolicy`",
3969 )))
3970 }
3971 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
3972 "Received `{unknown_type}` content type response that cannot be converted to `models::PasswordPolicy`"
3973 )))),
3974 }
3975 } else {
3976 let content = resp.text().await?;
3977 let entity: Option<PoliciesPasswordRetrieveError> = serde_json::from_str(&content).ok();
3978 Err(Error::ResponseError(ResponseContent {
3979 status,
3980 content,
3981 entity,
3982 }))
3983 }
3984}
3985
3986pub async fn policies_password_update(
3988 configuration: &configuration::Configuration,
3989 policy_uuid: &str,
3990 password_policy_request: models::PasswordPolicyRequest,
3991) -> Result<models::PasswordPolicy, Error<PoliciesPasswordUpdateError>> {
3992 let p_path_policy_uuid = policy_uuid;
3994 let p_body_password_policy_request = password_policy_request;
3995
3996 let uri_str = format!(
3997 "{}/policies/password/{policy_uuid}/",
3998 configuration.base_path,
3999 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4000 );
4001 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4002
4003 if let Some(ref user_agent) = configuration.user_agent {
4004 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4005 }
4006 if let Some(ref token) = configuration.bearer_access_token {
4007 req_builder = req_builder.bearer_auth(token.to_owned());
4008 };
4009 req_builder = req_builder.json(&p_body_password_policy_request);
4010
4011 let req = req_builder.build()?;
4012 let resp = configuration.client.execute(req).await?;
4013
4014 let status = resp.status();
4015 let content_type = resp
4016 .headers()
4017 .get("content-type")
4018 .and_then(|v| v.to_str().ok())
4019 .unwrap_or("application/octet-stream");
4020 let content_type = super::ContentType::from(content_type);
4021
4022 if !status.is_client_error() && !status.is_server_error() {
4023 let content = resp.text().await?;
4024 match content_type {
4025 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4026 ContentType::Text => {
4027 return Err(Error::from(serde_json::Error::custom(
4028 "Received `text/plain` content type response that cannot be converted to `models::PasswordPolicy`",
4029 )))
4030 }
4031 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!(
4032 "Received `{unknown_type}` content type response that cannot be converted to `models::PasswordPolicy`"
4033 )))),
4034 }
4035 } else {
4036 let content = resp.text().await?;
4037 let entity: Option<PoliciesPasswordUpdateError> = serde_json::from_str(&content).ok();
4038 Err(Error::ResponseError(ResponseContent {
4039 status,
4040 content,
4041 entity,
4042 }))
4043 }
4044}
4045
4046pub async fn policies_password_used_by_list(
4048 configuration: &configuration::Configuration,
4049 policy_uuid: &str,
4050) -> Result<Vec<models::UsedBy>, Error<PoliciesPasswordUsedByListError>> {
4051 let p_path_policy_uuid = policy_uuid;
4053
4054 let uri_str = format!(
4055 "{}/policies/password/{policy_uuid}/used_by/",
4056 configuration.base_path,
4057 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4058 );
4059 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4060
4061 if let Some(ref user_agent) = configuration.user_agent {
4062 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4063 }
4064 if let Some(ref token) = configuration.bearer_access_token {
4065 req_builder = req_builder.bearer_auth(token.to_owned());
4066 };
4067
4068 let req = req_builder.build()?;
4069 let resp = configuration.client.execute(req).await?;
4070
4071 let status = resp.status();
4072 let content_type = resp
4073 .headers()
4074 .get("content-type")
4075 .and_then(|v| v.to_str().ok())
4076 .unwrap_or("application/octet-stream");
4077 let content_type = super::ContentType::from(content_type);
4078
4079 if !status.is_client_error() && !status.is_server_error() {
4080 let content = resp.text().await?;
4081 match content_type {
4082 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4083 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
4084 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::UsedBy>`")))),
4085 }
4086 } else {
4087 let content = resp.text().await?;
4088 let entity: Option<PoliciesPasswordUsedByListError> = serde_json::from_str(&content).ok();
4089 Err(Error::ResponseError(ResponseContent {
4090 status,
4091 content,
4092 entity,
4093 }))
4094 }
4095}
4096
4097pub async fn policies_reputation_create(
4099 configuration: &configuration::Configuration,
4100 reputation_policy_request: models::ReputationPolicyRequest,
4101) -> Result<models::ReputationPolicy, Error<PoliciesReputationCreateError>> {
4102 let p_body_reputation_policy_request = reputation_policy_request;
4104
4105 let uri_str = format!("{}/policies/reputation/", configuration.base_path);
4106 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4107
4108 if let Some(ref user_agent) = configuration.user_agent {
4109 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4110 }
4111 if let Some(ref token) = configuration.bearer_access_token {
4112 req_builder = req_builder.bearer_auth(token.to_owned());
4113 };
4114 req_builder = req_builder.json(&p_body_reputation_policy_request);
4115
4116 let req = req_builder.build()?;
4117 let resp = configuration.client.execute(req).await?;
4118
4119 let status = resp.status();
4120 let content_type = resp
4121 .headers()
4122 .get("content-type")
4123 .and_then(|v| v.to_str().ok())
4124 .unwrap_or("application/octet-stream");
4125 let content_type = super::ContentType::from(content_type);
4126
4127 if !status.is_client_error() && !status.is_server_error() {
4128 let content = resp.text().await?;
4129 match content_type {
4130 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4131 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReputationPolicy`"))),
4132 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::ReputationPolicy`")))),
4133 }
4134 } else {
4135 let content = resp.text().await?;
4136 let entity: Option<PoliciesReputationCreateError> = serde_json::from_str(&content).ok();
4137 Err(Error::ResponseError(ResponseContent {
4138 status,
4139 content,
4140 entity,
4141 }))
4142 }
4143}
4144
4145pub async fn policies_reputation_destroy(
4147 configuration: &configuration::Configuration,
4148 policy_uuid: &str,
4149) -> Result<(), Error<PoliciesReputationDestroyError>> {
4150 let p_path_policy_uuid = policy_uuid;
4152
4153 let uri_str = format!(
4154 "{}/policies/reputation/{policy_uuid}/",
4155 configuration.base_path,
4156 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4157 );
4158 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4159
4160 if let Some(ref user_agent) = configuration.user_agent {
4161 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4162 }
4163 if let Some(ref token) = configuration.bearer_access_token {
4164 req_builder = req_builder.bearer_auth(token.to_owned());
4165 };
4166
4167 let req = req_builder.build()?;
4168 let resp = configuration.client.execute(req).await?;
4169
4170 let status = resp.status();
4171
4172 if !status.is_client_error() && !status.is_server_error() {
4173 Ok(())
4174 } else {
4175 let content = resp.text().await?;
4176 let entity: Option<PoliciesReputationDestroyError> = serde_json::from_str(&content).ok();
4177 Err(Error::ResponseError(ResponseContent {
4178 status,
4179 content,
4180 entity,
4181 }))
4182 }
4183}
4184
4185pub async fn policies_reputation_list(
4187 configuration: &configuration::Configuration,
4188 check_ip: Option<bool>,
4189 check_username: Option<bool>,
4190 created: Option<String>,
4191 execution_logging: Option<bool>,
4192 last_updated: Option<String>,
4193 name: Option<&str>,
4194 ordering: Option<&str>,
4195 page: Option<i32>,
4196 page_size: Option<i32>,
4197 policy_uuid: Option<&str>,
4198 search: Option<&str>,
4199 threshold: Option<i32>,
4200) -> Result<models::PaginatedReputationPolicyList, Error<PoliciesReputationListError>> {
4201 let p_query_check_ip = check_ip;
4203 let p_query_check_username = check_username;
4204 let p_query_created = created;
4205 let p_query_execution_logging = execution_logging;
4206 let p_query_last_updated = last_updated;
4207 let p_query_name = name;
4208 let p_query_ordering = ordering;
4209 let p_query_page = page;
4210 let p_query_page_size = page_size;
4211 let p_query_policy_uuid = policy_uuid;
4212 let p_query_search = search;
4213 let p_query_threshold = threshold;
4214
4215 let uri_str = format!("{}/policies/reputation/", configuration.base_path);
4216 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4217
4218 if let Some(ref param_value) = p_query_check_ip {
4219 req_builder = req_builder.query(&[("check_ip", ¶m_value.to_string())]);
4220 }
4221 if let Some(ref param_value) = p_query_check_username {
4222 req_builder = req_builder.query(&[("check_username", ¶m_value.to_string())]);
4223 }
4224 if let Some(ref param_value) = p_query_created {
4225 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
4226 }
4227 if let Some(ref param_value) = p_query_execution_logging {
4228 req_builder = req_builder.query(&[("execution_logging", ¶m_value.to_string())]);
4229 }
4230 if let Some(ref param_value) = p_query_last_updated {
4231 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
4232 }
4233 if let Some(ref param_value) = p_query_name {
4234 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
4235 }
4236 if let Some(ref param_value) = p_query_ordering {
4237 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
4238 }
4239 if let Some(ref param_value) = p_query_page {
4240 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4241 }
4242 if let Some(ref param_value) = p_query_page_size {
4243 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
4244 }
4245 if let Some(ref param_value) = p_query_policy_uuid {
4246 req_builder = req_builder.query(&[("policy_uuid", ¶m_value.to_string())]);
4247 }
4248 if let Some(ref param_value) = p_query_search {
4249 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
4250 }
4251 if let Some(ref param_value) = p_query_threshold {
4252 req_builder = req_builder.query(&[("threshold", ¶m_value.to_string())]);
4253 }
4254 if let Some(ref user_agent) = configuration.user_agent {
4255 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4256 }
4257 if let Some(ref token) = configuration.bearer_access_token {
4258 req_builder = req_builder.bearer_auth(token.to_owned());
4259 };
4260
4261 let req = req_builder.build()?;
4262 let resp = configuration.client.execute(req).await?;
4263
4264 let status = resp.status();
4265 let content_type = resp
4266 .headers()
4267 .get("content-type")
4268 .and_then(|v| v.to_str().ok())
4269 .unwrap_or("application/octet-stream");
4270 let content_type = super::ContentType::from(content_type);
4271
4272 if !status.is_client_error() && !status.is_server_error() {
4273 let content = resp.text().await?;
4274 match content_type {
4275 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4276 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedReputationPolicyList`"))),
4277 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::PaginatedReputationPolicyList`")))),
4278 }
4279 } else {
4280 let content = resp.text().await?;
4281 let entity: Option<PoliciesReputationListError> = serde_json::from_str(&content).ok();
4282 Err(Error::ResponseError(ResponseContent {
4283 status,
4284 content,
4285 entity,
4286 }))
4287 }
4288}
4289
4290pub async fn policies_reputation_partial_update(
4292 configuration: &configuration::Configuration,
4293 policy_uuid: &str,
4294 patched_reputation_policy_request: Option<models::PatchedReputationPolicyRequest>,
4295) -> Result<models::ReputationPolicy, Error<PoliciesReputationPartialUpdateError>> {
4296 let p_path_policy_uuid = policy_uuid;
4298 let p_body_patched_reputation_policy_request = patched_reputation_policy_request;
4299
4300 let uri_str = format!(
4301 "{}/policies/reputation/{policy_uuid}/",
4302 configuration.base_path,
4303 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4304 );
4305 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4306
4307 if let Some(ref user_agent) = configuration.user_agent {
4308 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4309 }
4310 if let Some(ref token) = configuration.bearer_access_token {
4311 req_builder = req_builder.bearer_auth(token.to_owned());
4312 };
4313 req_builder = req_builder.json(&p_body_patched_reputation_policy_request);
4314
4315 let req = req_builder.build()?;
4316 let resp = configuration.client.execute(req).await?;
4317
4318 let status = resp.status();
4319 let content_type = resp
4320 .headers()
4321 .get("content-type")
4322 .and_then(|v| v.to_str().ok())
4323 .unwrap_or("application/octet-stream");
4324 let content_type = super::ContentType::from(content_type);
4325
4326 if !status.is_client_error() && !status.is_server_error() {
4327 let content = resp.text().await?;
4328 match content_type {
4329 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4330 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReputationPolicy`"))),
4331 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::ReputationPolicy`")))),
4332 }
4333 } else {
4334 let content = resp.text().await?;
4335 let entity: Option<PoliciesReputationPartialUpdateError> = serde_json::from_str(&content).ok();
4336 Err(Error::ResponseError(ResponseContent {
4337 status,
4338 content,
4339 entity,
4340 }))
4341 }
4342}
4343
4344pub async fn policies_reputation_retrieve(
4346 configuration: &configuration::Configuration,
4347 policy_uuid: &str,
4348) -> Result<models::ReputationPolicy, Error<PoliciesReputationRetrieveError>> {
4349 let p_path_policy_uuid = policy_uuid;
4351
4352 let uri_str = format!(
4353 "{}/policies/reputation/{policy_uuid}/",
4354 configuration.base_path,
4355 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4356 );
4357 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4358
4359 if let Some(ref user_agent) = configuration.user_agent {
4360 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4361 }
4362 if let Some(ref token) = configuration.bearer_access_token {
4363 req_builder = req_builder.bearer_auth(token.to_owned());
4364 };
4365
4366 let req = req_builder.build()?;
4367 let resp = configuration.client.execute(req).await?;
4368
4369 let status = resp.status();
4370 let content_type = resp
4371 .headers()
4372 .get("content-type")
4373 .and_then(|v| v.to_str().ok())
4374 .unwrap_or("application/octet-stream");
4375 let content_type = super::ContentType::from(content_type);
4376
4377 if !status.is_client_error() && !status.is_server_error() {
4378 let content = resp.text().await?;
4379 match content_type {
4380 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4381 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReputationPolicy`"))),
4382 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::ReputationPolicy`")))),
4383 }
4384 } else {
4385 let content = resp.text().await?;
4386 let entity: Option<PoliciesReputationRetrieveError> = serde_json::from_str(&content).ok();
4387 Err(Error::ResponseError(ResponseContent {
4388 status,
4389 content,
4390 entity,
4391 }))
4392 }
4393}
4394
4395pub async fn policies_reputation_scores_destroy(
4397 configuration: &configuration::Configuration,
4398 reputation_uuid: &str,
4399) -> Result<(), Error<PoliciesReputationScoresDestroyError>> {
4400 let p_path_reputation_uuid = reputation_uuid;
4402
4403 let uri_str = format!(
4404 "{}/policies/reputation/scores/{reputation_uuid}/",
4405 configuration.base_path,
4406 reputation_uuid = crate::apis::urlencode(p_path_reputation_uuid)
4407 );
4408 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4409
4410 if let Some(ref user_agent) = configuration.user_agent {
4411 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4412 }
4413 if let Some(ref token) = configuration.bearer_access_token {
4414 req_builder = req_builder.bearer_auth(token.to_owned());
4415 };
4416
4417 let req = req_builder.build()?;
4418 let resp = configuration.client.execute(req).await?;
4419
4420 let status = resp.status();
4421
4422 if !status.is_client_error() && !status.is_server_error() {
4423 Ok(())
4424 } else {
4425 let content = resp.text().await?;
4426 let entity: Option<PoliciesReputationScoresDestroyError> = serde_json::from_str(&content).ok();
4427 Err(Error::ResponseError(ResponseContent {
4428 status,
4429 content,
4430 entity,
4431 }))
4432 }
4433}
4434
4435pub async fn policies_reputation_scores_list(
4437 configuration: &configuration::Configuration,
4438 identifier: Option<&str>,
4439 identifier_in: Option<Vec<String>>,
4440 ip: Option<&str>,
4441 ordering: Option<&str>,
4442 page: Option<i32>,
4443 page_size: Option<i32>,
4444 score: Option<i32>,
4445 search: Option<&str>,
4446) -> Result<models::PaginatedReputationList, Error<PoliciesReputationScoresListError>> {
4447 let p_query_identifier = identifier;
4449 let p_query_identifier_in = identifier_in;
4450 let p_query_ip = ip;
4451 let p_query_ordering = ordering;
4452 let p_query_page = page;
4453 let p_query_page_size = page_size;
4454 let p_query_score = score;
4455 let p_query_search = search;
4456
4457 let uri_str = format!("{}/policies/reputation/scores/", configuration.base_path);
4458 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4459
4460 if let Some(ref param_value) = p_query_identifier {
4461 req_builder = req_builder.query(&[("identifier", ¶m_value.to_string())]);
4462 }
4463 if let Some(ref param_value) = p_query_identifier_in {
4464 req_builder = match "csv" {
4465 "multi" => req_builder.query(
4466 ¶m_value
4467 .into_iter()
4468 .map(|p| ("identifier_in".to_owned(), p.to_string()))
4469 .collect::<Vec<(std::string::String, std::string::String)>>(),
4470 ),
4471 _ => req_builder.query(&[(
4472 "identifier_in",
4473 ¶m_value
4474 .into_iter()
4475 .map(|p| p.to_string())
4476 .collect::<Vec<String>>()
4477 .join(",")
4478 .to_string(),
4479 )]),
4480 };
4481 }
4482 if let Some(ref param_value) = p_query_ip {
4483 req_builder = req_builder.query(&[("ip", ¶m_value.to_string())]);
4484 }
4485 if let Some(ref param_value) = p_query_ordering {
4486 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
4487 }
4488 if let Some(ref param_value) = p_query_page {
4489 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4490 }
4491 if let Some(ref param_value) = p_query_page_size {
4492 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
4493 }
4494 if let Some(ref param_value) = p_query_score {
4495 req_builder = req_builder.query(&[("score", ¶m_value.to_string())]);
4496 }
4497 if let Some(ref param_value) = p_query_search {
4498 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
4499 }
4500 if let Some(ref user_agent) = configuration.user_agent {
4501 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4502 }
4503 if let Some(ref token) = configuration.bearer_access_token {
4504 req_builder = req_builder.bearer_auth(token.to_owned());
4505 };
4506
4507 let req = req_builder.build()?;
4508 let resp = configuration.client.execute(req).await?;
4509
4510 let status = resp.status();
4511 let content_type = resp
4512 .headers()
4513 .get("content-type")
4514 .and_then(|v| v.to_str().ok())
4515 .unwrap_or("application/octet-stream");
4516 let content_type = super::ContentType::from(content_type);
4517
4518 if !status.is_client_error() && !status.is_server_error() {
4519 let content = resp.text().await?;
4520 match content_type {
4521 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4522 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedReputationList`"))),
4523 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::PaginatedReputationList`")))),
4524 }
4525 } else {
4526 let content = resp.text().await?;
4527 let entity: Option<PoliciesReputationScoresListError> = serde_json::from_str(&content).ok();
4528 Err(Error::ResponseError(ResponseContent {
4529 status,
4530 content,
4531 entity,
4532 }))
4533 }
4534}
4535
4536pub async fn policies_reputation_scores_retrieve(
4538 configuration: &configuration::Configuration,
4539 reputation_uuid: &str,
4540) -> Result<models::Reputation, Error<PoliciesReputationScoresRetrieveError>> {
4541 let p_path_reputation_uuid = reputation_uuid;
4543
4544 let uri_str = format!(
4545 "{}/policies/reputation/scores/{reputation_uuid}/",
4546 configuration.base_path,
4547 reputation_uuid = crate::apis::urlencode(p_path_reputation_uuid)
4548 );
4549 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4550
4551 if let Some(ref user_agent) = configuration.user_agent {
4552 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4553 }
4554 if let Some(ref token) = configuration.bearer_access_token {
4555 req_builder = req_builder.bearer_auth(token.to_owned());
4556 };
4557
4558 let req = req_builder.build()?;
4559 let resp = configuration.client.execute(req).await?;
4560
4561 let status = resp.status();
4562 let content_type = resp
4563 .headers()
4564 .get("content-type")
4565 .and_then(|v| v.to_str().ok())
4566 .unwrap_or("application/octet-stream");
4567 let content_type = super::ContentType::from(content_type);
4568
4569 if !status.is_client_error() && !status.is_server_error() {
4570 let content = resp.text().await?;
4571 match content_type {
4572 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4573 ContentType::Text => {
4574 return Err(Error::from(serde_json::Error::custom(
4575 "Received `text/plain` content type response that cannot be converted to `models::Reputation`",
4576 )))
4577 }
4578 ContentType::Unsupported(unknown_type) => {
4579 return Err(Error::from(serde_json::Error::custom(format!(
4580 "Received `{unknown_type}` content type response that cannot be converted to `models::Reputation`"
4581 ))))
4582 }
4583 }
4584 } else {
4585 let content = resp.text().await?;
4586 let entity: Option<PoliciesReputationScoresRetrieveError> = serde_json::from_str(&content).ok();
4587 Err(Error::ResponseError(ResponseContent {
4588 status,
4589 content,
4590 entity,
4591 }))
4592 }
4593}
4594
4595pub async fn policies_reputation_scores_used_by_list(
4597 configuration: &configuration::Configuration,
4598 reputation_uuid: &str,
4599) -> Result<Vec<models::UsedBy>, Error<PoliciesReputationScoresUsedByListError>> {
4600 let p_path_reputation_uuid = reputation_uuid;
4602
4603 let uri_str = format!(
4604 "{}/policies/reputation/scores/{reputation_uuid}/used_by/",
4605 configuration.base_path,
4606 reputation_uuid = crate::apis::urlencode(p_path_reputation_uuid)
4607 );
4608 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4609
4610 if let Some(ref user_agent) = configuration.user_agent {
4611 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4612 }
4613 if let Some(ref token) = configuration.bearer_access_token {
4614 req_builder = req_builder.bearer_auth(token.to_owned());
4615 };
4616
4617 let req = req_builder.build()?;
4618 let resp = configuration.client.execute(req).await?;
4619
4620 let status = resp.status();
4621 let content_type = resp
4622 .headers()
4623 .get("content-type")
4624 .and_then(|v| v.to_str().ok())
4625 .unwrap_or("application/octet-stream");
4626 let content_type = super::ContentType::from(content_type);
4627
4628 if !status.is_client_error() && !status.is_server_error() {
4629 let content = resp.text().await?;
4630 match content_type {
4631 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4632 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
4633 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::UsedBy>`")))),
4634 }
4635 } else {
4636 let content = resp.text().await?;
4637 let entity: Option<PoliciesReputationScoresUsedByListError> = serde_json::from_str(&content).ok();
4638 Err(Error::ResponseError(ResponseContent {
4639 status,
4640 content,
4641 entity,
4642 }))
4643 }
4644}
4645
4646pub async fn policies_reputation_update(
4648 configuration: &configuration::Configuration,
4649 policy_uuid: &str,
4650 reputation_policy_request: models::ReputationPolicyRequest,
4651) -> Result<models::ReputationPolicy, Error<PoliciesReputationUpdateError>> {
4652 let p_path_policy_uuid = policy_uuid;
4654 let p_body_reputation_policy_request = reputation_policy_request;
4655
4656 let uri_str = format!(
4657 "{}/policies/reputation/{policy_uuid}/",
4658 configuration.base_path,
4659 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4660 );
4661 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
4662
4663 if let Some(ref user_agent) = configuration.user_agent {
4664 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4665 }
4666 if let Some(ref token) = configuration.bearer_access_token {
4667 req_builder = req_builder.bearer_auth(token.to_owned());
4668 };
4669 req_builder = req_builder.json(&p_body_reputation_policy_request);
4670
4671 let req = req_builder.build()?;
4672 let resp = configuration.client.execute(req).await?;
4673
4674 let status = resp.status();
4675 let content_type = resp
4676 .headers()
4677 .get("content-type")
4678 .and_then(|v| v.to_str().ok())
4679 .unwrap_or("application/octet-stream");
4680 let content_type = super::ContentType::from(content_type);
4681
4682 if !status.is_client_error() && !status.is_server_error() {
4683 let content = resp.text().await?;
4684 match content_type {
4685 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4686 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReputationPolicy`"))),
4687 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::ReputationPolicy`")))),
4688 }
4689 } else {
4690 let content = resp.text().await?;
4691 let entity: Option<PoliciesReputationUpdateError> = serde_json::from_str(&content).ok();
4692 Err(Error::ResponseError(ResponseContent {
4693 status,
4694 content,
4695 entity,
4696 }))
4697 }
4698}
4699
4700pub async fn policies_reputation_used_by_list(
4702 configuration: &configuration::Configuration,
4703 policy_uuid: &str,
4704) -> Result<Vec<models::UsedBy>, Error<PoliciesReputationUsedByListError>> {
4705 let p_path_policy_uuid = policy_uuid;
4707
4708 let uri_str = format!(
4709 "{}/policies/reputation/{policy_uuid}/used_by/",
4710 configuration.base_path,
4711 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4712 );
4713 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4714
4715 if let Some(ref user_agent) = configuration.user_agent {
4716 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4717 }
4718 if let Some(ref token) = configuration.bearer_access_token {
4719 req_builder = req_builder.bearer_auth(token.to_owned());
4720 };
4721
4722 let req = req_builder.build()?;
4723 let resp = configuration.client.execute(req).await?;
4724
4725 let status = resp.status();
4726 let content_type = resp
4727 .headers()
4728 .get("content-type")
4729 .and_then(|v| v.to_str().ok())
4730 .unwrap_or("application/octet-stream");
4731 let content_type = super::ContentType::from(content_type);
4732
4733 if !status.is_client_error() && !status.is_server_error() {
4734 let content = resp.text().await?;
4735 match content_type {
4736 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4737 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
4738 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::UsedBy>`")))),
4739 }
4740 } else {
4741 let content = resp.text().await?;
4742 let entity: Option<PoliciesReputationUsedByListError> = serde_json::from_str(&content).ok();
4743 Err(Error::ResponseError(ResponseContent {
4744 status,
4745 content,
4746 entity,
4747 }))
4748 }
4749}
4750
4751pub async fn policies_unique_password_create(
4753 configuration: &configuration::Configuration,
4754 unique_password_policy_request: models::UniquePasswordPolicyRequest,
4755) -> Result<models::UniquePasswordPolicy, Error<PoliciesUniquePasswordCreateError>> {
4756 let p_body_unique_password_policy_request = unique_password_policy_request;
4758
4759 let uri_str = format!("{}/policies/unique_password/", configuration.base_path);
4760 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4761
4762 if let Some(ref user_agent) = configuration.user_agent {
4763 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4764 }
4765 if let Some(ref token) = configuration.bearer_access_token {
4766 req_builder = req_builder.bearer_auth(token.to_owned());
4767 };
4768 req_builder = req_builder.json(&p_body_unique_password_policy_request);
4769
4770 let req = req_builder.build()?;
4771 let resp = configuration.client.execute(req).await?;
4772
4773 let status = resp.status();
4774 let content_type = resp
4775 .headers()
4776 .get("content-type")
4777 .and_then(|v| v.to_str().ok())
4778 .unwrap_or("application/octet-stream");
4779 let content_type = super::ContentType::from(content_type);
4780
4781 if !status.is_client_error() && !status.is_server_error() {
4782 let content = resp.text().await?;
4783 match content_type {
4784 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4785 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UniquePasswordPolicy`"))),
4786 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::UniquePasswordPolicy`")))),
4787 }
4788 } else {
4789 let content = resp.text().await?;
4790 let entity: Option<PoliciesUniquePasswordCreateError> = serde_json::from_str(&content).ok();
4791 Err(Error::ResponseError(ResponseContent {
4792 status,
4793 content,
4794 entity,
4795 }))
4796 }
4797}
4798
4799pub async fn policies_unique_password_destroy(
4801 configuration: &configuration::Configuration,
4802 policy_uuid: &str,
4803) -> Result<(), Error<PoliciesUniquePasswordDestroyError>> {
4804 let p_path_policy_uuid = policy_uuid;
4806
4807 let uri_str = format!(
4808 "{}/policies/unique_password/{policy_uuid}/",
4809 configuration.base_path,
4810 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4811 );
4812 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
4813
4814 if let Some(ref user_agent) = configuration.user_agent {
4815 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4816 }
4817 if let Some(ref token) = configuration.bearer_access_token {
4818 req_builder = req_builder.bearer_auth(token.to_owned());
4819 };
4820
4821 let req = req_builder.build()?;
4822 let resp = configuration.client.execute(req).await?;
4823
4824 let status = resp.status();
4825
4826 if !status.is_client_error() && !status.is_server_error() {
4827 Ok(())
4828 } else {
4829 let content = resp.text().await?;
4830 let entity: Option<PoliciesUniquePasswordDestroyError> = serde_json::from_str(&content).ok();
4831 Err(Error::ResponseError(ResponseContent {
4832 status,
4833 content,
4834 entity,
4835 }))
4836 }
4837}
4838
4839pub async fn policies_unique_password_list(
4841 configuration: &configuration::Configuration,
4842 created: Option<String>,
4843 execution_logging: Option<bool>,
4844 last_updated: Option<String>,
4845 name: Option<&str>,
4846 num_historical_passwords: Option<i32>,
4847 ordering: Option<&str>,
4848 page: Option<i32>,
4849 page_size: Option<i32>,
4850 password_field: Option<&str>,
4851 policy_uuid: Option<&str>,
4852 search: Option<&str>,
4853) -> Result<models::PaginatedUniquePasswordPolicyList, Error<PoliciesUniquePasswordListError>> {
4854 let p_query_created = created;
4856 let p_query_execution_logging = execution_logging;
4857 let p_query_last_updated = last_updated;
4858 let p_query_name = name;
4859 let p_query_num_historical_passwords = num_historical_passwords;
4860 let p_query_ordering = ordering;
4861 let p_query_page = page;
4862 let p_query_page_size = page_size;
4863 let p_query_password_field = password_field;
4864 let p_query_policy_uuid = policy_uuid;
4865 let p_query_search = search;
4866
4867 let uri_str = format!("{}/policies/unique_password/", configuration.base_path);
4868 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
4869
4870 if let Some(ref param_value) = p_query_created {
4871 req_builder = req_builder.query(&[("created", ¶m_value.to_string())]);
4872 }
4873 if let Some(ref param_value) = p_query_execution_logging {
4874 req_builder = req_builder.query(&[("execution_logging", ¶m_value.to_string())]);
4875 }
4876 if let Some(ref param_value) = p_query_last_updated {
4877 req_builder = req_builder.query(&[("last_updated", ¶m_value.to_string())]);
4878 }
4879 if let Some(ref param_value) = p_query_name {
4880 req_builder = req_builder.query(&[("name", ¶m_value.to_string())]);
4881 }
4882 if let Some(ref param_value) = p_query_num_historical_passwords {
4883 req_builder = req_builder.query(&[("num_historical_passwords", ¶m_value.to_string())]);
4884 }
4885 if let Some(ref param_value) = p_query_ordering {
4886 req_builder = req_builder.query(&[("ordering", ¶m_value.to_string())]);
4887 }
4888 if let Some(ref param_value) = p_query_page {
4889 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
4890 }
4891 if let Some(ref param_value) = p_query_page_size {
4892 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
4893 }
4894 if let Some(ref param_value) = p_query_password_field {
4895 req_builder = req_builder.query(&[("password_field", ¶m_value.to_string())]);
4896 }
4897 if let Some(ref param_value) = p_query_policy_uuid {
4898 req_builder = req_builder.query(&[("policy_uuid", ¶m_value.to_string())]);
4899 }
4900 if let Some(ref param_value) = p_query_search {
4901 req_builder = req_builder.query(&[("search", ¶m_value.to_string())]);
4902 }
4903 if let Some(ref user_agent) = configuration.user_agent {
4904 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4905 }
4906 if let Some(ref token) = configuration.bearer_access_token {
4907 req_builder = req_builder.bearer_auth(token.to_owned());
4908 };
4909
4910 let req = req_builder.build()?;
4911 let resp = configuration.client.execute(req).await?;
4912
4913 let status = resp.status();
4914 let content_type = resp
4915 .headers()
4916 .get("content-type")
4917 .and_then(|v| v.to_str().ok())
4918 .unwrap_or("application/octet-stream");
4919 let content_type = super::ContentType::from(content_type);
4920
4921 if !status.is_client_error() && !status.is_server_error() {
4922 let content = resp.text().await?;
4923 match content_type {
4924 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4925 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PaginatedUniquePasswordPolicyList`"))),
4926 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::PaginatedUniquePasswordPolicyList`")))),
4927 }
4928 } else {
4929 let content = resp.text().await?;
4930 let entity: Option<PoliciesUniquePasswordListError> = serde_json::from_str(&content).ok();
4931 Err(Error::ResponseError(ResponseContent {
4932 status,
4933 content,
4934 entity,
4935 }))
4936 }
4937}
4938
4939pub async fn policies_unique_password_partial_update(
4941 configuration: &configuration::Configuration,
4942 policy_uuid: &str,
4943 patched_unique_password_policy_request: Option<models::PatchedUniquePasswordPolicyRequest>,
4944) -> Result<models::UniquePasswordPolicy, Error<PoliciesUniquePasswordPartialUpdateError>> {
4945 let p_path_policy_uuid = policy_uuid;
4947 let p_body_patched_unique_password_policy_request = patched_unique_password_policy_request;
4948
4949 let uri_str = format!(
4950 "{}/policies/unique_password/{policy_uuid}/",
4951 configuration.base_path,
4952 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
4953 );
4954 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
4955
4956 if let Some(ref user_agent) = configuration.user_agent {
4957 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
4958 }
4959 if let Some(ref token) = configuration.bearer_access_token {
4960 req_builder = req_builder.bearer_auth(token.to_owned());
4961 };
4962 req_builder = req_builder.json(&p_body_patched_unique_password_policy_request);
4963
4964 let req = req_builder.build()?;
4965 let resp = configuration.client.execute(req).await?;
4966
4967 let status = resp.status();
4968 let content_type = resp
4969 .headers()
4970 .get("content-type")
4971 .and_then(|v| v.to_str().ok())
4972 .unwrap_or("application/octet-stream");
4973 let content_type = super::ContentType::from(content_type);
4974
4975 if !status.is_client_error() && !status.is_server_error() {
4976 let content = resp.text().await?;
4977 match content_type {
4978 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
4979 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UniquePasswordPolicy`"))),
4980 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::UniquePasswordPolicy`")))),
4981 }
4982 } else {
4983 let content = resp.text().await?;
4984 let entity: Option<PoliciesUniquePasswordPartialUpdateError> = serde_json::from_str(&content).ok();
4985 Err(Error::ResponseError(ResponseContent {
4986 status,
4987 content,
4988 entity,
4989 }))
4990 }
4991}
4992
4993pub async fn policies_unique_password_retrieve(
4995 configuration: &configuration::Configuration,
4996 policy_uuid: &str,
4997) -> Result<models::UniquePasswordPolicy, Error<PoliciesUniquePasswordRetrieveError>> {
4998 let p_path_policy_uuid = policy_uuid;
5000
5001 let uri_str = format!(
5002 "{}/policies/unique_password/{policy_uuid}/",
5003 configuration.base_path,
5004 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
5005 );
5006 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5007
5008 if let Some(ref user_agent) = configuration.user_agent {
5009 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5010 }
5011 if let Some(ref token) = configuration.bearer_access_token {
5012 req_builder = req_builder.bearer_auth(token.to_owned());
5013 };
5014
5015 let req = req_builder.build()?;
5016 let resp = configuration.client.execute(req).await?;
5017
5018 let status = resp.status();
5019 let content_type = resp
5020 .headers()
5021 .get("content-type")
5022 .and_then(|v| v.to_str().ok())
5023 .unwrap_or("application/octet-stream");
5024 let content_type = super::ContentType::from(content_type);
5025
5026 if !status.is_client_error() && !status.is_server_error() {
5027 let content = resp.text().await?;
5028 match content_type {
5029 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5030 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UniquePasswordPolicy`"))),
5031 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::UniquePasswordPolicy`")))),
5032 }
5033 } else {
5034 let content = resp.text().await?;
5035 let entity: Option<PoliciesUniquePasswordRetrieveError> = serde_json::from_str(&content).ok();
5036 Err(Error::ResponseError(ResponseContent {
5037 status,
5038 content,
5039 entity,
5040 }))
5041 }
5042}
5043
5044pub async fn policies_unique_password_update(
5046 configuration: &configuration::Configuration,
5047 policy_uuid: &str,
5048 unique_password_policy_request: models::UniquePasswordPolicyRequest,
5049) -> Result<models::UniquePasswordPolicy, Error<PoliciesUniquePasswordUpdateError>> {
5050 let p_path_policy_uuid = policy_uuid;
5052 let p_body_unique_password_policy_request = unique_password_policy_request;
5053
5054 let uri_str = format!(
5055 "{}/policies/unique_password/{policy_uuid}/",
5056 configuration.base_path,
5057 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
5058 );
5059 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
5060
5061 if let Some(ref user_agent) = configuration.user_agent {
5062 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5063 }
5064 if let Some(ref token) = configuration.bearer_access_token {
5065 req_builder = req_builder.bearer_auth(token.to_owned());
5066 };
5067 req_builder = req_builder.json(&p_body_unique_password_policy_request);
5068
5069 let req = req_builder.build()?;
5070 let resp = configuration.client.execute(req).await?;
5071
5072 let status = resp.status();
5073 let content_type = resp
5074 .headers()
5075 .get("content-type")
5076 .and_then(|v| v.to_str().ok())
5077 .unwrap_or("application/octet-stream");
5078 let content_type = super::ContentType::from(content_type);
5079
5080 if !status.is_client_error() && !status.is_server_error() {
5081 let content = resp.text().await?;
5082 match content_type {
5083 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5084 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UniquePasswordPolicy`"))),
5085 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::UniquePasswordPolicy`")))),
5086 }
5087 } else {
5088 let content = resp.text().await?;
5089 let entity: Option<PoliciesUniquePasswordUpdateError> = serde_json::from_str(&content).ok();
5090 Err(Error::ResponseError(ResponseContent {
5091 status,
5092 content,
5093 entity,
5094 }))
5095 }
5096}
5097
5098pub async fn policies_unique_password_used_by_list(
5100 configuration: &configuration::Configuration,
5101 policy_uuid: &str,
5102) -> Result<Vec<models::UsedBy>, Error<PoliciesUniquePasswordUsedByListError>> {
5103 let p_path_policy_uuid = policy_uuid;
5105
5106 let uri_str = format!(
5107 "{}/policies/unique_password/{policy_uuid}/used_by/",
5108 configuration.base_path,
5109 policy_uuid = crate::apis::urlencode(p_path_policy_uuid)
5110 );
5111 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
5112
5113 if let Some(ref user_agent) = configuration.user_agent {
5114 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
5115 }
5116 if let Some(ref token) = configuration.bearer_access_token {
5117 req_builder = req_builder.bearer_auth(token.to_owned());
5118 };
5119
5120 let req = req_builder.build()?;
5121 let resp = configuration.client.execute(req).await?;
5122
5123 let status = resp.status();
5124 let content_type = resp
5125 .headers()
5126 .get("content-type")
5127 .and_then(|v| v.to_str().ok())
5128 .unwrap_or("application/octet-stream");
5129 let content_type = super::ContentType::from(content_type);
5130
5131 if !status.is_client_error() && !status.is_server_error() {
5132 let content = resp.text().await?;
5133 match content_type {
5134 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
5135 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UsedBy>`"))),
5136 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::UsedBy>`")))),
5137 }
5138 } else {
5139 let content = resp.text().await?;
5140 let entity: Option<PoliciesUniquePasswordUsedByListError> = serde_json::from_str(&content).ok();
5141 Err(Error::ResponseError(ResponseContent {
5142 status,
5143 content,
5144 entity,
5145 }))
5146 }
5147}