1use crate::Client;
4
5pub mod abuse_reports {
8 use crate::types;
9 use crate::Error;
10
11 #[derive(Debug, Clone)]
14 pub struct Client {
15 c: crate::Client,
16 }
17
18 impl Client {
19 pub fn new(c: crate::Client) -> Self {
20 Self { c }
21 }
22
23 pub async fn create(
27 &self,
28 req: &types::AbuseReportCreate,
29 ) -> Result<types::AbuseReport, Error> {
30 self.c
31 .make_request("/abuse_reports", reqwest::Method::POST, Some(req))
32 .await
33 }
34
35 pub async fn get(&self, id: &str) -> Result<types::AbuseReport, Error> {
37 self.c
38 .make_request(
39 &format!("/abuse_reports/{id}", id = id),
40 reqwest::Method::GET,
41 None::<Option<()>>,
42 )
43 .await
44 }
45 }
46}
47
48pub mod agent_ingresses {
49 use crate::types;
50 use crate::Error;
51 use futures::{Stream, TryStreamExt};
52
53 #[derive(Debug, Clone)]
54 pub struct Client {
55 c: crate::Client,
56 }
57 pub struct List {
59 c: std::sync::Arc<Client>,
60 req: types::Paging,
61 }
62
63 impl List {
64 pub async fn pages(
69 self,
70 ) -> impl Stream<Item = Result<types::AgentIngressList, Error>> + Unpin {
71 struct State {
72 c: std::sync::Arc<Client>,
73 req: types::Paging,
74 init: bool,
75 cur_uri: Option<String>,
76 }
77
78 let s = State {
79 c: self.c,
80 req: self.req,
81 init: true,
82 cur_uri: None,
83 };
84
85 Box::pin(futures::stream::unfold(s, |s| async move {
86 let page_resp = match (s.init, &s.cur_uri) {
87 (true, _) => s.c.list_page(&s.req).await,
88 (false, None) => {
89 return None;
90 }
91 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
92 };
93 match page_resp {
94 Err(e) => Some((Err(e), s)),
95 Ok(page) => {
96 let next = page.next_page_uri.clone();
97 Some((
98 Ok(page),
99 State {
100 init: false,
101 cur_uri: next,
102 ..s
103 },
104 ))
105 }
106 }
107 }))
108 }
109
110 pub async fn ingresses(
115 self,
116 ) -> impl Stream<Item = Result<types::AgentIngress, Error>> + Unpin {
117 self.pages()
118 .await
119 .map_ok(|page| futures::stream::iter(page.ingresses.into_iter().map(Ok)))
120 .try_flatten()
121 }
122 }
123
124 impl Client {
125 pub fn new(c: crate::Client) -> Self {
126 Self { c }
127 }
128
129 pub async fn create(
132 &self,
133 req: &types::AgentIngressCreate,
134 ) -> Result<types::AgentIngress, Error> {
135 self.c
136 .make_request("/agent_ingresses", reqwest::Method::POST, Some(req))
137 .await
138 }
139
140 pub async fn delete(&self, id: &str) -> Result<(), Error> {
142 self.c
143 .make_request(
144 &format!("/agent_ingresses/{id}", id = id),
145 reqwest::Method::DELETE,
146 None::<Option<()>>,
147 )
148 .await
149 }
150
151 pub async fn get(&self, id: &str) -> Result<types::AgentIngress, Error> {
153 self.c
154 .make_request(
155 &format!("/agent_ingresses/{id}", id = id),
156 reqwest::Method::GET,
157 None::<Option<()>>,
158 )
159 .await
160 }
161
162 pub(crate) async fn list_page(
165 &self,
166 req: &types::Paging,
167 ) -> Result<types::AgentIngressList, Error> {
168 self.c
169 .make_request("/agent_ingresses", reqwest::Method::GET, Some(req))
170 .await
171 }
172
173 pub fn list(&self, req: types::Paging) -> List {
175 List {
176 c: std::sync::Arc::new(self.clone()),
177 req,
178 }
179 }
180
181 pub async fn update(
183 &self,
184 req: &types::AgentIngressUpdate,
185 ) -> Result<types::AgentIngress, Error> {
186 self.c
187 .make_request(
188 &format!("/agent_ingresses/{id}", id = req.id),
189 reqwest::Method::PATCH,
190 Some(req),
191 )
192 .await
193 }
194 }
195}
196
197pub mod api_keys {
203 use crate::types;
204 use crate::Error;
205 use futures::{Stream, TryStreamExt};
206
207 #[derive(Debug, Clone)]
213 pub struct Client {
214 c: crate::Client,
215 }
216 pub struct List {
218 c: std::sync::Arc<Client>,
219 req: types::Paging,
220 }
221
222 impl List {
223 pub async fn pages(self) -> impl Stream<Item = Result<types::APIKeyList, Error>> + Unpin {
228 struct State {
229 c: std::sync::Arc<Client>,
230 req: types::Paging,
231 init: bool,
232 cur_uri: Option<String>,
233 }
234
235 let s = State {
236 c: self.c,
237 req: self.req,
238 init: true,
239 cur_uri: None,
240 };
241
242 Box::pin(futures::stream::unfold(s, |s| async move {
243 let page_resp = match (s.init, &s.cur_uri) {
244 (true, _) => s.c.list_page(&s.req).await,
245 (false, None) => {
246 return None;
247 }
248 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
249 };
250 match page_resp {
251 Err(e) => Some((Err(e), s)),
252 Ok(page) => {
253 let next = page.next_page_uri.clone();
254 Some((
255 Ok(page),
256 State {
257 init: false,
258 cur_uri: next,
259 ..s
260 },
261 ))
262 }
263 }
264 }))
265 }
266
267 pub async fn keys(self) -> impl Stream<Item = Result<types::APIKey, Error>> + Unpin {
272 self.pages()
273 .await
274 .map_ok(|page| futures::stream::iter(page.keys.into_iter().map(Ok)))
275 .try_flatten()
276 }
277 }
278
279 impl Client {
280 pub fn new(c: crate::Client) -> Self {
281 Self { c }
282 }
283
284 pub async fn create(&self, req: &types::APIKeyCreate) -> Result<types::APIKey, Error> {
287 self.c
288 .make_request("/api_keys", reqwest::Method::POST, Some(req))
289 .await
290 }
291
292 pub async fn delete(&self, id: &str) -> Result<(), Error> {
294 self.c
295 .make_request(
296 &format!("/api_keys/{id}", id = id),
297 reqwest::Method::DELETE,
298 None::<Option<()>>,
299 )
300 .await
301 }
302
303 pub async fn get(&self, id: &str) -> Result<types::APIKey, Error> {
305 self.c
306 .make_request(
307 &format!("/api_keys/{id}", id = id),
308 reqwest::Method::GET,
309 None::<Option<()>>,
310 )
311 .await
312 }
313
314 pub(crate) async fn list_page(
317 &self,
318 req: &types::Paging,
319 ) -> Result<types::APIKeyList, Error> {
320 self.c
321 .make_request("/api_keys", reqwest::Method::GET, Some(req))
322 .await
323 }
324
325 pub fn list(&self, req: types::Paging) -> List {
327 List {
328 c: std::sync::Arc::new(self.clone()),
329 req,
330 }
331 }
332
333 pub async fn update(&self, req: &types::APIKeyUpdate) -> Result<types::APIKey, Error> {
335 self.c
336 .make_request(
337 &format!("/api_keys/{id}", id = req.id),
338 reqwest::Method::PATCH,
339 Some(req),
340 )
341 .await
342 }
343 }
344}
345
346pub mod application_sessions {
347 use crate::types;
348 use crate::Error;
349 use futures::{Stream, TryStreamExt};
350
351 #[derive(Debug, Clone)]
352 pub struct Client {
353 c: crate::Client,
354 }
355 pub struct List {
357 c: std::sync::Arc<Client>,
358 req: types::Paging,
359 }
360
361 impl List {
362 pub async fn pages(
367 self,
368 ) -> impl Stream<Item = Result<types::ApplicationSessionList, Error>> + Unpin {
369 struct State {
370 c: std::sync::Arc<Client>,
371 req: types::Paging,
372 init: bool,
373 cur_uri: Option<String>,
374 }
375
376 let s = State {
377 c: self.c,
378 req: self.req,
379 init: true,
380 cur_uri: None,
381 };
382
383 Box::pin(futures::stream::unfold(s, |s| async move {
384 let page_resp = match (s.init, &s.cur_uri) {
385 (true, _) => s.c.list_page(&s.req).await,
386 (false, None) => {
387 return None;
388 }
389 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
390 };
391 match page_resp {
392 Err(e) => Some((Err(e), s)),
393 Ok(page) => {
394 let next = page.next_page_uri.clone();
395 Some((
396 Ok(page),
397 State {
398 init: false,
399 cur_uri: next,
400 ..s
401 },
402 ))
403 }
404 }
405 }))
406 }
407
408 pub async fn application_sessions(
413 self,
414 ) -> impl Stream<Item = Result<types::ApplicationSession, Error>> + Unpin {
415 self.pages()
416 .await
417 .map_ok(|page| futures::stream::iter(page.application_sessions.into_iter().map(Ok)))
418 .try_flatten()
419 }
420 }
421
422 impl Client {
423 pub fn new(c: crate::Client) -> Self {
424 Self { c }
425 }
426
427 pub async fn get(&self, id: &str) -> Result<types::ApplicationSession, Error> {
429 self.c
430 .make_request(
431 &format!("/app/sessions/{id}", id = id),
432 reqwest::Method::GET,
433 None::<Option<()>>,
434 )
435 .await
436 }
437
438 pub async fn delete(&self, id: &str) -> Result<(), Error> {
440 self.c
441 .make_request(
442 &format!("/app/sessions/{id}", id = id),
443 reqwest::Method::DELETE,
444 None::<Option<()>>,
445 )
446 .await
447 }
448
449 pub(crate) async fn list_page(
452 &self,
453 req: &types::Paging,
454 ) -> Result<types::ApplicationSessionList, Error> {
455 self.c
456 .make_request("/app/sessions", reqwest::Method::GET, Some(req))
457 .await
458 }
459
460 pub fn list(&self, req: types::Paging) -> List {
462 List {
463 c: std::sync::Arc::new(self.clone()),
464 req,
465 }
466 }
467 }
468}
469
470pub mod application_users {
471 use crate::types;
472 use crate::Error;
473 use futures::{Stream, TryStreamExt};
474
475 #[derive(Debug, Clone)]
476 pub struct Client {
477 c: crate::Client,
478 }
479 pub struct List {
481 c: std::sync::Arc<Client>,
482 req: types::Paging,
483 }
484
485 impl List {
486 pub async fn pages(
491 self,
492 ) -> impl Stream<Item = Result<types::ApplicationUserList, Error>> + Unpin {
493 struct State {
494 c: std::sync::Arc<Client>,
495 req: types::Paging,
496 init: bool,
497 cur_uri: Option<String>,
498 }
499
500 let s = State {
501 c: self.c,
502 req: self.req,
503 init: true,
504 cur_uri: None,
505 };
506
507 Box::pin(futures::stream::unfold(s, |s| async move {
508 let page_resp = match (s.init, &s.cur_uri) {
509 (true, _) => s.c.list_page(&s.req).await,
510 (false, None) => {
511 return None;
512 }
513 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
514 };
515 match page_resp {
516 Err(e) => Some((Err(e), s)),
517 Ok(page) => {
518 let next = page.next_page_uri.clone();
519 Some((
520 Ok(page),
521 State {
522 init: false,
523 cur_uri: next,
524 ..s
525 },
526 ))
527 }
528 }
529 }))
530 }
531
532 pub async fn application_users(
537 self,
538 ) -> impl Stream<Item = Result<types::ApplicationUser, Error>> + Unpin {
539 self.pages()
540 .await
541 .map_ok(|page| futures::stream::iter(page.application_users.into_iter().map(Ok)))
542 .try_flatten()
543 }
544 }
545
546 impl Client {
547 pub fn new(c: crate::Client) -> Self {
548 Self { c }
549 }
550
551 pub async fn get(&self, id: &str) -> Result<types::ApplicationUser, Error> {
553 self.c
554 .make_request(
555 &format!("/app/users/{id}", id = id),
556 reqwest::Method::GET,
557 None::<Option<()>>,
558 )
559 .await
560 }
561
562 pub async fn delete(&self, id: &str) -> Result<(), Error> {
564 self.c
565 .make_request(
566 &format!("/app/users/{id}", id = id),
567 reqwest::Method::DELETE,
568 None::<Option<()>>,
569 )
570 .await
571 }
572
573 pub(crate) async fn list_page(
576 &self,
577 req: &types::Paging,
578 ) -> Result<types::ApplicationUserList, Error> {
579 self.c
580 .make_request("/app/users", reqwest::Method::GET, Some(req))
581 .await
582 }
583
584 pub fn list(&self, req: types::Paging) -> List {
586 List {
587 c: std::sync::Arc::new(self.clone()),
588 req,
589 }
590 }
591 }
592}
593
594pub mod tunnel_sessions {
598 use crate::types;
599 use crate::Error;
600 use futures::{Stream, TryStreamExt};
601
602 #[derive(Debug, Clone)]
606 pub struct Client {
607 c: crate::Client,
608 }
609 pub struct List {
611 c: std::sync::Arc<Client>,
612 req: types::Paging,
613 }
614
615 impl List {
616 pub async fn pages(
621 self,
622 ) -> impl Stream<Item = Result<types::TunnelSessionList, Error>> + Unpin {
623 struct State {
624 c: std::sync::Arc<Client>,
625 req: types::Paging,
626 init: bool,
627 cur_uri: Option<String>,
628 }
629
630 let s = State {
631 c: self.c,
632 req: self.req,
633 init: true,
634 cur_uri: None,
635 };
636
637 Box::pin(futures::stream::unfold(s, |s| async move {
638 let page_resp = match (s.init, &s.cur_uri) {
639 (true, _) => s.c.list_page(&s.req).await,
640 (false, None) => {
641 return None;
642 }
643 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
644 };
645 match page_resp {
646 Err(e) => Some((Err(e), s)),
647 Ok(page) => {
648 let next = page.next_page_uri.clone();
649 Some((
650 Ok(page),
651 State {
652 init: false,
653 cur_uri: next,
654 ..s
655 },
656 ))
657 }
658 }
659 }))
660 }
661
662 pub async fn tunnel_sessions(
667 self,
668 ) -> impl Stream<Item = Result<types::TunnelSession, Error>> + Unpin {
669 self.pages()
670 .await
671 .map_ok(|page| futures::stream::iter(page.tunnel_sessions.into_iter().map(Ok)))
672 .try_flatten()
673 }
674 }
675
676 impl Client {
677 pub fn new(c: crate::Client) -> Self {
678 Self { c }
679 }
680
681 pub(crate) async fn list_page(
684 &self,
685 req: &types::Paging,
686 ) -> Result<types::TunnelSessionList, Error> {
687 self.c
688 .make_request("/tunnel_sessions", reqwest::Method::GET, Some(req))
689 .await
690 }
691
692 pub fn list(&self, req: types::Paging) -> List {
694 List {
695 c: std::sync::Arc::new(self.clone()),
696 req,
697 }
698 }
699
700 pub async fn get(&self, id: &str) -> Result<types::TunnelSession, Error> {
702 self.c
703 .make_request(
704 &format!("/tunnel_sessions/{id}", id = id),
705 reqwest::Method::GET,
706 None::<Option<()>>,
707 )
708 .await
709 }
710
711 pub async fn restart(&self, id: &str) -> Result<(), Error> {
716 self.c
717 .make_request(
718 &format!("/tunnel_sessions/{id}/restart", id = id),
719 reqwest::Method::POST,
720 Some(&types::Item { id: id.into() }),
721 )
722 .await
723 }
724
725 pub async fn stop(&self, id: &str) -> Result<(), Error> {
728 self.c
729 .make_request(
730 &format!("/tunnel_sessions/{id}/stop", id = id),
731 reqwest::Method::POST,
732 Some(&types::Item { id: id.into() }),
733 )
734 .await
735 }
736
737 pub async fn update(&self, id: &str) -> Result<(), Error> {
750 self.c
751 .make_request(
752 &format!("/tunnel_sessions/{id}/update", id = id),
753 reqwest::Method::POST,
754 Some(&types::TunnelSessionsUpdate { id: id.into() }),
755 )
756 .await
757 }
758 }
759}
760
761pub mod bot_users {
762 use crate::types;
763 use crate::Error;
764 use futures::{Stream, TryStreamExt};
765
766 #[derive(Debug, Clone)]
767 pub struct Client {
768 c: crate::Client,
769 }
770 pub struct List {
772 c: std::sync::Arc<Client>,
773 req: types::Paging,
774 }
775
776 impl List {
777 pub async fn pages(self) -> impl Stream<Item = Result<types::BotUserList, Error>> + Unpin {
782 struct State {
783 c: std::sync::Arc<Client>,
784 req: types::Paging,
785 init: bool,
786 cur_uri: Option<String>,
787 }
788
789 let s = State {
790 c: self.c,
791 req: self.req,
792 init: true,
793 cur_uri: None,
794 };
795
796 Box::pin(futures::stream::unfold(s, |s| async move {
797 let page_resp = match (s.init, &s.cur_uri) {
798 (true, _) => s.c.list_page(&s.req).await,
799 (false, None) => {
800 return None;
801 }
802 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
803 };
804 match page_resp {
805 Err(e) => Some((Err(e), s)),
806 Ok(page) => {
807 let next = page.next_page_uri.clone();
808 Some((
809 Ok(page),
810 State {
811 init: false,
812 cur_uri: next,
813 ..s
814 },
815 ))
816 }
817 }
818 }))
819 }
820
821 pub async fn bot_users(self) -> impl Stream<Item = Result<types::BotUser, Error>> + Unpin {
826 self.pages()
827 .await
828 .map_ok(|page| futures::stream::iter(page.bot_users.into_iter().map(Ok)))
829 .try_flatten()
830 }
831 }
832
833 impl Client {
834 pub fn new(c: crate::Client) -> Self {
835 Self { c }
836 }
837
838 pub async fn create(&self, req: &types::BotUserCreate) -> Result<types::BotUser, Error> {
840 self.c
841 .make_request("/bot_users", reqwest::Method::POST, Some(req))
842 .await
843 }
844
845 pub async fn delete(&self, id: &str) -> Result<(), Error> {
847 self.c
848 .make_request(
849 &format!("/bot_users/{id}", id = id),
850 reqwest::Method::DELETE,
851 None::<Option<()>>,
852 )
853 .await
854 }
855
856 pub async fn get(&self, id: &str) -> Result<types::BotUser, Error> {
858 self.c
859 .make_request(
860 &format!("/bot_users/{id}", id = id),
861 reqwest::Method::GET,
862 None::<Option<()>>,
863 )
864 .await
865 }
866
867 pub(crate) async fn list_page(
870 &self,
871 req: &types::Paging,
872 ) -> Result<types::BotUserList, Error> {
873 self.c
874 .make_request("/bot_users", reqwest::Method::GET, Some(req))
875 .await
876 }
877
878 pub fn list(&self, req: types::Paging) -> List {
880 List {
881 c: std::sync::Arc::new(self.clone()),
882 req,
883 }
884 }
885
886 pub async fn update(&self, req: &types::BotUserUpdate) -> Result<types::BotUser, Error> {
888 self.c
889 .make_request(
890 &format!("/bot_users/{id}", id = req.id),
891 reqwest::Method::PATCH,
892 Some(req),
893 )
894 .await
895 }
896 }
897}
898
899pub mod certificate_authorities {
905 use crate::types;
906 use crate::Error;
907 use futures::{Stream, TryStreamExt};
908
909 #[derive(Debug, Clone)]
915 pub struct Client {
916 c: crate::Client,
917 }
918 pub struct List {
920 c: std::sync::Arc<Client>,
921 req: types::Paging,
922 }
923
924 impl List {
925 pub async fn pages(
930 self,
931 ) -> impl Stream<Item = Result<types::CertificateAuthorityList, Error>> + Unpin {
932 struct State {
933 c: std::sync::Arc<Client>,
934 req: types::Paging,
935 init: bool,
936 cur_uri: Option<String>,
937 }
938
939 let s = State {
940 c: self.c,
941 req: self.req,
942 init: true,
943 cur_uri: None,
944 };
945
946 Box::pin(futures::stream::unfold(s, |s| async move {
947 let page_resp = match (s.init, &s.cur_uri) {
948 (true, _) => s.c.list_page(&s.req).await,
949 (false, None) => {
950 return None;
951 }
952 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
953 };
954 match page_resp {
955 Err(e) => Some((Err(e), s)),
956 Ok(page) => {
957 let next = page.next_page_uri.clone();
958 Some((
959 Ok(page),
960 State {
961 init: false,
962 cur_uri: next,
963 ..s
964 },
965 ))
966 }
967 }
968 }))
969 }
970
971 pub async fn certificate_authorities(
976 self,
977 ) -> impl Stream<Item = Result<types::CertificateAuthority, Error>> + Unpin {
978 self.pages()
979 .await
980 .map_ok(|page| {
981 futures::stream::iter(page.certificate_authorities.into_iter().map(Ok))
982 })
983 .try_flatten()
984 }
985 }
986
987 impl Client {
988 pub fn new(c: crate::Client) -> Self {
989 Self { c }
990 }
991
992 pub async fn create(
994 &self,
995 req: &types::CertificateAuthorityCreate,
996 ) -> Result<types::CertificateAuthority, Error> {
997 self.c
998 .make_request("/certificate_authorities", reqwest::Method::POST, Some(req))
999 .await
1000 }
1001
1002 pub async fn delete(&self, id: &str) -> Result<(), Error> {
1004 self.c
1005 .make_request(
1006 &format!("/certificate_authorities/{id}", id = id),
1007 reqwest::Method::DELETE,
1008 None::<Option<()>>,
1009 )
1010 .await
1011 }
1012
1013 pub async fn get(&self, id: &str) -> Result<types::CertificateAuthority, Error> {
1015 self.c
1016 .make_request(
1017 &format!("/certificate_authorities/{id}", id = id),
1018 reqwest::Method::GET,
1019 None::<Option<()>>,
1020 )
1021 .await
1022 }
1023
1024 pub(crate) async fn list_page(
1027 &self,
1028 req: &types::Paging,
1029 ) -> Result<types::CertificateAuthorityList, Error> {
1030 self.c
1031 .make_request("/certificate_authorities", reqwest::Method::GET, Some(req))
1032 .await
1033 }
1034
1035 pub fn list(&self, req: types::Paging) -> List {
1037 List {
1038 c: std::sync::Arc::new(self.clone()),
1039 req,
1040 }
1041 }
1042
1043 pub async fn update(
1045 &self,
1046 req: &types::CertificateAuthorityUpdate,
1047 ) -> Result<types::CertificateAuthority, Error> {
1048 self.c
1049 .make_request(
1050 &format!("/certificate_authorities/{id}", id = req.id),
1051 reqwest::Method::PATCH,
1052 Some(req),
1053 )
1054 .await
1055 }
1056 }
1057}
1058
1059pub mod credentials {
1064 use crate::types;
1065 use crate::Error;
1066 use futures::{Stream, TryStreamExt};
1067
1068 #[derive(Debug, Clone)]
1073 pub struct Client {
1074 c: crate::Client,
1075 }
1076 pub struct List {
1078 c: std::sync::Arc<Client>,
1079 req: types::Paging,
1080 }
1081
1082 impl List {
1083 pub async fn pages(
1088 self,
1089 ) -> impl Stream<Item = Result<types::CredentialList, Error>> + Unpin {
1090 struct State {
1091 c: std::sync::Arc<Client>,
1092 req: types::Paging,
1093 init: bool,
1094 cur_uri: Option<String>,
1095 }
1096
1097 let s = State {
1098 c: self.c,
1099 req: self.req,
1100 init: true,
1101 cur_uri: None,
1102 };
1103
1104 Box::pin(futures::stream::unfold(s, |s| async move {
1105 let page_resp = match (s.init, &s.cur_uri) {
1106 (true, _) => s.c.list_page(&s.req).await,
1107 (false, None) => {
1108 return None;
1109 }
1110 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
1111 };
1112 match page_resp {
1113 Err(e) => Some((Err(e), s)),
1114 Ok(page) => {
1115 let next = page.next_page_uri.clone();
1116 Some((
1117 Ok(page),
1118 State {
1119 init: false,
1120 cur_uri: next,
1121 ..s
1122 },
1123 ))
1124 }
1125 }
1126 }))
1127 }
1128
1129 pub async fn credentials(
1134 self,
1135 ) -> impl Stream<Item = Result<types::Credential, Error>> + Unpin {
1136 self.pages()
1137 .await
1138 .map_ok(|page| futures::stream::iter(page.credentials.into_iter().map(Ok)))
1139 .try_flatten()
1140 }
1141 }
1142
1143 impl Client {
1144 pub fn new(c: crate::Client) -> Self {
1145 Self { c }
1146 }
1147
1148 pub async fn create(
1153 &self,
1154 req: &types::CredentialCreate,
1155 ) -> Result<types::Credential, Error> {
1156 self.c
1157 .make_request("/credentials", reqwest::Method::POST, Some(req))
1158 .await
1159 }
1160
1161 pub async fn delete(&self, id: &str) -> Result<(), Error> {
1163 self.c
1164 .make_request(
1165 &format!("/credentials/{id}", id = id),
1166 reqwest::Method::DELETE,
1167 None::<Option<()>>,
1168 )
1169 .await
1170 }
1171
1172 pub async fn get(&self, id: &str) -> Result<types::Credential, Error> {
1174 self.c
1175 .make_request(
1176 &format!("/credentials/{id}", id = id),
1177 reqwest::Method::GET,
1178 None::<Option<()>>,
1179 )
1180 .await
1181 }
1182
1183 pub(crate) async fn list_page(
1186 &self,
1187 req: &types::Paging,
1188 ) -> Result<types::CredentialList, Error> {
1189 self.c
1190 .make_request("/credentials", reqwest::Method::GET, Some(req))
1191 .await
1192 }
1193
1194 pub fn list(&self, req: types::Paging) -> List {
1196 List {
1197 c: std::sync::Arc::new(self.clone()),
1198 req,
1199 }
1200 }
1201
1202 pub async fn update(
1204 &self,
1205 req: &types::CredentialUpdate,
1206 ) -> Result<types::Credential, Error> {
1207 self.c
1208 .make_request(
1209 &format!("/credentials/{id}", id = req.id),
1210 reqwest::Method::PATCH,
1211 Some(req),
1212 )
1213 .await
1214 }
1215 }
1216}
1217
1218pub mod endpoints {
1222 use crate::types;
1223 use crate::Error;
1224 use futures::{Stream, TryStreamExt};
1225
1226 #[derive(Debug, Clone)]
1230 pub struct Client {
1231 c: crate::Client,
1232 }
1233 pub struct List {
1235 c: std::sync::Arc<Client>,
1236 req: types::EndpointListArgs,
1237 }
1238
1239 impl List {
1240 pub async fn pages(self) -> impl Stream<Item = Result<types::EndpointList, Error>> + Unpin {
1245 struct State {
1246 c: std::sync::Arc<Client>,
1247 req: types::EndpointListArgs,
1248 init: bool,
1249 cur_uri: Option<String>,
1250 }
1251
1252 let s = State {
1253 c: self.c,
1254 req: self.req,
1255 init: true,
1256 cur_uri: None,
1257 };
1258
1259 Box::pin(futures::stream::unfold(s, |s| async move {
1260 let page_resp = match (s.init, &s.cur_uri) {
1261 (true, _) => s.c.list_page(&s.req).await,
1262 (false, None) => {
1263 return None;
1264 }
1265 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
1266 };
1267 match page_resp {
1268 Err(e) => Some((Err(e), s)),
1269 Ok(page) => {
1270 let next = page.next_page_uri.clone();
1271 Some((
1272 Ok(page),
1273 State {
1274 init: false,
1275 cur_uri: next,
1276 ..s
1277 },
1278 ))
1279 }
1280 }
1281 }))
1282 }
1283
1284 pub async fn endpoints(self) -> impl Stream<Item = Result<types::Endpoint, Error>> + Unpin {
1289 self.pages()
1290 .await
1291 .map_ok(|page| futures::stream::iter(page.endpoints.into_iter().map(Ok)))
1292 .try_flatten()
1293 }
1294 }
1295
1296 impl Client {
1297 pub fn new(c: crate::Client) -> Self {
1298 Self { c }
1299 }
1300
1301 pub async fn create(&self, req: &types::EndpointCreate) -> Result<types::Endpoint, Error> {
1303 self.c
1304 .make_request("/endpoints", reqwest::Method::POST, Some(req))
1305 .await
1306 }
1307
1308 pub(crate) async fn list_page(
1311 &self,
1312 req: &types::EndpointListArgs,
1313 ) -> Result<types::EndpointList, Error> {
1314 self.c
1315 .make_request("/endpoints", reqwest::Method::GET, Some(req))
1316 .await
1317 }
1318
1319 pub fn list(&self, req: types::EndpointListArgs) -> List {
1321 List {
1322 c: std::sync::Arc::new(self.clone()),
1323 req,
1324 }
1325 }
1326
1327 pub async fn get(&self, id: &str) -> Result<types::Endpoint, Error> {
1329 self.c
1330 .make_request(
1331 &format!("/endpoints/{id}", id = id),
1332 reqwest::Method::GET,
1333 None::<Option<()>>,
1334 )
1335 .await
1336 }
1337
1338 pub async fn update(&self, req: &types::EndpointUpdate) -> Result<types::Endpoint, Error> {
1340 self.c
1341 .make_request(
1342 &format!("/endpoints/{id}", id = req.id),
1343 reqwest::Method::PATCH,
1344 Some(req),
1345 )
1346 .await
1347 }
1348
1349 pub async fn delete(&self, id: &str) -> Result<(), Error> {
1351 self.c
1352 .make_request(
1353 &format!("/endpoints/{id}", id = id),
1354 reqwest::Method::DELETE,
1355 None::<Option<()>>,
1356 )
1357 .await
1358 }
1359 }
1360}
1361
1362pub mod event_destinations {
1363 use crate::types;
1364 use crate::Error;
1365 use futures::{Stream, TryStreamExt};
1366
1367 #[derive(Debug, Clone)]
1368 pub struct Client {
1369 c: crate::Client,
1370 }
1371 pub struct List {
1373 c: std::sync::Arc<Client>,
1374 req: types::Paging,
1375 }
1376
1377 impl List {
1378 pub async fn pages(
1383 self,
1384 ) -> impl Stream<Item = Result<types::EventDestinationList, Error>> + Unpin {
1385 struct State {
1386 c: std::sync::Arc<Client>,
1387 req: types::Paging,
1388 init: bool,
1389 cur_uri: Option<String>,
1390 }
1391
1392 let s = State {
1393 c: self.c,
1394 req: self.req,
1395 init: true,
1396 cur_uri: None,
1397 };
1398
1399 Box::pin(futures::stream::unfold(s, |s| async move {
1400 let page_resp = match (s.init, &s.cur_uri) {
1401 (true, _) => s.c.list_page(&s.req).await,
1402 (false, None) => {
1403 return None;
1404 }
1405 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
1406 };
1407 match page_resp {
1408 Err(e) => Some((Err(e), s)),
1409 Ok(page) => {
1410 let next = page.next_page_uri.clone();
1411 Some((
1412 Ok(page),
1413 State {
1414 init: false,
1415 cur_uri: next,
1416 ..s
1417 },
1418 ))
1419 }
1420 }
1421 }))
1422 }
1423
1424 pub async fn event_destinations(
1429 self,
1430 ) -> impl Stream<Item = Result<types::EventDestination, Error>> + Unpin {
1431 self.pages()
1432 .await
1433 .map_ok(|page| futures::stream::iter(page.event_destinations.into_iter().map(Ok)))
1434 .try_flatten()
1435 }
1436 }
1437
1438 impl Client {
1439 pub fn new(c: crate::Client) -> Self {
1440 Self { c }
1441 }
1442
1443 pub async fn create(
1446 &self,
1447 req: &types::EventDestinationCreate,
1448 ) -> Result<types::EventDestination, Error> {
1449 self.c
1450 .make_request("/event_destinations", reqwest::Method::POST, Some(req))
1451 .await
1452 }
1453
1454 pub async fn delete(&self, id: &str) -> Result<(), Error> {
1457 self.c
1458 .make_request(
1459 &format!("/event_destinations/{id}", id = id),
1460 reqwest::Method::DELETE,
1461 None::<Option<()>>,
1462 )
1463 .await
1464 }
1465
1466 pub async fn get(&self, id: &str) -> Result<types::EventDestination, Error> {
1468 self.c
1469 .make_request(
1470 &format!("/event_destinations/{id}", id = id),
1471 reqwest::Method::GET,
1472 None::<Option<()>>,
1473 )
1474 .await
1475 }
1476
1477 pub(crate) async fn list_page(
1480 &self,
1481 req: &types::Paging,
1482 ) -> Result<types::EventDestinationList, Error> {
1483 self.c
1484 .make_request("/event_destinations", reqwest::Method::GET, Some(req))
1485 .await
1486 }
1487
1488 pub fn list(&self, req: types::Paging) -> List {
1490 List {
1491 c: std::sync::Arc::new(self.clone()),
1492 req,
1493 }
1494 }
1495
1496 pub async fn update(
1498 &self,
1499 req: &types::EventDestinationUpdate,
1500 ) -> Result<types::EventDestination, Error> {
1501 self.c
1502 .make_request(
1503 &format!("/event_destinations/{id}", id = req.id),
1504 reqwest::Method::PATCH,
1505 Some(req),
1506 )
1507 .await
1508 }
1509 }
1510}
1511
1512pub mod event_subscriptions {
1513 use crate::types;
1514 use crate::Error;
1515 use futures::{Stream, TryStreamExt};
1516
1517 #[derive(Debug, Clone)]
1518 pub struct Client {
1519 c: crate::Client,
1520 }
1521 pub struct List {
1523 c: std::sync::Arc<Client>,
1524 req: types::Paging,
1525 }
1526
1527 impl List {
1528 pub async fn pages(
1533 self,
1534 ) -> impl Stream<Item = Result<types::EventSubscriptionList, Error>> + Unpin {
1535 struct State {
1536 c: std::sync::Arc<Client>,
1537 req: types::Paging,
1538 init: bool,
1539 cur_uri: Option<String>,
1540 }
1541
1542 let s = State {
1543 c: self.c,
1544 req: self.req,
1545 init: true,
1546 cur_uri: None,
1547 };
1548
1549 Box::pin(futures::stream::unfold(s, |s| async move {
1550 let page_resp = match (s.init, &s.cur_uri) {
1551 (true, _) => s.c.list_page(&s.req).await,
1552 (false, None) => {
1553 return None;
1554 }
1555 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
1556 };
1557 match page_resp {
1558 Err(e) => Some((Err(e), s)),
1559 Ok(page) => {
1560 let next = page.next_page_uri.clone();
1561 Some((
1562 Ok(page),
1563 State {
1564 init: false,
1565 cur_uri: next,
1566 ..s
1567 },
1568 ))
1569 }
1570 }
1571 }))
1572 }
1573
1574 pub async fn event_subscriptions(
1579 self,
1580 ) -> impl Stream<Item = Result<types::EventSubscription, Error>> + Unpin {
1581 self.pages()
1582 .await
1583 .map_ok(|page| futures::stream::iter(page.event_subscriptions.into_iter().map(Ok)))
1584 .try_flatten()
1585 }
1586 }
1587
1588 impl Client {
1589 pub fn new(c: crate::Client) -> Self {
1590 Self { c }
1591 }
1592
1593 pub async fn create(
1595 &self,
1596 req: &types::EventSubscriptionCreate,
1597 ) -> Result<types::EventSubscription, Error> {
1598 self.c
1599 .make_request("/event_subscriptions", reqwest::Method::POST, Some(req))
1600 .await
1601 }
1602
1603 pub async fn delete(&self, id: &str) -> Result<(), Error> {
1605 self.c
1606 .make_request(
1607 &format!("/event_subscriptions/{id}", id = id),
1608 reqwest::Method::DELETE,
1609 None::<Option<()>>,
1610 )
1611 .await
1612 }
1613
1614 pub async fn get(&self, id: &str) -> Result<types::EventSubscription, Error> {
1616 self.c
1617 .make_request(
1618 &format!("/event_subscriptions/{id}", id = id),
1619 reqwest::Method::GET,
1620 None::<Option<()>>,
1621 )
1622 .await
1623 }
1624
1625 pub(crate) async fn list_page(
1628 &self,
1629 req: &types::Paging,
1630 ) -> Result<types::EventSubscriptionList, Error> {
1631 self.c
1632 .make_request("/event_subscriptions", reqwest::Method::GET, Some(req))
1633 .await
1634 }
1635
1636 pub fn list(&self, req: types::Paging) -> List {
1638 List {
1639 c: std::sync::Arc::new(self.clone()),
1640 req,
1641 }
1642 }
1643
1644 pub async fn update(
1646 &self,
1647 req: &types::EventSubscriptionUpdate,
1648 ) -> Result<types::EventSubscription, Error> {
1649 self.c
1650 .make_request(
1651 &format!("/event_subscriptions/{id}", id = req.id),
1652 reqwest::Method::PATCH,
1653 Some(req),
1654 )
1655 .await
1656 }
1657 }
1658}
1659
1660pub mod event_sources {
1661 use crate::types;
1662 use crate::Error;
1663
1664 #[derive(Debug, Clone)]
1665 pub struct Client {
1666 c: crate::Client,
1667 }
1668
1669 impl Client {
1670 pub fn new(c: crate::Client) -> Self {
1671 Self { c }
1672 }
1673
1674 pub async fn create(
1676 &self,
1677 req: &types::EventSourceCreate,
1678 ) -> Result<types::EventSource, Error> {
1679 self.c
1680 .make_request(
1681 &format!(
1682 "/event_subscriptions/{subscription_id}/sources",
1683 subscription_id = req.subscription_id
1684 ),
1685 reqwest::Method::POST,
1686 Some(req),
1687 )
1688 .await
1689 }
1690
1691 pub async fn delete(&self, req: &types::EventSourceItem) -> Result<(), Error> {
1693 self.c
1694 .make_request(
1695 &format!(
1696 "/event_subscriptions/{subscription_id}/sources/{type}",
1697 subscription_id = req.subscription_id,
1698 r#type = req.r#type
1699 ),
1700 reqwest::Method::DELETE,
1701 None::<Option<()>>,
1702 )
1703 .await
1704 }
1705
1706 pub async fn get(&self, req: &types::EventSourceItem) -> Result<types::EventSource, Error> {
1708 self.c
1709 .make_request(
1710 &format!(
1711 "/event_subscriptions/{subscription_id}/sources/{type}",
1712 subscription_id = req.subscription_id,
1713 r#type = req.r#type
1714 ),
1715 reqwest::Method::GET,
1716 None::<Option<()>>,
1717 )
1718 .await
1719 }
1720
1721 pub async fn list(&self, subscription_id: &str) -> Result<types::EventSourceList, Error> {
1723 self.c
1724 .make_request(
1725 &format!(
1726 "/event_subscriptions/{subscription_id}/sources",
1727 subscription_id = subscription_id
1728 ),
1729 reqwest::Method::GET,
1730 None::<Option<()>>,
1731 )
1732 .await
1733 }
1734
1735 pub async fn update(
1737 &self,
1738 req: &types::EventSourceUpdate,
1739 ) -> Result<types::EventSource, Error> {
1740 self.c
1741 .make_request(
1742 &format!(
1743 "/event_subscriptions/{subscription_id}/sources/{type}",
1744 subscription_id = req.subscription_id,
1745 r#type = req.r#type
1746 ),
1747 reqwest::Method::PATCH,
1748 Some(req),
1749 )
1750 .await
1751 }
1752 }
1753}
1754
1755pub mod ip_policies {
1760 use crate::types;
1761 use crate::Error;
1762 use futures::{Stream, TryStreamExt};
1763
1764 #[derive(Debug, Clone)]
1769 pub struct Client {
1770 c: crate::Client,
1771 }
1772 pub struct List {
1774 c: std::sync::Arc<Client>,
1775 req: types::Paging,
1776 }
1777
1778 impl List {
1779 pub async fn pages(self) -> impl Stream<Item = Result<types::IPPolicyList, Error>> + Unpin {
1784 struct State {
1785 c: std::sync::Arc<Client>,
1786 req: types::Paging,
1787 init: bool,
1788 cur_uri: Option<String>,
1789 }
1790
1791 let s = State {
1792 c: self.c,
1793 req: self.req,
1794 init: true,
1795 cur_uri: None,
1796 };
1797
1798 Box::pin(futures::stream::unfold(s, |s| async move {
1799 let page_resp = match (s.init, &s.cur_uri) {
1800 (true, _) => s.c.list_page(&s.req).await,
1801 (false, None) => {
1802 return None;
1803 }
1804 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
1805 };
1806 match page_resp {
1807 Err(e) => Some((Err(e), s)),
1808 Ok(page) => {
1809 let next = page.next_page_uri.clone();
1810 Some((
1811 Ok(page),
1812 State {
1813 init: false,
1814 cur_uri: next,
1815 ..s
1816 },
1817 ))
1818 }
1819 }
1820 }))
1821 }
1822
1823 pub async fn ip_policies(
1828 self,
1829 ) -> impl Stream<Item = Result<types::IPPolicy, Error>> + Unpin {
1830 self.pages()
1831 .await
1832 .map_ok(|page| futures::stream::iter(page.ip_policies.into_iter().map(Ok)))
1833 .try_flatten()
1834 }
1835 }
1836
1837 impl Client {
1838 pub fn new(c: crate::Client) -> Self {
1839 Self { c }
1840 }
1841
1842 pub async fn create(&self, req: &types::IPPolicyCreate) -> Result<types::IPPolicy, Error> {
1845 self.c
1846 .make_request("/ip_policies", reqwest::Method::POST, Some(req))
1847 .await
1848 }
1849
1850 pub async fn delete(&self, id: &str) -> Result<(), Error> {
1854 self.c
1855 .make_request(
1856 &format!("/ip_policies/{id}", id = id),
1857 reqwest::Method::DELETE,
1858 None::<Option<()>>,
1859 )
1860 .await
1861 }
1862
1863 pub async fn get(&self, id: &str) -> Result<types::IPPolicy, Error> {
1865 self.c
1866 .make_request(
1867 &format!("/ip_policies/{id}", id = id),
1868 reqwest::Method::GET,
1869 None::<Option<()>>,
1870 )
1871 .await
1872 }
1873
1874 pub(crate) async fn list_page(
1877 &self,
1878 req: &types::Paging,
1879 ) -> Result<types::IPPolicyList, Error> {
1880 self.c
1881 .make_request("/ip_policies", reqwest::Method::GET, Some(req))
1882 .await
1883 }
1884
1885 pub fn list(&self, req: types::Paging) -> List {
1887 List {
1888 c: std::sync::Arc::new(self.clone()),
1889 req,
1890 }
1891 }
1892
1893 pub async fn update(&self, req: &types::IPPolicyUpdate) -> Result<types::IPPolicy, Error> {
1895 self.c
1896 .make_request(
1897 &format!("/ip_policies/{id}", id = req.id),
1898 reqwest::Method::PATCH,
1899 Some(req),
1900 )
1901 .await
1902 }
1903 }
1904}
1905
1906pub mod ip_policy_rules {
1909 use crate::types;
1910 use crate::Error;
1911 use futures::{Stream, TryStreamExt};
1912
1913 #[derive(Debug, Clone)]
1916 pub struct Client {
1917 c: crate::Client,
1918 }
1919 pub struct List {
1921 c: std::sync::Arc<Client>,
1922 req: types::Paging,
1923 }
1924
1925 impl List {
1926 pub async fn pages(
1931 self,
1932 ) -> impl Stream<Item = Result<types::IPPolicyRuleList, Error>> + Unpin {
1933 struct State {
1934 c: std::sync::Arc<Client>,
1935 req: types::Paging,
1936 init: bool,
1937 cur_uri: Option<String>,
1938 }
1939
1940 let s = State {
1941 c: self.c,
1942 req: self.req,
1943 init: true,
1944 cur_uri: None,
1945 };
1946
1947 Box::pin(futures::stream::unfold(s, |s| async move {
1948 let page_resp = match (s.init, &s.cur_uri) {
1949 (true, _) => s.c.list_page(&s.req).await,
1950 (false, None) => {
1951 return None;
1952 }
1953 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
1954 };
1955 match page_resp {
1956 Err(e) => Some((Err(e), s)),
1957 Ok(page) => {
1958 let next = page.next_page_uri.clone();
1959 Some((
1960 Ok(page),
1961 State {
1962 init: false,
1963 cur_uri: next,
1964 ..s
1965 },
1966 ))
1967 }
1968 }
1969 }))
1970 }
1971
1972 pub async fn ip_policy_rules(
1977 self,
1978 ) -> impl Stream<Item = Result<types::IPPolicyRule, Error>> + Unpin {
1979 self.pages()
1980 .await
1981 .map_ok(|page| futures::stream::iter(page.ip_policy_rules.into_iter().map(Ok)))
1982 .try_flatten()
1983 }
1984 }
1985
1986 impl Client {
1987 pub fn new(c: crate::Client) -> Self {
1988 Self { c }
1989 }
1990
1991 pub async fn create(
1993 &self,
1994 req: &types::IPPolicyRuleCreate,
1995 ) -> Result<types::IPPolicyRule, Error> {
1996 self.c
1997 .make_request("/ip_policy_rules", reqwest::Method::POST, Some(req))
1998 .await
1999 }
2000
2001 pub async fn delete(&self, id: &str) -> Result<(), Error> {
2003 self.c
2004 .make_request(
2005 &format!("/ip_policy_rules/{id}", id = id),
2006 reqwest::Method::DELETE,
2007 None::<Option<()>>,
2008 )
2009 .await
2010 }
2011
2012 pub async fn get(&self, id: &str) -> Result<types::IPPolicyRule, Error> {
2014 self.c
2015 .make_request(
2016 &format!("/ip_policy_rules/{id}", id = id),
2017 reqwest::Method::GET,
2018 None::<Option<()>>,
2019 )
2020 .await
2021 }
2022
2023 pub(crate) async fn list_page(
2026 &self,
2027 req: &types::Paging,
2028 ) -> Result<types::IPPolicyRuleList, Error> {
2029 self.c
2030 .make_request("/ip_policy_rules", reqwest::Method::GET, Some(req))
2031 .await
2032 }
2033
2034 pub fn list(&self, req: types::Paging) -> List {
2036 List {
2037 c: std::sync::Arc::new(self.clone()),
2038 req,
2039 }
2040 }
2041
2042 pub async fn update(
2044 &self,
2045 req: &types::IPPolicyRuleUpdate,
2046 ) -> Result<types::IPPolicyRule, Error> {
2047 self.c
2048 .make_request(
2049 &format!("/ip_policy_rules/{id}", id = req.id),
2050 reqwest::Method::PATCH,
2051 Some(req),
2052 )
2053 .await
2054 }
2055 }
2056}
2057
2058pub mod ip_restrictions {
2065 use crate::types;
2066 use crate::Error;
2067 use futures::{Stream, TryStreamExt};
2068
2069 #[derive(Debug, Clone)]
2076 pub struct Client {
2077 c: crate::Client,
2078 }
2079 pub struct List {
2081 c: std::sync::Arc<Client>,
2082 req: types::Paging,
2083 }
2084
2085 impl List {
2086 pub async fn pages(
2091 self,
2092 ) -> impl Stream<Item = Result<types::IPRestrictionList, Error>> + Unpin {
2093 struct State {
2094 c: std::sync::Arc<Client>,
2095 req: types::Paging,
2096 init: bool,
2097 cur_uri: Option<String>,
2098 }
2099
2100 let s = State {
2101 c: self.c,
2102 req: self.req,
2103 init: true,
2104 cur_uri: None,
2105 };
2106
2107 Box::pin(futures::stream::unfold(s, |s| async move {
2108 let page_resp = match (s.init, &s.cur_uri) {
2109 (true, _) => s.c.list_page(&s.req).await,
2110 (false, None) => {
2111 return None;
2112 }
2113 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2114 };
2115 match page_resp {
2116 Err(e) => Some((Err(e), s)),
2117 Ok(page) => {
2118 let next = page.next_page_uri.clone();
2119 Some((
2120 Ok(page),
2121 State {
2122 init: false,
2123 cur_uri: next,
2124 ..s
2125 },
2126 ))
2127 }
2128 }
2129 }))
2130 }
2131
2132 pub async fn ip_restrictions(
2137 self,
2138 ) -> impl Stream<Item = Result<types::IPRestriction, Error>> + Unpin {
2139 self.pages()
2140 .await
2141 .map_ok(|page| futures::stream::iter(page.ip_restrictions.into_iter().map(Ok)))
2142 .try_flatten()
2143 }
2144 }
2145
2146 impl Client {
2147 pub fn new(c: crate::Client) -> Self {
2148 Self { c }
2149 }
2150
2151 pub async fn create(
2153 &self,
2154 req: &types::IPRestrictionCreate,
2155 ) -> Result<types::IPRestriction, Error> {
2156 self.c
2157 .make_request("/ip_restrictions", reqwest::Method::POST, Some(req))
2158 .await
2159 }
2160
2161 pub async fn delete(&self, id: &str) -> Result<(), Error> {
2163 self.c
2164 .make_request(
2165 &format!("/ip_restrictions/{id}", id = id),
2166 reqwest::Method::DELETE,
2167 None::<Option<()>>,
2168 )
2169 .await
2170 }
2171
2172 pub async fn get(&self, id: &str) -> Result<types::IPRestriction, Error> {
2174 self.c
2175 .make_request(
2176 &format!("/ip_restrictions/{id}", id = id),
2177 reqwest::Method::GET,
2178 None::<Option<()>>,
2179 )
2180 .await
2181 }
2182
2183 pub(crate) async fn list_page(
2186 &self,
2187 req: &types::Paging,
2188 ) -> Result<types::IPRestrictionList, Error> {
2189 self.c
2190 .make_request("/ip_restrictions", reqwest::Method::GET, Some(req))
2191 .await
2192 }
2193
2194 pub fn list(&self, req: types::Paging) -> List {
2196 List {
2197 c: std::sync::Arc::new(self.clone()),
2198 req,
2199 }
2200 }
2201
2202 pub async fn update(
2204 &self,
2205 req: &types::IPRestrictionUpdate,
2206 ) -> Result<types::IPRestriction, Error> {
2207 self.c
2208 .make_request(
2209 &format!("/ip_restrictions/{id}", id = req.id),
2210 reqwest::Method::PATCH,
2211 Some(req),
2212 )
2213 .await
2214 }
2215 }
2216}
2217
2218pub mod reserved_addrs {
2222 use crate::types;
2223 use crate::Error;
2224 use futures::{Stream, TryStreamExt};
2225
2226 #[derive(Debug, Clone)]
2230 pub struct Client {
2231 c: crate::Client,
2232 }
2233 pub struct List {
2235 c: std::sync::Arc<Client>,
2236 req: types::Paging,
2237 }
2238
2239 impl List {
2240 pub async fn pages(
2245 self,
2246 ) -> impl Stream<Item = Result<types::ReservedAddrList, Error>> + Unpin {
2247 struct State {
2248 c: std::sync::Arc<Client>,
2249 req: types::Paging,
2250 init: bool,
2251 cur_uri: Option<String>,
2252 }
2253
2254 let s = State {
2255 c: self.c,
2256 req: self.req,
2257 init: true,
2258 cur_uri: None,
2259 };
2260
2261 Box::pin(futures::stream::unfold(s, |s| async move {
2262 let page_resp = match (s.init, &s.cur_uri) {
2263 (true, _) => s.c.list_page(&s.req).await,
2264 (false, None) => {
2265 return None;
2266 }
2267 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2268 };
2269 match page_resp {
2270 Err(e) => Some((Err(e), s)),
2271 Ok(page) => {
2272 let next = page.next_page_uri.clone();
2273 Some((
2274 Ok(page),
2275 State {
2276 init: false,
2277 cur_uri: next,
2278 ..s
2279 },
2280 ))
2281 }
2282 }
2283 }))
2284 }
2285
2286 pub async fn reserved_addrs(
2291 self,
2292 ) -> impl Stream<Item = Result<types::ReservedAddr, Error>> + Unpin {
2293 self.pages()
2294 .await
2295 .map_ok(|page| futures::stream::iter(page.reserved_addrs.into_iter().map(Ok)))
2296 .try_flatten()
2297 }
2298 }
2299
2300 impl Client {
2301 pub fn new(c: crate::Client) -> Self {
2302 Self { c }
2303 }
2304
2305 pub async fn create(
2307 &self,
2308 req: &types::ReservedAddrCreate,
2309 ) -> Result<types::ReservedAddr, Error> {
2310 self.c
2311 .make_request("/reserved_addrs", reqwest::Method::POST, Some(req))
2312 .await
2313 }
2314
2315 pub async fn delete(&self, id: &str) -> Result<(), Error> {
2317 self.c
2318 .make_request(
2319 &format!("/reserved_addrs/{id}", id = id),
2320 reqwest::Method::DELETE,
2321 None::<Option<()>>,
2322 )
2323 .await
2324 }
2325
2326 pub async fn get(&self, id: &str) -> Result<types::ReservedAddr, Error> {
2328 self.c
2329 .make_request(
2330 &format!("/reserved_addrs/{id}", id = id),
2331 reqwest::Method::GET,
2332 None::<Option<()>>,
2333 )
2334 .await
2335 }
2336
2337 pub(crate) async fn list_page(
2340 &self,
2341 req: &types::Paging,
2342 ) -> Result<types::ReservedAddrList, Error> {
2343 self.c
2344 .make_request("/reserved_addrs", reqwest::Method::GET, Some(req))
2345 .await
2346 }
2347
2348 pub fn list(&self, req: types::Paging) -> List {
2350 List {
2351 c: std::sync::Arc::new(self.clone()),
2352 req,
2353 }
2354 }
2355
2356 pub async fn update(
2358 &self,
2359 req: &types::ReservedAddrUpdate,
2360 ) -> Result<types::ReservedAddr, Error> {
2361 self.c
2362 .make_request(
2363 &format!("/reserved_addrs/{id}", id = req.id),
2364 reqwest::Method::PATCH,
2365 Some(req),
2366 )
2367 .await
2368 }
2369 }
2370}
2371
2372pub mod reserved_domains {
2377 use crate::types;
2378 use crate::Error;
2379 use futures::{Stream, TryStreamExt};
2380
2381 #[derive(Debug, Clone)]
2386 pub struct Client {
2387 c: crate::Client,
2388 }
2389 pub struct List {
2391 c: std::sync::Arc<Client>,
2392 req: types::Paging,
2393 }
2394
2395 impl List {
2396 pub async fn pages(
2401 self,
2402 ) -> impl Stream<Item = Result<types::ReservedDomainList, Error>> + Unpin {
2403 struct State {
2404 c: std::sync::Arc<Client>,
2405 req: types::Paging,
2406 init: bool,
2407 cur_uri: Option<String>,
2408 }
2409
2410 let s = State {
2411 c: self.c,
2412 req: self.req,
2413 init: true,
2414 cur_uri: None,
2415 };
2416
2417 Box::pin(futures::stream::unfold(s, |s| async move {
2418 let page_resp = match (s.init, &s.cur_uri) {
2419 (true, _) => s.c.list_page(&s.req).await,
2420 (false, None) => {
2421 return None;
2422 }
2423 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2424 };
2425 match page_resp {
2426 Err(e) => Some((Err(e), s)),
2427 Ok(page) => {
2428 let next = page.next_page_uri.clone();
2429 Some((
2430 Ok(page),
2431 State {
2432 init: false,
2433 cur_uri: next,
2434 ..s
2435 },
2436 ))
2437 }
2438 }
2439 }))
2440 }
2441
2442 pub async fn reserved_domains(
2447 self,
2448 ) -> impl Stream<Item = Result<types::ReservedDomain, Error>> + Unpin {
2449 self.pages()
2450 .await
2451 .map_ok(|page| futures::stream::iter(page.reserved_domains.into_iter().map(Ok)))
2452 .try_flatten()
2453 }
2454 }
2455
2456 impl Client {
2457 pub fn new(c: crate::Client) -> Self {
2458 Self { c }
2459 }
2460
2461 pub async fn create(
2463 &self,
2464 req: &types::ReservedDomainCreate,
2465 ) -> Result<types::ReservedDomain, Error> {
2466 self.c
2467 .make_request("/reserved_domains", reqwest::Method::POST, Some(req))
2468 .await
2469 }
2470
2471 pub async fn delete(&self, id: &str) -> Result<(), Error> {
2473 self.c
2474 .make_request(
2475 &format!("/reserved_domains/{id}", id = id),
2476 reqwest::Method::DELETE,
2477 None::<Option<()>>,
2478 )
2479 .await
2480 }
2481
2482 pub async fn get(&self, id: &str) -> Result<types::ReservedDomain, Error> {
2484 self.c
2485 .make_request(
2486 &format!("/reserved_domains/{id}", id = id),
2487 reqwest::Method::GET,
2488 None::<Option<()>>,
2489 )
2490 .await
2491 }
2492
2493 pub(crate) async fn list_page(
2496 &self,
2497 req: &types::Paging,
2498 ) -> Result<types::ReservedDomainList, Error> {
2499 self.c
2500 .make_request("/reserved_domains", reqwest::Method::GET, Some(req))
2501 .await
2502 }
2503
2504 pub fn list(&self, req: types::Paging) -> List {
2506 List {
2507 c: std::sync::Arc::new(self.clone()),
2508 req,
2509 }
2510 }
2511
2512 pub async fn update(
2514 &self,
2515 req: &types::ReservedDomainUpdate,
2516 ) -> Result<types::ReservedDomain, Error> {
2517 self.c
2518 .make_request(
2519 &format!("/reserved_domains/{id}", id = req.id),
2520 reqwest::Method::PATCH,
2521 Some(req),
2522 )
2523 .await
2524 }
2525
2526 pub async fn delete_certificate_management_policy(&self, id: &str) -> Result<(), Error> {
2528 self.c
2529 .make_request(
2530 &format!(
2531 "/reserved_domains/{id}/certificate_management_policy",
2532 id = id
2533 ),
2534 reqwest::Method::DELETE,
2535 None::<Option<()>>,
2536 )
2537 .await
2538 }
2539
2540 pub async fn delete_certificate(&self, id: &str) -> Result<(), Error> {
2542 self.c
2543 .make_request(
2544 &format!("/reserved_domains/{id}/certificate", id = id),
2545 reqwest::Method::DELETE,
2546 None::<Option<()>>,
2547 )
2548 .await
2549 }
2550 }
2551}
2552
2553pub mod secrets {
2556 use crate::types;
2557 use crate::Error;
2558 use futures::{Stream, TryStreamExt};
2559
2560 #[derive(Debug, Clone)]
2563 pub struct Client {
2564 c: crate::Client,
2565 }
2566 pub struct List {
2568 c: std::sync::Arc<Client>,
2569 req: types::Paging,
2570 }
2571
2572 impl List {
2573 pub async fn pages(self) -> impl Stream<Item = Result<types::SecretList, Error>> + Unpin {
2578 struct State {
2579 c: std::sync::Arc<Client>,
2580 req: types::Paging,
2581 init: bool,
2582 cur_uri: Option<String>,
2583 }
2584
2585 let s = State {
2586 c: self.c,
2587 req: self.req,
2588 init: true,
2589 cur_uri: None,
2590 };
2591
2592 Box::pin(futures::stream::unfold(s, |s| async move {
2593 let page_resp = match (s.init, &s.cur_uri) {
2594 (true, _) => s.c.list_page(&s.req).await,
2595 (false, None) => {
2596 return None;
2597 }
2598 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2599 };
2600 match page_resp {
2601 Err(e) => Some((Err(e), s)),
2602 Ok(page) => {
2603 let next = page.next_page_uri.clone();
2604 Some((
2605 Ok(page),
2606 State {
2607 init: false,
2608 cur_uri: next,
2609 ..s
2610 },
2611 ))
2612 }
2613 }
2614 }))
2615 }
2616
2617 pub async fn secrets(self) -> impl Stream<Item = Result<types::Secret, Error>> + Unpin {
2622 self.pages()
2623 .await
2624 .map_ok(|page| futures::stream::iter(page.secrets.into_iter().map(Ok)))
2625 .try_flatten()
2626 }
2627 }
2628
2629 impl Client {
2630 pub fn new(c: crate::Client) -> Self {
2631 Self { c }
2632 }
2633
2634 pub async fn create(&self, req: &types::SecretCreate) -> Result<types::Secret, Error> {
2636 self.c
2637 .make_request("/vault_secrets", reqwest::Method::POST, Some(req))
2638 .await
2639 }
2640
2641 pub async fn update(&self, req: &types::SecretUpdate) -> Result<types::Secret, Error> {
2643 self.c
2644 .make_request(
2645 &format!("/vault_secrets/{id}", id = req.id),
2646 reqwest::Method::PATCH,
2647 Some(req),
2648 )
2649 .await
2650 }
2651
2652 pub async fn delete(&self, id: &str) -> Result<(), Error> {
2654 self.c
2655 .make_request(
2656 &format!("/vault_secrets/{id}", id = id),
2657 reqwest::Method::DELETE,
2658 None::<Option<()>>,
2659 )
2660 .await
2661 }
2662
2663 pub async fn get(&self, id: &str) -> Result<types::Secret, Error> {
2665 self.c
2666 .make_request(
2667 &format!("/vault_secrets/{id}", id = id),
2668 reqwest::Method::GET,
2669 None::<Option<()>>,
2670 )
2671 .await
2672 }
2673
2674 pub(crate) async fn list_page(
2677 &self,
2678 req: &types::Paging,
2679 ) -> Result<types::SecretList, Error> {
2680 self.c
2681 .make_request("/vault_secrets", reqwest::Method::GET, Some(req))
2682 .await
2683 }
2684
2685 pub fn list(&self, req: types::Paging) -> List {
2687 List {
2688 c: std::sync::Arc::new(self.clone()),
2689 req,
2690 }
2691 }
2692 }
2693}
2694
2695pub mod ssh_certificate_authorities {
2698 use crate::types;
2699 use crate::Error;
2700 use futures::{Stream, TryStreamExt};
2701
2702 #[derive(Debug, Clone)]
2705 pub struct Client {
2706 c: crate::Client,
2707 }
2708 pub struct List {
2710 c: std::sync::Arc<Client>,
2711 req: types::Paging,
2712 }
2713
2714 impl List {
2715 pub async fn pages(
2720 self,
2721 ) -> impl Stream<Item = Result<types::SSHCertificateAuthorityList, Error>> + Unpin {
2722 struct State {
2723 c: std::sync::Arc<Client>,
2724 req: types::Paging,
2725 init: bool,
2726 cur_uri: Option<String>,
2727 }
2728
2729 let s = State {
2730 c: self.c,
2731 req: self.req,
2732 init: true,
2733 cur_uri: None,
2734 };
2735
2736 Box::pin(futures::stream::unfold(s, |s| async move {
2737 let page_resp = match (s.init, &s.cur_uri) {
2738 (true, _) => s.c.list_page(&s.req).await,
2739 (false, None) => {
2740 return None;
2741 }
2742 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2743 };
2744 match page_resp {
2745 Err(e) => Some((Err(e), s)),
2746 Ok(page) => {
2747 let next = page.next_page_uri.clone();
2748 Some((
2749 Ok(page),
2750 State {
2751 init: false,
2752 cur_uri: next,
2753 ..s
2754 },
2755 ))
2756 }
2757 }
2758 }))
2759 }
2760
2761 pub async fn ssh_certificate_authorities(
2766 self,
2767 ) -> impl Stream<Item = Result<types::SSHCertificateAuthority, Error>> + Unpin {
2768 self.pages()
2769 .await
2770 .map_ok(|page| {
2771 futures::stream::iter(page.ssh_certificate_authorities.into_iter().map(Ok))
2772 })
2773 .try_flatten()
2774 }
2775 }
2776
2777 impl Client {
2778 pub fn new(c: crate::Client) -> Self {
2779 Self { c }
2780 }
2781
2782 pub async fn create(
2784 &self,
2785 req: &types::SSHCertificateAuthorityCreate,
2786 ) -> Result<types::SSHCertificateAuthority, Error> {
2787 self.c
2788 .make_request(
2789 "/ssh_certificate_authorities",
2790 reqwest::Method::POST,
2791 Some(req),
2792 )
2793 .await
2794 }
2795
2796 pub async fn delete(&self, id: &str) -> Result<(), Error> {
2798 self.c
2799 .make_request(
2800 &format!("/ssh_certificate_authorities/{id}", id = id),
2801 reqwest::Method::DELETE,
2802 None::<Option<()>>,
2803 )
2804 .await
2805 }
2806
2807 pub async fn get(&self, id: &str) -> Result<types::SSHCertificateAuthority, Error> {
2809 self.c
2810 .make_request(
2811 &format!("/ssh_certificate_authorities/{id}", id = id),
2812 reqwest::Method::GET,
2813 None::<Option<()>>,
2814 )
2815 .await
2816 }
2817
2818 pub(crate) async fn list_page(
2821 &self,
2822 req: &types::Paging,
2823 ) -> Result<types::SSHCertificateAuthorityList, Error> {
2824 self.c
2825 .make_request(
2826 "/ssh_certificate_authorities",
2827 reqwest::Method::GET,
2828 Some(req),
2829 )
2830 .await
2831 }
2832
2833 pub fn list(&self, req: types::Paging) -> List {
2835 List {
2836 c: std::sync::Arc::new(self.clone()),
2837 req,
2838 }
2839 }
2840
2841 pub async fn update(
2843 &self,
2844 req: &types::SSHCertificateAuthorityUpdate,
2845 ) -> Result<types::SSHCertificateAuthority, Error> {
2846 self.c
2847 .make_request(
2848 &format!("/ssh_certificate_authorities/{id}", id = req.id),
2849 reqwest::Method::PATCH,
2850 Some(req),
2851 )
2852 .await
2853 }
2854 }
2855}
2856
2857pub mod ssh_credentials {
2860 use crate::types;
2861 use crate::Error;
2862 use futures::{Stream, TryStreamExt};
2863
2864 #[derive(Debug, Clone)]
2867 pub struct Client {
2868 c: crate::Client,
2869 }
2870 pub struct List {
2872 c: std::sync::Arc<Client>,
2873 req: types::Paging,
2874 }
2875
2876 impl List {
2877 pub async fn pages(
2882 self,
2883 ) -> impl Stream<Item = Result<types::SSHCredentialList, Error>> + Unpin {
2884 struct State {
2885 c: std::sync::Arc<Client>,
2886 req: types::Paging,
2887 init: bool,
2888 cur_uri: Option<String>,
2889 }
2890
2891 let s = State {
2892 c: self.c,
2893 req: self.req,
2894 init: true,
2895 cur_uri: None,
2896 };
2897
2898 Box::pin(futures::stream::unfold(s, |s| async move {
2899 let page_resp = match (s.init, &s.cur_uri) {
2900 (true, _) => s.c.list_page(&s.req).await,
2901 (false, None) => {
2902 return None;
2903 }
2904 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2905 };
2906 match page_resp {
2907 Err(e) => Some((Err(e), s)),
2908 Ok(page) => {
2909 let next = page.next_page_uri.clone();
2910 Some((
2911 Ok(page),
2912 State {
2913 init: false,
2914 cur_uri: next,
2915 ..s
2916 },
2917 ))
2918 }
2919 }
2920 }))
2921 }
2922
2923 pub async fn ssh_credentials(
2928 self,
2929 ) -> impl Stream<Item = Result<types::SSHCredential, Error>> + Unpin {
2930 self.pages()
2931 .await
2932 .map_ok(|page| futures::stream::iter(page.ssh_credentials.into_iter().map(Ok)))
2933 .try_flatten()
2934 }
2935 }
2936
2937 impl Client {
2938 pub fn new(c: crate::Client) -> Self {
2939 Self { c }
2940 }
2941
2942 pub async fn create(
2945 &self,
2946 req: &types::SSHCredentialCreate,
2947 ) -> Result<types::SSHCredential, Error> {
2948 self.c
2949 .make_request("/ssh_credentials", reqwest::Method::POST, Some(req))
2950 .await
2951 }
2952
2953 pub async fn delete(&self, id: &str) -> Result<(), Error> {
2955 self.c
2956 .make_request(
2957 &format!("/ssh_credentials/{id}", id = id),
2958 reqwest::Method::DELETE,
2959 None::<Option<()>>,
2960 )
2961 .await
2962 }
2963
2964 pub async fn get(&self, id: &str) -> Result<types::SSHCredential, Error> {
2966 self.c
2967 .make_request(
2968 &format!("/ssh_credentials/{id}", id = id),
2969 reqwest::Method::GET,
2970 None::<Option<()>>,
2971 )
2972 .await
2973 }
2974
2975 pub(crate) async fn list_page(
2978 &self,
2979 req: &types::Paging,
2980 ) -> Result<types::SSHCredentialList, Error> {
2981 self.c
2982 .make_request("/ssh_credentials", reqwest::Method::GET, Some(req))
2983 .await
2984 }
2985
2986 pub fn list(&self, req: types::Paging) -> List {
2988 List {
2989 c: std::sync::Arc::new(self.clone()),
2990 req,
2991 }
2992 }
2993
2994 pub async fn update(
2996 &self,
2997 req: &types::SSHCredentialUpdate,
2998 ) -> Result<types::SSHCredential, Error> {
2999 self.c
3000 .make_request(
3001 &format!("/ssh_credentials/{id}", id = req.id),
3002 reqwest::Method::PATCH,
3003 Some(req),
3004 )
3005 .await
3006 }
3007 }
3008}
3009
3010pub mod ssh_host_certificates {
3014 use crate::types;
3015 use crate::Error;
3016 use futures::{Stream, TryStreamExt};
3017
3018 #[derive(Debug, Clone)]
3022 pub struct Client {
3023 c: crate::Client,
3024 }
3025 pub struct List {
3027 c: std::sync::Arc<Client>,
3028 req: types::Paging,
3029 }
3030
3031 impl List {
3032 pub async fn pages(
3037 self,
3038 ) -> impl Stream<Item = Result<types::SSHHostCertificateList, Error>> + Unpin {
3039 struct State {
3040 c: std::sync::Arc<Client>,
3041 req: types::Paging,
3042 init: bool,
3043 cur_uri: Option<String>,
3044 }
3045
3046 let s = State {
3047 c: self.c,
3048 req: self.req,
3049 init: true,
3050 cur_uri: None,
3051 };
3052
3053 Box::pin(futures::stream::unfold(s, |s| async move {
3054 let page_resp = match (s.init, &s.cur_uri) {
3055 (true, _) => s.c.list_page(&s.req).await,
3056 (false, None) => {
3057 return None;
3058 }
3059 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3060 };
3061 match page_resp {
3062 Err(e) => Some((Err(e), s)),
3063 Ok(page) => {
3064 let next = page.next_page_uri.clone();
3065 Some((
3066 Ok(page),
3067 State {
3068 init: false,
3069 cur_uri: next,
3070 ..s
3071 },
3072 ))
3073 }
3074 }
3075 }))
3076 }
3077
3078 pub async fn ssh_host_certificates(
3083 self,
3084 ) -> impl Stream<Item = Result<types::SSHHostCertificate, Error>> + Unpin {
3085 self.pages()
3086 .await
3087 .map_ok(|page| {
3088 futures::stream::iter(page.ssh_host_certificates.into_iter().map(Ok))
3089 })
3090 .try_flatten()
3091 }
3092 }
3093
3094 impl Client {
3095 pub fn new(c: crate::Client) -> Self {
3096 Self { c }
3097 }
3098
3099 pub async fn create(
3101 &self,
3102 req: &types::SSHHostCertificateCreate,
3103 ) -> Result<types::SSHHostCertificate, Error> {
3104 self.c
3105 .make_request("/ssh_host_certificates", reqwest::Method::POST, Some(req))
3106 .await
3107 }
3108
3109 pub async fn delete(&self, id: &str) -> Result<(), Error> {
3111 self.c
3112 .make_request(
3113 &format!("/ssh_host_certificates/{id}", id = id),
3114 reqwest::Method::DELETE,
3115 None::<Option<()>>,
3116 )
3117 .await
3118 }
3119
3120 pub async fn get(&self, id: &str) -> Result<types::SSHHostCertificate, Error> {
3122 self.c
3123 .make_request(
3124 &format!("/ssh_host_certificates/{id}", id = id),
3125 reqwest::Method::GET,
3126 None::<Option<()>>,
3127 )
3128 .await
3129 }
3130
3131 pub(crate) async fn list_page(
3134 &self,
3135 req: &types::Paging,
3136 ) -> Result<types::SSHHostCertificateList, Error> {
3137 self.c
3138 .make_request("/ssh_host_certificates", reqwest::Method::GET, Some(req))
3139 .await
3140 }
3141
3142 pub fn list(&self, req: types::Paging) -> List {
3144 List {
3145 c: std::sync::Arc::new(self.clone()),
3146 req,
3147 }
3148 }
3149
3150 pub async fn update(
3152 &self,
3153 req: &types::SSHHostCertificateUpdate,
3154 ) -> Result<types::SSHHostCertificate, Error> {
3155 self.c
3156 .make_request(
3157 &format!("/ssh_host_certificates/{id}", id = req.id),
3158 reqwest::Method::PATCH,
3159 Some(req),
3160 )
3161 .await
3162 }
3163 }
3164}
3165
3166pub mod ssh_user_certificates {
3170 use crate::types;
3171 use crate::Error;
3172 use futures::{Stream, TryStreamExt};
3173
3174 #[derive(Debug, Clone)]
3178 pub struct Client {
3179 c: crate::Client,
3180 }
3181 pub struct List {
3183 c: std::sync::Arc<Client>,
3184 req: types::Paging,
3185 }
3186
3187 impl List {
3188 pub async fn pages(
3193 self,
3194 ) -> impl Stream<Item = Result<types::SSHUserCertificateList, Error>> + Unpin {
3195 struct State {
3196 c: std::sync::Arc<Client>,
3197 req: types::Paging,
3198 init: bool,
3199 cur_uri: Option<String>,
3200 }
3201
3202 let s = State {
3203 c: self.c,
3204 req: self.req,
3205 init: true,
3206 cur_uri: None,
3207 };
3208
3209 Box::pin(futures::stream::unfold(s, |s| async move {
3210 let page_resp = match (s.init, &s.cur_uri) {
3211 (true, _) => s.c.list_page(&s.req).await,
3212 (false, None) => {
3213 return None;
3214 }
3215 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3216 };
3217 match page_resp {
3218 Err(e) => Some((Err(e), s)),
3219 Ok(page) => {
3220 let next = page.next_page_uri.clone();
3221 Some((
3222 Ok(page),
3223 State {
3224 init: false,
3225 cur_uri: next,
3226 ..s
3227 },
3228 ))
3229 }
3230 }
3231 }))
3232 }
3233
3234 pub async fn ssh_user_certificates(
3239 self,
3240 ) -> impl Stream<Item = Result<types::SSHUserCertificate, Error>> + Unpin {
3241 self.pages()
3242 .await
3243 .map_ok(|page| {
3244 futures::stream::iter(page.ssh_user_certificates.into_iter().map(Ok))
3245 })
3246 .try_flatten()
3247 }
3248 }
3249
3250 impl Client {
3251 pub fn new(c: crate::Client) -> Self {
3252 Self { c }
3253 }
3254
3255 pub async fn create(
3257 &self,
3258 req: &types::SSHUserCertificateCreate,
3259 ) -> Result<types::SSHUserCertificate, Error> {
3260 self.c
3261 .make_request("/ssh_user_certificates", reqwest::Method::POST, Some(req))
3262 .await
3263 }
3264
3265 pub async fn delete(&self, id: &str) -> Result<(), Error> {
3267 self.c
3268 .make_request(
3269 &format!("/ssh_user_certificates/{id}", id = id),
3270 reqwest::Method::DELETE,
3271 None::<Option<()>>,
3272 )
3273 .await
3274 }
3275
3276 pub async fn get(&self, id: &str) -> Result<types::SSHUserCertificate, Error> {
3278 self.c
3279 .make_request(
3280 &format!("/ssh_user_certificates/{id}", id = id),
3281 reqwest::Method::GET,
3282 None::<Option<()>>,
3283 )
3284 .await
3285 }
3286
3287 pub(crate) async fn list_page(
3290 &self,
3291 req: &types::Paging,
3292 ) -> Result<types::SSHUserCertificateList, Error> {
3293 self.c
3294 .make_request("/ssh_user_certificates", reqwest::Method::GET, Some(req))
3295 .await
3296 }
3297
3298 pub fn list(&self, req: types::Paging) -> List {
3300 List {
3301 c: std::sync::Arc::new(self.clone()),
3302 req,
3303 }
3304 }
3305
3306 pub async fn update(
3308 &self,
3309 req: &types::SSHUserCertificateUpdate,
3310 ) -> Result<types::SSHUserCertificate, Error> {
3311 self.c
3312 .make_request(
3313 &format!("/ssh_user_certificates/{id}", id = req.id),
3314 reqwest::Method::PATCH,
3315 Some(req),
3316 )
3317 .await
3318 }
3319 }
3320}
3321
3322pub mod tls_certificates {
3328 use crate::types;
3329 use crate::Error;
3330 use futures::{Stream, TryStreamExt};
3331
3332 #[derive(Debug, Clone)]
3338 pub struct Client {
3339 c: crate::Client,
3340 }
3341 pub struct List {
3343 c: std::sync::Arc<Client>,
3344 req: types::Paging,
3345 }
3346
3347 impl List {
3348 pub async fn pages(
3353 self,
3354 ) -> impl Stream<Item = Result<types::TLSCertificateList, Error>> + Unpin {
3355 struct State {
3356 c: std::sync::Arc<Client>,
3357 req: types::Paging,
3358 init: bool,
3359 cur_uri: Option<String>,
3360 }
3361
3362 let s = State {
3363 c: self.c,
3364 req: self.req,
3365 init: true,
3366 cur_uri: None,
3367 };
3368
3369 Box::pin(futures::stream::unfold(s, |s| async move {
3370 let page_resp = match (s.init, &s.cur_uri) {
3371 (true, _) => s.c.list_page(&s.req).await,
3372 (false, None) => {
3373 return None;
3374 }
3375 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3376 };
3377 match page_resp {
3378 Err(e) => Some((Err(e), s)),
3379 Ok(page) => {
3380 let next = page.next_page_uri.clone();
3381 Some((
3382 Ok(page),
3383 State {
3384 init: false,
3385 cur_uri: next,
3386 ..s
3387 },
3388 ))
3389 }
3390 }
3391 }))
3392 }
3393
3394 pub async fn tls_certificates(
3399 self,
3400 ) -> impl Stream<Item = Result<types::TLSCertificate, Error>> + Unpin {
3401 self.pages()
3402 .await
3403 .map_ok(|page| futures::stream::iter(page.tls_certificates.into_iter().map(Ok)))
3404 .try_flatten()
3405 }
3406 }
3407
3408 impl Client {
3409 pub fn new(c: crate::Client) -> Self {
3410 Self { c }
3411 }
3412
3413 pub async fn create(
3415 &self,
3416 req: &types::TLSCertificateCreate,
3417 ) -> Result<types::TLSCertificate, Error> {
3418 self.c
3419 .make_request("/tls_certificates", reqwest::Method::POST, Some(req))
3420 .await
3421 }
3422
3423 pub async fn delete(&self, id: &str) -> Result<(), Error> {
3425 self.c
3426 .make_request(
3427 &format!("/tls_certificates/{id}", id = id),
3428 reqwest::Method::DELETE,
3429 None::<Option<()>>,
3430 )
3431 .await
3432 }
3433
3434 pub async fn get(&self, id: &str) -> Result<types::TLSCertificate, Error> {
3436 self.c
3437 .make_request(
3438 &format!("/tls_certificates/{id}", id = id),
3439 reqwest::Method::GET,
3440 None::<Option<()>>,
3441 )
3442 .await
3443 }
3444
3445 pub(crate) async fn list_page(
3448 &self,
3449 req: &types::Paging,
3450 ) -> Result<types::TLSCertificateList, Error> {
3451 self.c
3452 .make_request("/tls_certificates", reqwest::Method::GET, Some(req))
3453 .await
3454 }
3455
3456 pub fn list(&self, req: types::Paging) -> List {
3458 List {
3459 c: std::sync::Arc::new(self.clone()),
3460 req,
3461 }
3462 }
3463
3464 pub async fn update(
3466 &self,
3467 req: &types::TLSCertificateUpdate,
3468 ) -> Result<types::TLSCertificate, Error> {
3469 self.c
3470 .make_request(
3471 &format!("/tls_certificates/{id}", id = req.id),
3472 reqwest::Method::PATCH,
3473 Some(req),
3474 )
3475 .await
3476 }
3477 }
3478}
3479
3480pub mod tunnels {
3483 use crate::types;
3484 use crate::Error;
3485 use futures::{Stream, TryStreamExt};
3486
3487 #[derive(Debug, Clone)]
3490 pub struct Client {
3491 c: crate::Client,
3492 }
3493 pub struct List {
3495 c: std::sync::Arc<Client>,
3496 req: types::Paging,
3497 }
3498
3499 impl List {
3500 pub async fn pages(self) -> impl Stream<Item = Result<types::TunnelList, Error>> + Unpin {
3505 struct State {
3506 c: std::sync::Arc<Client>,
3507 req: types::Paging,
3508 init: bool,
3509 cur_uri: Option<String>,
3510 }
3511
3512 let s = State {
3513 c: self.c,
3514 req: self.req,
3515 init: true,
3516 cur_uri: None,
3517 };
3518
3519 Box::pin(futures::stream::unfold(s, |s| async move {
3520 let page_resp = match (s.init, &s.cur_uri) {
3521 (true, _) => s.c.list_page(&s.req).await,
3522 (false, None) => {
3523 return None;
3524 }
3525 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3526 };
3527 match page_resp {
3528 Err(e) => Some((Err(e), s)),
3529 Ok(page) => {
3530 let next = page.next_page_uri.clone();
3531 Some((
3532 Ok(page),
3533 State {
3534 init: false,
3535 cur_uri: next,
3536 ..s
3537 },
3538 ))
3539 }
3540 }
3541 }))
3542 }
3543
3544 pub async fn tunnels(self) -> impl Stream<Item = Result<types::Tunnel, Error>> + Unpin {
3549 self.pages()
3550 .await
3551 .map_ok(|page| futures::stream::iter(page.tunnels.into_iter().map(Ok)))
3552 .try_flatten()
3553 }
3554 }
3555
3556 impl Client {
3557 pub fn new(c: crate::Client) -> Self {
3558 Self { c }
3559 }
3560
3561 pub(crate) async fn list_page(
3564 &self,
3565 req: &types::Paging,
3566 ) -> Result<types::TunnelList, Error> {
3567 self.c
3568 .make_request("/tunnels", reqwest::Method::GET, Some(req))
3569 .await
3570 }
3571
3572 pub fn list(&self, req: types::Paging) -> List {
3574 List {
3575 c: std::sync::Arc::new(self.clone()),
3576 req,
3577 }
3578 }
3579
3580 pub async fn get(&self, id: &str) -> Result<types::Tunnel, Error> {
3582 self.c
3583 .make_request(
3584 &format!("/tunnels/{id}", id = id),
3585 reqwest::Method::GET,
3586 None::<Option<()>>,
3587 )
3588 .await
3589 }
3590 }
3591}
3592
3593pub mod vaults {
3596 use crate::types;
3597 use crate::Error;
3598 use futures::{Stream, TryStreamExt};
3599
3600 #[derive(Debug, Clone)]
3603 pub struct Client {
3604 c: crate::Client,
3605 }
3606 pub struct GetSecretsByVault {
3608 c: std::sync::Arc<Client>,
3609 req: types::ItemPaging,
3610 }
3611
3612 impl GetSecretsByVault {
3613 pub async fn pages(self) -> impl Stream<Item = Result<types::SecretList, Error>> + Unpin {
3618 struct State {
3619 c: std::sync::Arc<Client>,
3620 req: types::ItemPaging,
3621 init: bool,
3622 cur_uri: Option<String>,
3623 }
3624
3625 let s = State {
3626 c: self.c,
3627 req: self.req,
3628 init: true,
3629 cur_uri: None,
3630 };
3631
3632 Box::pin(futures::stream::unfold(s, |s| async move {
3633 let page_resp = match (s.init, &s.cur_uri) {
3634 (true, _) => s.c.get_secrets_by_vault_page(&s.req).await,
3635 (false, None) => {
3636 return None;
3637 }
3638 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3639 };
3640 match page_resp {
3641 Err(e) => Some((Err(e), s)),
3642 Ok(page) => {
3643 let next = page.next_page_uri.clone();
3644 Some((
3645 Ok(page),
3646 State {
3647 init: false,
3648 cur_uri: next,
3649 ..s
3650 },
3651 ))
3652 }
3653 }
3654 }))
3655 }
3656
3657 pub async fn secrets(self) -> impl Stream<Item = Result<types::Secret, Error>> + Unpin {
3662 self.pages()
3663 .await
3664 .map_ok(|page| futures::stream::iter(page.secrets.into_iter().map(Ok)))
3665 .try_flatten()
3666 }
3667 }
3668
3669 pub struct List {
3671 c: std::sync::Arc<Client>,
3672 req: types::Paging,
3673 }
3674
3675 impl List {
3676 pub async fn pages(self) -> impl Stream<Item = Result<types::VaultList, Error>> + Unpin {
3681 struct State {
3682 c: std::sync::Arc<Client>,
3683 req: types::Paging,
3684 init: bool,
3685 cur_uri: Option<String>,
3686 }
3687
3688 let s = State {
3689 c: self.c,
3690 req: self.req,
3691 init: true,
3692 cur_uri: None,
3693 };
3694
3695 Box::pin(futures::stream::unfold(s, |s| async move {
3696 let page_resp = match (s.init, &s.cur_uri) {
3697 (true, _) => s.c.list_page(&s.req).await,
3698 (false, None) => {
3699 return None;
3700 }
3701 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3702 };
3703 match page_resp {
3704 Err(e) => Some((Err(e), s)),
3705 Ok(page) => {
3706 let next = page.next_page_uri.clone();
3707 Some((
3708 Ok(page),
3709 State {
3710 init: false,
3711 cur_uri: next,
3712 ..s
3713 },
3714 ))
3715 }
3716 }
3717 }))
3718 }
3719
3720 pub async fn vaults(self) -> impl Stream<Item = Result<types::Vault, Error>> + Unpin {
3725 self.pages()
3726 .await
3727 .map_ok(|page| futures::stream::iter(page.vaults.into_iter().map(Ok)))
3728 .try_flatten()
3729 }
3730 }
3731
3732 impl Client {
3733 pub fn new(c: crate::Client) -> Self {
3734 Self { c }
3735 }
3736
3737 pub async fn create(&self, req: &types::VaultCreate) -> Result<types::Vault, Error> {
3739 self.c
3740 .make_request("/vaults", reqwest::Method::POST, Some(req))
3741 .await
3742 }
3743
3744 pub async fn update(&self, req: &types::VaultUpdate) -> Result<types::Vault, Error> {
3746 self.c
3747 .make_request(
3748 &format!("/vaults/{id}", id = req.id),
3749 reqwest::Method::PATCH,
3750 Some(req),
3751 )
3752 .await
3753 }
3754
3755 pub async fn delete(&self, id: &str) -> Result<(), Error> {
3757 self.c
3758 .make_request(
3759 &format!("/vaults/{id}", id = id),
3760 reqwest::Method::DELETE,
3761 None::<Option<()>>,
3762 )
3763 .await
3764 }
3765
3766 pub async fn get(&self, id: &str) -> Result<types::Vault, Error> {
3768 self.c
3769 .make_request(
3770 &format!("/vaults/{id}", id = id),
3771 reqwest::Method::GET,
3772 None::<Option<()>>,
3773 )
3774 .await
3775 }
3776
3777 pub(crate) async fn get_secrets_by_vault_page(
3780 &self,
3781 req: &types::ItemPaging,
3782 ) -> Result<types::SecretList, Error> {
3783 self.c
3784 .make_request(
3785 &format!("/vaults/{id}/secrets", id = req.id),
3786 reqwest::Method::GET,
3787 Some(req),
3788 )
3789 .await
3790 }
3791
3792 pub fn get_secrets_by_vault(&self, req: types::ItemPaging) -> GetSecretsByVault {
3794 GetSecretsByVault {
3795 c: std::sync::Arc::new(self.clone()),
3796 req,
3797 }
3798 }
3799
3800 pub(crate) async fn list_page(
3803 &self,
3804 req: &types::Paging,
3805 ) -> Result<types::VaultList, Error> {
3806 self.c
3807 .make_request("/vaults", reqwest::Method::GET, Some(req))
3808 .await
3809 }
3810
3811 pub fn list(&self, req: types::Paging) -> List {
3813 List {
3814 c: std::sync::Arc::new(self.clone()),
3815 req,
3816 }
3817 }
3818 }
3819}
3820impl Client {
3821 pub fn abuse_reports(&self) -> abuse_reports::Client {
3822 abuse_reports::Client::new(self.clone())
3823 }
3824 pub fn agent_ingresses(&self) -> agent_ingresses::Client {
3825 agent_ingresses::Client::new(self.clone())
3826 }
3827 pub fn api_keys(&self) -> api_keys::Client {
3828 api_keys::Client::new(self.clone())
3829 }
3830 pub fn application_sessions(&self) -> application_sessions::Client {
3831 application_sessions::Client::new(self.clone())
3832 }
3833 pub fn application_users(&self) -> application_users::Client {
3834 application_users::Client::new(self.clone())
3835 }
3836 pub fn tunnel_sessions(&self) -> tunnel_sessions::Client {
3837 tunnel_sessions::Client::new(self.clone())
3838 }
3839 pub fn bot_users(&self) -> bot_users::Client {
3840 bot_users::Client::new(self.clone())
3841 }
3842 pub fn certificate_authorities(&self) -> certificate_authorities::Client {
3843 certificate_authorities::Client::new(self.clone())
3844 }
3845 pub fn credentials(&self) -> credentials::Client {
3846 credentials::Client::new(self.clone())
3847 }
3848 pub fn endpoints(&self) -> endpoints::Client {
3849 endpoints::Client::new(self.clone())
3850 }
3851 pub fn event_destinations(&self) -> event_destinations::Client {
3852 event_destinations::Client::new(self.clone())
3853 }
3854 pub fn event_subscriptions(&self) -> event_subscriptions::Client {
3855 event_subscriptions::Client::new(self.clone())
3856 }
3857 pub fn event_sources(&self) -> event_sources::Client {
3858 event_sources::Client::new(self.clone())
3859 }
3860 pub fn ip_policies(&self) -> ip_policies::Client {
3861 ip_policies::Client::new(self.clone())
3862 }
3863 pub fn ip_policy_rules(&self) -> ip_policy_rules::Client {
3864 ip_policy_rules::Client::new(self.clone())
3865 }
3866 pub fn ip_restrictions(&self) -> ip_restrictions::Client {
3867 ip_restrictions::Client::new(self.clone())
3868 }
3869 pub fn reserved_addrs(&self) -> reserved_addrs::Client {
3870 reserved_addrs::Client::new(self.clone())
3871 }
3872 pub fn reserved_domains(&self) -> reserved_domains::Client {
3873 reserved_domains::Client::new(self.clone())
3874 }
3875 pub fn secrets(&self) -> secrets::Client {
3876 secrets::Client::new(self.clone())
3877 }
3878 pub fn ssh_certificate_authorities(&self) -> ssh_certificate_authorities::Client {
3879 ssh_certificate_authorities::Client::new(self.clone())
3880 }
3881 pub fn ssh_credentials(&self) -> ssh_credentials::Client {
3882 ssh_credentials::Client::new(self.clone())
3883 }
3884 pub fn ssh_host_certificates(&self) -> ssh_host_certificates::Client {
3885 ssh_host_certificates::Client::new(self.clone())
3886 }
3887 pub fn ssh_user_certificates(&self) -> ssh_user_certificates::Client {
3888 ssh_user_certificates::Client::new(self.clone())
3889 }
3890 pub fn tls_certificates(&self) -> tls_certificates::Client {
3891 tls_certificates::Client::new(self.clone())
3892 }
3893 pub fn tunnels(&self) -> tunnels::Client {
3894 tunnels::Client::new(self.clone())
3895 }
3896 pub fn vaults(&self) -> vaults::Client {
3897 vaults::Client::new(self.clone())
3898 }
3899}
3900
3901pub mod backends {
3902 pub struct Client {
3903 c: crate::Client,
3904 }
3905
3906 impl Client {
3907 pub fn new(c: crate::Client) -> Self {
3908 Self { c }
3909 }
3910 }
3911
3912 pub mod failover {
3917 use crate::types;
3918 use crate::Error;
3919 use futures::{Stream, TryStreamExt};
3920
3921 #[derive(Debug, Clone)]
3926 pub struct Client {
3927 c: crate::Client,
3928 }
3929 pub struct List {
3931 c: std::sync::Arc<Client>,
3932 req: types::Paging,
3933 }
3934
3935 impl List {
3936 pub async fn pages(
3941 self,
3942 ) -> impl Stream<Item = Result<types::FailoverBackendList, Error>> + Unpin {
3943 struct State {
3944 c: std::sync::Arc<Client>,
3945 req: types::Paging,
3946 init: bool,
3947 cur_uri: Option<String>,
3948 }
3949
3950 let s = State {
3951 c: self.c,
3952 req: self.req,
3953 init: true,
3954 cur_uri: None,
3955 };
3956
3957 Box::pin(futures::stream::unfold(s, |s| async move {
3958 let page_resp = match (s.init, &s.cur_uri) {
3959 (true, _) => s.c.list_page(&s.req).await,
3960 (false, None) => {
3961 return None;
3962 }
3963 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3964 };
3965 match page_resp {
3966 Err(e) => Some((Err(e), s)),
3967 Ok(page) => {
3968 let next = page.next_page_uri.clone();
3969 Some((
3970 Ok(page),
3971 State {
3972 init: false,
3973 cur_uri: next,
3974 ..s
3975 },
3976 ))
3977 }
3978 }
3979 }))
3980 }
3981
3982 pub async fn backends(
3987 self,
3988 ) -> impl Stream<Item = Result<types::FailoverBackend, Error>> + Unpin {
3989 self.pages()
3990 .await
3991 .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
3992 .try_flatten()
3993 }
3994 }
3995
3996 impl Client {
3997 pub fn new(c: crate::Client) -> Self {
3998 Self { c }
3999 }
4000
4001 pub async fn create(
4003 &self,
4004 req: &types::FailoverBackendCreate,
4005 ) -> Result<types::FailoverBackend, Error> {
4006 self.c
4007 .make_request("/backends/failover", reqwest::Method::POST, Some(req))
4008 .await
4009 }
4010
4011 pub async fn delete(&self, id: &str) -> Result<(), Error> {
4013 self.c
4014 .make_request(
4015 &format!("/backends/failover/{id}", id = id),
4016 reqwest::Method::DELETE,
4017 None::<Option<()>>,
4018 )
4019 .await
4020 }
4021
4022 pub async fn get(&self, id: &str) -> Result<types::FailoverBackend, Error> {
4024 self.c
4025 .make_request(
4026 &format!("/backends/failover/{id}", id = id),
4027 reqwest::Method::GET,
4028 None::<Option<()>>,
4029 )
4030 .await
4031 }
4032
4033 pub(crate) async fn list_page(
4036 &self,
4037 req: &types::Paging,
4038 ) -> Result<types::FailoverBackendList, Error> {
4039 self.c
4040 .make_request("/backends/failover", reqwest::Method::GET, Some(req))
4041 .await
4042 }
4043
4044 pub fn list(&self, req: types::Paging) -> List {
4046 List {
4047 c: std::sync::Arc::new(self.clone()),
4048 req,
4049 }
4050 }
4051
4052 pub async fn update(
4054 &self,
4055 req: &types::FailoverBackendUpdate,
4056 ) -> Result<types::FailoverBackend, Error> {
4057 self.c
4058 .make_request(
4059 &format!("/backends/failover/{id}", id = req.id),
4060 reqwest::Method::PATCH,
4061 Some(req),
4062 )
4063 .await
4064 }
4065 }
4066 }
4067
4068 pub mod http_response {
4069 use crate::types;
4070 use crate::Error;
4071 use futures::{Stream, TryStreamExt};
4072
4073 #[derive(Debug, Clone)]
4074 pub struct Client {
4075 c: crate::Client,
4076 }
4077 pub struct List {
4079 c: std::sync::Arc<Client>,
4080 req: types::Paging,
4081 }
4082
4083 impl List {
4084 pub async fn pages(
4089 self,
4090 ) -> impl Stream<Item = Result<types::HTTPResponseBackendList, Error>> + Unpin
4091 {
4092 struct State {
4093 c: std::sync::Arc<Client>,
4094 req: types::Paging,
4095 init: bool,
4096 cur_uri: Option<String>,
4097 }
4098
4099 let s = State {
4100 c: self.c,
4101 req: self.req,
4102 init: true,
4103 cur_uri: None,
4104 };
4105
4106 Box::pin(futures::stream::unfold(s, |s| async move {
4107 let page_resp = match (s.init, &s.cur_uri) {
4108 (true, _) => s.c.list_page(&s.req).await,
4109 (false, None) => {
4110 return None;
4111 }
4112 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4113 };
4114 match page_resp {
4115 Err(e) => Some((Err(e), s)),
4116 Ok(page) => {
4117 let next = page.next_page_uri.clone();
4118 Some((
4119 Ok(page),
4120 State {
4121 init: false,
4122 cur_uri: next,
4123 ..s
4124 },
4125 ))
4126 }
4127 }
4128 }))
4129 }
4130
4131 pub async fn backends(
4136 self,
4137 ) -> impl Stream<Item = Result<types::HTTPResponseBackend, Error>> + Unpin {
4138 self.pages()
4139 .await
4140 .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4141 .try_flatten()
4142 }
4143 }
4144
4145 impl Client {
4146 pub fn new(c: crate::Client) -> Self {
4147 Self { c }
4148 }
4149
4150 pub async fn create(
4151 &self,
4152 req: &types::HTTPResponseBackendCreate,
4153 ) -> Result<types::HTTPResponseBackend, Error> {
4154 self.c
4155 .make_request("/backends/http_response", reqwest::Method::POST, Some(req))
4156 .await
4157 }
4158
4159 pub async fn delete(&self, id: &str) -> Result<(), Error> {
4160 self.c
4161 .make_request(
4162 &format!("/backends/http_response/{id}", id = id),
4163 reqwest::Method::DELETE,
4164 None::<Option<()>>,
4165 )
4166 .await
4167 }
4168
4169 pub async fn get(&self, id: &str) -> Result<types::HTTPResponseBackend, Error> {
4170 self.c
4171 .make_request(
4172 &format!("/backends/http_response/{id}", id = id),
4173 reqwest::Method::GET,
4174 None::<Option<()>>,
4175 )
4176 .await
4177 }
4178
4179 pub(crate) async fn list_page(
4182 &self,
4183 req: &types::Paging,
4184 ) -> Result<types::HTTPResponseBackendList, Error> {
4185 self.c
4186 .make_request("/backends/http_response", reqwest::Method::GET, Some(req))
4187 .await
4188 }
4189
4190 pub fn list(&self, req: types::Paging) -> List {
4191 List {
4192 c: std::sync::Arc::new(self.clone()),
4193 req,
4194 }
4195 }
4196
4197 pub async fn update(
4198 &self,
4199 req: &types::HTTPResponseBackendUpdate,
4200 ) -> Result<types::HTTPResponseBackend, Error> {
4201 self.c
4202 .make_request(
4203 &format!("/backends/http_response/{id}", id = req.id),
4204 reqwest::Method::PATCH,
4205 Some(req),
4206 )
4207 .await
4208 }
4209 }
4210 }
4211
4212 pub mod static_address {
4215 use crate::types;
4216 use crate::Error;
4217 use futures::{Stream, TryStreamExt};
4218
4219 #[derive(Debug, Clone)]
4222 pub struct Client {
4223 c: crate::Client,
4224 }
4225 pub struct List {
4227 c: std::sync::Arc<Client>,
4228 req: types::Paging,
4229 }
4230
4231 impl List {
4232 pub async fn pages(
4237 self,
4238 ) -> impl Stream<Item = Result<types::StaticBackendList, Error>> + Unpin {
4239 struct State {
4240 c: std::sync::Arc<Client>,
4241 req: types::Paging,
4242 init: bool,
4243 cur_uri: Option<String>,
4244 }
4245
4246 let s = State {
4247 c: self.c,
4248 req: self.req,
4249 init: true,
4250 cur_uri: None,
4251 };
4252
4253 Box::pin(futures::stream::unfold(s, |s| async move {
4254 let page_resp = match (s.init, &s.cur_uri) {
4255 (true, _) => s.c.list_page(&s.req).await,
4256 (false, None) => {
4257 return None;
4258 }
4259 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4260 };
4261 match page_resp {
4262 Err(e) => Some((Err(e), s)),
4263 Ok(page) => {
4264 let next = page.next_page_uri.clone();
4265 Some((
4266 Ok(page),
4267 State {
4268 init: false,
4269 cur_uri: next,
4270 ..s
4271 },
4272 ))
4273 }
4274 }
4275 }))
4276 }
4277
4278 pub async fn backends(
4283 self,
4284 ) -> impl Stream<Item = Result<types::StaticBackend, Error>> + Unpin {
4285 self.pages()
4286 .await
4287 .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4288 .try_flatten()
4289 }
4290 }
4291
4292 impl Client {
4293 pub fn new(c: crate::Client) -> Self {
4294 Self { c }
4295 }
4296
4297 pub async fn create(
4299 &self,
4300 req: &types::StaticBackendCreate,
4301 ) -> Result<types::StaticBackend, Error> {
4302 self.c
4303 .make_request("/backends/static", reqwest::Method::POST, Some(req))
4304 .await
4305 }
4306
4307 pub async fn delete(&self, id: &str) -> Result<(), Error> {
4309 self.c
4310 .make_request(
4311 &format!("/backends/static/{id}", id = id),
4312 reqwest::Method::DELETE,
4313 None::<Option<()>>,
4314 )
4315 .await
4316 }
4317
4318 pub async fn get(&self, id: &str) -> Result<types::StaticBackend, Error> {
4320 self.c
4321 .make_request(
4322 &format!("/backends/static/{id}", id = id),
4323 reqwest::Method::GET,
4324 None::<Option<()>>,
4325 )
4326 .await
4327 }
4328
4329 pub(crate) async fn list_page(
4332 &self,
4333 req: &types::Paging,
4334 ) -> Result<types::StaticBackendList, Error> {
4335 self.c
4336 .make_request("/backends/static", reqwest::Method::GET, Some(req))
4337 .await
4338 }
4339
4340 pub fn list(&self, req: types::Paging) -> List {
4342 List {
4343 c: std::sync::Arc::new(self.clone()),
4344 req,
4345 }
4346 }
4347
4348 pub async fn update(
4350 &self,
4351 req: &types::StaticBackendUpdate,
4352 ) -> Result<types::StaticBackend, Error> {
4353 self.c
4354 .make_request(
4355 &format!("/backends/static/{id}", id = req.id),
4356 reqwest::Method::PATCH,
4357 Some(req),
4358 )
4359 .await
4360 }
4361 }
4362 }
4363
4364 pub mod tunnel_group {
4367 use crate::types;
4368 use crate::Error;
4369 use futures::{Stream, TryStreamExt};
4370
4371 #[derive(Debug, Clone)]
4374 pub struct Client {
4375 c: crate::Client,
4376 }
4377 pub struct List {
4379 c: std::sync::Arc<Client>,
4380 req: types::Paging,
4381 }
4382
4383 impl List {
4384 pub async fn pages(
4389 self,
4390 ) -> impl Stream<Item = Result<types::TunnelGroupBackendList, Error>> + Unpin
4391 {
4392 struct State {
4393 c: std::sync::Arc<Client>,
4394 req: types::Paging,
4395 init: bool,
4396 cur_uri: Option<String>,
4397 }
4398
4399 let s = State {
4400 c: self.c,
4401 req: self.req,
4402 init: true,
4403 cur_uri: None,
4404 };
4405
4406 Box::pin(futures::stream::unfold(s, |s| async move {
4407 let page_resp = match (s.init, &s.cur_uri) {
4408 (true, _) => s.c.list_page(&s.req).await,
4409 (false, None) => {
4410 return None;
4411 }
4412 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4413 };
4414 match page_resp {
4415 Err(e) => Some((Err(e), s)),
4416 Ok(page) => {
4417 let next = page.next_page_uri.clone();
4418 Some((
4419 Ok(page),
4420 State {
4421 init: false,
4422 cur_uri: next,
4423 ..s
4424 },
4425 ))
4426 }
4427 }
4428 }))
4429 }
4430
4431 pub async fn backends(
4436 self,
4437 ) -> impl Stream<Item = Result<types::TunnelGroupBackend, Error>> + Unpin {
4438 self.pages()
4439 .await
4440 .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4441 .try_flatten()
4442 }
4443 }
4444
4445 impl Client {
4446 pub fn new(c: crate::Client) -> Self {
4447 Self { c }
4448 }
4449
4450 pub async fn create(
4452 &self,
4453 req: &types::TunnelGroupBackendCreate,
4454 ) -> Result<types::TunnelGroupBackend, Error> {
4455 self.c
4456 .make_request("/backends/tunnel_group", reqwest::Method::POST, Some(req))
4457 .await
4458 }
4459
4460 pub async fn delete(&self, id: &str) -> Result<(), Error> {
4462 self.c
4463 .make_request(
4464 &format!("/backends/tunnel_group/{id}", id = id),
4465 reqwest::Method::DELETE,
4466 None::<Option<()>>,
4467 )
4468 .await
4469 }
4470
4471 pub async fn get(&self, id: &str) -> Result<types::TunnelGroupBackend, Error> {
4473 self.c
4474 .make_request(
4475 &format!("/backends/tunnel_group/{id}", id = id),
4476 reqwest::Method::GET,
4477 None::<Option<()>>,
4478 )
4479 .await
4480 }
4481
4482 pub(crate) async fn list_page(
4485 &self,
4486 req: &types::Paging,
4487 ) -> Result<types::TunnelGroupBackendList, Error> {
4488 self.c
4489 .make_request("/backends/tunnel_group", reqwest::Method::GET, Some(req))
4490 .await
4491 }
4492
4493 pub fn list(&self, req: types::Paging) -> List {
4495 List {
4496 c: std::sync::Arc::new(self.clone()),
4497 req,
4498 }
4499 }
4500
4501 pub async fn update(
4503 &self,
4504 req: &types::TunnelGroupBackendUpdate,
4505 ) -> Result<types::TunnelGroupBackend, Error> {
4506 self.c
4507 .make_request(
4508 &format!("/backends/tunnel_group/{id}", id = req.id),
4509 reqwest::Method::PATCH,
4510 Some(req),
4511 )
4512 .await
4513 }
4514 }
4515 }
4516
4517 pub mod weighted {
4522 use crate::types;
4523 use crate::Error;
4524 use futures::{Stream, TryStreamExt};
4525
4526 #[derive(Debug, Clone)]
4531 pub struct Client {
4532 c: crate::Client,
4533 }
4534 pub struct List {
4536 c: std::sync::Arc<Client>,
4537 req: types::Paging,
4538 }
4539
4540 impl List {
4541 pub async fn pages(
4546 self,
4547 ) -> impl Stream<Item = Result<types::WeightedBackendList, Error>> + Unpin {
4548 struct State {
4549 c: std::sync::Arc<Client>,
4550 req: types::Paging,
4551 init: bool,
4552 cur_uri: Option<String>,
4553 }
4554
4555 let s = State {
4556 c: self.c,
4557 req: self.req,
4558 init: true,
4559 cur_uri: None,
4560 };
4561
4562 Box::pin(futures::stream::unfold(s, |s| async move {
4563 let page_resp = match (s.init, &s.cur_uri) {
4564 (true, _) => s.c.list_page(&s.req).await,
4565 (false, None) => {
4566 return None;
4567 }
4568 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4569 };
4570 match page_resp {
4571 Err(e) => Some((Err(e), s)),
4572 Ok(page) => {
4573 let next = page.next_page_uri.clone();
4574 Some((
4575 Ok(page),
4576 State {
4577 init: false,
4578 cur_uri: next,
4579 ..s
4580 },
4581 ))
4582 }
4583 }
4584 }))
4585 }
4586
4587 pub async fn backends(
4592 self,
4593 ) -> impl Stream<Item = Result<types::WeightedBackend, Error>> + Unpin {
4594 self.pages()
4595 .await
4596 .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4597 .try_flatten()
4598 }
4599 }
4600
4601 impl Client {
4602 pub fn new(c: crate::Client) -> Self {
4603 Self { c }
4604 }
4605
4606 pub async fn create(
4608 &self,
4609 req: &types::WeightedBackendCreate,
4610 ) -> Result<types::WeightedBackend, Error> {
4611 self.c
4612 .make_request("/backends/weighted", reqwest::Method::POST, Some(req))
4613 .await
4614 }
4615
4616 pub async fn delete(&self, id: &str) -> Result<(), Error> {
4618 self.c
4619 .make_request(
4620 &format!("/backends/weighted/{id}", id = id),
4621 reqwest::Method::DELETE,
4622 None::<Option<()>>,
4623 )
4624 .await
4625 }
4626
4627 pub async fn get(&self, id: &str) -> Result<types::WeightedBackend, Error> {
4629 self.c
4630 .make_request(
4631 &format!("/backends/weighted/{id}", id = id),
4632 reqwest::Method::GET,
4633 None::<Option<()>>,
4634 )
4635 .await
4636 }
4637
4638 pub(crate) async fn list_page(
4641 &self,
4642 req: &types::Paging,
4643 ) -> Result<types::WeightedBackendList, Error> {
4644 self.c
4645 .make_request("/backends/weighted", reqwest::Method::GET, Some(req))
4646 .await
4647 }
4648
4649 pub fn list(&self, req: types::Paging) -> List {
4651 List {
4652 c: std::sync::Arc::new(self.clone()),
4653 req,
4654 }
4655 }
4656
4657 pub async fn update(
4659 &self,
4660 req: &types::WeightedBackendUpdate,
4661 ) -> Result<types::WeightedBackend, Error> {
4662 self.c
4663 .make_request(
4664 &format!("/backends/weighted/{id}", id = req.id),
4665 reqwest::Method::PATCH,
4666 Some(req),
4667 )
4668 .await
4669 }
4670 }
4671 }
4672 impl Client {
4673 pub fn failover(&self) -> failover::Client {
4674 failover::Client::new(self.c.clone())
4675 }
4676 pub fn http_response(&self) -> http_response::Client {
4677 http_response::Client::new(self.c.clone())
4678 }
4679 pub fn static_address(&self) -> static_address::Client {
4680 static_address::Client::new(self.c.clone())
4681 }
4682 pub fn tunnel_group(&self) -> tunnel_group::Client {
4683 tunnel_group::Client::new(self.c.clone())
4684 }
4685 pub fn weighted(&self) -> weighted::Client {
4686 weighted::Client::new(self.c.clone())
4687 }
4688 }
4689}
4690
4691pub mod edges {
4692 pub struct Client {
4693 c: crate::Client,
4694 }
4695
4696 impl Client {
4697 pub fn new(c: crate::Client) -> Self {
4698 Self { c }
4699 }
4700 }
4701
4702 pub mod https_routes {
4703 use crate::types;
4704 use crate::Error;
4705
4706 #[derive(Debug, Clone)]
4707 pub struct Client {
4708 c: crate::Client,
4709 }
4710
4711 impl Client {
4712 pub fn new(c: crate::Client) -> Self {
4713 Self { c }
4714 }
4715
4716 pub async fn create(
4718 &self,
4719 req: &types::HTTPSEdgeRouteCreate,
4720 ) -> Result<types::HTTPSEdgeRoute, Error> {
4721 self.c
4722 .make_request(
4723 &format!("/edges/https/{edge_id}/routes", edge_id = req.edge_id),
4724 reqwest::Method::POST,
4725 Some(req),
4726 )
4727 .await
4728 }
4729
4730 pub async fn get(
4732 &self,
4733 req: &types::EdgeRouteItem,
4734 ) -> Result<types::HTTPSEdgeRoute, Error> {
4735 self.c
4736 .make_request(
4737 &format!(
4738 "/edges/https/{edge_id}/routes/{id}",
4739 edge_id = req.edge_id,
4740 id = req.id
4741 ),
4742 reqwest::Method::GET,
4743 None::<Option<()>>,
4744 )
4745 .await
4746 }
4747
4748 pub async fn update(
4753 &self,
4754 req: &types::HTTPSEdgeRouteUpdate,
4755 ) -> Result<types::HTTPSEdgeRoute, Error> {
4756 self.c
4757 .make_request(
4758 &format!(
4759 "/edges/https/{edge_id}/routes/{id}",
4760 edge_id = req.edge_id,
4761 id = req.id
4762 ),
4763 reqwest::Method::PATCH,
4764 Some(req),
4765 )
4766 .await
4767 }
4768
4769 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
4771 self.c
4772 .make_request(
4773 &format!(
4774 "/edges/https/{edge_id}/routes/{id}",
4775 edge_id = req.edge_id,
4776 id = req.id
4777 ),
4778 reqwest::Method::DELETE,
4779 None::<Option<()>>,
4780 )
4781 .await
4782 }
4783 }
4784 }
4785
4786 pub mod https {
4787 use crate::types;
4788 use crate::Error;
4789 use futures::{Stream, TryStreamExt};
4790
4791 #[derive(Debug, Clone)]
4792 pub struct Client {
4793 c: crate::Client,
4794 }
4795 pub struct List {
4797 c: std::sync::Arc<Client>,
4798 req: types::Paging,
4799 }
4800
4801 impl List {
4802 pub async fn pages(
4807 self,
4808 ) -> impl Stream<Item = Result<types::HTTPSEdgeList, Error>> + Unpin {
4809 struct State {
4810 c: std::sync::Arc<Client>,
4811 req: types::Paging,
4812 init: bool,
4813 cur_uri: Option<String>,
4814 }
4815
4816 let s = State {
4817 c: self.c,
4818 req: self.req,
4819 init: true,
4820 cur_uri: None,
4821 };
4822
4823 Box::pin(futures::stream::unfold(s, |s| async move {
4824 let page_resp = match (s.init, &s.cur_uri) {
4825 (true, _) => s.c.list_page(&s.req).await,
4826 (false, None) => {
4827 return None;
4828 }
4829 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4830 };
4831 match page_resp {
4832 Err(e) => Some((Err(e), s)),
4833 Ok(page) => {
4834 let next = page.next_page_uri.clone();
4835 Some((
4836 Ok(page),
4837 State {
4838 init: false,
4839 cur_uri: next,
4840 ..s
4841 },
4842 ))
4843 }
4844 }
4845 }))
4846 }
4847
4848 pub async fn https_edges(
4853 self,
4854 ) -> impl Stream<Item = Result<types::HTTPSEdge, Error>> + Unpin {
4855 self.pages()
4856 .await
4857 .map_ok(|page| futures::stream::iter(page.https_edges.into_iter().map(Ok)))
4858 .try_flatten()
4859 }
4860 }
4861
4862 impl Client {
4863 pub fn new(c: crate::Client) -> Self {
4864 Self { c }
4865 }
4866
4867 pub async fn create(
4869 &self,
4870 req: &types::HTTPSEdgeCreate,
4871 ) -> Result<types::HTTPSEdge, Error> {
4872 self.c
4873 .make_request("/edges/https", reqwest::Method::POST, Some(req))
4874 .await
4875 }
4876
4877 pub async fn get(&self, id: &str) -> Result<types::HTTPSEdge, Error> {
4879 self.c
4880 .make_request(
4881 &format!("/edges/https/{id}", id = id),
4882 reqwest::Method::GET,
4883 None::<Option<()>>,
4884 )
4885 .await
4886 }
4887
4888 pub(crate) async fn list_page(
4891 &self,
4892 req: &types::Paging,
4893 ) -> Result<types::HTTPSEdgeList, Error> {
4894 self.c
4895 .make_request("/edges/https", reqwest::Method::GET, Some(req))
4896 .await
4897 }
4898
4899 pub fn list(&self, req: types::Paging) -> List {
4901 List {
4902 c: std::sync::Arc::new(self.clone()),
4903 req,
4904 }
4905 }
4906
4907 pub async fn update(
4912 &self,
4913 req: &types::HTTPSEdgeUpdate,
4914 ) -> Result<types::HTTPSEdge, Error> {
4915 self.c
4916 .make_request(
4917 &format!("/edges/https/{id}", id = req.id),
4918 reqwest::Method::PATCH,
4919 Some(req),
4920 )
4921 .await
4922 }
4923
4924 pub async fn delete(&self, id: &str) -> Result<(), Error> {
4926 self.c
4927 .make_request(
4928 &format!("/edges/https/{id}", id = id),
4929 reqwest::Method::DELETE,
4930 None::<Option<()>>,
4931 )
4932 .await
4933 }
4934 }
4935 }
4936
4937 pub mod tcp {
4938 use crate::types;
4939 use crate::Error;
4940 use futures::{Stream, TryStreamExt};
4941
4942 #[derive(Debug, Clone)]
4943 pub struct Client {
4944 c: crate::Client,
4945 }
4946 pub struct List {
4948 c: std::sync::Arc<Client>,
4949 req: types::Paging,
4950 }
4951
4952 impl List {
4953 pub async fn pages(
4958 self,
4959 ) -> impl Stream<Item = Result<types::TCPEdgeList, Error>> + Unpin {
4960 struct State {
4961 c: std::sync::Arc<Client>,
4962 req: types::Paging,
4963 init: bool,
4964 cur_uri: Option<String>,
4965 }
4966
4967 let s = State {
4968 c: self.c,
4969 req: self.req,
4970 init: true,
4971 cur_uri: None,
4972 };
4973
4974 Box::pin(futures::stream::unfold(s, |s| async move {
4975 let page_resp = match (s.init, &s.cur_uri) {
4976 (true, _) => s.c.list_page(&s.req).await,
4977 (false, None) => {
4978 return None;
4979 }
4980 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4981 };
4982 match page_resp {
4983 Err(e) => Some((Err(e), s)),
4984 Ok(page) => {
4985 let next = page.next_page_uri.clone();
4986 Some((
4987 Ok(page),
4988 State {
4989 init: false,
4990 cur_uri: next,
4991 ..s
4992 },
4993 ))
4994 }
4995 }
4996 }))
4997 }
4998
4999 pub async fn tcp_edges(
5004 self,
5005 ) -> impl Stream<Item = Result<types::TCPEdge, Error>> + Unpin {
5006 self.pages()
5007 .await
5008 .map_ok(|page| futures::stream::iter(page.tcp_edges.into_iter().map(Ok)))
5009 .try_flatten()
5010 }
5011 }
5012
5013 impl Client {
5014 pub fn new(c: crate::Client) -> Self {
5015 Self { c }
5016 }
5017
5018 pub async fn create(
5020 &self,
5021 req: &types::TCPEdgeCreate,
5022 ) -> Result<types::TCPEdge, Error> {
5023 self.c
5024 .make_request("/edges/tcp", reqwest::Method::POST, Some(req))
5025 .await
5026 }
5027
5028 pub async fn get(&self, id: &str) -> Result<types::TCPEdge, Error> {
5030 self.c
5031 .make_request(
5032 &format!("/edges/tcp/{id}", id = id),
5033 reqwest::Method::GET,
5034 None::<Option<()>>,
5035 )
5036 .await
5037 }
5038
5039 pub(crate) async fn list_page(
5042 &self,
5043 req: &types::Paging,
5044 ) -> Result<types::TCPEdgeList, Error> {
5045 self.c
5046 .make_request("/edges/tcp", reqwest::Method::GET, Some(req))
5047 .await
5048 }
5049
5050 pub fn list(&self, req: types::Paging) -> List {
5052 List {
5053 c: std::sync::Arc::new(self.clone()),
5054 req,
5055 }
5056 }
5057
5058 pub async fn update(
5063 &self,
5064 req: &types::TCPEdgeUpdate,
5065 ) -> Result<types::TCPEdge, Error> {
5066 self.c
5067 .make_request(
5068 &format!("/edges/tcp/{id}", id = req.id),
5069 reqwest::Method::PATCH,
5070 Some(req),
5071 )
5072 .await
5073 }
5074
5075 pub async fn delete(&self, id: &str) -> Result<(), Error> {
5077 self.c
5078 .make_request(
5079 &format!("/edges/tcp/{id}", id = id),
5080 reqwest::Method::DELETE,
5081 None::<Option<()>>,
5082 )
5083 .await
5084 }
5085 }
5086 }
5087
5088 pub mod tls {
5089 use crate::types;
5090 use crate::Error;
5091 use futures::{Stream, TryStreamExt};
5092
5093 #[derive(Debug, Clone)]
5094 pub struct Client {
5095 c: crate::Client,
5096 }
5097 pub struct List {
5099 c: std::sync::Arc<Client>,
5100 req: types::Paging,
5101 }
5102
5103 impl List {
5104 pub async fn pages(
5109 self,
5110 ) -> impl Stream<Item = Result<types::TLSEdgeList, Error>> + Unpin {
5111 struct State {
5112 c: std::sync::Arc<Client>,
5113 req: types::Paging,
5114 init: bool,
5115 cur_uri: Option<String>,
5116 }
5117
5118 let s = State {
5119 c: self.c,
5120 req: self.req,
5121 init: true,
5122 cur_uri: None,
5123 };
5124
5125 Box::pin(futures::stream::unfold(s, |s| async move {
5126 let page_resp = match (s.init, &s.cur_uri) {
5127 (true, _) => s.c.list_page(&s.req).await,
5128 (false, None) => {
5129 return None;
5130 }
5131 (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
5132 };
5133 match page_resp {
5134 Err(e) => Some((Err(e), s)),
5135 Ok(page) => {
5136 let next = page.next_page_uri.clone();
5137 Some((
5138 Ok(page),
5139 State {
5140 init: false,
5141 cur_uri: next,
5142 ..s
5143 },
5144 ))
5145 }
5146 }
5147 }))
5148 }
5149
5150 pub async fn tls_edges(
5155 self,
5156 ) -> impl Stream<Item = Result<types::TLSEdge, Error>> + Unpin {
5157 self.pages()
5158 .await
5159 .map_ok(|page| futures::stream::iter(page.tls_edges.into_iter().map(Ok)))
5160 .try_flatten()
5161 }
5162 }
5163
5164 impl Client {
5165 pub fn new(c: crate::Client) -> Self {
5166 Self { c }
5167 }
5168
5169 pub async fn create(
5171 &self,
5172 req: &types::TLSEdgeCreate,
5173 ) -> Result<types::TLSEdge, Error> {
5174 self.c
5175 .make_request("/edges/tls", reqwest::Method::POST, Some(req))
5176 .await
5177 }
5178
5179 pub async fn get(&self, id: &str) -> Result<types::TLSEdge, Error> {
5181 self.c
5182 .make_request(
5183 &format!("/edges/tls/{id}", id = id),
5184 reqwest::Method::GET,
5185 None::<Option<()>>,
5186 )
5187 .await
5188 }
5189
5190 pub(crate) async fn list_page(
5193 &self,
5194 req: &types::Paging,
5195 ) -> Result<types::TLSEdgeList, Error> {
5196 self.c
5197 .make_request("/edges/tls", reqwest::Method::GET, Some(req))
5198 .await
5199 }
5200
5201 pub fn list(&self, req: types::Paging) -> List {
5203 List {
5204 c: std::sync::Arc::new(self.clone()),
5205 req,
5206 }
5207 }
5208
5209 pub async fn update(
5214 &self,
5215 req: &types::TLSEdgeUpdate,
5216 ) -> Result<types::TLSEdge, Error> {
5217 self.c
5218 .make_request(
5219 &format!("/edges/tls/{id}", id = req.id),
5220 reqwest::Method::PATCH,
5221 Some(req),
5222 )
5223 .await
5224 }
5225
5226 pub async fn delete(&self, id: &str) -> Result<(), Error> {
5228 self.c
5229 .make_request(
5230 &format!("/edges/tls/{id}", id = id),
5231 reqwest::Method::DELETE,
5232 None::<Option<()>>,
5233 )
5234 .await
5235 }
5236 }
5237 }
5238 impl Client {
5239 pub fn https_routes(&self) -> https_routes::Client {
5240 https_routes::Client::new(self.c.clone())
5241 }
5242 pub fn https(&self) -> https::Client {
5243 https::Client::new(self.c.clone())
5244 }
5245 pub fn tcp(&self) -> tcp::Client {
5246 tcp::Client::new(self.c.clone())
5247 }
5248 pub fn tls(&self) -> tls::Client {
5249 tls::Client::new(self.c.clone())
5250 }
5251 }
5252}
5253
5254pub mod edge_modules {
5255 pub struct Client {
5256 c: crate::Client,
5257 }
5258
5259 impl Client {
5260 pub fn new(c: crate::Client) -> Self {
5261 Self { c }
5262 }
5263 }
5264
5265 pub mod https_edge_mutual_tls {
5266 use crate::types;
5267 use crate::Error;
5268
5269 #[derive(Debug, Clone)]
5270 pub struct Client {
5271 c: crate::Client,
5272 }
5273
5274 impl Client {
5275 pub fn new(c: crate::Client) -> Self {
5276 Self { c }
5277 }
5278
5279 pub async fn replace(
5280 &self,
5281 req: &types::EdgeMutualTLSReplace,
5282 ) -> Result<types::EndpointMutualTLS, Error> {
5283 self.c
5284 .make_request(
5285 &format!("/edges/https/{id}/mutual_tls", id = req.id),
5286 reqwest::Method::PUT,
5287 Some(req),
5288 )
5289 .await
5290 }
5291
5292 pub async fn get(&self, id: &str) -> Result<types::EndpointMutualTLS, Error> {
5293 self.c
5294 .make_request(
5295 &format!("/edges/https/{id}/mutual_tls", id = id),
5296 reqwest::Method::GET,
5297 None::<Option<()>>,
5298 )
5299 .await
5300 }
5301
5302 pub async fn delete(&self, id: &str) -> Result<(), Error> {
5303 self.c
5304 .make_request(
5305 &format!("/edges/https/{id}/mutual_tls", id = id),
5306 reqwest::Method::DELETE,
5307 None::<Option<()>>,
5308 )
5309 .await
5310 }
5311 }
5312 }
5313
5314 pub mod https_edge_tls_termination {
5315 use crate::types;
5316 use crate::Error;
5317
5318 #[derive(Debug, Clone)]
5319 pub struct Client {
5320 c: crate::Client,
5321 }
5322
5323 impl Client {
5324 pub fn new(c: crate::Client) -> Self {
5325 Self { c }
5326 }
5327
5328 pub async fn replace(
5329 &self,
5330 req: &types::EdgeTLSTerminationAtEdgeReplace,
5331 ) -> Result<types::EndpointTLSTermination, Error> {
5332 self.c
5333 .make_request(
5334 &format!("/edges/https/{id}/tls_termination", id = req.id),
5335 reqwest::Method::PUT,
5336 Some(req),
5337 )
5338 .await
5339 }
5340
5341 pub async fn get(&self, id: &str) -> Result<types::EndpointTLSTermination, Error> {
5342 self.c
5343 .make_request(
5344 &format!("/edges/https/{id}/tls_termination", id = id),
5345 reqwest::Method::GET,
5346 None::<Option<()>>,
5347 )
5348 .await
5349 }
5350
5351 pub async fn delete(&self, id: &str) -> Result<(), Error> {
5352 self.c
5353 .make_request(
5354 &format!("/edges/https/{id}/tls_termination", id = id),
5355 reqwest::Method::DELETE,
5356 None::<Option<()>>,
5357 )
5358 .await
5359 }
5360 }
5361 }
5362
5363 pub mod https_edge_route_backend {
5364 use crate::types;
5365 use crate::Error;
5366
5367 #[derive(Debug, Clone)]
5368 pub struct Client {
5369 c: crate::Client,
5370 }
5371
5372 impl Client {
5373 pub fn new(c: crate::Client) -> Self {
5374 Self { c }
5375 }
5376
5377 pub async fn replace(
5378 &self,
5379 req: &types::EdgeRouteBackendReplace,
5380 ) -> Result<types::EndpointBackend, Error> {
5381 self.c
5382 .make_request(
5383 &format!(
5384 "/edges/https/{edge_id}/routes/{id}/backend",
5385 edge_id = req.edge_id,
5386 id = req.id
5387 ),
5388 reqwest::Method::PUT,
5389 Some(req),
5390 )
5391 .await
5392 }
5393
5394 pub async fn get(
5395 &self,
5396 req: &types::EdgeRouteItem,
5397 ) -> Result<types::EndpointBackend, Error> {
5398 self.c
5399 .make_request(
5400 &format!(
5401 "/edges/https/{edge_id}/routes/{id}/backend",
5402 edge_id = req.edge_id,
5403 id = req.id
5404 ),
5405 reqwest::Method::GET,
5406 None::<Option<()>>,
5407 )
5408 .await
5409 }
5410
5411 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5412 self.c
5413 .make_request(
5414 &format!(
5415 "/edges/https/{edge_id}/routes/{id}/backend",
5416 edge_id = req.edge_id,
5417 id = req.id
5418 ),
5419 reqwest::Method::DELETE,
5420 None::<Option<()>>,
5421 )
5422 .await
5423 }
5424 }
5425 }
5426
5427 pub mod https_edge_route_ip_restriction {
5428 use crate::types;
5429 use crate::Error;
5430
5431 #[derive(Debug, Clone)]
5432 pub struct Client {
5433 c: crate::Client,
5434 }
5435
5436 impl Client {
5437 pub fn new(c: crate::Client) -> Self {
5438 Self { c }
5439 }
5440
5441 pub async fn replace(
5442 &self,
5443 req: &types::EdgeRouteIPRestrictionReplace,
5444 ) -> Result<types::EndpointIPPolicy, Error> {
5445 self.c
5446 .make_request(
5447 &format!(
5448 "/edges/https/{edge_id}/routes/{id}/ip_restriction",
5449 edge_id = req.edge_id,
5450 id = req.id
5451 ),
5452 reqwest::Method::PUT,
5453 Some(req),
5454 )
5455 .await
5456 }
5457
5458 pub async fn get(
5459 &self,
5460 req: &types::EdgeRouteItem,
5461 ) -> Result<types::EndpointIPPolicy, Error> {
5462 self.c
5463 .make_request(
5464 &format!(
5465 "/edges/https/{edge_id}/routes/{id}/ip_restriction",
5466 edge_id = req.edge_id,
5467 id = req.id
5468 ),
5469 reqwest::Method::GET,
5470 None::<Option<()>>,
5471 )
5472 .await
5473 }
5474
5475 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5476 self.c
5477 .make_request(
5478 &format!(
5479 "/edges/https/{edge_id}/routes/{id}/ip_restriction",
5480 edge_id = req.edge_id,
5481 id = req.id
5482 ),
5483 reqwest::Method::DELETE,
5484 None::<Option<()>>,
5485 )
5486 .await
5487 }
5488 }
5489 }
5490
5491 pub mod https_edge_route_request_headers {
5492 use crate::types;
5493 use crate::Error;
5494
5495 #[derive(Debug, Clone)]
5496 pub struct Client {
5497 c: crate::Client,
5498 }
5499
5500 impl Client {
5501 pub fn new(c: crate::Client) -> Self {
5502 Self { c }
5503 }
5504
5505 pub async fn replace(
5506 &self,
5507 req: &types::EdgeRouteRequestHeadersReplace,
5508 ) -> Result<types::EndpointRequestHeaders, Error> {
5509 self.c
5510 .make_request(
5511 &format!(
5512 "/edges/https/{edge_id}/routes/{id}/request_headers",
5513 edge_id = req.edge_id,
5514 id = req.id
5515 ),
5516 reqwest::Method::PUT,
5517 Some(req),
5518 )
5519 .await
5520 }
5521
5522 pub async fn get(
5523 &self,
5524 req: &types::EdgeRouteItem,
5525 ) -> Result<types::EndpointRequestHeaders, Error> {
5526 self.c
5527 .make_request(
5528 &format!(
5529 "/edges/https/{edge_id}/routes/{id}/request_headers",
5530 edge_id = req.edge_id,
5531 id = req.id
5532 ),
5533 reqwest::Method::GET,
5534 None::<Option<()>>,
5535 )
5536 .await
5537 }
5538
5539 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5540 self.c
5541 .make_request(
5542 &format!(
5543 "/edges/https/{edge_id}/routes/{id}/request_headers",
5544 edge_id = req.edge_id,
5545 id = req.id
5546 ),
5547 reqwest::Method::DELETE,
5548 None::<Option<()>>,
5549 )
5550 .await
5551 }
5552 }
5553 }
5554
5555 pub mod https_edge_route_response_headers {
5556 use crate::types;
5557 use crate::Error;
5558
5559 #[derive(Debug, Clone)]
5560 pub struct Client {
5561 c: crate::Client,
5562 }
5563
5564 impl Client {
5565 pub fn new(c: crate::Client) -> Self {
5566 Self { c }
5567 }
5568
5569 pub async fn replace(
5570 &self,
5571 req: &types::EdgeRouteResponseHeadersReplace,
5572 ) -> Result<types::EndpointResponseHeaders, Error> {
5573 self.c
5574 .make_request(
5575 &format!(
5576 "/edges/https/{edge_id}/routes/{id}/response_headers",
5577 edge_id = req.edge_id,
5578 id = req.id
5579 ),
5580 reqwest::Method::PUT,
5581 Some(req),
5582 )
5583 .await
5584 }
5585
5586 pub async fn get(
5587 &self,
5588 req: &types::EdgeRouteItem,
5589 ) -> Result<types::EndpointResponseHeaders, Error> {
5590 self.c
5591 .make_request(
5592 &format!(
5593 "/edges/https/{edge_id}/routes/{id}/response_headers",
5594 edge_id = req.edge_id,
5595 id = req.id
5596 ),
5597 reqwest::Method::GET,
5598 None::<Option<()>>,
5599 )
5600 .await
5601 }
5602
5603 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5604 self.c
5605 .make_request(
5606 &format!(
5607 "/edges/https/{edge_id}/routes/{id}/response_headers",
5608 edge_id = req.edge_id,
5609 id = req.id
5610 ),
5611 reqwest::Method::DELETE,
5612 None::<Option<()>>,
5613 )
5614 .await
5615 }
5616 }
5617 }
5618
5619 pub mod https_edge_route_compression {
5620 use crate::types;
5621 use crate::Error;
5622
5623 #[derive(Debug, Clone)]
5624 pub struct Client {
5625 c: crate::Client,
5626 }
5627
5628 impl Client {
5629 pub fn new(c: crate::Client) -> Self {
5630 Self { c }
5631 }
5632
5633 pub async fn replace(
5634 &self,
5635 req: &types::EdgeRouteCompressionReplace,
5636 ) -> Result<types::EndpointCompression, Error> {
5637 self.c
5638 .make_request(
5639 &format!(
5640 "/edges/https/{edge_id}/routes/{id}/compression",
5641 edge_id = req.edge_id,
5642 id = req.id
5643 ),
5644 reqwest::Method::PUT,
5645 Some(req),
5646 )
5647 .await
5648 }
5649
5650 pub async fn get(
5651 &self,
5652 req: &types::EdgeRouteItem,
5653 ) -> Result<types::EndpointCompression, Error> {
5654 self.c
5655 .make_request(
5656 &format!(
5657 "/edges/https/{edge_id}/routes/{id}/compression",
5658 edge_id = req.edge_id,
5659 id = req.id
5660 ),
5661 reqwest::Method::GET,
5662 None::<Option<()>>,
5663 )
5664 .await
5665 }
5666
5667 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5668 self.c
5669 .make_request(
5670 &format!(
5671 "/edges/https/{edge_id}/routes/{id}/compression",
5672 edge_id = req.edge_id,
5673 id = req.id
5674 ),
5675 reqwest::Method::DELETE,
5676 None::<Option<()>>,
5677 )
5678 .await
5679 }
5680 }
5681 }
5682
5683 pub mod https_edge_route_circuit_breaker {
5684 use crate::types;
5685 use crate::Error;
5686
5687 #[derive(Debug, Clone)]
5688 pub struct Client {
5689 c: crate::Client,
5690 }
5691
5692 impl Client {
5693 pub fn new(c: crate::Client) -> Self {
5694 Self { c }
5695 }
5696
5697 pub async fn replace(
5698 &self,
5699 req: &types::EdgeRouteCircuitBreakerReplace,
5700 ) -> Result<types::EndpointCircuitBreaker, Error> {
5701 self.c
5702 .make_request(
5703 &format!(
5704 "/edges/https/{edge_id}/routes/{id}/circuit_breaker",
5705 edge_id = req.edge_id,
5706 id = req.id
5707 ),
5708 reqwest::Method::PUT,
5709 Some(req),
5710 )
5711 .await
5712 }
5713
5714 pub async fn get(
5715 &self,
5716 req: &types::EdgeRouteItem,
5717 ) -> Result<types::EndpointCircuitBreaker, Error> {
5718 self.c
5719 .make_request(
5720 &format!(
5721 "/edges/https/{edge_id}/routes/{id}/circuit_breaker",
5722 edge_id = req.edge_id,
5723 id = req.id
5724 ),
5725 reqwest::Method::GET,
5726 None::<Option<()>>,
5727 )
5728 .await
5729 }
5730
5731 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5732 self.c
5733 .make_request(
5734 &format!(
5735 "/edges/https/{edge_id}/routes/{id}/circuit_breaker",
5736 edge_id = req.edge_id,
5737 id = req.id
5738 ),
5739 reqwest::Method::DELETE,
5740 None::<Option<()>>,
5741 )
5742 .await
5743 }
5744 }
5745 }
5746
5747 pub mod https_edge_route_webhook_verification {
5748 use crate::types;
5749 use crate::Error;
5750
5751 #[derive(Debug, Clone)]
5752 pub struct Client {
5753 c: crate::Client,
5754 }
5755
5756 impl Client {
5757 pub fn new(c: crate::Client) -> Self {
5758 Self { c }
5759 }
5760
5761 pub async fn replace(
5762 &self,
5763 req: &types::EdgeRouteWebhookVerificationReplace,
5764 ) -> Result<types::EndpointWebhookValidation, Error> {
5765 self.c
5766 .make_request(
5767 &format!(
5768 "/edges/https/{edge_id}/routes/{id}/webhook_verification",
5769 edge_id = req.edge_id,
5770 id = req.id
5771 ),
5772 reqwest::Method::PUT,
5773 Some(req),
5774 )
5775 .await
5776 }
5777
5778 pub async fn get(
5779 &self,
5780 req: &types::EdgeRouteItem,
5781 ) -> Result<types::EndpointWebhookValidation, Error> {
5782 self.c
5783 .make_request(
5784 &format!(
5785 "/edges/https/{edge_id}/routes/{id}/webhook_verification",
5786 edge_id = req.edge_id,
5787 id = req.id
5788 ),
5789 reqwest::Method::GET,
5790 None::<Option<()>>,
5791 )
5792 .await
5793 }
5794
5795 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5796 self.c
5797 .make_request(
5798 &format!(
5799 "/edges/https/{edge_id}/routes/{id}/webhook_verification",
5800 edge_id = req.edge_id,
5801 id = req.id
5802 ),
5803 reqwest::Method::DELETE,
5804 None::<Option<()>>,
5805 )
5806 .await
5807 }
5808 }
5809 }
5810
5811 pub mod https_edge_route_oauth {
5812 use crate::types;
5813 use crate::Error;
5814
5815 #[derive(Debug, Clone)]
5816 pub struct Client {
5817 c: crate::Client,
5818 }
5819
5820 impl Client {
5821 pub fn new(c: crate::Client) -> Self {
5822 Self { c }
5823 }
5824
5825 pub async fn replace(
5826 &self,
5827 req: &types::EdgeRouteOAuthReplace,
5828 ) -> Result<types::EndpointOAuth, Error> {
5829 self.c
5830 .make_request(
5831 &format!(
5832 "/edges/https/{edge_id}/routes/{id}/oauth",
5833 edge_id = req.edge_id,
5834 id = req.id
5835 ),
5836 reqwest::Method::PUT,
5837 Some(req),
5838 )
5839 .await
5840 }
5841
5842 pub async fn get(
5843 &self,
5844 req: &types::EdgeRouteItem,
5845 ) -> Result<types::EndpointOAuth, Error> {
5846 self.c
5847 .make_request(
5848 &format!(
5849 "/edges/https/{edge_id}/routes/{id}/oauth",
5850 edge_id = req.edge_id,
5851 id = req.id
5852 ),
5853 reqwest::Method::GET,
5854 None::<Option<()>>,
5855 )
5856 .await
5857 }
5858
5859 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5860 self.c
5861 .make_request(
5862 &format!(
5863 "/edges/https/{edge_id}/routes/{id}/oauth",
5864 edge_id = req.edge_id,
5865 id = req.id
5866 ),
5867 reqwest::Method::DELETE,
5868 None::<Option<()>>,
5869 )
5870 .await
5871 }
5872 }
5873 }
5874
5875 pub mod https_edge_route_saml {
5876 use crate::types;
5877 use crate::Error;
5878
5879 #[derive(Debug, Clone)]
5880 pub struct Client {
5881 c: crate::Client,
5882 }
5883
5884 impl Client {
5885 pub fn new(c: crate::Client) -> Self {
5886 Self { c }
5887 }
5888
5889 pub async fn replace(
5890 &self,
5891 req: &types::EdgeRouteSAMLReplace,
5892 ) -> Result<types::EndpointSAML, Error> {
5893 self.c
5894 .make_request(
5895 &format!(
5896 "/edges/https/{edge_id}/routes/{id}/saml",
5897 edge_id = req.edge_id,
5898 id = req.id
5899 ),
5900 reqwest::Method::PUT,
5901 Some(req),
5902 )
5903 .await
5904 }
5905
5906 pub async fn get(
5907 &self,
5908 req: &types::EdgeRouteItem,
5909 ) -> Result<types::EndpointSAML, Error> {
5910 self.c
5911 .make_request(
5912 &format!(
5913 "/edges/https/{edge_id}/routes/{id}/saml",
5914 edge_id = req.edge_id,
5915 id = req.id
5916 ),
5917 reqwest::Method::GET,
5918 None::<Option<()>>,
5919 )
5920 .await
5921 }
5922
5923 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5924 self.c
5925 .make_request(
5926 &format!(
5927 "/edges/https/{edge_id}/routes/{id}/saml",
5928 edge_id = req.edge_id,
5929 id = req.id
5930 ),
5931 reqwest::Method::DELETE,
5932 None::<Option<()>>,
5933 )
5934 .await
5935 }
5936 }
5937 }
5938
5939 pub mod https_edge_route_oidc {
5940 use crate::types;
5941 use crate::Error;
5942
5943 #[derive(Debug, Clone)]
5944 pub struct Client {
5945 c: crate::Client,
5946 }
5947
5948 impl Client {
5949 pub fn new(c: crate::Client) -> Self {
5950 Self { c }
5951 }
5952
5953 pub async fn replace(
5954 &self,
5955 req: &types::EdgeRouteOIDCReplace,
5956 ) -> Result<types::EndpointOIDC, Error> {
5957 self.c
5958 .make_request(
5959 &format!(
5960 "/edges/https/{edge_id}/routes/{id}/oidc",
5961 edge_id = req.edge_id,
5962 id = req.id
5963 ),
5964 reqwest::Method::PUT,
5965 Some(req),
5966 )
5967 .await
5968 }
5969
5970 pub async fn get(
5971 &self,
5972 req: &types::EdgeRouteItem,
5973 ) -> Result<types::EndpointOIDC, Error> {
5974 self.c
5975 .make_request(
5976 &format!(
5977 "/edges/https/{edge_id}/routes/{id}/oidc",
5978 edge_id = req.edge_id,
5979 id = req.id
5980 ),
5981 reqwest::Method::GET,
5982 None::<Option<()>>,
5983 )
5984 .await
5985 }
5986
5987 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5988 self.c
5989 .make_request(
5990 &format!(
5991 "/edges/https/{edge_id}/routes/{id}/oidc",
5992 edge_id = req.edge_id,
5993 id = req.id
5994 ),
5995 reqwest::Method::DELETE,
5996 None::<Option<()>>,
5997 )
5998 .await
5999 }
6000 }
6001 }
6002
6003 pub mod https_edge_route_websocket_tcp_converter {
6004 use crate::types;
6005 use crate::Error;
6006
6007 #[derive(Debug, Clone)]
6008 pub struct Client {
6009 c: crate::Client,
6010 }
6011
6012 impl Client {
6013 pub fn new(c: crate::Client) -> Self {
6014 Self { c }
6015 }
6016
6017 pub async fn replace(
6018 &self,
6019 req: &types::EdgeRouteWebsocketTCPConverterReplace,
6020 ) -> Result<types::EndpointWebsocketTCPConverter, Error> {
6021 self.c
6022 .make_request(
6023 &format!(
6024 "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter",
6025 edge_id = req.edge_id,
6026 id = req.id
6027 ),
6028 reqwest::Method::PUT,
6029 Some(req),
6030 )
6031 .await
6032 }
6033
6034 pub async fn get(
6035 &self,
6036 req: &types::EdgeRouteItem,
6037 ) -> Result<types::EndpointWebsocketTCPConverter, Error> {
6038 self.c
6039 .make_request(
6040 &format!(
6041 "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter",
6042 edge_id = req.edge_id,
6043 id = req.id
6044 ),
6045 reqwest::Method::GET,
6046 None::<Option<()>>,
6047 )
6048 .await
6049 }
6050
6051 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6052 self.c
6053 .make_request(
6054 &format!(
6055 "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter",
6056 edge_id = req.edge_id,
6057 id = req.id
6058 ),
6059 reqwest::Method::DELETE,
6060 None::<Option<()>>,
6061 )
6062 .await
6063 }
6064 }
6065 }
6066
6067 pub mod https_edge_route_user_agent_filter {
6068 use crate::types;
6069 use crate::Error;
6070
6071 #[derive(Debug, Clone)]
6072 pub struct Client {
6073 c: crate::Client,
6074 }
6075
6076 impl Client {
6077 pub fn new(c: crate::Client) -> Self {
6078 Self { c }
6079 }
6080
6081 pub async fn replace(
6082 &self,
6083 req: &types::EdgeRouteUserAgentFilterReplace,
6084 ) -> Result<types::EndpointUserAgentFilter, Error> {
6085 self.c
6086 .make_request(
6087 &format!(
6088 "/edges/https/{edge_id}/routes/{id}/user_agent_filter",
6089 edge_id = req.edge_id,
6090 id = req.id
6091 ),
6092 reqwest::Method::PUT,
6093 Some(req),
6094 )
6095 .await
6096 }
6097
6098 pub async fn get(
6099 &self,
6100 req: &types::EdgeRouteItem,
6101 ) -> Result<types::EndpointUserAgentFilter, Error> {
6102 self.c
6103 .make_request(
6104 &format!(
6105 "/edges/https/{edge_id}/routes/{id}/user_agent_filter",
6106 edge_id = req.edge_id,
6107 id = req.id
6108 ),
6109 reqwest::Method::GET,
6110 None::<Option<()>>,
6111 )
6112 .await
6113 }
6114
6115 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6116 self.c
6117 .make_request(
6118 &format!(
6119 "/edges/https/{edge_id}/routes/{id}/user_agent_filter",
6120 edge_id = req.edge_id,
6121 id = req.id
6122 ),
6123 reqwest::Method::DELETE,
6124 None::<Option<()>>,
6125 )
6126 .await
6127 }
6128 }
6129 }
6130
6131 pub mod https_edge_route_traffic_policy {
6132 use crate::types;
6133 use crate::Error;
6134
6135 #[derive(Debug, Clone)]
6136 pub struct Client {
6137 c: crate::Client,
6138 }
6139
6140 impl Client {
6141 pub fn new(c: crate::Client) -> Self {
6142 Self { c }
6143 }
6144
6145 pub async fn replace(
6146 &self,
6147 req: &types::EdgeRouteTrafficPolicyReplace,
6148 ) -> Result<types::EndpointTrafficPolicy, Error> {
6149 self.c
6150 .make_request(
6151 &format!(
6152 "/edges/https/{edge_id}/routes/{id}/traffic_policy",
6153 edge_id = req.edge_id,
6154 id = req.id
6155 ),
6156 reqwest::Method::PUT,
6157 Some(req),
6158 )
6159 .await
6160 }
6161
6162 pub async fn get(
6163 &self,
6164 req: &types::EdgeRouteItem,
6165 ) -> Result<types::EndpointTrafficPolicy, Error> {
6166 self.c
6167 .make_request(
6168 &format!(
6169 "/edges/https/{edge_id}/routes/{id}/traffic_policy",
6170 edge_id = req.edge_id,
6171 id = req.id
6172 ),
6173 reqwest::Method::GET,
6174 None::<Option<()>>,
6175 )
6176 .await
6177 }
6178
6179 pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6180 self.c
6181 .make_request(
6182 &format!(
6183 "/edges/https/{edge_id}/routes/{id}/traffic_policy",
6184 edge_id = req.edge_id,
6185 id = req.id
6186 ),
6187 reqwest::Method::DELETE,
6188 None::<Option<()>>,
6189 )
6190 .await
6191 }
6192 }
6193 }
6194
6195 pub mod tcp_edge_backend {
6196 use crate::types;
6197 use crate::Error;
6198
6199 #[derive(Debug, Clone)]
6200 pub struct Client {
6201 c: crate::Client,
6202 }
6203
6204 impl Client {
6205 pub fn new(c: crate::Client) -> Self {
6206 Self { c }
6207 }
6208
6209 pub async fn replace(
6210 &self,
6211 req: &types::EdgeBackendReplace,
6212 ) -> Result<types::EndpointBackend, Error> {
6213 self.c
6214 .make_request(
6215 &format!("/edges/tcp/{id}/backend", id = req.id),
6216 reqwest::Method::PUT,
6217 Some(req),
6218 )
6219 .await
6220 }
6221
6222 pub async fn get(&self, id: &str) -> Result<types::EndpointBackend, Error> {
6223 self.c
6224 .make_request(
6225 &format!("/edges/tcp/{id}/backend", id = id),
6226 reqwest::Method::GET,
6227 None::<Option<()>>,
6228 )
6229 .await
6230 }
6231
6232 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6233 self.c
6234 .make_request(
6235 &format!("/edges/tcp/{id}/backend", id = id),
6236 reqwest::Method::DELETE,
6237 None::<Option<()>>,
6238 )
6239 .await
6240 }
6241 }
6242 }
6243
6244 pub mod tcp_edge_ip_restriction {
6245 use crate::types;
6246 use crate::Error;
6247
6248 #[derive(Debug, Clone)]
6249 pub struct Client {
6250 c: crate::Client,
6251 }
6252
6253 impl Client {
6254 pub fn new(c: crate::Client) -> Self {
6255 Self { c }
6256 }
6257
6258 pub async fn replace(
6259 &self,
6260 req: &types::EdgeIPRestrictionReplace,
6261 ) -> Result<types::EndpointIPPolicy, Error> {
6262 self.c
6263 .make_request(
6264 &format!("/edges/tcp/{id}/ip_restriction", id = req.id),
6265 reqwest::Method::PUT,
6266 Some(req),
6267 )
6268 .await
6269 }
6270
6271 pub async fn get(&self, id: &str) -> Result<types::EndpointIPPolicy, Error> {
6272 self.c
6273 .make_request(
6274 &format!("/edges/tcp/{id}/ip_restriction", id = id),
6275 reqwest::Method::GET,
6276 None::<Option<()>>,
6277 )
6278 .await
6279 }
6280
6281 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6282 self.c
6283 .make_request(
6284 &format!("/edges/tcp/{id}/ip_restriction", id = id),
6285 reqwest::Method::DELETE,
6286 None::<Option<()>>,
6287 )
6288 .await
6289 }
6290 }
6291 }
6292
6293 pub mod tcp_edge_traffic_policy {
6294 use crate::types;
6295 use crate::Error;
6296
6297 #[derive(Debug, Clone)]
6298 pub struct Client {
6299 c: crate::Client,
6300 }
6301
6302 impl Client {
6303 pub fn new(c: crate::Client) -> Self {
6304 Self { c }
6305 }
6306
6307 pub async fn replace(
6308 &self,
6309 req: &types::EdgeTrafficPolicyReplace,
6310 ) -> Result<types::EndpointTrafficPolicy, Error> {
6311 self.c
6312 .make_request(
6313 &format!("/edges/tcp/{id}/traffic_policy", id = req.id),
6314 reqwest::Method::PUT,
6315 Some(req),
6316 )
6317 .await
6318 }
6319
6320 pub async fn get(&self, id: &str) -> Result<types::EndpointTrafficPolicy, Error> {
6321 self.c
6322 .make_request(
6323 &format!("/edges/tcp/{id}/traffic_policy", id = id),
6324 reqwest::Method::GET,
6325 None::<Option<()>>,
6326 )
6327 .await
6328 }
6329
6330 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6331 self.c
6332 .make_request(
6333 &format!("/edges/tcp/{id}/traffic_policy", id = id),
6334 reqwest::Method::DELETE,
6335 None::<Option<()>>,
6336 )
6337 .await
6338 }
6339 }
6340 }
6341
6342 pub mod tls_edge_backend {
6343 use crate::types;
6344 use crate::Error;
6345
6346 #[derive(Debug, Clone)]
6347 pub struct Client {
6348 c: crate::Client,
6349 }
6350
6351 impl Client {
6352 pub fn new(c: crate::Client) -> Self {
6353 Self { c }
6354 }
6355
6356 pub async fn replace(
6357 &self,
6358 req: &types::EdgeBackendReplace,
6359 ) -> Result<types::EndpointBackend, Error> {
6360 self.c
6361 .make_request(
6362 &format!("/edges/tls/{id}/backend", id = req.id),
6363 reqwest::Method::PUT,
6364 Some(req),
6365 )
6366 .await
6367 }
6368
6369 pub async fn get(&self, id: &str) -> Result<types::EndpointBackend, Error> {
6370 self.c
6371 .make_request(
6372 &format!("/edges/tls/{id}/backend", id = id),
6373 reqwest::Method::GET,
6374 None::<Option<()>>,
6375 )
6376 .await
6377 }
6378
6379 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6380 self.c
6381 .make_request(
6382 &format!("/edges/tls/{id}/backend", id = id),
6383 reqwest::Method::DELETE,
6384 None::<Option<()>>,
6385 )
6386 .await
6387 }
6388 }
6389 }
6390
6391 pub mod tls_edge_ip_restriction {
6392 use crate::types;
6393 use crate::Error;
6394
6395 #[derive(Debug, Clone)]
6396 pub struct Client {
6397 c: crate::Client,
6398 }
6399
6400 impl Client {
6401 pub fn new(c: crate::Client) -> Self {
6402 Self { c }
6403 }
6404
6405 pub async fn replace(
6406 &self,
6407 req: &types::EdgeIPRestrictionReplace,
6408 ) -> Result<types::EndpointIPPolicy, Error> {
6409 self.c
6410 .make_request(
6411 &format!("/edges/tls/{id}/ip_restriction", id = req.id),
6412 reqwest::Method::PUT,
6413 Some(req),
6414 )
6415 .await
6416 }
6417
6418 pub async fn get(&self, id: &str) -> Result<types::EndpointIPPolicy, Error> {
6419 self.c
6420 .make_request(
6421 &format!("/edges/tls/{id}/ip_restriction", id = id),
6422 reqwest::Method::GET,
6423 None::<Option<()>>,
6424 )
6425 .await
6426 }
6427
6428 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6429 self.c
6430 .make_request(
6431 &format!("/edges/tls/{id}/ip_restriction", id = id),
6432 reqwest::Method::DELETE,
6433 None::<Option<()>>,
6434 )
6435 .await
6436 }
6437 }
6438 }
6439
6440 pub mod tls_edge_mutual_tls {
6441 use crate::types;
6442 use crate::Error;
6443
6444 #[derive(Debug, Clone)]
6445 pub struct Client {
6446 c: crate::Client,
6447 }
6448
6449 impl Client {
6450 pub fn new(c: crate::Client) -> Self {
6451 Self { c }
6452 }
6453
6454 pub async fn replace(
6455 &self,
6456 req: &types::EdgeMutualTLSReplace,
6457 ) -> Result<types::EndpointMutualTLS, Error> {
6458 self.c
6459 .make_request(
6460 &format!("/edges/tls/{id}/mutual_tls", id = req.id),
6461 reqwest::Method::PUT,
6462 Some(req),
6463 )
6464 .await
6465 }
6466
6467 pub async fn get(&self, id: &str) -> Result<types::EndpointMutualTLS, Error> {
6468 self.c
6469 .make_request(
6470 &format!("/edges/tls/{id}/mutual_tls", id = id),
6471 reqwest::Method::GET,
6472 None::<Option<()>>,
6473 )
6474 .await
6475 }
6476
6477 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6478 self.c
6479 .make_request(
6480 &format!("/edges/tls/{id}/mutual_tls", id = id),
6481 reqwest::Method::DELETE,
6482 None::<Option<()>>,
6483 )
6484 .await
6485 }
6486 }
6487 }
6488
6489 pub mod tls_edge_tls_termination {
6490 use crate::types;
6491 use crate::Error;
6492
6493 #[derive(Debug, Clone)]
6494 pub struct Client {
6495 c: crate::Client,
6496 }
6497
6498 impl Client {
6499 pub fn new(c: crate::Client) -> Self {
6500 Self { c }
6501 }
6502
6503 pub async fn replace(
6504 &self,
6505 req: &types::EdgeTLSTerminationReplace,
6506 ) -> Result<types::EndpointTLSTermination, Error> {
6507 self.c
6508 .make_request(
6509 &format!("/edges/tls/{id}/tls_termination", id = req.id),
6510 reqwest::Method::PUT,
6511 Some(req),
6512 )
6513 .await
6514 }
6515
6516 pub async fn get(&self, id: &str) -> Result<types::EndpointTLSTermination, Error> {
6517 self.c
6518 .make_request(
6519 &format!("/edges/tls/{id}/tls_termination", id = id),
6520 reqwest::Method::GET,
6521 None::<Option<()>>,
6522 )
6523 .await
6524 }
6525
6526 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6527 self.c
6528 .make_request(
6529 &format!("/edges/tls/{id}/tls_termination", id = id),
6530 reqwest::Method::DELETE,
6531 None::<Option<()>>,
6532 )
6533 .await
6534 }
6535 }
6536 }
6537
6538 pub mod tls_edge_traffic_policy {
6539 use crate::types;
6540 use crate::Error;
6541
6542 #[derive(Debug, Clone)]
6543 pub struct Client {
6544 c: crate::Client,
6545 }
6546
6547 impl Client {
6548 pub fn new(c: crate::Client) -> Self {
6549 Self { c }
6550 }
6551
6552 pub async fn replace(
6553 &self,
6554 req: &types::EdgeTrafficPolicyReplace,
6555 ) -> Result<types::EndpointTrafficPolicy, Error> {
6556 self.c
6557 .make_request(
6558 &format!("/edges/tls/{id}/traffic_policy", id = req.id),
6559 reqwest::Method::PUT,
6560 Some(req),
6561 )
6562 .await
6563 }
6564
6565 pub async fn get(&self, id: &str) -> Result<types::EndpointTrafficPolicy, Error> {
6566 self.c
6567 .make_request(
6568 &format!("/edges/tls/{id}/traffic_policy", id = id),
6569 reqwest::Method::GET,
6570 None::<Option<()>>,
6571 )
6572 .await
6573 }
6574
6575 pub async fn delete(&self, id: &str) -> Result<(), Error> {
6576 self.c
6577 .make_request(
6578 &format!("/edges/tls/{id}/traffic_policy", id = id),
6579 reqwest::Method::DELETE,
6580 None::<Option<()>>,
6581 )
6582 .await
6583 }
6584 }
6585 }
6586 impl Client {
6587 pub fn https_edge_mutual_tls(&self) -> https_edge_mutual_tls::Client {
6588 https_edge_mutual_tls::Client::new(self.c.clone())
6589 }
6590 pub fn https_edge_tls_termination(&self) -> https_edge_tls_termination::Client {
6591 https_edge_tls_termination::Client::new(self.c.clone())
6592 }
6593 pub fn https_edge_route_backend(&self) -> https_edge_route_backend::Client {
6594 https_edge_route_backend::Client::new(self.c.clone())
6595 }
6596 pub fn https_edge_route_ip_restriction(&self) -> https_edge_route_ip_restriction::Client {
6597 https_edge_route_ip_restriction::Client::new(self.c.clone())
6598 }
6599 pub fn https_edge_route_request_headers(&self) -> https_edge_route_request_headers::Client {
6600 https_edge_route_request_headers::Client::new(self.c.clone())
6601 }
6602 pub fn https_edge_route_response_headers(
6603 &self,
6604 ) -> https_edge_route_response_headers::Client {
6605 https_edge_route_response_headers::Client::new(self.c.clone())
6606 }
6607 pub fn https_edge_route_compression(&self) -> https_edge_route_compression::Client {
6608 https_edge_route_compression::Client::new(self.c.clone())
6609 }
6610 pub fn https_edge_route_circuit_breaker(&self) -> https_edge_route_circuit_breaker::Client {
6611 https_edge_route_circuit_breaker::Client::new(self.c.clone())
6612 }
6613 pub fn https_edge_route_webhook_verification(
6614 &self,
6615 ) -> https_edge_route_webhook_verification::Client {
6616 https_edge_route_webhook_verification::Client::new(self.c.clone())
6617 }
6618 pub fn https_edge_route_oauth(&self) -> https_edge_route_oauth::Client {
6619 https_edge_route_oauth::Client::new(self.c.clone())
6620 }
6621 pub fn https_edge_route_saml(&self) -> https_edge_route_saml::Client {
6622 https_edge_route_saml::Client::new(self.c.clone())
6623 }
6624 pub fn https_edge_route_oidc(&self) -> https_edge_route_oidc::Client {
6625 https_edge_route_oidc::Client::new(self.c.clone())
6626 }
6627 pub fn https_edge_route_websocket_tcp_converter(
6628 &self,
6629 ) -> https_edge_route_websocket_tcp_converter::Client {
6630 https_edge_route_websocket_tcp_converter::Client::new(self.c.clone())
6631 }
6632 pub fn https_edge_route_user_agent_filter(
6633 &self,
6634 ) -> https_edge_route_user_agent_filter::Client {
6635 https_edge_route_user_agent_filter::Client::new(self.c.clone())
6636 }
6637 pub fn https_edge_route_traffic_policy(&self) -> https_edge_route_traffic_policy::Client {
6638 https_edge_route_traffic_policy::Client::new(self.c.clone())
6639 }
6640 pub fn tcp_edge_backend(&self) -> tcp_edge_backend::Client {
6641 tcp_edge_backend::Client::new(self.c.clone())
6642 }
6643 pub fn tcp_edge_ip_restriction(&self) -> tcp_edge_ip_restriction::Client {
6644 tcp_edge_ip_restriction::Client::new(self.c.clone())
6645 }
6646 pub fn tcp_edge_traffic_policy(&self) -> tcp_edge_traffic_policy::Client {
6647 tcp_edge_traffic_policy::Client::new(self.c.clone())
6648 }
6649 pub fn tls_edge_backend(&self) -> tls_edge_backend::Client {
6650 tls_edge_backend::Client::new(self.c.clone())
6651 }
6652 pub fn tls_edge_ip_restriction(&self) -> tls_edge_ip_restriction::Client {
6653 tls_edge_ip_restriction::Client::new(self.c.clone())
6654 }
6655 pub fn tls_edge_mutual_tls(&self) -> tls_edge_mutual_tls::Client {
6656 tls_edge_mutual_tls::Client::new(self.c.clone())
6657 }
6658 pub fn tls_edge_tls_termination(&self) -> tls_edge_tls_termination::Client {
6659 tls_edge_tls_termination::Client::new(self.c.clone())
6660 }
6661 pub fn tls_edge_traffic_policy(&self) -> tls_edge_traffic_policy::Client {
6662 tls_edge_traffic_policy::Client::new(self.c.clone())
6663 }
6664 }
6665}
6666
6667impl Client {
6668 pub fn backends(&self) -> backends::Client {
6669 backends::Client::new(self.clone())
6670 }
6671 pub fn edges(&self) -> edges::Client {
6672 edges::Client::new(self.clone())
6673 }
6674 pub fn edge_modules(&self) -> edge_modules::Client {
6675 edge_modules::Client::new(self.clone())
6676 }
6677}