ngrok_api/
clients.rs

1// Code generated for API Clients. DO NOT EDIT.
2
3use crate::Client;
4
5/// Abuse Reports allow you to submit take-down requests for URLs hosted by
6///  ngrok that violate ngrok's terms of service.
7pub mod abuse_reports {
8    use crate::types;
9    use crate::Error;
10
11    /// Abuse Reports allow you to submit take-down requests for URLs hosted by
12    ///  ngrok that violate ngrok's terms of service.
13    #[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        /// Creates a new abuse report which will be reviewed by our system and abuse
24        /// response team. This API is only available to authorized accounts. Contact
25        /// abuse@ngrok.com to request access
26        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        /// Get the detailed status of abuse report by ID.
36        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    /// Provides streams of pages of [types::AgentIngressList], or of [types::AgentIngress] directly.
58    pub struct List {
59        c: std::sync::Arc<Client>,
60        req: types::FilteredPaging,
61    }
62
63    impl List {
64        /// Iterate over [types::AgentIngressList].
65        ///
66        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
67        /// documentation for more info on usage.
68        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::FilteredPaging,
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        /// Iterate over [types::AgentIngress] items.
111        ///
112        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
113        /// documentation for more info on usage.
114        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        /// Create a new Agent Ingress. The ngrok agent can be configured to connect to
130        /// ngrok via the new set of addresses on the returned Agent Ingress.
131        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        /// Delete an Agent Ingress by ID
141        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        /// Get the details of an Agent Ingress by ID.
152        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        /// Get a single page without pagination. Prefer using list
163        /// which will do pagination for you.
164        pub(crate) async fn list_page(
165            &self,
166            req: &types::FilteredPaging,
167        ) -> Result<types::AgentIngressList, Error> {
168            self.c
169                .make_request("/agent_ingresses", reqwest::Method::GET, Some(req))
170                .await
171        }
172
173        /// List all Agent Ingresses owned by this account
174        pub fn list(&self, req: types::FilteredPaging) -> List {
175            List {
176                c: std::sync::Arc::new(self.clone()),
177                req,
178            }
179        }
180
181        /// Update attributes of an Agent Ingress by ID.
182        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
197/// API Keys are used to authenticate to the [ngrok
198///  API](https://ngrok.com/docs/api#authentication). You may use the API itself
199///  to provision and manage API Keys but you'll need to provision your first API
200///  key from the [API Keys page](https://dashboard.ngrok.com/api/keys) on your
201///  ngrok.com dashboard.
202pub mod api_keys {
203    use crate::types;
204    use crate::Error;
205    use futures::{Stream, TryStreamExt};
206
207    /// API Keys are used to authenticate to the [ngrok
208    ///  API](https://ngrok.com/docs/api#authentication). You may use the API itself
209    ///  to provision and manage API Keys but you'll need to provision your first API
210    ///  key from the [API Keys page](https://dashboard.ngrok.com/api/keys) on your
211    ///  ngrok.com dashboard.
212    #[derive(Debug, Clone)]
213    pub struct Client {
214        c: crate::Client,
215    }
216    /// Provides streams of pages of [types::APIKeyList], or of [types::APIKey] directly.
217    pub struct List {
218        c: std::sync::Arc<Client>,
219        req: types::FilteredPaging,
220    }
221
222    impl List {
223        /// Iterate over [types::APIKeyList].
224        ///
225        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
226        /// documentation for more info on usage.
227        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::FilteredPaging,
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        /// Iterate over [types::APIKey] items.
268        ///
269        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
270        /// documentation for more info on usage.
271        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        /// Create a new API key. The generated API key can be used to authenticate to the
285        /// ngrok API.
286        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        /// Delete an API key by ID
293        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        /// Get the details of an API key by ID.
304        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        /// Get a single page without pagination. Prefer using list
315        /// which will do pagination for you.
316        pub(crate) async fn list_page(
317            &self,
318            req: &types::FilteredPaging,
319        ) -> Result<types::APIKeyList, Error> {
320            self.c
321                .make_request("/api_keys", reqwest::Method::GET, Some(req))
322                .await
323        }
324
325        /// List all API keys owned by this account
326        pub fn list(&self, req: types::FilteredPaging) -> List {
327            List {
328                c: std::sync::Arc::new(self.clone()),
329                req,
330            }
331        }
332
333        /// Update attributes of an API key by ID.
334        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    /// Provides streams of pages of [types::ApplicationSessionList], or of [types::ApplicationSession] directly.
356    pub struct List {
357        c: std::sync::Arc<Client>,
358        req: types::Paging,
359    }
360
361    impl List {
362        /// Iterate over [types::ApplicationSessionList].
363        ///
364        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
365        /// documentation for more info on usage.
366        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        /// Iterate over [types::ApplicationSession] items.
409        ///
410        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
411        /// documentation for more info on usage.
412        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        /// Get an application session by ID.
428        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        /// Delete an application session by ID.
439        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        /// Get a single page without pagination. Prefer using list
450        /// which will do pagination for you.
451        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        /// List all application sessions for this account.
461        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    /// Provides streams of pages of [types::ApplicationUserList], or of [types::ApplicationUser] directly.
480    pub struct List {
481        c: std::sync::Arc<Client>,
482        req: types::Paging,
483    }
484
485    impl List {
486        /// Iterate over [types::ApplicationUserList].
487        ///
488        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
489        /// documentation for more info on usage.
490        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        /// Iterate over [types::ApplicationUser] items.
533        ///
534        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
535        /// documentation for more info on usage.
536        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        /// Get an application user by ID.
552        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        /// Delete an application user by ID.
563        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        /// Get a single page without pagination. Prefer using list
574        /// which will do pagination for you.
575        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        /// List all application users for this account.
585        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
594/// Tunnel Sessions represent instances of ngrok agents or SSH reverse tunnel
595///  sessions that are running and connected to the ngrok service. Each tunnel
596///  session can include one or more Tunnels.
597pub mod tunnel_sessions {
598    use crate::types;
599    use crate::Error;
600    use futures::{Stream, TryStreamExt};
601
602    /// Tunnel Sessions represent instances of ngrok agents or SSH reverse tunnel
603    ///  sessions that are running and connected to the ngrok service. Each tunnel
604    ///  session can include one or more Tunnels.
605    #[derive(Debug, Clone)]
606    pub struct Client {
607        c: crate::Client,
608    }
609    /// Provides streams of pages of [types::TunnelSessionList], or of [types::TunnelSession] directly.
610    pub struct List {
611        c: std::sync::Arc<Client>,
612        req: types::FilteredPaging,
613    }
614
615    impl List {
616        /// Iterate over [types::TunnelSessionList].
617        ///
618        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
619        /// documentation for more info on usage.
620        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::FilteredPaging,
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        /// Iterate over [types::TunnelSession] items.
663        ///
664        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
665        /// documentation for more info on usage.
666        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        /// Get a single page without pagination. Prefer using list
682        /// which will do pagination for you.
683        pub(crate) async fn list_page(
684            &self,
685            req: &types::FilteredPaging,
686        ) -> Result<types::TunnelSessionList, Error> {
687            self.c
688                .make_request("/tunnel_sessions", reqwest::Method::GET, Some(req))
689                .await
690        }
691
692        /// List all online tunnel sessions running on this account.
693        pub fn list(&self, req: types::FilteredPaging) -> List {
694            List {
695                c: std::sync::Arc::new(self.clone()),
696                req,
697            }
698        }
699
700        /// Get the detailed status of a tunnel session by ID
701        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        /// Issues a command instructing the ngrok agent to restart. The agent restarts
712        /// itself by calling exec() on platforms that support it. This operation is notably
713        /// not supported on Windows. When an agent restarts, it reconnects with a new
714        /// tunnel session ID.
715        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        /// Issues a command instructing the ngrok agent that started this tunnel session to
726        /// exit.
727        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        /// Issues a command instructing the ngrok agent to update itself to the latest
738        /// version. After this call completes successfully, the ngrok agent will be in the
739        /// update process. A caller should wait some amount of time to allow the update to
740        /// complete (at least 10 seconds) before making a call to the Restart endpoint to
741        /// request that the agent restart itself to start using the new code. This call
742        /// will never update an ngrok agent to a new major version which could cause
743        /// breaking compatibility issues. If you wish to update to a new major version,
744        /// that must be done manually. Still, please be aware that updating your ngrok
745        /// agent could break your integration. This call will fail in any of the following
746        /// circumstances: there is no update available the ngrok agent's configuration
747        /// disabled update checks the agent is currently in process of updating the agent
748        /// has already successfully updated but has not yet been restarted
749        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    /// Provides streams of pages of [types::BotUserList], or of [types::BotUser] directly.
771    pub struct List {
772        c: std::sync::Arc<Client>,
773        req: types::Paging,
774    }
775
776    impl List {
777        /// Iterate over [types::BotUserList].
778        ///
779        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
780        /// documentation for more info on usage.
781        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        /// Iterate over [types::BotUser] items.
822        ///
823        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
824        /// documentation for more info on usage.
825        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        /// Create a new bot user
839        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        /// Delete a bot user by ID
846        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        /// Get the details of a Bot User by ID.
857        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        /// Get a single page without pagination. Prefer using list
868        /// which will do pagination for you.
869        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        /// List all bot users in this account.
879        pub fn list(&self, req: types::Paging) -> List {
880            List {
881                c: std::sync::Arc::new(self.clone()),
882                req,
883            }
884        }
885
886        /// Update attributes of a bot user by ID.
887        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
899/// Certificate Authorities are x509 certificates that are used to sign other
900///  x509 certificates. Attach a Certificate Authority to the Mutual TLS module
901///  to verify that the TLS certificate presented by a client has been signed by
902///  this CA. Certificate Authorities  are used only for mTLS validation only and
903///  thus a private key is not included in the resource.
904pub mod certificate_authorities {
905    use crate::types;
906    use crate::Error;
907    use futures::{Stream, TryStreamExt};
908
909    /// Certificate Authorities are x509 certificates that are used to sign other
910    ///  x509 certificates. Attach a Certificate Authority to the Mutual TLS module
911    ///  to verify that the TLS certificate presented by a client has been signed by
912    ///  this CA. Certificate Authorities  are used only for mTLS validation only and
913    ///  thus a private key is not included in the resource.
914    #[derive(Debug, Clone)]
915    pub struct Client {
916        c: crate::Client,
917    }
918    /// Provides streams of pages of [types::CertificateAuthorityList], or of [types::CertificateAuthority] directly.
919    pub struct List {
920        c: std::sync::Arc<Client>,
921        req: types::FilteredPaging,
922    }
923
924    impl List {
925        /// Iterate over [types::CertificateAuthorityList].
926        ///
927        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
928        /// documentation for more info on usage.
929        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::FilteredPaging,
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        /// Iterate over [types::CertificateAuthority] items.
972        ///
973        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
974        /// documentation for more info on usage.
975        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        /// Upload a new Certificate Authority
993        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        /// Delete a Certificate Authority
1003        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        /// Get detailed information about a certificate authority
1014        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        /// Get a single page without pagination. Prefer using list
1025        /// which will do pagination for you.
1026        pub(crate) async fn list_page(
1027            &self,
1028            req: &types::FilteredPaging,
1029        ) -> Result<types::CertificateAuthorityList, Error> {
1030            self.c
1031                .make_request("/certificate_authorities", reqwest::Method::GET, Some(req))
1032                .await
1033        }
1034
1035        /// List all Certificate Authority on this account
1036        pub fn list(&self, req: types::FilteredPaging) -> List {
1037            List {
1038                c: std::sync::Arc::new(self.clone()),
1039                req,
1040            }
1041        }
1042
1043        /// Update attributes of a Certificate Authority by ID
1044        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
1059/// Tunnel Credentials are ngrok agent authtokens. They authorize the ngrok
1060///  agent to connect the ngrok service as your account. They are installed with
1061///  the `ngrok config add-authtoken` command or by specifying it in the `ngrok.yml`
1062///  configuration file with the `authtoken` property.
1063pub mod credentials {
1064    use crate::types;
1065    use crate::Error;
1066    use futures::{Stream, TryStreamExt};
1067
1068    /// Tunnel Credentials are ngrok agent authtokens. They authorize the ngrok
1069    ///  agent to connect the ngrok service as your account. They are installed with
1070    ///  the `ngrok config add-authtoken` command or by specifying it in the `ngrok.yml`
1071    ///  configuration file with the `authtoken` property.
1072    #[derive(Debug, Clone)]
1073    pub struct Client {
1074        c: crate::Client,
1075    }
1076    /// Provides streams of pages of [types::CredentialList], or of [types::Credential] directly.
1077    pub struct List {
1078        c: std::sync::Arc<Client>,
1079        req: types::FilteredPaging,
1080    }
1081
1082    impl List {
1083        /// Iterate over [types::CredentialList].
1084        ///
1085        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1086        /// documentation for more info on usage.
1087        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::FilteredPaging,
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        /// Iterate over [types::Credential] items.
1130        ///
1131        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1132        /// documentation for more info on usage.
1133        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        /// Create a new tunnel authtoken credential. This authtoken credential can be used
1149        /// to start a new tunnel session. The response to this API call is the only time
1150        /// the generated token is available. If you need it for future use, you must save
1151        /// it securely yourself.
1152        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        /// Delete a tunnel authtoken credential by ID
1162        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        /// Get detailed information about a tunnel authtoken credential
1173        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        /// Get a single page without pagination. Prefer using list
1184        /// which will do pagination for you.
1185        pub(crate) async fn list_page(
1186            &self,
1187            req: &types::FilteredPaging,
1188        ) -> Result<types::CredentialList, Error> {
1189            self.c
1190                .make_request("/credentials", reqwest::Method::GET, Some(req))
1191                .await
1192        }
1193
1194        /// List all tunnel authtoken credentials on this account
1195        pub fn list(&self, req: types::FilteredPaging) -> List {
1196            List {
1197                c: std::sync::Arc::new(self.clone()),
1198                req,
1199            }
1200        }
1201
1202        /// Update attributes of an tunnel authtoken credential by ID
1203        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
1218/// Endpoints provides an API for querying the endpoint objects
1219///  which define what tunnel or edge is used to serve a hostport.
1220///  Only active endpoints associated with a tunnel or backend are returned.
1221pub mod endpoints {
1222    use crate::types;
1223    use crate::Error;
1224    use futures::{Stream, TryStreamExt};
1225
1226    /// Endpoints provides an API for querying the endpoint objects
1227    ///  which define what tunnel or edge is used to serve a hostport.
1228    ///  Only active endpoints associated with a tunnel or backend are returned.
1229    #[derive(Debug, Clone)]
1230    pub struct Client {
1231        c: crate::Client,
1232    }
1233    /// Provides streams of pages of [types::EndpointList], or of [types::Endpoint] directly.
1234    pub struct List {
1235        c: std::sync::Arc<Client>,
1236        req: types::EndpointListArgs,
1237    }
1238
1239    impl List {
1240        /// Iterate over [types::EndpointList].
1241        ///
1242        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1243        /// documentation for more info on usage.
1244        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        /// Iterate over [types::Endpoint] items.
1285        ///
1286        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1287        /// documentation for more info on usage.
1288        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        /// Create an endpoint, currently available only for cloud endpoints
1302        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        /// Get a single page without pagination. Prefer using list
1309        /// which will do pagination for you.
1310        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        /// List all active endpoints on the account
1320        pub fn list(&self, req: types::EndpointListArgs) -> List {
1321            List {
1322                c: std::sync::Arc::new(self.clone()),
1323                req,
1324            }
1325        }
1326
1327        /// Get the status of an endpoint by ID
1328        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        /// Update an Endpoint by ID, currently available only for cloud endpoints
1339        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        /// Delete an Endpoint by ID, currently available only for cloud endpoints
1350        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    /// Provides streams of pages of [types::EventDestinationList], or of [types::EventDestination] directly.
1372    pub struct List {
1373        c: std::sync::Arc<Client>,
1374        req: types::FilteredPaging,
1375    }
1376
1377    impl List {
1378        /// Iterate over [types::EventDestinationList].
1379        ///
1380        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1381        /// documentation for more info on usage.
1382        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::FilteredPaging,
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        /// Iterate over [types::EventDestination] items.
1425        ///
1426        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1427        /// documentation for more info on usage.
1428        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        /// Create a new Event Destination. It will not apply to anything until it is
1444        /// associated with an Event Subscription.
1445        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        /// Delete an Event Destination. If the Event Destination is still referenced by an
1455        /// Event Subscription.
1456        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        /// Get detailed information about an Event Destination by ID.
1467        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        /// Get a single page without pagination. Prefer using list
1478        /// which will do pagination for you.
1479        pub(crate) async fn list_page(
1480            &self,
1481            req: &types::FilteredPaging,
1482        ) -> Result<types::EventDestinationList, Error> {
1483            self.c
1484                .make_request("/event_destinations", reqwest::Method::GET, Some(req))
1485                .await
1486        }
1487
1488        /// List all Event Destinations on this account.
1489        pub fn list(&self, req: types::FilteredPaging) -> List {
1490            List {
1491                c: std::sync::Arc::new(self.clone()),
1492                req,
1493            }
1494        }
1495
1496        /// Update attributes of an Event Destination.
1497        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    /// Provides streams of pages of [types::EventSubscriptionList], or of [types::EventSubscription] directly.
1522    pub struct List {
1523        c: std::sync::Arc<Client>,
1524        req: types::FilteredPaging,
1525    }
1526
1527    impl List {
1528        /// Iterate over [types::EventSubscriptionList].
1529        ///
1530        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1531        /// documentation for more info on usage.
1532        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::FilteredPaging,
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        /// Iterate over [types::EventSubscription] items.
1575        ///
1576        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1577        /// documentation for more info on usage.
1578        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        /// Create an Event Subscription.
1594        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        /// Delete an Event Subscription.
1604        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        /// Get an Event Subscription by ID.
1615        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        /// Get a single page without pagination. Prefer using list
1626        /// which will do pagination for you.
1627        pub(crate) async fn list_page(
1628            &self,
1629            req: &types::FilteredPaging,
1630        ) -> Result<types::EventSubscriptionList, Error> {
1631            self.c
1632                .make_request("/event_subscriptions", reqwest::Method::GET, Some(req))
1633                .await
1634        }
1635
1636        /// List this Account's Event Subscriptions.
1637        pub fn list(&self, req: types::FilteredPaging) -> List {
1638            List {
1639                c: std::sync::Arc::new(self.clone()),
1640                req,
1641            }
1642        }
1643
1644        /// Update an Event Subscription.
1645        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        /// Add an additional type for which this event subscription will trigger
1675        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        /// Remove a type for which this event subscription will trigger
1692        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        /// Get the details for a given type that triggers for the given event subscription
1707        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        /// List the types for which this event subscription will trigger
1722        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        /// Update the type for which this event subscription will trigger
1736        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
1755/// IP Policies are reusable groups of CIDR ranges with an `allow` or `deny`
1756///  action. They can be attached to endpoints via the Endpoint Configuration IP
1757///  Policy module. They can also be used with IP Restrictions to control source
1758///  IP ranges that can start tunnel sessions and connect to the API and dashboard.
1759pub mod ip_policies {
1760    use crate::types;
1761    use crate::Error;
1762    use futures::{Stream, TryStreamExt};
1763
1764    /// IP Policies are reusable groups of CIDR ranges with an `allow` or `deny`
1765    ///  action. They can be attached to endpoints via the Endpoint Configuration IP
1766    ///  Policy module. They can also be used with IP Restrictions to control source
1767    ///  IP ranges that can start tunnel sessions and connect to the API and dashboard.
1768    #[derive(Debug, Clone)]
1769    pub struct Client {
1770        c: crate::Client,
1771    }
1772    /// Provides streams of pages of [types::IPPolicyList], or of [types::IPPolicy] directly.
1773    pub struct List {
1774        c: std::sync::Arc<Client>,
1775        req: types::FilteredPaging,
1776    }
1777
1778    impl List {
1779        /// Iterate over [types::IPPolicyList].
1780        ///
1781        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1782        /// documentation for more info on usage.
1783        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::FilteredPaging,
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        /// Iterate over [types::IPPolicy] items.
1824        ///
1825        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1826        /// documentation for more info on usage.
1827        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        /// Create a new IP policy. It will not apply to any traffic until you associate to
1843        /// a traffic source via an endpoint configuration or IP restriction.
1844        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        /// Delete an IP policy. If the IP policy is referenced by another object for the
1851        /// purposes of traffic restriction it will be treated as if the IP policy remains
1852        /// but has zero rules.
1853        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        /// Get detailed information about an IP policy by ID.
1864        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        /// Get a single page without pagination. Prefer using list
1875        /// which will do pagination for you.
1876        pub(crate) async fn list_page(
1877            &self,
1878            req: &types::FilteredPaging,
1879        ) -> Result<types::IPPolicyList, Error> {
1880            self.c
1881                .make_request("/ip_policies", reqwest::Method::GET, Some(req))
1882                .await
1883        }
1884
1885        /// List all IP policies on this account
1886        pub fn list(&self, req: types::FilteredPaging) -> List {
1887            List {
1888                c: std::sync::Arc::new(self.clone()),
1889                req,
1890            }
1891        }
1892
1893        /// Update attributes of an IP policy by ID
1894        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
1906/// IP Policy Rules are the IPv4 or IPv6 CIDRs entries that
1907///  make up an IP Policy.
1908pub mod ip_policy_rules {
1909    use crate::types;
1910    use crate::Error;
1911    use futures::{Stream, TryStreamExt};
1912
1913    /// IP Policy Rules are the IPv4 or IPv6 CIDRs entries that
1914    ///  make up an IP Policy.
1915    #[derive(Debug, Clone)]
1916    pub struct Client {
1917        c: crate::Client,
1918    }
1919    /// Provides streams of pages of [types::IPPolicyRuleList], or of [types::IPPolicyRule] directly.
1920    pub struct List {
1921        c: std::sync::Arc<Client>,
1922        req: types::FilteredPaging,
1923    }
1924
1925    impl List {
1926        /// Iterate over [types::IPPolicyRuleList].
1927        ///
1928        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1929        /// documentation for more info on usage.
1930        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::FilteredPaging,
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        /// Iterate over [types::IPPolicyRule] items.
1973        ///
1974        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
1975        /// documentation for more info on usage.
1976        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        /// Create a new IP policy rule attached to an IP Policy.
1992        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        /// Delete an IP policy rule.
2002        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        /// Get detailed information about an IP policy rule by ID.
2013        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        /// Get a single page without pagination. Prefer using list
2024        /// which will do pagination for you.
2025        pub(crate) async fn list_page(
2026            &self,
2027            req: &types::FilteredPaging,
2028        ) -> Result<types::IPPolicyRuleList, Error> {
2029            self.c
2030                .make_request("/ip_policy_rules", reqwest::Method::GET, Some(req))
2031                .await
2032        }
2033
2034        /// List all IP policy rules on this account
2035        pub fn list(&self, req: types::FilteredPaging) -> List {
2036            List {
2037                c: std::sync::Arc::new(self.clone()),
2038                req,
2039            }
2040        }
2041
2042        /// Update attributes of an IP policy rule by ID
2043        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
2058/// An IP restriction is a restriction placed on the CIDRs that are allowed to
2059///  initiate traffic to a specific aspect of your ngrok account. An IP
2060///  restriction has a type which defines the ingress it applies to. IP
2061///  restrictions can be used to enforce the source IPs that can make API
2062///  requests, log in to the dashboard, start ngrok agents, and connect to your
2063///  public-facing endpoints.
2064pub mod ip_restrictions {
2065    use crate::types;
2066    use crate::Error;
2067    use futures::{Stream, TryStreamExt};
2068
2069    /// An IP restriction is a restriction placed on the CIDRs that are allowed to
2070    ///  initiate traffic to a specific aspect of your ngrok account. An IP
2071    ///  restriction has a type which defines the ingress it applies to. IP
2072    ///  restrictions can be used to enforce the source IPs that can make API
2073    ///  requests, log in to the dashboard, start ngrok agents, and connect to your
2074    ///  public-facing endpoints.
2075    #[derive(Debug, Clone)]
2076    pub struct Client {
2077        c: crate::Client,
2078    }
2079    /// Provides streams of pages of [types::IPRestrictionList], or of [types::IPRestriction] directly.
2080    pub struct List {
2081        c: std::sync::Arc<Client>,
2082        req: types::FilteredPaging,
2083    }
2084
2085    impl List {
2086        /// Iterate over [types::IPRestrictionList].
2087        ///
2088        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2089        /// documentation for more info on usage.
2090        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::FilteredPaging,
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        /// Iterate over [types::IPRestriction] items.
2133        ///
2134        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2135        /// documentation for more info on usage.
2136        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        /// Create a new IP restriction
2152        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        /// Delete an IP restriction
2162        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        /// Get detailed information about an IP restriction
2173        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        /// Get a single page without pagination. Prefer using list
2184        /// which will do pagination for you.
2185        pub(crate) async fn list_page(
2186            &self,
2187            req: &types::FilteredPaging,
2188        ) -> Result<types::IPRestrictionList, Error> {
2189            self.c
2190                .make_request("/ip_restrictions", reqwest::Method::GET, Some(req))
2191                .await
2192        }
2193
2194        /// List all IP restrictions on this account
2195        pub fn list(&self, req: types::FilteredPaging) -> List {
2196            List {
2197                c: std::sync::Arc::new(self.clone()),
2198                req,
2199            }
2200        }
2201
2202        /// Update attributes of an IP restriction by ID
2203        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
2218/// Reserved Addresses are TCP addresses that can be used to listen for traffic.
2219///  TCP address hostnames and ports are assigned by ngrok, they cannot be
2220///  chosen.
2221pub mod reserved_addrs {
2222    use crate::types;
2223    use crate::Error;
2224    use futures::{Stream, TryStreamExt};
2225
2226    /// Reserved Addresses are TCP addresses that can be used to listen for traffic.
2227    ///  TCP address hostnames and ports are assigned by ngrok, they cannot be
2228    ///  chosen.
2229    #[derive(Debug, Clone)]
2230    pub struct Client {
2231        c: crate::Client,
2232    }
2233    /// Provides streams of pages of [types::ReservedAddrList], or of [types::ReservedAddr] directly.
2234    pub struct List {
2235        c: std::sync::Arc<Client>,
2236        req: types::FilteredPaging,
2237    }
2238
2239    impl List {
2240        /// Iterate over [types::ReservedAddrList].
2241        ///
2242        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2243        /// documentation for more info on usage.
2244        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::FilteredPaging,
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        /// Iterate over [types::ReservedAddr] items.
2287        ///
2288        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2289        /// documentation for more info on usage.
2290        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        /// Create a new reserved address.
2306        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        /// Delete a reserved address.
2316        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        /// Get the details of a reserved address.
2327        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        /// Get a single page without pagination. Prefer using list
2338        /// which will do pagination for you.
2339        pub(crate) async fn list_page(
2340            &self,
2341            req: &types::FilteredPaging,
2342        ) -> Result<types::ReservedAddrList, Error> {
2343            self.c
2344                .make_request("/reserved_addrs", reqwest::Method::GET, Some(req))
2345                .await
2346        }
2347
2348        /// List all reserved addresses on this account.
2349        pub fn list(&self, req: types::FilteredPaging) -> List {
2350            List {
2351                c: std::sync::Arc::new(self.clone()),
2352                req,
2353            }
2354        }
2355
2356        /// Update the attributes of a reserved address.
2357        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
2372/// Reserved Domains are hostnames that you can listen for traffic on. Domains
2373///  can be used to listen for http, https or tls traffic. You may use a domain
2374///  that you own by creating a CNAME record specified in the returned resource.
2375///  This CNAME record points traffic for that domain to ngrok's edge servers.
2376pub mod reserved_domains {
2377    use crate::types;
2378    use crate::Error;
2379    use futures::{Stream, TryStreamExt};
2380
2381    /// Reserved Domains are hostnames that you can listen for traffic on. Domains
2382    ///  can be used to listen for http, https or tls traffic. You may use a domain
2383    ///  that you own by creating a CNAME record specified in the returned resource.
2384    ///  This CNAME record points traffic for that domain to ngrok's edge servers.
2385    #[derive(Debug, Clone)]
2386    pub struct Client {
2387        c: crate::Client,
2388    }
2389    /// Provides streams of pages of [types::ReservedDomainList], or of [types::ReservedDomain] directly.
2390    pub struct List {
2391        c: std::sync::Arc<Client>,
2392        req: types::FilteredPaging,
2393    }
2394
2395    impl List {
2396        /// Iterate over [types::ReservedDomainList].
2397        ///
2398        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2399        /// documentation for more info on usage.
2400        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::FilteredPaging,
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        /// Iterate over [types::ReservedDomain] items.
2443        ///
2444        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2445        /// documentation for more info on usage.
2446        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        /// Create a new reserved domain.
2462        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        /// Delete a reserved domain.
2472        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        /// Get the details of a reserved domain.
2483        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        /// Get a single page without pagination. Prefer using list
2494        /// which will do pagination for you.
2495        pub(crate) async fn list_page(
2496            &self,
2497            req: &types::FilteredPaging,
2498        ) -> Result<types::ReservedDomainList, Error> {
2499            self.c
2500                .make_request("/reserved_domains", reqwest::Method::GET, Some(req))
2501                .await
2502        }
2503
2504        /// List all reserved domains on this account.
2505        pub fn list(&self, req: types::FilteredPaging) -> List {
2506            List {
2507                c: std::sync::Arc::new(self.clone()),
2508                req,
2509            }
2510        }
2511
2512        /// Update the attributes of a reserved domain.
2513        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        /// Detach the certificate management policy attached to a reserved domain.
2527        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        /// Detach the certificate attached to a reserved domain.
2541        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
2553/// Secrets is an api service for securely storing and managing sensitive data such
2554/// as secrets, credentials, and tokens.
2555pub mod secrets {
2556    use crate::types;
2557    use crate::Error;
2558    use futures::{Stream, TryStreamExt};
2559
2560    /// Secrets is an api service for securely storing and managing sensitive data such
2561    /// as secrets, credentials, and tokens.
2562    #[derive(Debug, Clone)]
2563    pub struct Client {
2564        c: crate::Client,
2565    }
2566    /// Provides streams of pages of [types::SecretList], or of [types::Secret] directly.
2567    pub struct List {
2568        c: std::sync::Arc<Client>,
2569        req: types::FilteredPaging,
2570    }
2571
2572    impl List {
2573        /// Iterate over [types::SecretList].
2574        ///
2575        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2576        /// documentation for more info on usage.
2577        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::FilteredPaging,
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        /// Iterate over [types::Secret] items.
2618        ///
2619        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2620        /// documentation for more info on usage.
2621        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        /// Create a new Secret
2635        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        /// Update an existing Secret by ID
2642        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        /// Delete a Secret
2653        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        /// Get a Secret by ID
2664        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        /// Get a single page without pagination. Prefer using list
2675        /// which will do pagination for you.
2676        pub(crate) async fn list_page(
2677            &self,
2678            req: &types::FilteredPaging,
2679        ) -> Result<types::SecretList, Error> {
2680            self.c
2681                .make_request("/vault_secrets", reqwest::Method::GET, Some(req))
2682                .await
2683        }
2684
2685        /// List all Secrets owned by account
2686        pub fn list(&self, req: types::FilteredPaging) -> List {
2687            List {
2688                c: std::sync::Arc::new(self.clone()),
2689                req,
2690            }
2691        }
2692    }
2693}
2694
2695pub mod service_users {
2696    use crate::types;
2697    use crate::Error;
2698    use futures::{Stream, TryStreamExt};
2699
2700    #[derive(Debug, Clone)]
2701    pub struct Client {
2702        c: crate::Client,
2703    }
2704    /// Provides streams of pages of [types::ServiceUserList], or of [types::ServiceUser] directly.
2705    pub struct List {
2706        c: std::sync::Arc<Client>,
2707        req: types::FilteredPaging,
2708    }
2709
2710    impl List {
2711        /// Iterate over [types::ServiceUserList].
2712        ///
2713        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2714        /// documentation for more info on usage.
2715        pub async fn pages(
2716            self,
2717        ) -> impl Stream<Item = Result<types::ServiceUserList, Error>> + Unpin {
2718            struct State {
2719                c: std::sync::Arc<Client>,
2720                req: types::FilteredPaging,
2721                init: bool,
2722                cur_uri: Option<String>,
2723            }
2724
2725            let s = State {
2726                c: self.c,
2727                req: self.req,
2728                init: true,
2729                cur_uri: None,
2730            };
2731
2732            Box::pin(futures::stream::unfold(s, |s| async move {
2733                let page_resp = match (s.init, &s.cur_uri) {
2734                    (true, _) => s.c.list_page(&s.req).await,
2735                    (false, None) => {
2736                        return None;
2737                    }
2738                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2739                };
2740                match page_resp {
2741                    Err(e) => Some((Err(e), s)),
2742                    Ok(page) => {
2743                        let next = page.next_page_uri.clone();
2744                        Some((
2745                            Ok(page),
2746                            State {
2747                                init: false,
2748                                cur_uri: next,
2749                                ..s
2750                            },
2751                        ))
2752                    }
2753                }
2754            }))
2755        }
2756
2757        /// Iterate over [types::ServiceUser] items.
2758        ///
2759        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2760        /// documentation for more info on usage.
2761        pub async fn service_users(
2762            self,
2763        ) -> impl Stream<Item = Result<types::ServiceUser, Error>> + Unpin {
2764            self.pages()
2765                .await
2766                .map_ok(|page| futures::stream::iter(page.service_users.into_iter().map(Ok)))
2767                .try_flatten()
2768        }
2769    }
2770
2771    impl Client {
2772        pub fn new(c: crate::Client) -> Self {
2773            Self { c }
2774        }
2775
2776        /// Create a new service user
2777        pub async fn create(
2778            &self,
2779            req: &types::ServiceUserCreate,
2780        ) -> Result<types::ServiceUser, Error> {
2781            self.c
2782                .make_request("/service_users", reqwest::Method::POST, Some(req))
2783                .await
2784        }
2785
2786        /// Delete a service user by ID
2787        pub async fn delete(&self, id: &str) -> Result<(), Error> {
2788            self.c
2789                .make_request(
2790                    &format!("/service_users/{id}", id = id),
2791                    reqwest::Method::DELETE,
2792                    None::<Option<()>>,
2793                )
2794                .await
2795        }
2796
2797        /// Get the details of a Bot User by ID.
2798        pub async fn get(&self, id: &str) -> Result<types::ServiceUser, Error> {
2799            self.c
2800                .make_request(
2801                    &format!("/service_users/{id}", id = id),
2802                    reqwest::Method::GET,
2803                    None::<Option<()>>,
2804                )
2805                .await
2806        }
2807
2808        /// Get a single page without pagination. Prefer using list
2809        /// which will do pagination for you.
2810        pub(crate) async fn list_page(
2811            &self,
2812            req: &types::FilteredPaging,
2813        ) -> Result<types::ServiceUserList, Error> {
2814            self.c
2815                .make_request("/service_users", reqwest::Method::GET, Some(req))
2816                .await
2817        }
2818
2819        /// List all service users in this account.
2820        pub fn list(&self, req: types::FilteredPaging) -> List {
2821            List {
2822                c: std::sync::Arc::new(self.clone()),
2823                req,
2824            }
2825        }
2826
2827        /// Update attributes of a service user by ID.
2828        pub async fn update(
2829            &self,
2830            req: &types::ServiceUserUpdate,
2831        ) -> Result<types::ServiceUser, Error> {
2832            self.c
2833                .make_request(
2834                    &format!("/service_users/{id}", id = req.id),
2835                    reqwest::Method::PATCH,
2836                    Some(req),
2837                )
2838                .await
2839        }
2840    }
2841}
2842
2843/// An SSH Certificate Authority is a pair of an SSH Certificate and its private
2844///  key that can be used to sign other SSH host and user certificates.
2845pub mod ssh_certificate_authorities {
2846    use crate::types;
2847    use crate::Error;
2848    use futures::{Stream, TryStreamExt};
2849
2850    /// An SSH Certificate Authority is a pair of an SSH Certificate and its private
2851    ///  key that can be used to sign other SSH host and user certificates.
2852    #[derive(Debug, Clone)]
2853    pub struct Client {
2854        c: crate::Client,
2855    }
2856    /// Provides streams of pages of [types::SSHCertificateAuthorityList], or of [types::SSHCertificateAuthority] directly.
2857    pub struct List {
2858        c: std::sync::Arc<Client>,
2859        req: types::FilteredPaging,
2860    }
2861
2862    impl List {
2863        /// Iterate over [types::SSHCertificateAuthorityList].
2864        ///
2865        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2866        /// documentation for more info on usage.
2867        pub async fn pages(
2868            self,
2869        ) -> impl Stream<Item = Result<types::SSHCertificateAuthorityList, Error>> + Unpin {
2870            struct State {
2871                c: std::sync::Arc<Client>,
2872                req: types::FilteredPaging,
2873                init: bool,
2874                cur_uri: Option<String>,
2875            }
2876
2877            let s = State {
2878                c: self.c,
2879                req: self.req,
2880                init: true,
2881                cur_uri: None,
2882            };
2883
2884            Box::pin(futures::stream::unfold(s, |s| async move {
2885                let page_resp = match (s.init, &s.cur_uri) {
2886                    (true, _) => s.c.list_page(&s.req).await,
2887                    (false, None) => {
2888                        return None;
2889                    }
2890                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
2891                };
2892                match page_resp {
2893                    Err(e) => Some((Err(e), s)),
2894                    Ok(page) => {
2895                        let next = page.next_page_uri.clone();
2896                        Some((
2897                            Ok(page),
2898                            State {
2899                                init: false,
2900                                cur_uri: next,
2901                                ..s
2902                            },
2903                        ))
2904                    }
2905                }
2906            }))
2907        }
2908
2909        /// Iterate over [types::SSHCertificateAuthority] items.
2910        ///
2911        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
2912        /// documentation for more info on usage.
2913        pub async fn ssh_certificate_authorities(
2914            self,
2915        ) -> impl Stream<Item = Result<types::SSHCertificateAuthority, Error>> + Unpin {
2916            self.pages()
2917                .await
2918                .map_ok(|page| {
2919                    futures::stream::iter(page.ssh_certificate_authorities.into_iter().map(Ok))
2920                })
2921                .try_flatten()
2922        }
2923    }
2924
2925    impl Client {
2926        pub fn new(c: crate::Client) -> Self {
2927            Self { c }
2928        }
2929
2930        /// Create a new SSH Certificate Authority
2931        pub async fn create(
2932            &self,
2933            req: &types::SSHCertificateAuthorityCreate,
2934        ) -> Result<types::SSHCertificateAuthority, Error> {
2935            self.c
2936                .make_request(
2937                    "/ssh_certificate_authorities",
2938                    reqwest::Method::POST,
2939                    Some(req),
2940                )
2941                .await
2942        }
2943
2944        /// Delete an SSH Certificate Authority
2945        pub async fn delete(&self, id: &str) -> Result<(), Error> {
2946            self.c
2947                .make_request(
2948                    &format!("/ssh_certificate_authorities/{id}", id = id),
2949                    reqwest::Method::DELETE,
2950                    None::<Option<()>>,
2951                )
2952                .await
2953        }
2954
2955        /// Get detailed information about an SSH Certificate Authority
2956        pub async fn get(&self, id: &str) -> Result<types::SSHCertificateAuthority, Error> {
2957            self.c
2958                .make_request(
2959                    &format!("/ssh_certificate_authorities/{id}", id = id),
2960                    reqwest::Method::GET,
2961                    None::<Option<()>>,
2962                )
2963                .await
2964        }
2965
2966        /// Get a single page without pagination. Prefer using list
2967        /// which will do pagination for you.
2968        pub(crate) async fn list_page(
2969            &self,
2970            req: &types::FilteredPaging,
2971        ) -> Result<types::SSHCertificateAuthorityList, Error> {
2972            self.c
2973                .make_request(
2974                    "/ssh_certificate_authorities",
2975                    reqwest::Method::GET,
2976                    Some(req),
2977                )
2978                .await
2979        }
2980
2981        /// List all SSH Certificate Authorities on this account
2982        pub fn list(&self, req: types::FilteredPaging) -> List {
2983            List {
2984                c: std::sync::Arc::new(self.clone()),
2985                req,
2986            }
2987        }
2988
2989        /// Update an SSH Certificate Authority
2990        pub async fn update(
2991            &self,
2992            req: &types::SSHCertificateAuthorityUpdate,
2993        ) -> Result<types::SSHCertificateAuthority, Error> {
2994            self.c
2995                .make_request(
2996                    &format!("/ssh_certificate_authorities/{id}", id = req.id),
2997                    reqwest::Method::PATCH,
2998                    Some(req),
2999                )
3000                .await
3001        }
3002    }
3003}
3004
3005/// SSH Credentials are SSH public keys that can be used to start SSH tunnels
3006///  via the ngrok SSH tunnel gateway.
3007pub mod ssh_credentials {
3008    use crate::types;
3009    use crate::Error;
3010    use futures::{Stream, TryStreamExt};
3011
3012    /// SSH Credentials are SSH public keys that can be used to start SSH tunnels
3013    ///  via the ngrok SSH tunnel gateway.
3014    #[derive(Debug, Clone)]
3015    pub struct Client {
3016        c: crate::Client,
3017    }
3018    /// Provides streams of pages of [types::SSHCredentialList], or of [types::SSHCredential] directly.
3019    pub struct List {
3020        c: std::sync::Arc<Client>,
3021        req: types::FilteredPaging,
3022    }
3023
3024    impl List {
3025        /// Iterate over [types::SSHCredentialList].
3026        ///
3027        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3028        /// documentation for more info on usage.
3029        pub async fn pages(
3030            self,
3031        ) -> impl Stream<Item = Result<types::SSHCredentialList, Error>> + Unpin {
3032            struct State {
3033                c: std::sync::Arc<Client>,
3034                req: types::FilteredPaging,
3035                init: bool,
3036                cur_uri: Option<String>,
3037            }
3038
3039            let s = State {
3040                c: self.c,
3041                req: self.req,
3042                init: true,
3043                cur_uri: None,
3044            };
3045
3046            Box::pin(futures::stream::unfold(s, |s| async move {
3047                let page_resp = match (s.init, &s.cur_uri) {
3048                    (true, _) => s.c.list_page(&s.req).await,
3049                    (false, None) => {
3050                        return None;
3051                    }
3052                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3053                };
3054                match page_resp {
3055                    Err(e) => Some((Err(e), s)),
3056                    Ok(page) => {
3057                        let next = page.next_page_uri.clone();
3058                        Some((
3059                            Ok(page),
3060                            State {
3061                                init: false,
3062                                cur_uri: next,
3063                                ..s
3064                            },
3065                        ))
3066                    }
3067                }
3068            }))
3069        }
3070
3071        /// Iterate over [types::SSHCredential] items.
3072        ///
3073        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3074        /// documentation for more info on usage.
3075        pub async fn ssh_credentials(
3076            self,
3077        ) -> impl Stream<Item = Result<types::SSHCredential, Error>> + Unpin {
3078            self.pages()
3079                .await
3080                .map_ok(|page| futures::stream::iter(page.ssh_credentials.into_iter().map(Ok)))
3081                .try_flatten()
3082        }
3083    }
3084
3085    impl Client {
3086        pub fn new(c: crate::Client) -> Self {
3087            Self { c }
3088        }
3089
3090        /// Create a new ssh_credential from an uploaded public SSH key. This ssh credential
3091        /// can be used to start new tunnels via ngrok's SSH gateway.
3092        pub async fn create(
3093            &self,
3094            req: &types::SSHCredentialCreate,
3095        ) -> Result<types::SSHCredential, Error> {
3096            self.c
3097                .make_request("/ssh_credentials", reqwest::Method::POST, Some(req))
3098                .await
3099        }
3100
3101        /// Delete an ssh_credential by ID
3102        pub async fn delete(&self, id: &str) -> Result<(), Error> {
3103            self.c
3104                .make_request(
3105                    &format!("/ssh_credentials/{id}", id = id),
3106                    reqwest::Method::DELETE,
3107                    None::<Option<()>>,
3108                )
3109                .await
3110        }
3111
3112        /// Get detailed information about an ssh_credential
3113        pub async fn get(&self, id: &str) -> Result<types::SSHCredential, Error> {
3114            self.c
3115                .make_request(
3116                    &format!("/ssh_credentials/{id}", id = id),
3117                    reqwest::Method::GET,
3118                    None::<Option<()>>,
3119                )
3120                .await
3121        }
3122
3123        /// Get a single page without pagination. Prefer using list
3124        /// which will do pagination for you.
3125        pub(crate) async fn list_page(
3126            &self,
3127            req: &types::FilteredPaging,
3128        ) -> Result<types::SSHCredentialList, Error> {
3129            self.c
3130                .make_request("/ssh_credentials", reqwest::Method::GET, Some(req))
3131                .await
3132        }
3133
3134        /// List all ssh credentials on this account
3135        pub fn list(&self, req: types::FilteredPaging) -> List {
3136            List {
3137                c: std::sync::Arc::new(self.clone()),
3138                req,
3139            }
3140        }
3141
3142        /// Update attributes of an ssh_credential by ID
3143        pub async fn update(
3144            &self,
3145            req: &types::SSHCredentialUpdate,
3146        ) -> Result<types::SSHCredential, Error> {
3147            self.c
3148                .make_request(
3149                    &format!("/ssh_credentials/{id}", id = req.id),
3150                    reqwest::Method::PATCH,
3151                    Some(req),
3152                )
3153                .await
3154        }
3155    }
3156}
3157
3158/// SSH Host Certificates along with the corresponding private key allows an SSH
3159///  server to assert its authenticity to connecting SSH clients who trust the
3160///  SSH Certificate Authority that was used to sign the certificate.
3161pub mod ssh_host_certificates {
3162    use crate::types;
3163    use crate::Error;
3164    use futures::{Stream, TryStreamExt};
3165
3166    /// SSH Host Certificates along with the corresponding private key allows an SSH
3167    ///  server to assert its authenticity to connecting SSH clients who trust the
3168    ///  SSH Certificate Authority that was used to sign the certificate.
3169    #[derive(Debug, Clone)]
3170    pub struct Client {
3171        c: crate::Client,
3172    }
3173    /// Provides streams of pages of [types::SSHHostCertificateList], or of [types::SSHHostCertificate] directly.
3174    pub struct List {
3175        c: std::sync::Arc<Client>,
3176        req: types::Paging,
3177    }
3178
3179    impl List {
3180        /// Iterate over [types::SSHHostCertificateList].
3181        ///
3182        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3183        /// documentation for more info on usage.
3184        pub async fn pages(
3185            self,
3186        ) -> impl Stream<Item = Result<types::SSHHostCertificateList, Error>> + Unpin {
3187            struct State {
3188                c: std::sync::Arc<Client>,
3189                req: types::Paging,
3190                init: bool,
3191                cur_uri: Option<String>,
3192            }
3193
3194            let s = State {
3195                c: self.c,
3196                req: self.req,
3197                init: true,
3198                cur_uri: None,
3199            };
3200
3201            Box::pin(futures::stream::unfold(s, |s| async move {
3202                let page_resp = match (s.init, &s.cur_uri) {
3203                    (true, _) => s.c.list_page(&s.req).await,
3204                    (false, None) => {
3205                        return None;
3206                    }
3207                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3208                };
3209                match page_resp {
3210                    Err(e) => Some((Err(e), s)),
3211                    Ok(page) => {
3212                        let next = page.next_page_uri.clone();
3213                        Some((
3214                            Ok(page),
3215                            State {
3216                                init: false,
3217                                cur_uri: next,
3218                                ..s
3219                            },
3220                        ))
3221                    }
3222                }
3223            }))
3224        }
3225
3226        /// Iterate over [types::SSHHostCertificate] items.
3227        ///
3228        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3229        /// documentation for more info on usage.
3230        pub async fn ssh_host_certificates(
3231            self,
3232        ) -> impl Stream<Item = Result<types::SSHHostCertificate, Error>> + Unpin {
3233            self.pages()
3234                .await
3235                .map_ok(|page| {
3236                    futures::stream::iter(page.ssh_host_certificates.into_iter().map(Ok))
3237                })
3238                .try_flatten()
3239        }
3240    }
3241
3242    impl Client {
3243        pub fn new(c: crate::Client) -> Self {
3244            Self { c }
3245        }
3246
3247        /// Create a new SSH Host Certificate
3248        pub async fn create(
3249            &self,
3250            req: &types::SSHHostCertificateCreate,
3251        ) -> Result<types::SSHHostCertificate, Error> {
3252            self.c
3253                .make_request("/ssh_host_certificates", reqwest::Method::POST, Some(req))
3254                .await
3255        }
3256
3257        /// Delete an SSH Host Certificate
3258        pub async fn delete(&self, id: &str) -> Result<(), Error> {
3259            self.c
3260                .make_request(
3261                    &format!("/ssh_host_certificates/{id}", id = id),
3262                    reqwest::Method::DELETE,
3263                    None::<Option<()>>,
3264                )
3265                .await
3266        }
3267
3268        /// Get detailed information about an SSH Host Certificate
3269        pub async fn get(&self, id: &str) -> Result<types::SSHHostCertificate, Error> {
3270            self.c
3271                .make_request(
3272                    &format!("/ssh_host_certificates/{id}", id = id),
3273                    reqwest::Method::GET,
3274                    None::<Option<()>>,
3275                )
3276                .await
3277        }
3278
3279        /// Get a single page without pagination. Prefer using list
3280        /// which will do pagination for you.
3281        pub(crate) async fn list_page(
3282            &self,
3283            req: &types::Paging,
3284        ) -> Result<types::SSHHostCertificateList, Error> {
3285            self.c
3286                .make_request("/ssh_host_certificates", reqwest::Method::GET, Some(req))
3287                .await
3288        }
3289
3290        /// List all SSH Host Certificates issued on this account
3291        pub fn list(&self, req: types::Paging) -> List {
3292            List {
3293                c: std::sync::Arc::new(self.clone()),
3294                req,
3295            }
3296        }
3297
3298        /// Update an SSH Host Certificate
3299        pub async fn update(
3300            &self,
3301            req: &types::SSHHostCertificateUpdate,
3302        ) -> Result<types::SSHHostCertificate, Error> {
3303            self.c
3304                .make_request(
3305                    &format!("/ssh_host_certificates/{id}", id = req.id),
3306                    reqwest::Method::PATCH,
3307                    Some(req),
3308                )
3309                .await
3310        }
3311    }
3312}
3313
3314/// SSH User Certificates are presented by SSH clients when connecting to an SSH
3315///  server to authenticate their connection. The SSH server must trust the SSH
3316///  Certificate Authority used to sign the certificate.
3317pub mod ssh_user_certificates {
3318    use crate::types;
3319    use crate::Error;
3320    use futures::{Stream, TryStreamExt};
3321
3322    /// SSH User Certificates are presented by SSH clients when connecting to an SSH
3323    ///  server to authenticate their connection. The SSH server must trust the SSH
3324    ///  Certificate Authority used to sign the certificate.
3325    #[derive(Debug, Clone)]
3326    pub struct Client {
3327        c: crate::Client,
3328    }
3329    /// Provides streams of pages of [types::SSHUserCertificateList], or of [types::SSHUserCertificate] directly.
3330    pub struct List {
3331        c: std::sync::Arc<Client>,
3332        req: types::Paging,
3333    }
3334
3335    impl List {
3336        /// Iterate over [types::SSHUserCertificateList].
3337        ///
3338        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3339        /// documentation for more info on usage.
3340        pub async fn pages(
3341            self,
3342        ) -> impl Stream<Item = Result<types::SSHUserCertificateList, Error>> + Unpin {
3343            struct State {
3344                c: std::sync::Arc<Client>,
3345                req: types::Paging,
3346                init: bool,
3347                cur_uri: Option<String>,
3348            }
3349
3350            let s = State {
3351                c: self.c,
3352                req: self.req,
3353                init: true,
3354                cur_uri: None,
3355            };
3356
3357            Box::pin(futures::stream::unfold(s, |s| async move {
3358                let page_resp = match (s.init, &s.cur_uri) {
3359                    (true, _) => s.c.list_page(&s.req).await,
3360                    (false, None) => {
3361                        return None;
3362                    }
3363                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3364                };
3365                match page_resp {
3366                    Err(e) => Some((Err(e), s)),
3367                    Ok(page) => {
3368                        let next = page.next_page_uri.clone();
3369                        Some((
3370                            Ok(page),
3371                            State {
3372                                init: false,
3373                                cur_uri: next,
3374                                ..s
3375                            },
3376                        ))
3377                    }
3378                }
3379            }))
3380        }
3381
3382        /// Iterate over [types::SSHUserCertificate] items.
3383        ///
3384        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3385        /// documentation for more info on usage.
3386        pub async fn ssh_user_certificates(
3387            self,
3388        ) -> impl Stream<Item = Result<types::SSHUserCertificate, Error>> + Unpin {
3389            self.pages()
3390                .await
3391                .map_ok(|page| {
3392                    futures::stream::iter(page.ssh_user_certificates.into_iter().map(Ok))
3393                })
3394                .try_flatten()
3395        }
3396    }
3397
3398    impl Client {
3399        pub fn new(c: crate::Client) -> Self {
3400            Self { c }
3401        }
3402
3403        /// Create a new SSH User Certificate
3404        pub async fn create(
3405            &self,
3406            req: &types::SSHUserCertificateCreate,
3407        ) -> Result<types::SSHUserCertificate, Error> {
3408            self.c
3409                .make_request("/ssh_user_certificates", reqwest::Method::POST, Some(req))
3410                .await
3411        }
3412
3413        /// Delete an SSH User Certificate
3414        pub async fn delete(&self, id: &str) -> Result<(), Error> {
3415            self.c
3416                .make_request(
3417                    &format!("/ssh_user_certificates/{id}", id = id),
3418                    reqwest::Method::DELETE,
3419                    None::<Option<()>>,
3420                )
3421                .await
3422        }
3423
3424        /// Get detailed information about an SSH User Certificate
3425        pub async fn get(&self, id: &str) -> Result<types::SSHUserCertificate, Error> {
3426            self.c
3427                .make_request(
3428                    &format!("/ssh_user_certificates/{id}", id = id),
3429                    reqwest::Method::GET,
3430                    None::<Option<()>>,
3431                )
3432                .await
3433        }
3434
3435        /// Get a single page without pagination. Prefer using list
3436        /// which will do pagination for you.
3437        pub(crate) async fn list_page(
3438            &self,
3439            req: &types::Paging,
3440        ) -> Result<types::SSHUserCertificateList, Error> {
3441            self.c
3442                .make_request("/ssh_user_certificates", reqwest::Method::GET, Some(req))
3443                .await
3444        }
3445
3446        /// List all SSH User Certificates issued on this account
3447        pub fn list(&self, req: types::Paging) -> List {
3448            List {
3449                c: std::sync::Arc::new(self.clone()),
3450                req,
3451            }
3452        }
3453
3454        /// Update an SSH User Certificate
3455        pub async fn update(
3456            &self,
3457            req: &types::SSHUserCertificateUpdate,
3458        ) -> Result<types::SSHUserCertificate, Error> {
3459            self.c
3460                .make_request(
3461                    &format!("/ssh_user_certificates/{id}", id = req.id),
3462                    reqwest::Method::PATCH,
3463                    Some(req),
3464                )
3465                .await
3466        }
3467    }
3468}
3469
3470/// TLS Certificates are pairs of x509 certificates and their matching private
3471///  key that can be used to terminate TLS traffic. TLS certificates are unused
3472///  until they are attached to a Domain. TLS Certificates may also be
3473///  provisioned by ngrok automatically for domains on which you have enabled
3474///  automated certificate provisioning.
3475pub mod tls_certificates {
3476    use crate::types;
3477    use crate::Error;
3478    use futures::{Stream, TryStreamExt};
3479
3480    /// TLS Certificates are pairs of x509 certificates and their matching private
3481    ///  key that can be used to terminate TLS traffic. TLS certificates are unused
3482    ///  until they are attached to a Domain. TLS Certificates may also be
3483    ///  provisioned by ngrok automatically for domains on which you have enabled
3484    ///  automated certificate provisioning.
3485    #[derive(Debug, Clone)]
3486    pub struct Client {
3487        c: crate::Client,
3488    }
3489    /// Provides streams of pages of [types::TLSCertificateList], or of [types::TLSCertificate] directly.
3490    pub struct List {
3491        c: std::sync::Arc<Client>,
3492        req: types::FilteredPaging,
3493    }
3494
3495    impl List {
3496        /// Iterate over [types::TLSCertificateList].
3497        ///
3498        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3499        /// documentation for more info on usage.
3500        pub async fn pages(
3501            self,
3502        ) -> impl Stream<Item = Result<types::TLSCertificateList, Error>> + Unpin {
3503            struct State {
3504                c: std::sync::Arc<Client>,
3505                req: types::FilteredPaging,
3506                init: bool,
3507                cur_uri: Option<String>,
3508            }
3509
3510            let s = State {
3511                c: self.c,
3512                req: self.req,
3513                init: true,
3514                cur_uri: None,
3515            };
3516
3517            Box::pin(futures::stream::unfold(s, |s| async move {
3518                let page_resp = match (s.init, &s.cur_uri) {
3519                    (true, _) => s.c.list_page(&s.req).await,
3520                    (false, None) => {
3521                        return None;
3522                    }
3523                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3524                };
3525                match page_resp {
3526                    Err(e) => Some((Err(e), s)),
3527                    Ok(page) => {
3528                        let next = page.next_page_uri.clone();
3529                        Some((
3530                            Ok(page),
3531                            State {
3532                                init: false,
3533                                cur_uri: next,
3534                                ..s
3535                            },
3536                        ))
3537                    }
3538                }
3539            }))
3540        }
3541
3542        /// Iterate over [types::TLSCertificate] items.
3543        ///
3544        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3545        /// documentation for more info on usage.
3546        pub async fn tls_certificates(
3547            self,
3548        ) -> impl Stream<Item = Result<types::TLSCertificate, Error>> + Unpin {
3549            self.pages()
3550                .await
3551                .map_ok(|page| futures::stream::iter(page.tls_certificates.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        /// Upload a new TLS certificate
3562        pub async fn create(
3563            &self,
3564            req: &types::TLSCertificateCreate,
3565        ) -> Result<types::TLSCertificate, Error> {
3566            self.c
3567                .make_request("/tls_certificates", reqwest::Method::POST, Some(req))
3568                .await
3569        }
3570
3571        /// Delete a TLS certificate
3572        pub async fn delete(&self, id: &str) -> Result<(), Error> {
3573            self.c
3574                .make_request(
3575                    &format!("/tls_certificates/{id}", id = id),
3576                    reqwest::Method::DELETE,
3577                    None::<Option<()>>,
3578                )
3579                .await
3580        }
3581
3582        /// Get detailed information about a TLS certificate
3583        pub async fn get(&self, id: &str) -> Result<types::TLSCertificate, Error> {
3584            self.c
3585                .make_request(
3586                    &format!("/tls_certificates/{id}", id = id),
3587                    reqwest::Method::GET,
3588                    None::<Option<()>>,
3589                )
3590                .await
3591        }
3592
3593        /// Get a single page without pagination. Prefer using list
3594        /// which will do pagination for you.
3595        pub(crate) async fn list_page(
3596            &self,
3597            req: &types::FilteredPaging,
3598        ) -> Result<types::TLSCertificateList, Error> {
3599            self.c
3600                .make_request("/tls_certificates", reqwest::Method::GET, Some(req))
3601                .await
3602        }
3603
3604        /// List all TLS certificates on this account
3605        pub fn list(&self, req: types::FilteredPaging) -> List {
3606            List {
3607                c: std::sync::Arc::new(self.clone()),
3608                req,
3609            }
3610        }
3611
3612        /// Update attributes of a TLS Certificate by ID
3613        pub async fn update(
3614            &self,
3615            req: &types::TLSCertificateUpdate,
3616        ) -> Result<types::TLSCertificate, Error> {
3617            self.c
3618                .make_request(
3619                    &format!("/tls_certificates/{id}", id = req.id),
3620                    reqwest::Method::PATCH,
3621                    Some(req),
3622                )
3623                .await
3624        }
3625    }
3626}
3627
3628/// Tunnels provide endpoints to access services exposed by a running ngrok
3629///  agent tunnel session or an SSH reverse tunnel session.
3630pub mod tunnels {
3631    use crate::types;
3632    use crate::Error;
3633    use futures::{Stream, TryStreamExt};
3634
3635    /// Tunnels provide endpoints to access services exposed by a running ngrok
3636    ///  agent tunnel session or an SSH reverse tunnel session.
3637    #[derive(Debug, Clone)]
3638    pub struct Client {
3639        c: crate::Client,
3640    }
3641    /// Provides streams of pages of [types::TunnelList], or of [types::Tunnel] directly.
3642    pub struct List {
3643        c: std::sync::Arc<Client>,
3644        req: types::Paging,
3645    }
3646
3647    impl List {
3648        /// Iterate over [types::TunnelList].
3649        ///
3650        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3651        /// documentation for more info on usage.
3652        pub async fn pages(self) -> impl Stream<Item = Result<types::TunnelList, Error>> + Unpin {
3653            struct State {
3654                c: std::sync::Arc<Client>,
3655                req: types::Paging,
3656                init: bool,
3657                cur_uri: Option<String>,
3658            }
3659
3660            let s = State {
3661                c: self.c,
3662                req: self.req,
3663                init: true,
3664                cur_uri: None,
3665            };
3666
3667            Box::pin(futures::stream::unfold(s, |s| async move {
3668                let page_resp = match (s.init, &s.cur_uri) {
3669                    (true, _) => s.c.list_page(&s.req).await,
3670                    (false, None) => {
3671                        return None;
3672                    }
3673                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3674                };
3675                match page_resp {
3676                    Err(e) => Some((Err(e), s)),
3677                    Ok(page) => {
3678                        let next = page.next_page_uri.clone();
3679                        Some((
3680                            Ok(page),
3681                            State {
3682                                init: false,
3683                                cur_uri: next,
3684                                ..s
3685                            },
3686                        ))
3687                    }
3688                }
3689            }))
3690        }
3691
3692        /// Iterate over [types::Tunnel] items.
3693        ///
3694        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3695        /// documentation for more info on usage.
3696        pub async fn tunnels(self) -> impl Stream<Item = Result<types::Tunnel, Error>> + Unpin {
3697            self.pages()
3698                .await
3699                .map_ok(|page| futures::stream::iter(page.tunnels.into_iter().map(Ok)))
3700                .try_flatten()
3701        }
3702    }
3703
3704    impl Client {
3705        pub fn new(c: crate::Client) -> Self {
3706            Self { c }
3707        }
3708
3709        /// Get a single page without pagination. Prefer using list
3710        /// which will do pagination for you.
3711        pub(crate) async fn list_page(
3712            &self,
3713            req: &types::Paging,
3714        ) -> Result<types::TunnelList, Error> {
3715            self.c
3716                .make_request("/tunnels", reqwest::Method::GET, Some(req))
3717                .await
3718        }
3719
3720        /// List all online tunnels currently running on the account.
3721        pub fn list(&self, req: types::Paging) -> List {
3722            List {
3723                c: std::sync::Arc::new(self.clone()),
3724                req,
3725            }
3726        }
3727
3728        /// Get the status of a tunnel by ID
3729        pub async fn get(&self, id: &str) -> Result<types::Tunnel, Error> {
3730            self.c
3731                .make_request(
3732                    &format!("/tunnels/{id}", id = id),
3733                    reqwest::Method::GET,
3734                    None::<Option<()>>,
3735                )
3736                .await
3737        }
3738    }
3739}
3740
3741/// Vaults is an api service for securely storing and managing sensitive data such
3742/// as secrets, credentials, and tokens.
3743pub mod vaults {
3744    use crate::types;
3745    use crate::Error;
3746    use futures::{Stream, TryStreamExt};
3747
3748    /// Vaults is an api service for securely storing and managing sensitive data such
3749    /// as secrets, credentials, and tokens.
3750    #[derive(Debug, Clone)]
3751    pub struct Client {
3752        c: crate::Client,
3753    }
3754    /// Provides streams of pages of [types::SecretList], or of [types::Secret] directly.
3755    pub struct GetSecretsByVault {
3756        c: std::sync::Arc<Client>,
3757        req: types::ItemPaging,
3758    }
3759
3760    impl GetSecretsByVault {
3761        /// Iterate over [types::SecretList].
3762        ///
3763        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3764        /// documentation for more info on usage.
3765        pub async fn pages(self) -> impl Stream<Item = Result<types::SecretList, Error>> + Unpin {
3766            struct State {
3767                c: std::sync::Arc<Client>,
3768                req: types::ItemPaging,
3769                init: bool,
3770                cur_uri: Option<String>,
3771            }
3772
3773            let s = State {
3774                c: self.c,
3775                req: self.req,
3776                init: true,
3777                cur_uri: None,
3778            };
3779
3780            Box::pin(futures::stream::unfold(s, |s| async move {
3781                let page_resp = match (s.init, &s.cur_uri) {
3782                    (true, _) => s.c.get_secrets_by_vault_page(&s.req).await,
3783                    (false, None) => {
3784                        return None;
3785                    }
3786                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3787                };
3788                match page_resp {
3789                    Err(e) => Some((Err(e), s)),
3790                    Ok(page) => {
3791                        let next = page.next_page_uri.clone();
3792                        Some((
3793                            Ok(page),
3794                            State {
3795                                init: false,
3796                                cur_uri: next,
3797                                ..s
3798                            },
3799                        ))
3800                    }
3801                }
3802            }))
3803        }
3804
3805        /// Iterate over [types::Secret] items.
3806        ///
3807        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3808        /// documentation for more info on usage.
3809        pub async fn secrets(self) -> impl Stream<Item = Result<types::Secret, Error>> + Unpin {
3810            self.pages()
3811                .await
3812                .map_ok(|page| futures::stream::iter(page.secrets.into_iter().map(Ok)))
3813                .try_flatten()
3814        }
3815    }
3816
3817    /// Provides streams of pages of [types::VaultList], or of [types::Vault] directly.
3818    pub struct List {
3819        c: std::sync::Arc<Client>,
3820        req: types::FilteredPaging,
3821    }
3822
3823    impl List {
3824        /// Iterate over [types::VaultList].
3825        ///
3826        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3827        /// documentation for more info on usage.
3828        pub async fn pages(self) -> impl Stream<Item = Result<types::VaultList, Error>> + Unpin {
3829            struct State {
3830                c: std::sync::Arc<Client>,
3831                req: types::FilteredPaging,
3832                init: bool,
3833                cur_uri: Option<String>,
3834            }
3835
3836            let s = State {
3837                c: self.c,
3838                req: self.req,
3839                init: true,
3840                cur_uri: None,
3841            };
3842
3843            Box::pin(futures::stream::unfold(s, |s| async move {
3844                let page_resp = match (s.init, &s.cur_uri) {
3845                    (true, _) => s.c.list_page(&s.req).await,
3846                    (false, None) => {
3847                        return None;
3848                    }
3849                    (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
3850                };
3851                match page_resp {
3852                    Err(e) => Some((Err(e), s)),
3853                    Ok(page) => {
3854                        let next = page.next_page_uri.clone();
3855                        Some((
3856                            Ok(page),
3857                            State {
3858                                init: false,
3859                                cur_uri: next,
3860                                ..s
3861                            },
3862                        ))
3863                    }
3864                }
3865            }))
3866        }
3867
3868        /// Iterate over [types::Vault] items.
3869        ///
3870        /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
3871        /// documentation for more info on usage.
3872        pub async fn vaults(self) -> impl Stream<Item = Result<types::Vault, Error>> + Unpin {
3873            self.pages()
3874                .await
3875                .map_ok(|page| futures::stream::iter(page.vaults.into_iter().map(Ok)))
3876                .try_flatten()
3877        }
3878    }
3879
3880    impl Client {
3881        pub fn new(c: crate::Client) -> Self {
3882            Self { c }
3883        }
3884
3885        /// Create a new Vault
3886        pub async fn create(&self, req: &types::VaultCreate) -> Result<types::Vault, Error> {
3887            self.c
3888                .make_request("/vaults", reqwest::Method::POST, Some(req))
3889                .await
3890        }
3891
3892        /// Update an existing Vault by ID
3893        pub async fn update(&self, req: &types::VaultUpdate) -> Result<types::Vault, Error> {
3894            self.c
3895                .make_request(
3896                    &format!("/vaults/{id}", id = req.id),
3897                    reqwest::Method::PATCH,
3898                    Some(req),
3899                )
3900                .await
3901        }
3902
3903        /// Delete a Vault
3904        pub async fn delete(&self, id: &str) -> Result<(), Error> {
3905            self.c
3906                .make_request(
3907                    &format!("/vaults/{id}", id = id),
3908                    reqwest::Method::DELETE,
3909                    None::<Option<()>>,
3910                )
3911                .await
3912        }
3913
3914        /// Get a Vault by ID
3915        pub async fn get(&self, id: &str) -> Result<types::Vault, Error> {
3916            self.c
3917                .make_request(
3918                    &format!("/vaults/{id}", id = id),
3919                    reqwest::Method::GET,
3920                    None::<Option<()>>,
3921                )
3922                .await
3923        }
3924
3925        /// Get a single page without pagination. Prefer using get_secrets_by_vault
3926        /// which will do pagination for you.
3927        pub(crate) async fn get_secrets_by_vault_page(
3928            &self,
3929            req: &types::ItemPaging,
3930        ) -> Result<types::SecretList, Error> {
3931            self.c
3932                .make_request(
3933                    &format!("/vaults/{id}/secrets", id = req.id),
3934                    reqwest::Method::GET,
3935                    Some(req),
3936                )
3937                .await
3938        }
3939
3940        /// Get Secrets by Vault ID
3941        pub fn get_secrets_by_vault(&self, req: types::ItemPaging) -> GetSecretsByVault {
3942            GetSecretsByVault {
3943                c: std::sync::Arc::new(self.clone()),
3944                req,
3945            }
3946        }
3947
3948        /// Get a single page without pagination. Prefer using list
3949        /// which will do pagination for you.
3950        pub(crate) async fn list_page(
3951            &self,
3952            req: &types::FilteredPaging,
3953        ) -> Result<types::VaultList, Error> {
3954            self.c
3955                .make_request("/vaults", reqwest::Method::GET, Some(req))
3956                .await
3957        }
3958
3959        /// List all Vaults owned by account
3960        pub fn list(&self, req: types::FilteredPaging) -> List {
3961            List {
3962                c: std::sync::Arc::new(self.clone()),
3963                req,
3964            }
3965        }
3966    }
3967}
3968impl Client {
3969    pub fn abuse_reports(&self) -> abuse_reports::Client {
3970        abuse_reports::Client::new(self.clone())
3971    }
3972    pub fn agent_ingresses(&self) -> agent_ingresses::Client {
3973        agent_ingresses::Client::new(self.clone())
3974    }
3975    pub fn api_keys(&self) -> api_keys::Client {
3976        api_keys::Client::new(self.clone())
3977    }
3978    pub fn application_sessions(&self) -> application_sessions::Client {
3979        application_sessions::Client::new(self.clone())
3980    }
3981    pub fn application_users(&self) -> application_users::Client {
3982        application_users::Client::new(self.clone())
3983    }
3984    pub fn tunnel_sessions(&self) -> tunnel_sessions::Client {
3985        tunnel_sessions::Client::new(self.clone())
3986    }
3987    pub fn bot_users(&self) -> bot_users::Client {
3988        bot_users::Client::new(self.clone())
3989    }
3990    pub fn certificate_authorities(&self) -> certificate_authorities::Client {
3991        certificate_authorities::Client::new(self.clone())
3992    }
3993    pub fn credentials(&self) -> credentials::Client {
3994        credentials::Client::new(self.clone())
3995    }
3996    pub fn endpoints(&self) -> endpoints::Client {
3997        endpoints::Client::new(self.clone())
3998    }
3999    pub fn event_destinations(&self) -> event_destinations::Client {
4000        event_destinations::Client::new(self.clone())
4001    }
4002    pub fn event_subscriptions(&self) -> event_subscriptions::Client {
4003        event_subscriptions::Client::new(self.clone())
4004    }
4005    pub fn event_sources(&self) -> event_sources::Client {
4006        event_sources::Client::new(self.clone())
4007    }
4008    pub fn ip_policies(&self) -> ip_policies::Client {
4009        ip_policies::Client::new(self.clone())
4010    }
4011    pub fn ip_policy_rules(&self) -> ip_policy_rules::Client {
4012        ip_policy_rules::Client::new(self.clone())
4013    }
4014    pub fn ip_restrictions(&self) -> ip_restrictions::Client {
4015        ip_restrictions::Client::new(self.clone())
4016    }
4017    pub fn reserved_addrs(&self) -> reserved_addrs::Client {
4018        reserved_addrs::Client::new(self.clone())
4019    }
4020    pub fn reserved_domains(&self) -> reserved_domains::Client {
4021        reserved_domains::Client::new(self.clone())
4022    }
4023    pub fn secrets(&self) -> secrets::Client {
4024        secrets::Client::new(self.clone())
4025    }
4026    pub fn service_users(&self) -> service_users::Client {
4027        service_users::Client::new(self.clone())
4028    }
4029    pub fn ssh_certificate_authorities(&self) -> ssh_certificate_authorities::Client {
4030        ssh_certificate_authorities::Client::new(self.clone())
4031    }
4032    pub fn ssh_credentials(&self) -> ssh_credentials::Client {
4033        ssh_credentials::Client::new(self.clone())
4034    }
4035    pub fn ssh_host_certificates(&self) -> ssh_host_certificates::Client {
4036        ssh_host_certificates::Client::new(self.clone())
4037    }
4038    pub fn ssh_user_certificates(&self) -> ssh_user_certificates::Client {
4039        ssh_user_certificates::Client::new(self.clone())
4040    }
4041    pub fn tls_certificates(&self) -> tls_certificates::Client {
4042        tls_certificates::Client::new(self.clone())
4043    }
4044    pub fn tunnels(&self) -> tunnels::Client {
4045        tunnels::Client::new(self.clone())
4046    }
4047    pub fn vaults(&self) -> vaults::Client {
4048        vaults::Client::new(self.clone())
4049    }
4050}
4051
4052pub mod backends {
4053    pub struct Client {
4054        c: crate::Client,
4055    }
4056
4057    impl Client {
4058        pub fn new(c: crate::Client) -> Self {
4059            Self { c }
4060        }
4061    }
4062
4063    /// A Failover backend defines failover behavior within a list of referenced
4064    ///  backends. Traffic is sent to the first backend in the list. If that backend
4065    ///  is offline or no connection can be established, ngrok attempts to connect to
4066    ///  the next backend in the list until one is successful.
4067    pub mod failover {
4068        use crate::types;
4069        use crate::Error;
4070        use futures::{Stream, TryStreamExt};
4071
4072        /// A Failover backend defines failover behavior within a list of referenced
4073        ///  backends. Traffic is sent to the first backend in the list. If that backend
4074        ///  is offline or no connection can be established, ngrok attempts to connect to
4075        ///  the next backend in the list until one is successful.
4076        #[derive(Debug, Clone)]
4077        pub struct Client {
4078            c: crate::Client,
4079        }
4080        /// Provides streams of pages of [types::FailoverBackendList], or of [types::FailoverBackend] directly.
4081        pub struct List {
4082            c: std::sync::Arc<Client>,
4083            req: types::Paging,
4084        }
4085
4086        impl List {
4087            /// Iterate over [types::FailoverBackendList].
4088            ///
4089            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4090            /// documentation for more info on usage.
4091            pub async fn pages(
4092                self,
4093            ) -> impl Stream<Item = Result<types::FailoverBackendList, Error>> + Unpin {
4094                struct State {
4095                    c: std::sync::Arc<Client>,
4096                    req: types::Paging,
4097                    init: bool,
4098                    cur_uri: Option<String>,
4099                }
4100
4101                let s = State {
4102                    c: self.c,
4103                    req: self.req,
4104                    init: true,
4105                    cur_uri: None,
4106                };
4107
4108                Box::pin(futures::stream::unfold(s, |s| async move {
4109                    let page_resp = match (s.init, &s.cur_uri) {
4110                        (true, _) => s.c.list_page(&s.req).await,
4111                        (false, None) => {
4112                            return None;
4113                        }
4114                        (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4115                    };
4116                    match page_resp {
4117                        Err(e) => Some((Err(e), s)),
4118                        Ok(page) => {
4119                            let next = page.next_page_uri.clone();
4120                            Some((
4121                                Ok(page),
4122                                State {
4123                                    init: false,
4124                                    cur_uri: next,
4125                                    ..s
4126                                },
4127                            ))
4128                        }
4129                    }
4130                }))
4131            }
4132
4133            /// Iterate over [types::FailoverBackend] items.
4134            ///
4135            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4136            /// documentation for more info on usage.
4137            pub async fn backends(
4138                self,
4139            ) -> impl Stream<Item = Result<types::FailoverBackend, Error>> + Unpin {
4140                self.pages()
4141                    .await
4142                    .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4143                    .try_flatten()
4144            }
4145        }
4146
4147        impl Client {
4148            pub fn new(c: crate::Client) -> Self {
4149                Self { c }
4150            }
4151
4152            /// Create a new Failover backend
4153            pub async fn create(
4154                &self,
4155                req: &types::FailoverBackendCreate,
4156            ) -> Result<types::FailoverBackend, Error> {
4157                self.c
4158                    .make_request("/backends/failover", reqwest::Method::POST, Some(req))
4159                    .await
4160            }
4161
4162            /// Delete a Failover backend by ID.
4163            pub async fn delete(&self, id: &str) -> Result<(), Error> {
4164                self.c
4165                    .make_request(
4166                        &format!("/backends/failover/{id}", id = id),
4167                        reqwest::Method::DELETE,
4168                        None::<Option<()>>,
4169                    )
4170                    .await
4171            }
4172
4173            /// Get detailed information about a Failover backend by ID
4174            pub async fn get(&self, id: &str) -> Result<types::FailoverBackend, Error> {
4175                self.c
4176                    .make_request(
4177                        &format!("/backends/failover/{id}", id = id),
4178                        reqwest::Method::GET,
4179                        None::<Option<()>>,
4180                    )
4181                    .await
4182            }
4183
4184            /// Get a single page without pagination. Prefer using list
4185            /// which will do pagination for you.
4186            pub(crate) async fn list_page(
4187                &self,
4188                req: &types::Paging,
4189            ) -> Result<types::FailoverBackendList, Error> {
4190                self.c
4191                    .make_request("/backends/failover", reqwest::Method::GET, Some(req))
4192                    .await
4193            }
4194
4195            /// List all Failover backends on this account
4196            pub fn list(&self, req: types::Paging) -> List {
4197                List {
4198                    c: std::sync::Arc::new(self.clone()),
4199                    req,
4200                }
4201            }
4202
4203            /// Update Failover backend by ID
4204            pub async fn update(
4205                &self,
4206                req: &types::FailoverBackendUpdate,
4207            ) -> Result<types::FailoverBackend, Error> {
4208                self.c
4209                    .make_request(
4210                        &format!("/backends/failover/{id}", id = req.id),
4211                        reqwest::Method::PATCH,
4212                        Some(req),
4213                    )
4214                    .await
4215            }
4216        }
4217    }
4218
4219    pub mod http_response {
4220        use crate::types;
4221        use crate::Error;
4222        use futures::{Stream, TryStreamExt};
4223
4224        #[derive(Debug, Clone)]
4225        pub struct Client {
4226            c: crate::Client,
4227        }
4228        /// Provides streams of pages of [types::HTTPResponseBackendList], or of [types::HTTPResponseBackend] directly.
4229        pub struct List {
4230            c: std::sync::Arc<Client>,
4231            req: types::Paging,
4232        }
4233
4234        impl List {
4235            /// Iterate over [types::HTTPResponseBackendList].
4236            ///
4237            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4238            /// documentation for more info on usage.
4239            pub async fn pages(
4240                self,
4241            ) -> impl Stream<Item = Result<types::HTTPResponseBackendList, Error>> + Unpin
4242            {
4243                struct State {
4244                    c: std::sync::Arc<Client>,
4245                    req: types::Paging,
4246                    init: bool,
4247                    cur_uri: Option<String>,
4248                }
4249
4250                let s = State {
4251                    c: self.c,
4252                    req: self.req,
4253                    init: true,
4254                    cur_uri: None,
4255                };
4256
4257                Box::pin(futures::stream::unfold(s, |s| async move {
4258                    let page_resp = match (s.init, &s.cur_uri) {
4259                        (true, _) => s.c.list_page(&s.req).await,
4260                        (false, None) => {
4261                            return None;
4262                        }
4263                        (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4264                    };
4265                    match page_resp {
4266                        Err(e) => Some((Err(e), s)),
4267                        Ok(page) => {
4268                            let next = page.next_page_uri.clone();
4269                            Some((
4270                                Ok(page),
4271                                State {
4272                                    init: false,
4273                                    cur_uri: next,
4274                                    ..s
4275                                },
4276                            ))
4277                        }
4278                    }
4279                }))
4280            }
4281
4282            /// Iterate over [types::HTTPResponseBackend] items.
4283            ///
4284            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4285            /// documentation for more info on usage.
4286            pub async fn backends(
4287                self,
4288            ) -> impl Stream<Item = Result<types::HTTPResponseBackend, Error>> + Unpin {
4289                self.pages()
4290                    .await
4291                    .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4292                    .try_flatten()
4293            }
4294        }
4295
4296        impl Client {
4297            pub fn new(c: crate::Client) -> Self {
4298                Self { c }
4299            }
4300
4301            pub async fn create(
4302                &self,
4303                req: &types::HTTPResponseBackendCreate,
4304            ) -> Result<types::HTTPResponseBackend, Error> {
4305                self.c
4306                    .make_request("/backends/http_response", reqwest::Method::POST, Some(req))
4307                    .await
4308            }
4309
4310            pub async fn delete(&self, id: &str) -> Result<(), Error> {
4311                self.c
4312                    .make_request(
4313                        &format!("/backends/http_response/{id}", id = id),
4314                        reqwest::Method::DELETE,
4315                        None::<Option<()>>,
4316                    )
4317                    .await
4318            }
4319
4320            pub async fn get(&self, id: &str) -> Result<types::HTTPResponseBackend, Error> {
4321                self.c
4322                    .make_request(
4323                        &format!("/backends/http_response/{id}", id = id),
4324                        reqwest::Method::GET,
4325                        None::<Option<()>>,
4326                    )
4327                    .await
4328            }
4329
4330            /// Get a single page without pagination. Prefer using list
4331            /// which will do pagination for you.
4332            pub(crate) async fn list_page(
4333                &self,
4334                req: &types::Paging,
4335            ) -> Result<types::HTTPResponseBackendList, Error> {
4336                self.c
4337                    .make_request("/backends/http_response", reqwest::Method::GET, Some(req))
4338                    .await
4339            }
4340
4341            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(
4349                &self,
4350                req: &types::HTTPResponseBackendUpdate,
4351            ) -> Result<types::HTTPResponseBackend, Error> {
4352                self.c
4353                    .make_request(
4354                        &format!("/backends/http_response/{id}", id = req.id),
4355                        reqwest::Method::PATCH,
4356                        Some(req),
4357                    )
4358                    .await
4359            }
4360        }
4361    }
4362
4363    /// A static backend sends traffic to a TCP address (hostname and port) that
4364    ///  is reachable on the public internet.
4365    pub mod static_address {
4366        use crate::types;
4367        use crate::Error;
4368        use futures::{Stream, TryStreamExt};
4369
4370        /// A static backend sends traffic to a TCP address (hostname and port) that
4371        ///  is reachable on the public internet.
4372        #[derive(Debug, Clone)]
4373        pub struct Client {
4374            c: crate::Client,
4375        }
4376        /// Provides streams of pages of [types::StaticBackendList], or of [types::StaticBackend] directly.
4377        pub struct List {
4378            c: std::sync::Arc<Client>,
4379            req: types::Paging,
4380        }
4381
4382        impl List {
4383            /// Iterate over [types::StaticBackendList].
4384            ///
4385            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4386            /// documentation for more info on usage.
4387            pub async fn pages(
4388                self,
4389            ) -> impl Stream<Item = Result<types::StaticBackendList, Error>> + Unpin {
4390                struct State {
4391                    c: std::sync::Arc<Client>,
4392                    req: types::Paging,
4393                    init: bool,
4394                    cur_uri: Option<String>,
4395                }
4396
4397                let s = State {
4398                    c: self.c,
4399                    req: self.req,
4400                    init: true,
4401                    cur_uri: None,
4402                };
4403
4404                Box::pin(futures::stream::unfold(s, |s| async move {
4405                    let page_resp = match (s.init, &s.cur_uri) {
4406                        (true, _) => s.c.list_page(&s.req).await,
4407                        (false, None) => {
4408                            return None;
4409                        }
4410                        (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4411                    };
4412                    match page_resp {
4413                        Err(e) => Some((Err(e), s)),
4414                        Ok(page) => {
4415                            let next = page.next_page_uri.clone();
4416                            Some((
4417                                Ok(page),
4418                                State {
4419                                    init: false,
4420                                    cur_uri: next,
4421                                    ..s
4422                                },
4423                            ))
4424                        }
4425                    }
4426                }))
4427            }
4428
4429            /// Iterate over [types::StaticBackend] items.
4430            ///
4431            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4432            /// documentation for more info on usage.
4433            pub async fn backends(
4434                self,
4435            ) -> impl Stream<Item = Result<types::StaticBackend, Error>> + Unpin {
4436                self.pages()
4437                    .await
4438                    .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4439                    .try_flatten()
4440            }
4441        }
4442
4443        impl Client {
4444            pub fn new(c: crate::Client) -> Self {
4445                Self { c }
4446            }
4447
4448            /// Create a new static backend
4449            pub async fn create(
4450                &self,
4451                req: &types::StaticBackendCreate,
4452            ) -> Result<types::StaticBackend, Error> {
4453                self.c
4454                    .make_request("/backends/static", reqwest::Method::POST, Some(req))
4455                    .await
4456            }
4457
4458            /// Delete a static backend by ID.
4459            pub async fn delete(&self, id: &str) -> Result<(), Error> {
4460                self.c
4461                    .make_request(
4462                        &format!("/backends/static/{id}", id = id),
4463                        reqwest::Method::DELETE,
4464                        None::<Option<()>>,
4465                    )
4466                    .await
4467            }
4468
4469            /// Get detailed information about a static backend by ID
4470            pub async fn get(&self, id: &str) -> Result<types::StaticBackend, Error> {
4471                self.c
4472                    .make_request(
4473                        &format!("/backends/static/{id}", id = id),
4474                        reqwest::Method::GET,
4475                        None::<Option<()>>,
4476                    )
4477                    .await
4478            }
4479
4480            /// Get a single page without pagination. Prefer using list
4481            /// which will do pagination for you.
4482            pub(crate) async fn list_page(
4483                &self,
4484                req: &types::Paging,
4485            ) -> Result<types::StaticBackendList, Error> {
4486                self.c
4487                    .make_request("/backends/static", reqwest::Method::GET, Some(req))
4488                    .await
4489            }
4490
4491            /// List all static backends on this account
4492            pub fn list(&self, req: types::Paging) -> List {
4493                List {
4494                    c: std::sync::Arc::new(self.clone()),
4495                    req,
4496                }
4497            }
4498
4499            /// Update static backend by ID
4500            pub async fn update(
4501                &self,
4502                req: &types::StaticBackendUpdate,
4503            ) -> Result<types::StaticBackend, Error> {
4504                self.c
4505                    .make_request(
4506                        &format!("/backends/static/{id}", id = req.id),
4507                        reqwest::Method::PATCH,
4508                        Some(req),
4509                    )
4510                    .await
4511            }
4512        }
4513    }
4514
4515    /// A Tunnel Group Backend balances traffic among all online tunnels that match
4516    ///  a label selector.
4517    pub mod tunnel_group {
4518        use crate::types;
4519        use crate::Error;
4520        use futures::{Stream, TryStreamExt};
4521
4522        /// A Tunnel Group Backend balances traffic among all online tunnels that match
4523        ///  a label selector.
4524        #[derive(Debug, Clone)]
4525        pub struct Client {
4526            c: crate::Client,
4527        }
4528        /// Provides streams of pages of [types::TunnelGroupBackendList], or of [types::TunnelGroupBackend] directly.
4529        pub struct List {
4530            c: std::sync::Arc<Client>,
4531            req: types::Paging,
4532        }
4533
4534        impl List {
4535            /// Iterate over [types::TunnelGroupBackendList].
4536            ///
4537            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4538            /// documentation for more info on usage.
4539            pub async fn pages(
4540                self,
4541            ) -> impl Stream<Item = Result<types::TunnelGroupBackendList, Error>> + Unpin
4542            {
4543                struct State {
4544                    c: std::sync::Arc<Client>,
4545                    req: types::Paging,
4546                    init: bool,
4547                    cur_uri: Option<String>,
4548                }
4549
4550                let s = State {
4551                    c: self.c,
4552                    req: self.req,
4553                    init: true,
4554                    cur_uri: None,
4555                };
4556
4557                Box::pin(futures::stream::unfold(s, |s| async move {
4558                    let page_resp = match (s.init, &s.cur_uri) {
4559                        (true, _) => s.c.list_page(&s.req).await,
4560                        (false, None) => {
4561                            return None;
4562                        }
4563                        (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4564                    };
4565                    match page_resp {
4566                        Err(e) => Some((Err(e), s)),
4567                        Ok(page) => {
4568                            let next = page.next_page_uri.clone();
4569                            Some((
4570                                Ok(page),
4571                                State {
4572                                    init: false,
4573                                    cur_uri: next,
4574                                    ..s
4575                                },
4576                            ))
4577                        }
4578                    }
4579                }))
4580            }
4581
4582            /// Iterate over [types::TunnelGroupBackend] items.
4583            ///
4584            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4585            /// documentation for more info on usage.
4586            pub async fn backends(
4587                self,
4588            ) -> impl Stream<Item = Result<types::TunnelGroupBackend, Error>> + Unpin {
4589                self.pages()
4590                    .await
4591                    .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4592                    .try_flatten()
4593            }
4594        }
4595
4596        impl Client {
4597            pub fn new(c: crate::Client) -> Self {
4598                Self { c }
4599            }
4600
4601            /// Create a new TunnelGroup backend
4602            pub async fn create(
4603                &self,
4604                req: &types::TunnelGroupBackendCreate,
4605            ) -> Result<types::TunnelGroupBackend, Error> {
4606                self.c
4607                    .make_request("/backends/tunnel_group", reqwest::Method::POST, Some(req))
4608                    .await
4609            }
4610
4611            /// Delete a TunnelGroup backend by ID.
4612            pub async fn delete(&self, id: &str) -> Result<(), Error> {
4613                self.c
4614                    .make_request(
4615                        &format!("/backends/tunnel_group/{id}", id = id),
4616                        reqwest::Method::DELETE,
4617                        None::<Option<()>>,
4618                    )
4619                    .await
4620            }
4621
4622            /// Get detailed information about a TunnelGroup backend by ID
4623            pub async fn get(&self, id: &str) -> Result<types::TunnelGroupBackend, Error> {
4624                self.c
4625                    .make_request(
4626                        &format!("/backends/tunnel_group/{id}", id = id),
4627                        reqwest::Method::GET,
4628                        None::<Option<()>>,
4629                    )
4630                    .await
4631            }
4632
4633            /// Get a single page without pagination. Prefer using list
4634            /// which will do pagination for you.
4635            pub(crate) async fn list_page(
4636                &self,
4637                req: &types::Paging,
4638            ) -> Result<types::TunnelGroupBackendList, Error> {
4639                self.c
4640                    .make_request("/backends/tunnel_group", reqwest::Method::GET, Some(req))
4641                    .await
4642            }
4643
4644            /// List all TunnelGroup backends on this account
4645            pub fn list(&self, req: types::Paging) -> List {
4646                List {
4647                    c: std::sync::Arc::new(self.clone()),
4648                    req,
4649                }
4650            }
4651
4652            /// Update TunnelGroup backend by ID
4653            pub async fn update(
4654                &self,
4655                req: &types::TunnelGroupBackendUpdate,
4656            ) -> Result<types::TunnelGroupBackend, Error> {
4657                self.c
4658                    .make_request(
4659                        &format!("/backends/tunnel_group/{id}", id = req.id),
4660                        reqwest::Method::PATCH,
4661                        Some(req),
4662                    )
4663                    .await
4664            }
4665        }
4666    }
4667
4668    /// A Weighted Backend balances traffic among the referenced backends. Traffic
4669    ///  is assigned proportionally to each based on its weight. The percentage of
4670    ///  traffic is calculated by dividing a backend's weight by the sum of all
4671    ///  weights.
4672    pub mod weighted {
4673        use crate::types;
4674        use crate::Error;
4675        use futures::{Stream, TryStreamExt};
4676
4677        /// A Weighted Backend balances traffic among the referenced backends. Traffic
4678        ///  is assigned proportionally to each based on its weight. The percentage of
4679        ///  traffic is calculated by dividing a backend's weight by the sum of all
4680        ///  weights.
4681        #[derive(Debug, Clone)]
4682        pub struct Client {
4683            c: crate::Client,
4684        }
4685        /// Provides streams of pages of [types::WeightedBackendList], or of [types::WeightedBackend] directly.
4686        pub struct List {
4687            c: std::sync::Arc<Client>,
4688            req: types::Paging,
4689        }
4690
4691        impl List {
4692            /// Iterate over [types::WeightedBackendList].
4693            ///
4694            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4695            /// documentation for more info on usage.
4696            pub async fn pages(
4697                self,
4698            ) -> impl Stream<Item = Result<types::WeightedBackendList, Error>> + Unpin {
4699                struct State {
4700                    c: std::sync::Arc<Client>,
4701                    req: types::Paging,
4702                    init: bool,
4703                    cur_uri: Option<String>,
4704                }
4705
4706                let s = State {
4707                    c: self.c,
4708                    req: self.req,
4709                    init: true,
4710                    cur_uri: None,
4711                };
4712
4713                Box::pin(futures::stream::unfold(s, |s| async move {
4714                    let page_resp = match (s.init, &s.cur_uri) {
4715                        (true, _) => s.c.list_page(&s.req).await,
4716                        (false, None) => {
4717                            return None;
4718                        }
4719                        (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
4720                    };
4721                    match page_resp {
4722                        Err(e) => Some((Err(e), s)),
4723                        Ok(page) => {
4724                            let next = page.next_page_uri.clone();
4725                            Some((
4726                                Ok(page),
4727                                State {
4728                                    init: false,
4729                                    cur_uri: next,
4730                                    ..s
4731                                },
4732                            ))
4733                        }
4734                    }
4735                }))
4736            }
4737
4738            /// Iterate over [types::WeightedBackend] items.
4739            ///
4740            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4741            /// documentation for more info on usage.
4742            pub async fn backends(
4743                self,
4744            ) -> impl Stream<Item = Result<types::WeightedBackend, Error>> + Unpin {
4745                self.pages()
4746                    .await
4747                    .map_ok(|page| futures::stream::iter(page.backends.into_iter().map(Ok)))
4748                    .try_flatten()
4749            }
4750        }
4751
4752        impl Client {
4753            pub fn new(c: crate::Client) -> Self {
4754                Self { c }
4755            }
4756
4757            /// Create a new Weighted backend
4758            pub async fn create(
4759                &self,
4760                req: &types::WeightedBackendCreate,
4761            ) -> Result<types::WeightedBackend, Error> {
4762                self.c
4763                    .make_request("/backends/weighted", reqwest::Method::POST, Some(req))
4764                    .await
4765            }
4766
4767            /// Delete a Weighted backend by ID.
4768            pub async fn delete(&self, id: &str) -> Result<(), Error> {
4769                self.c
4770                    .make_request(
4771                        &format!("/backends/weighted/{id}", id = id),
4772                        reqwest::Method::DELETE,
4773                        None::<Option<()>>,
4774                    )
4775                    .await
4776            }
4777
4778            /// Get detailed information about a Weighted backend by ID
4779            pub async fn get(&self, id: &str) -> Result<types::WeightedBackend, Error> {
4780                self.c
4781                    .make_request(
4782                        &format!("/backends/weighted/{id}", id = id),
4783                        reqwest::Method::GET,
4784                        None::<Option<()>>,
4785                    )
4786                    .await
4787            }
4788
4789            /// Get a single page without pagination. Prefer using list
4790            /// which will do pagination for you.
4791            pub(crate) async fn list_page(
4792                &self,
4793                req: &types::Paging,
4794            ) -> Result<types::WeightedBackendList, Error> {
4795                self.c
4796                    .make_request("/backends/weighted", reqwest::Method::GET, Some(req))
4797                    .await
4798            }
4799
4800            /// List all Weighted backends on this account
4801            pub fn list(&self, req: types::Paging) -> List {
4802                List {
4803                    c: std::sync::Arc::new(self.clone()),
4804                    req,
4805                }
4806            }
4807
4808            /// Update Weighted backend by ID
4809            pub async fn update(
4810                &self,
4811                req: &types::WeightedBackendUpdate,
4812            ) -> Result<types::WeightedBackend, Error> {
4813                self.c
4814                    .make_request(
4815                        &format!("/backends/weighted/{id}", id = req.id),
4816                        reqwest::Method::PATCH,
4817                        Some(req),
4818                    )
4819                    .await
4820            }
4821        }
4822    }
4823    impl Client {
4824        pub fn failover(&self) -> failover::Client {
4825            failover::Client::new(self.c.clone())
4826        }
4827        pub fn http_response(&self) -> http_response::Client {
4828            http_response::Client::new(self.c.clone())
4829        }
4830        pub fn static_address(&self) -> static_address::Client {
4831            static_address::Client::new(self.c.clone())
4832        }
4833        pub fn tunnel_group(&self) -> tunnel_group::Client {
4834            tunnel_group::Client::new(self.c.clone())
4835        }
4836        pub fn weighted(&self) -> weighted::Client {
4837            weighted::Client::new(self.c.clone())
4838        }
4839    }
4840}
4841
4842pub mod edges {
4843    pub struct Client {
4844        c: crate::Client,
4845    }
4846
4847    impl Client {
4848        pub fn new(c: crate::Client) -> Self {
4849            Self { c }
4850        }
4851    }
4852
4853    pub mod https_routes {
4854        use crate::types;
4855        use crate::Error;
4856
4857        #[derive(Debug, Clone)]
4858        pub struct Client {
4859            c: crate::Client,
4860        }
4861
4862        impl Client {
4863            pub fn new(c: crate::Client) -> Self {
4864                Self { c }
4865            }
4866
4867            /// Create an HTTPS Edge Route
4868            pub async fn create(
4869                &self,
4870                req: &types::HTTPSEdgeRouteCreate,
4871            ) -> Result<types::HTTPSEdgeRoute, Error> {
4872                self.c
4873                    .make_request(
4874                        &format!("/edges/https/{edge_id}/routes", edge_id = req.edge_id),
4875                        reqwest::Method::POST,
4876                        Some(req),
4877                    )
4878                    .await
4879            }
4880
4881            /// Get an HTTPS Edge Route by ID
4882            pub async fn get(
4883                &self,
4884                req: &types::EdgeRouteItem,
4885            ) -> Result<types::HTTPSEdgeRoute, Error> {
4886                self.c
4887                    .make_request(
4888                        &format!(
4889                            "/edges/https/{edge_id}/routes/{id}",
4890                            edge_id = req.edge_id,
4891                            id = req.id
4892                        ),
4893                        reqwest::Method::GET,
4894                        None::<Option<()>>,
4895                    )
4896                    .await
4897            }
4898
4899            /// Updates an HTTPS Edge Route by ID. If a module is not specified in the update,
4900            /// it will not be modified. However, each module configuration that is specified
4901            /// will completely replace the existing value. There is no way to delete an
4902            /// existing module via this API, instead use the delete module API.
4903            pub async fn update(
4904                &self,
4905                req: &types::HTTPSEdgeRouteUpdate,
4906            ) -> Result<types::HTTPSEdgeRoute, Error> {
4907                self.c
4908                    .make_request(
4909                        &format!(
4910                            "/edges/https/{edge_id}/routes/{id}",
4911                            edge_id = req.edge_id,
4912                            id = req.id
4913                        ),
4914                        reqwest::Method::PATCH,
4915                        Some(req),
4916                    )
4917                    .await
4918            }
4919
4920            /// Delete an HTTPS Edge Route by ID
4921            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
4922                self.c
4923                    .make_request(
4924                        &format!(
4925                            "/edges/https/{edge_id}/routes/{id}",
4926                            edge_id = req.edge_id,
4927                            id = req.id
4928                        ),
4929                        reqwest::Method::DELETE,
4930                        None::<Option<()>>,
4931                    )
4932                    .await
4933            }
4934        }
4935    }
4936
4937    pub mod https {
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        /// Provides streams of pages of [types::HTTPSEdgeList], or of [types::HTTPSEdge] directly.
4947        pub struct List {
4948            c: std::sync::Arc<Client>,
4949            req: types::Paging,
4950        }
4951
4952        impl List {
4953            /// Iterate over [types::HTTPSEdgeList].
4954            ///
4955            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
4956            /// documentation for more info on usage.
4957            pub async fn pages(
4958                self,
4959            ) -> impl Stream<Item = Result<types::HTTPSEdgeList, 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            /// Iterate over [types::HTTPSEdge] items.
5000            ///
5001            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
5002            /// documentation for more info on usage.
5003            pub async fn https_edges(
5004                self,
5005            ) -> impl Stream<Item = Result<types::HTTPSEdge, Error>> + Unpin {
5006                self.pages()
5007                    .await
5008                    .map_ok(|page| futures::stream::iter(page.https_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            /// Create an HTTPS Edge
5019            pub async fn create(
5020                &self,
5021                req: &types::HTTPSEdgeCreate,
5022            ) -> Result<types::HTTPSEdge, Error> {
5023                self.c
5024                    .make_request("/edges/https", reqwest::Method::POST, Some(req))
5025                    .await
5026            }
5027
5028            /// Get an HTTPS Edge by ID
5029            pub async fn get(&self, id: &str) -> Result<types::HTTPSEdge, Error> {
5030                self.c
5031                    .make_request(
5032                        &format!("/edges/https/{id}", id = id),
5033                        reqwest::Method::GET,
5034                        None::<Option<()>>,
5035                    )
5036                    .await
5037            }
5038
5039            /// Get a single page without pagination. Prefer using list
5040            /// which will do pagination for you.
5041            pub(crate) async fn list_page(
5042                &self,
5043                req: &types::Paging,
5044            ) -> Result<types::HTTPSEdgeList, Error> {
5045                self.c
5046                    .make_request("/edges/https", reqwest::Method::GET, Some(req))
5047                    .await
5048            }
5049
5050            /// Returns a list of all HTTPS Edges on this account
5051            pub fn list(&self, req: types::Paging) -> List {
5052                List {
5053                    c: std::sync::Arc::new(self.clone()),
5054                    req,
5055                }
5056            }
5057
5058            /// Updates an HTTPS Edge by ID. If a module is not specified in the update, it will
5059            /// not be modified. However, each module configuration that is specified will
5060            /// completely replace the existing value. There is no way to delete an existing
5061            /// module via this API, instead use the delete module API.
5062            pub async fn update(
5063                &self,
5064                req: &types::HTTPSEdgeUpdate,
5065            ) -> Result<types::HTTPSEdge, Error> {
5066                self.c
5067                    .make_request(
5068                        &format!("/edges/https/{id}", id = req.id),
5069                        reqwest::Method::PATCH,
5070                        Some(req),
5071                    )
5072                    .await
5073            }
5074
5075            /// Delete an HTTPS Edge by ID
5076            pub async fn delete(&self, id: &str) -> Result<(), Error> {
5077                self.c
5078                    .make_request(
5079                        &format!("/edges/https/{id}", id = id),
5080                        reqwest::Method::DELETE,
5081                        None::<Option<()>>,
5082                    )
5083                    .await
5084            }
5085        }
5086    }
5087
5088    pub mod tcp {
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        /// Provides streams of pages of [types::TCPEdgeList], or of [types::TCPEdge] directly.
5098        pub struct List {
5099            c: std::sync::Arc<Client>,
5100            req: types::Paging,
5101        }
5102
5103        impl List {
5104            /// Iterate over [types::TCPEdgeList].
5105            ///
5106            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
5107            /// documentation for more info on usage.
5108            pub async fn pages(
5109                self,
5110            ) -> impl Stream<Item = Result<types::TCPEdgeList, 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            /// Iterate over [types::TCPEdge] items.
5151            ///
5152            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
5153            /// documentation for more info on usage.
5154            pub async fn tcp_edges(
5155                self,
5156            ) -> impl Stream<Item = Result<types::TCPEdge, Error>> + Unpin {
5157                self.pages()
5158                    .await
5159                    .map_ok(|page| futures::stream::iter(page.tcp_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            /// Create a TCP Edge
5170            pub async fn create(
5171                &self,
5172                req: &types::TCPEdgeCreate,
5173            ) -> Result<types::TCPEdge, Error> {
5174                self.c
5175                    .make_request("/edges/tcp", reqwest::Method::POST, Some(req))
5176                    .await
5177            }
5178
5179            /// Get a TCP Edge by ID
5180            pub async fn get(&self, id: &str) -> Result<types::TCPEdge, Error> {
5181                self.c
5182                    .make_request(
5183                        &format!("/edges/tcp/{id}", id = id),
5184                        reqwest::Method::GET,
5185                        None::<Option<()>>,
5186                    )
5187                    .await
5188            }
5189
5190            /// Get a single page without pagination. Prefer using list
5191            /// which will do pagination for you.
5192            pub(crate) async fn list_page(
5193                &self,
5194                req: &types::Paging,
5195            ) -> Result<types::TCPEdgeList, Error> {
5196                self.c
5197                    .make_request("/edges/tcp", reqwest::Method::GET, Some(req))
5198                    .await
5199            }
5200
5201            /// Returns a list of all TCP Edges on this account
5202            pub fn list(&self, req: types::Paging) -> List {
5203                List {
5204                    c: std::sync::Arc::new(self.clone()),
5205                    req,
5206                }
5207            }
5208
5209            /// Updates a TCP Edge by ID. If a module is not specified in the update, it will
5210            /// not be modified. However, each module configuration that is specified will
5211            /// completely replace the existing value. There is no way to delete an existing
5212            /// module via this API, instead use the delete module API.
5213            pub async fn update(
5214                &self,
5215                req: &types::TCPEdgeUpdate,
5216            ) -> Result<types::TCPEdge, Error> {
5217                self.c
5218                    .make_request(
5219                        &format!("/edges/tcp/{id}", id = req.id),
5220                        reqwest::Method::PATCH,
5221                        Some(req),
5222                    )
5223                    .await
5224            }
5225
5226            /// Delete a TCP Edge by ID
5227            pub async fn delete(&self, id: &str) -> Result<(), Error> {
5228                self.c
5229                    .make_request(
5230                        &format!("/edges/tcp/{id}", id = id),
5231                        reqwest::Method::DELETE,
5232                        None::<Option<()>>,
5233                    )
5234                    .await
5235            }
5236        }
5237    }
5238
5239    pub mod tls {
5240        use crate::types;
5241        use crate::Error;
5242        use futures::{Stream, TryStreamExt};
5243
5244        #[derive(Debug, Clone)]
5245        pub struct Client {
5246            c: crate::Client,
5247        }
5248        /// Provides streams of pages of [types::TLSEdgeList], or of [types::TLSEdge] directly.
5249        pub struct List {
5250            c: std::sync::Arc<Client>,
5251            req: types::Paging,
5252        }
5253
5254        impl List {
5255            /// Iterate over [types::TLSEdgeList].
5256            ///
5257            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
5258            /// documentation for more info on usage.
5259            pub async fn pages(
5260                self,
5261            ) -> impl Stream<Item = Result<types::TLSEdgeList, Error>> + Unpin {
5262                struct State {
5263                    c: std::sync::Arc<Client>,
5264                    req: types::Paging,
5265                    init: bool,
5266                    cur_uri: Option<String>,
5267                }
5268
5269                let s = State {
5270                    c: self.c,
5271                    req: self.req,
5272                    init: true,
5273                    cur_uri: None,
5274                };
5275
5276                Box::pin(futures::stream::unfold(s, |s| async move {
5277                    let page_resp = match (s.init, &s.cur_uri) {
5278                        (true, _) => s.c.list_page(&s.req).await,
5279                        (false, None) => {
5280                            return None;
5281                        }
5282                        (false, Some(uri)) => s.c.c.get_by_uri(uri).await,
5283                    };
5284                    match page_resp {
5285                        Err(e) => Some((Err(e), s)),
5286                        Ok(page) => {
5287                            let next = page.next_page_uri.clone();
5288                            Some((
5289                                Ok(page),
5290                                State {
5291                                    init: false,
5292                                    cur_uri: next,
5293                                    ..s
5294                                },
5295                            ))
5296                        }
5297                    }
5298                }))
5299            }
5300
5301            /// Iterate over [types::TLSEdge] items.
5302            ///
5303            /// See [Tokio Streams](https://tokio.rs/tokio/tutorial/streams)
5304            /// documentation for more info on usage.
5305            pub async fn tls_edges(
5306                self,
5307            ) -> impl Stream<Item = Result<types::TLSEdge, Error>> + Unpin {
5308                self.pages()
5309                    .await
5310                    .map_ok(|page| futures::stream::iter(page.tls_edges.into_iter().map(Ok)))
5311                    .try_flatten()
5312            }
5313        }
5314
5315        impl Client {
5316            pub fn new(c: crate::Client) -> Self {
5317                Self { c }
5318            }
5319
5320            /// Create a TLS Edge
5321            pub async fn create(
5322                &self,
5323                req: &types::TLSEdgeCreate,
5324            ) -> Result<types::TLSEdge, Error> {
5325                self.c
5326                    .make_request("/edges/tls", reqwest::Method::POST, Some(req))
5327                    .await
5328            }
5329
5330            /// Get a TLS Edge by ID
5331            pub async fn get(&self, id: &str) -> Result<types::TLSEdge, Error> {
5332                self.c
5333                    .make_request(
5334                        &format!("/edges/tls/{id}", id = id),
5335                        reqwest::Method::GET,
5336                        None::<Option<()>>,
5337                    )
5338                    .await
5339            }
5340
5341            /// Get a single page without pagination. Prefer using list
5342            /// which will do pagination for you.
5343            pub(crate) async fn list_page(
5344                &self,
5345                req: &types::Paging,
5346            ) -> Result<types::TLSEdgeList, Error> {
5347                self.c
5348                    .make_request("/edges/tls", reqwest::Method::GET, Some(req))
5349                    .await
5350            }
5351
5352            /// Returns a list of all TLS Edges on this account
5353            pub fn list(&self, req: types::Paging) -> List {
5354                List {
5355                    c: std::sync::Arc::new(self.clone()),
5356                    req,
5357                }
5358            }
5359
5360            /// Updates a TLS Edge by ID. If a module is not specified in the update, it will
5361            /// not be modified. However, each module configuration that is specified will
5362            /// completely replace the existing value. There is no way to delete an existing
5363            /// module via this API, instead use the delete module API.
5364            pub async fn update(
5365                &self,
5366                req: &types::TLSEdgeUpdate,
5367            ) -> Result<types::TLSEdge, Error> {
5368                self.c
5369                    .make_request(
5370                        &format!("/edges/tls/{id}", id = req.id),
5371                        reqwest::Method::PATCH,
5372                        Some(req),
5373                    )
5374                    .await
5375            }
5376
5377            /// Delete a TLS Edge by ID
5378            pub async fn delete(&self, id: &str) -> Result<(), Error> {
5379                self.c
5380                    .make_request(
5381                        &format!("/edges/tls/{id}", id = id),
5382                        reqwest::Method::DELETE,
5383                        None::<Option<()>>,
5384                    )
5385                    .await
5386            }
5387        }
5388    }
5389    impl Client {
5390        pub fn https_routes(&self) -> https_routes::Client {
5391            https_routes::Client::new(self.c.clone())
5392        }
5393        pub fn https(&self) -> https::Client {
5394            https::Client::new(self.c.clone())
5395        }
5396        pub fn tcp(&self) -> tcp::Client {
5397            tcp::Client::new(self.c.clone())
5398        }
5399        pub fn tls(&self) -> tls::Client {
5400            tls::Client::new(self.c.clone())
5401        }
5402    }
5403}
5404
5405pub mod edge_modules {
5406    pub struct Client {
5407        c: crate::Client,
5408    }
5409
5410    impl Client {
5411        pub fn new(c: crate::Client) -> Self {
5412            Self { c }
5413        }
5414    }
5415
5416    pub mod https_edge_mutual_tls {
5417        use crate::types;
5418        use crate::Error;
5419
5420        #[derive(Debug, Clone)]
5421        pub struct Client {
5422            c: crate::Client,
5423        }
5424
5425        impl Client {
5426            pub fn new(c: crate::Client) -> Self {
5427                Self { c }
5428            }
5429
5430            pub async fn replace(
5431                &self,
5432                req: &types::EdgeMutualTLSReplace,
5433            ) -> Result<types::EndpointMutualTLS, Error> {
5434                self.c
5435                    .make_request(
5436                        &format!("/edges/https/{id}/mutual_tls", id = req.id),
5437                        reqwest::Method::PUT,
5438                        Some(req),
5439                    )
5440                    .await
5441            }
5442
5443            pub async fn get(&self, id: &str) -> Result<types::EndpointMutualTLS, Error> {
5444                self.c
5445                    .make_request(
5446                        &format!("/edges/https/{id}/mutual_tls", id = id),
5447                        reqwest::Method::GET,
5448                        None::<Option<()>>,
5449                    )
5450                    .await
5451            }
5452
5453            pub async fn delete(&self, id: &str) -> Result<(), Error> {
5454                self.c
5455                    .make_request(
5456                        &format!("/edges/https/{id}/mutual_tls", id = id),
5457                        reqwest::Method::DELETE,
5458                        None::<Option<()>>,
5459                    )
5460                    .await
5461            }
5462        }
5463    }
5464
5465    pub mod https_edge_tls_termination {
5466        use crate::types;
5467        use crate::Error;
5468
5469        #[derive(Debug, Clone)]
5470        pub struct Client {
5471            c: crate::Client,
5472        }
5473
5474        impl Client {
5475            pub fn new(c: crate::Client) -> Self {
5476                Self { c }
5477            }
5478
5479            pub async fn replace(
5480                &self,
5481                req: &types::EdgeTLSTerminationAtEdgeReplace,
5482            ) -> Result<types::EndpointTLSTermination, Error> {
5483                self.c
5484                    .make_request(
5485                        &format!("/edges/https/{id}/tls_termination", id = req.id),
5486                        reqwest::Method::PUT,
5487                        Some(req),
5488                    )
5489                    .await
5490            }
5491
5492            pub async fn get(&self, id: &str) -> Result<types::EndpointTLSTermination, Error> {
5493                self.c
5494                    .make_request(
5495                        &format!("/edges/https/{id}/tls_termination", id = id),
5496                        reqwest::Method::GET,
5497                        None::<Option<()>>,
5498                    )
5499                    .await
5500            }
5501
5502            pub async fn delete(&self, id: &str) -> Result<(), Error> {
5503                self.c
5504                    .make_request(
5505                        &format!("/edges/https/{id}/tls_termination", id = id),
5506                        reqwest::Method::DELETE,
5507                        None::<Option<()>>,
5508                    )
5509                    .await
5510            }
5511        }
5512    }
5513
5514    pub mod https_edge_route_backend {
5515        use crate::types;
5516        use crate::Error;
5517
5518        #[derive(Debug, Clone)]
5519        pub struct Client {
5520            c: crate::Client,
5521        }
5522
5523        impl Client {
5524            pub fn new(c: crate::Client) -> Self {
5525                Self { c }
5526            }
5527
5528            pub async fn replace(
5529                &self,
5530                req: &types::EdgeRouteBackendReplace,
5531            ) -> Result<types::EndpointBackend, Error> {
5532                self.c
5533                    .make_request(
5534                        &format!(
5535                            "/edges/https/{edge_id}/routes/{id}/backend",
5536                            edge_id = req.edge_id,
5537                            id = req.id
5538                        ),
5539                        reqwest::Method::PUT,
5540                        Some(req),
5541                    )
5542                    .await
5543            }
5544
5545            pub async fn get(
5546                &self,
5547                req: &types::EdgeRouteItem,
5548            ) -> Result<types::EndpointBackend, Error> {
5549                self.c
5550                    .make_request(
5551                        &format!(
5552                            "/edges/https/{edge_id}/routes/{id}/backend",
5553                            edge_id = req.edge_id,
5554                            id = req.id
5555                        ),
5556                        reqwest::Method::GET,
5557                        None::<Option<()>>,
5558                    )
5559                    .await
5560            }
5561
5562            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5563                self.c
5564                    .make_request(
5565                        &format!(
5566                            "/edges/https/{edge_id}/routes/{id}/backend",
5567                            edge_id = req.edge_id,
5568                            id = req.id
5569                        ),
5570                        reqwest::Method::DELETE,
5571                        None::<Option<()>>,
5572                    )
5573                    .await
5574            }
5575        }
5576    }
5577
5578    pub mod https_edge_route_ip_restriction {
5579        use crate::types;
5580        use crate::Error;
5581
5582        #[derive(Debug, Clone)]
5583        pub struct Client {
5584            c: crate::Client,
5585        }
5586
5587        impl Client {
5588            pub fn new(c: crate::Client) -> Self {
5589                Self { c }
5590            }
5591
5592            pub async fn replace(
5593                &self,
5594                req: &types::EdgeRouteIPRestrictionReplace,
5595            ) -> Result<types::EndpointIPPolicy, Error> {
5596                self.c
5597                    .make_request(
5598                        &format!(
5599                            "/edges/https/{edge_id}/routes/{id}/ip_restriction",
5600                            edge_id = req.edge_id,
5601                            id = req.id
5602                        ),
5603                        reqwest::Method::PUT,
5604                        Some(req),
5605                    )
5606                    .await
5607            }
5608
5609            pub async fn get(
5610                &self,
5611                req: &types::EdgeRouteItem,
5612            ) -> Result<types::EndpointIPPolicy, Error> {
5613                self.c
5614                    .make_request(
5615                        &format!(
5616                            "/edges/https/{edge_id}/routes/{id}/ip_restriction",
5617                            edge_id = req.edge_id,
5618                            id = req.id
5619                        ),
5620                        reqwest::Method::GET,
5621                        None::<Option<()>>,
5622                    )
5623                    .await
5624            }
5625
5626            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5627                self.c
5628                    .make_request(
5629                        &format!(
5630                            "/edges/https/{edge_id}/routes/{id}/ip_restriction",
5631                            edge_id = req.edge_id,
5632                            id = req.id
5633                        ),
5634                        reqwest::Method::DELETE,
5635                        None::<Option<()>>,
5636                    )
5637                    .await
5638            }
5639        }
5640    }
5641
5642    pub mod https_edge_route_request_headers {
5643        use crate::types;
5644        use crate::Error;
5645
5646        #[derive(Debug, Clone)]
5647        pub struct Client {
5648            c: crate::Client,
5649        }
5650
5651        impl Client {
5652            pub fn new(c: crate::Client) -> Self {
5653                Self { c }
5654            }
5655
5656            pub async fn replace(
5657                &self,
5658                req: &types::EdgeRouteRequestHeadersReplace,
5659            ) -> Result<types::EndpointRequestHeaders, Error> {
5660                self.c
5661                    .make_request(
5662                        &format!(
5663                            "/edges/https/{edge_id}/routes/{id}/request_headers",
5664                            edge_id = req.edge_id,
5665                            id = req.id
5666                        ),
5667                        reqwest::Method::PUT,
5668                        Some(req),
5669                    )
5670                    .await
5671            }
5672
5673            pub async fn get(
5674                &self,
5675                req: &types::EdgeRouteItem,
5676            ) -> Result<types::EndpointRequestHeaders, Error> {
5677                self.c
5678                    .make_request(
5679                        &format!(
5680                            "/edges/https/{edge_id}/routes/{id}/request_headers",
5681                            edge_id = req.edge_id,
5682                            id = req.id
5683                        ),
5684                        reqwest::Method::GET,
5685                        None::<Option<()>>,
5686                    )
5687                    .await
5688            }
5689
5690            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5691                self.c
5692                    .make_request(
5693                        &format!(
5694                            "/edges/https/{edge_id}/routes/{id}/request_headers",
5695                            edge_id = req.edge_id,
5696                            id = req.id
5697                        ),
5698                        reqwest::Method::DELETE,
5699                        None::<Option<()>>,
5700                    )
5701                    .await
5702            }
5703        }
5704    }
5705
5706    pub mod https_edge_route_response_headers {
5707        use crate::types;
5708        use crate::Error;
5709
5710        #[derive(Debug, Clone)]
5711        pub struct Client {
5712            c: crate::Client,
5713        }
5714
5715        impl Client {
5716            pub fn new(c: crate::Client) -> Self {
5717                Self { c }
5718            }
5719
5720            pub async fn replace(
5721                &self,
5722                req: &types::EdgeRouteResponseHeadersReplace,
5723            ) -> Result<types::EndpointResponseHeaders, Error> {
5724                self.c
5725                    .make_request(
5726                        &format!(
5727                            "/edges/https/{edge_id}/routes/{id}/response_headers",
5728                            edge_id = req.edge_id,
5729                            id = req.id
5730                        ),
5731                        reqwest::Method::PUT,
5732                        Some(req),
5733                    )
5734                    .await
5735            }
5736
5737            pub async fn get(
5738                &self,
5739                req: &types::EdgeRouteItem,
5740            ) -> Result<types::EndpointResponseHeaders, Error> {
5741                self.c
5742                    .make_request(
5743                        &format!(
5744                            "/edges/https/{edge_id}/routes/{id}/response_headers",
5745                            edge_id = req.edge_id,
5746                            id = req.id
5747                        ),
5748                        reqwest::Method::GET,
5749                        None::<Option<()>>,
5750                    )
5751                    .await
5752            }
5753
5754            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5755                self.c
5756                    .make_request(
5757                        &format!(
5758                            "/edges/https/{edge_id}/routes/{id}/response_headers",
5759                            edge_id = req.edge_id,
5760                            id = req.id
5761                        ),
5762                        reqwest::Method::DELETE,
5763                        None::<Option<()>>,
5764                    )
5765                    .await
5766            }
5767        }
5768    }
5769
5770    pub mod https_edge_route_compression {
5771        use crate::types;
5772        use crate::Error;
5773
5774        #[derive(Debug, Clone)]
5775        pub struct Client {
5776            c: crate::Client,
5777        }
5778
5779        impl Client {
5780            pub fn new(c: crate::Client) -> Self {
5781                Self { c }
5782            }
5783
5784            pub async fn replace(
5785                &self,
5786                req: &types::EdgeRouteCompressionReplace,
5787            ) -> Result<types::EndpointCompression, Error> {
5788                self.c
5789                    .make_request(
5790                        &format!(
5791                            "/edges/https/{edge_id}/routes/{id}/compression",
5792                            edge_id = req.edge_id,
5793                            id = req.id
5794                        ),
5795                        reqwest::Method::PUT,
5796                        Some(req),
5797                    )
5798                    .await
5799            }
5800
5801            pub async fn get(
5802                &self,
5803                req: &types::EdgeRouteItem,
5804            ) -> Result<types::EndpointCompression, Error> {
5805                self.c
5806                    .make_request(
5807                        &format!(
5808                            "/edges/https/{edge_id}/routes/{id}/compression",
5809                            edge_id = req.edge_id,
5810                            id = req.id
5811                        ),
5812                        reqwest::Method::GET,
5813                        None::<Option<()>>,
5814                    )
5815                    .await
5816            }
5817
5818            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5819                self.c
5820                    .make_request(
5821                        &format!(
5822                            "/edges/https/{edge_id}/routes/{id}/compression",
5823                            edge_id = req.edge_id,
5824                            id = req.id
5825                        ),
5826                        reqwest::Method::DELETE,
5827                        None::<Option<()>>,
5828                    )
5829                    .await
5830            }
5831        }
5832    }
5833
5834    pub mod https_edge_route_circuit_breaker {
5835        use crate::types;
5836        use crate::Error;
5837
5838        #[derive(Debug, Clone)]
5839        pub struct Client {
5840            c: crate::Client,
5841        }
5842
5843        impl Client {
5844            pub fn new(c: crate::Client) -> Self {
5845                Self { c }
5846            }
5847
5848            pub async fn replace(
5849                &self,
5850                req: &types::EdgeRouteCircuitBreakerReplace,
5851            ) -> Result<types::EndpointCircuitBreaker, Error> {
5852                self.c
5853                    .make_request(
5854                        &format!(
5855                            "/edges/https/{edge_id}/routes/{id}/circuit_breaker",
5856                            edge_id = req.edge_id,
5857                            id = req.id
5858                        ),
5859                        reqwest::Method::PUT,
5860                        Some(req),
5861                    )
5862                    .await
5863            }
5864
5865            pub async fn get(
5866                &self,
5867                req: &types::EdgeRouteItem,
5868            ) -> Result<types::EndpointCircuitBreaker, Error> {
5869                self.c
5870                    .make_request(
5871                        &format!(
5872                            "/edges/https/{edge_id}/routes/{id}/circuit_breaker",
5873                            edge_id = req.edge_id,
5874                            id = req.id
5875                        ),
5876                        reqwest::Method::GET,
5877                        None::<Option<()>>,
5878                    )
5879                    .await
5880            }
5881
5882            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5883                self.c
5884                    .make_request(
5885                        &format!(
5886                            "/edges/https/{edge_id}/routes/{id}/circuit_breaker",
5887                            edge_id = req.edge_id,
5888                            id = req.id
5889                        ),
5890                        reqwest::Method::DELETE,
5891                        None::<Option<()>>,
5892                    )
5893                    .await
5894            }
5895        }
5896    }
5897
5898    pub mod https_edge_route_webhook_verification {
5899        use crate::types;
5900        use crate::Error;
5901
5902        #[derive(Debug, Clone)]
5903        pub struct Client {
5904            c: crate::Client,
5905        }
5906
5907        impl Client {
5908            pub fn new(c: crate::Client) -> Self {
5909                Self { c }
5910            }
5911
5912            pub async fn replace(
5913                &self,
5914                req: &types::EdgeRouteWebhookVerificationReplace,
5915            ) -> Result<types::EndpointWebhookValidation, Error> {
5916                self.c
5917                    .make_request(
5918                        &format!(
5919                            "/edges/https/{edge_id}/routes/{id}/webhook_verification",
5920                            edge_id = req.edge_id,
5921                            id = req.id
5922                        ),
5923                        reqwest::Method::PUT,
5924                        Some(req),
5925                    )
5926                    .await
5927            }
5928
5929            pub async fn get(
5930                &self,
5931                req: &types::EdgeRouteItem,
5932            ) -> Result<types::EndpointWebhookValidation, Error> {
5933                self.c
5934                    .make_request(
5935                        &format!(
5936                            "/edges/https/{edge_id}/routes/{id}/webhook_verification",
5937                            edge_id = req.edge_id,
5938                            id = req.id
5939                        ),
5940                        reqwest::Method::GET,
5941                        None::<Option<()>>,
5942                    )
5943                    .await
5944            }
5945
5946            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
5947                self.c
5948                    .make_request(
5949                        &format!(
5950                            "/edges/https/{edge_id}/routes/{id}/webhook_verification",
5951                            edge_id = req.edge_id,
5952                            id = req.id
5953                        ),
5954                        reqwest::Method::DELETE,
5955                        None::<Option<()>>,
5956                    )
5957                    .await
5958            }
5959        }
5960    }
5961
5962    pub mod https_edge_route_oauth {
5963        use crate::types;
5964        use crate::Error;
5965
5966        #[derive(Debug, Clone)]
5967        pub struct Client {
5968            c: crate::Client,
5969        }
5970
5971        impl Client {
5972            pub fn new(c: crate::Client) -> Self {
5973                Self { c }
5974            }
5975
5976            pub async fn replace(
5977                &self,
5978                req: &types::EdgeRouteOAuthReplace,
5979            ) -> Result<types::EndpointOAuth, Error> {
5980                self.c
5981                    .make_request(
5982                        &format!(
5983                            "/edges/https/{edge_id}/routes/{id}/oauth",
5984                            edge_id = req.edge_id,
5985                            id = req.id
5986                        ),
5987                        reqwest::Method::PUT,
5988                        Some(req),
5989                    )
5990                    .await
5991            }
5992
5993            pub async fn get(
5994                &self,
5995                req: &types::EdgeRouteItem,
5996            ) -> Result<types::EndpointOAuth, Error> {
5997                self.c
5998                    .make_request(
5999                        &format!(
6000                            "/edges/https/{edge_id}/routes/{id}/oauth",
6001                            edge_id = req.edge_id,
6002                            id = req.id
6003                        ),
6004                        reqwest::Method::GET,
6005                        None::<Option<()>>,
6006                    )
6007                    .await
6008            }
6009
6010            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6011                self.c
6012                    .make_request(
6013                        &format!(
6014                            "/edges/https/{edge_id}/routes/{id}/oauth",
6015                            edge_id = req.edge_id,
6016                            id = req.id
6017                        ),
6018                        reqwest::Method::DELETE,
6019                        None::<Option<()>>,
6020                    )
6021                    .await
6022            }
6023        }
6024    }
6025
6026    pub mod https_edge_route_saml {
6027        use crate::types;
6028        use crate::Error;
6029
6030        #[derive(Debug, Clone)]
6031        pub struct Client {
6032            c: crate::Client,
6033        }
6034
6035        impl Client {
6036            pub fn new(c: crate::Client) -> Self {
6037                Self { c }
6038            }
6039
6040            pub async fn replace(
6041                &self,
6042                req: &types::EdgeRouteSAMLReplace,
6043            ) -> Result<types::EndpointSAML, Error> {
6044                self.c
6045                    .make_request(
6046                        &format!(
6047                            "/edges/https/{edge_id}/routes/{id}/saml",
6048                            edge_id = req.edge_id,
6049                            id = req.id
6050                        ),
6051                        reqwest::Method::PUT,
6052                        Some(req),
6053                    )
6054                    .await
6055            }
6056
6057            pub async fn get(
6058                &self,
6059                req: &types::EdgeRouteItem,
6060            ) -> Result<types::EndpointSAML, Error> {
6061                self.c
6062                    .make_request(
6063                        &format!(
6064                            "/edges/https/{edge_id}/routes/{id}/saml",
6065                            edge_id = req.edge_id,
6066                            id = req.id
6067                        ),
6068                        reqwest::Method::GET,
6069                        None::<Option<()>>,
6070                    )
6071                    .await
6072            }
6073
6074            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6075                self.c
6076                    .make_request(
6077                        &format!(
6078                            "/edges/https/{edge_id}/routes/{id}/saml",
6079                            edge_id = req.edge_id,
6080                            id = req.id
6081                        ),
6082                        reqwest::Method::DELETE,
6083                        None::<Option<()>>,
6084                    )
6085                    .await
6086            }
6087        }
6088    }
6089
6090    pub mod https_edge_route_oidc {
6091        use crate::types;
6092        use crate::Error;
6093
6094        #[derive(Debug, Clone)]
6095        pub struct Client {
6096            c: crate::Client,
6097        }
6098
6099        impl Client {
6100            pub fn new(c: crate::Client) -> Self {
6101                Self { c }
6102            }
6103
6104            pub async fn replace(
6105                &self,
6106                req: &types::EdgeRouteOIDCReplace,
6107            ) -> Result<types::EndpointOIDC, Error> {
6108                self.c
6109                    .make_request(
6110                        &format!(
6111                            "/edges/https/{edge_id}/routes/{id}/oidc",
6112                            edge_id = req.edge_id,
6113                            id = req.id
6114                        ),
6115                        reqwest::Method::PUT,
6116                        Some(req),
6117                    )
6118                    .await
6119            }
6120
6121            pub async fn get(
6122                &self,
6123                req: &types::EdgeRouteItem,
6124            ) -> Result<types::EndpointOIDC, Error> {
6125                self.c
6126                    .make_request(
6127                        &format!(
6128                            "/edges/https/{edge_id}/routes/{id}/oidc",
6129                            edge_id = req.edge_id,
6130                            id = req.id
6131                        ),
6132                        reqwest::Method::GET,
6133                        None::<Option<()>>,
6134                    )
6135                    .await
6136            }
6137
6138            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6139                self.c
6140                    .make_request(
6141                        &format!(
6142                            "/edges/https/{edge_id}/routes/{id}/oidc",
6143                            edge_id = req.edge_id,
6144                            id = req.id
6145                        ),
6146                        reqwest::Method::DELETE,
6147                        None::<Option<()>>,
6148                    )
6149                    .await
6150            }
6151        }
6152    }
6153
6154    pub mod https_edge_route_websocket_tcp_converter {
6155        use crate::types;
6156        use crate::Error;
6157
6158        #[derive(Debug, Clone)]
6159        pub struct Client {
6160            c: crate::Client,
6161        }
6162
6163        impl Client {
6164            pub fn new(c: crate::Client) -> Self {
6165                Self { c }
6166            }
6167
6168            pub async fn replace(
6169                &self,
6170                req: &types::EdgeRouteWebsocketTCPConverterReplace,
6171            ) -> Result<types::EndpointWebsocketTCPConverter, Error> {
6172                self.c
6173                    .make_request(
6174                        &format!(
6175                            "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter",
6176                            edge_id = req.edge_id,
6177                            id = req.id
6178                        ),
6179                        reqwest::Method::PUT,
6180                        Some(req),
6181                    )
6182                    .await
6183            }
6184
6185            pub async fn get(
6186                &self,
6187                req: &types::EdgeRouteItem,
6188            ) -> Result<types::EndpointWebsocketTCPConverter, Error> {
6189                self.c
6190                    .make_request(
6191                        &format!(
6192                            "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter",
6193                            edge_id = req.edge_id,
6194                            id = req.id
6195                        ),
6196                        reqwest::Method::GET,
6197                        None::<Option<()>>,
6198                    )
6199                    .await
6200            }
6201
6202            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6203                self.c
6204                    .make_request(
6205                        &format!(
6206                            "/edges/https/{edge_id}/routes/{id}/websocket_tcp_converter",
6207                            edge_id = req.edge_id,
6208                            id = req.id
6209                        ),
6210                        reqwest::Method::DELETE,
6211                        None::<Option<()>>,
6212                    )
6213                    .await
6214            }
6215        }
6216    }
6217
6218    pub mod https_edge_route_user_agent_filter {
6219        use crate::types;
6220        use crate::Error;
6221
6222        #[derive(Debug, Clone)]
6223        pub struct Client {
6224            c: crate::Client,
6225        }
6226
6227        impl Client {
6228            pub fn new(c: crate::Client) -> Self {
6229                Self { c }
6230            }
6231
6232            pub async fn replace(
6233                &self,
6234                req: &types::EdgeRouteUserAgentFilterReplace,
6235            ) -> Result<types::EndpointUserAgentFilter, Error> {
6236                self.c
6237                    .make_request(
6238                        &format!(
6239                            "/edges/https/{edge_id}/routes/{id}/user_agent_filter",
6240                            edge_id = req.edge_id,
6241                            id = req.id
6242                        ),
6243                        reqwest::Method::PUT,
6244                        Some(req),
6245                    )
6246                    .await
6247            }
6248
6249            pub async fn get(
6250                &self,
6251                req: &types::EdgeRouteItem,
6252            ) -> Result<types::EndpointUserAgentFilter, Error> {
6253                self.c
6254                    .make_request(
6255                        &format!(
6256                            "/edges/https/{edge_id}/routes/{id}/user_agent_filter",
6257                            edge_id = req.edge_id,
6258                            id = req.id
6259                        ),
6260                        reqwest::Method::GET,
6261                        None::<Option<()>>,
6262                    )
6263                    .await
6264            }
6265
6266            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6267                self.c
6268                    .make_request(
6269                        &format!(
6270                            "/edges/https/{edge_id}/routes/{id}/user_agent_filter",
6271                            edge_id = req.edge_id,
6272                            id = req.id
6273                        ),
6274                        reqwest::Method::DELETE,
6275                        None::<Option<()>>,
6276                    )
6277                    .await
6278            }
6279        }
6280    }
6281
6282    pub mod https_edge_route_traffic_policy {
6283        use crate::types;
6284        use crate::Error;
6285
6286        #[derive(Debug, Clone)]
6287        pub struct Client {
6288            c: crate::Client,
6289        }
6290
6291        impl Client {
6292            pub fn new(c: crate::Client) -> Self {
6293                Self { c }
6294            }
6295
6296            pub async fn replace(
6297                &self,
6298                req: &types::EdgeRouteTrafficPolicyReplace,
6299            ) -> Result<types::EndpointTrafficPolicy, Error> {
6300                self.c
6301                    .make_request(
6302                        &format!(
6303                            "/edges/https/{edge_id}/routes/{id}/traffic_policy",
6304                            edge_id = req.edge_id,
6305                            id = req.id
6306                        ),
6307                        reqwest::Method::PUT,
6308                        Some(req),
6309                    )
6310                    .await
6311            }
6312
6313            pub async fn get(
6314                &self,
6315                req: &types::EdgeRouteItem,
6316            ) -> Result<types::EndpointTrafficPolicy, Error> {
6317                self.c
6318                    .make_request(
6319                        &format!(
6320                            "/edges/https/{edge_id}/routes/{id}/traffic_policy",
6321                            edge_id = req.edge_id,
6322                            id = req.id
6323                        ),
6324                        reqwest::Method::GET,
6325                        None::<Option<()>>,
6326                    )
6327                    .await
6328            }
6329
6330            pub async fn delete(&self, req: &types::EdgeRouteItem) -> Result<(), Error> {
6331                self.c
6332                    .make_request(
6333                        &format!(
6334                            "/edges/https/{edge_id}/routes/{id}/traffic_policy",
6335                            edge_id = req.edge_id,
6336                            id = req.id
6337                        ),
6338                        reqwest::Method::DELETE,
6339                        None::<Option<()>>,
6340                    )
6341                    .await
6342            }
6343        }
6344    }
6345
6346    pub mod tcp_edge_backend {
6347        use crate::types;
6348        use crate::Error;
6349
6350        #[derive(Debug, Clone)]
6351        pub struct Client {
6352            c: crate::Client,
6353        }
6354
6355        impl Client {
6356            pub fn new(c: crate::Client) -> Self {
6357                Self { c }
6358            }
6359
6360            pub async fn replace(
6361                &self,
6362                req: &types::EdgeBackendReplace,
6363            ) -> Result<types::EndpointBackend, Error> {
6364                self.c
6365                    .make_request(
6366                        &format!("/edges/tcp/{id}/backend", id = req.id),
6367                        reqwest::Method::PUT,
6368                        Some(req),
6369                    )
6370                    .await
6371            }
6372
6373            pub async fn get(&self, id: &str) -> Result<types::EndpointBackend, Error> {
6374                self.c
6375                    .make_request(
6376                        &format!("/edges/tcp/{id}/backend", id = id),
6377                        reqwest::Method::GET,
6378                        None::<Option<()>>,
6379                    )
6380                    .await
6381            }
6382
6383            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6384                self.c
6385                    .make_request(
6386                        &format!("/edges/tcp/{id}/backend", id = id),
6387                        reqwest::Method::DELETE,
6388                        None::<Option<()>>,
6389                    )
6390                    .await
6391            }
6392        }
6393    }
6394
6395    pub mod tcp_edge_ip_restriction {
6396        use crate::types;
6397        use crate::Error;
6398
6399        #[derive(Debug, Clone)]
6400        pub struct Client {
6401            c: crate::Client,
6402        }
6403
6404        impl Client {
6405            pub fn new(c: crate::Client) -> Self {
6406                Self { c }
6407            }
6408
6409            pub async fn replace(
6410                &self,
6411                req: &types::EdgeIPRestrictionReplace,
6412            ) -> Result<types::EndpointIPPolicy, Error> {
6413                self.c
6414                    .make_request(
6415                        &format!("/edges/tcp/{id}/ip_restriction", id = req.id),
6416                        reqwest::Method::PUT,
6417                        Some(req),
6418                    )
6419                    .await
6420            }
6421
6422            pub async fn get(&self, id: &str) -> Result<types::EndpointIPPolicy, Error> {
6423                self.c
6424                    .make_request(
6425                        &format!("/edges/tcp/{id}/ip_restriction", id = id),
6426                        reqwest::Method::GET,
6427                        None::<Option<()>>,
6428                    )
6429                    .await
6430            }
6431
6432            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6433                self.c
6434                    .make_request(
6435                        &format!("/edges/tcp/{id}/ip_restriction", id = id),
6436                        reqwest::Method::DELETE,
6437                        None::<Option<()>>,
6438                    )
6439                    .await
6440            }
6441        }
6442    }
6443
6444    pub mod tcp_edge_traffic_policy {
6445        use crate::types;
6446        use crate::Error;
6447
6448        #[derive(Debug, Clone)]
6449        pub struct Client {
6450            c: crate::Client,
6451        }
6452
6453        impl Client {
6454            pub fn new(c: crate::Client) -> Self {
6455                Self { c }
6456            }
6457
6458            pub async fn replace(
6459                &self,
6460                req: &types::EdgeTrafficPolicyReplace,
6461            ) -> Result<types::EndpointTrafficPolicy, Error> {
6462                self.c
6463                    .make_request(
6464                        &format!("/edges/tcp/{id}/traffic_policy", id = req.id),
6465                        reqwest::Method::PUT,
6466                        Some(req),
6467                    )
6468                    .await
6469            }
6470
6471            pub async fn get(&self, id: &str) -> Result<types::EndpointTrafficPolicy, Error> {
6472                self.c
6473                    .make_request(
6474                        &format!("/edges/tcp/{id}/traffic_policy", id = id),
6475                        reqwest::Method::GET,
6476                        None::<Option<()>>,
6477                    )
6478                    .await
6479            }
6480
6481            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6482                self.c
6483                    .make_request(
6484                        &format!("/edges/tcp/{id}/traffic_policy", id = id),
6485                        reqwest::Method::DELETE,
6486                        None::<Option<()>>,
6487                    )
6488                    .await
6489            }
6490        }
6491    }
6492
6493    pub mod tls_edge_backend {
6494        use crate::types;
6495        use crate::Error;
6496
6497        #[derive(Debug, Clone)]
6498        pub struct Client {
6499            c: crate::Client,
6500        }
6501
6502        impl Client {
6503            pub fn new(c: crate::Client) -> Self {
6504                Self { c }
6505            }
6506
6507            pub async fn replace(
6508                &self,
6509                req: &types::EdgeBackendReplace,
6510            ) -> Result<types::EndpointBackend, Error> {
6511                self.c
6512                    .make_request(
6513                        &format!("/edges/tls/{id}/backend", id = req.id),
6514                        reqwest::Method::PUT,
6515                        Some(req),
6516                    )
6517                    .await
6518            }
6519
6520            pub async fn get(&self, id: &str) -> Result<types::EndpointBackend, Error> {
6521                self.c
6522                    .make_request(
6523                        &format!("/edges/tls/{id}/backend", id = id),
6524                        reqwest::Method::GET,
6525                        None::<Option<()>>,
6526                    )
6527                    .await
6528            }
6529
6530            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6531                self.c
6532                    .make_request(
6533                        &format!("/edges/tls/{id}/backend", id = id),
6534                        reqwest::Method::DELETE,
6535                        None::<Option<()>>,
6536                    )
6537                    .await
6538            }
6539        }
6540    }
6541
6542    pub mod tls_edge_ip_restriction {
6543        use crate::types;
6544        use crate::Error;
6545
6546        #[derive(Debug, Clone)]
6547        pub struct Client {
6548            c: crate::Client,
6549        }
6550
6551        impl Client {
6552            pub fn new(c: crate::Client) -> Self {
6553                Self { c }
6554            }
6555
6556            pub async fn replace(
6557                &self,
6558                req: &types::EdgeIPRestrictionReplace,
6559            ) -> Result<types::EndpointIPPolicy, Error> {
6560                self.c
6561                    .make_request(
6562                        &format!("/edges/tls/{id}/ip_restriction", id = req.id),
6563                        reqwest::Method::PUT,
6564                        Some(req),
6565                    )
6566                    .await
6567            }
6568
6569            pub async fn get(&self, id: &str) -> Result<types::EndpointIPPolicy, Error> {
6570                self.c
6571                    .make_request(
6572                        &format!("/edges/tls/{id}/ip_restriction", id = id),
6573                        reqwest::Method::GET,
6574                        None::<Option<()>>,
6575                    )
6576                    .await
6577            }
6578
6579            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6580                self.c
6581                    .make_request(
6582                        &format!("/edges/tls/{id}/ip_restriction", id = id),
6583                        reqwest::Method::DELETE,
6584                        None::<Option<()>>,
6585                    )
6586                    .await
6587            }
6588        }
6589    }
6590
6591    pub mod tls_edge_mutual_tls {
6592        use crate::types;
6593        use crate::Error;
6594
6595        #[derive(Debug, Clone)]
6596        pub struct Client {
6597            c: crate::Client,
6598        }
6599
6600        impl Client {
6601            pub fn new(c: crate::Client) -> Self {
6602                Self { c }
6603            }
6604
6605            pub async fn replace(
6606                &self,
6607                req: &types::EdgeMutualTLSReplace,
6608            ) -> Result<types::EndpointMutualTLS, Error> {
6609                self.c
6610                    .make_request(
6611                        &format!("/edges/tls/{id}/mutual_tls", id = req.id),
6612                        reqwest::Method::PUT,
6613                        Some(req),
6614                    )
6615                    .await
6616            }
6617
6618            pub async fn get(&self, id: &str) -> Result<types::EndpointMutualTLS, Error> {
6619                self.c
6620                    .make_request(
6621                        &format!("/edges/tls/{id}/mutual_tls", id = id),
6622                        reqwest::Method::GET,
6623                        None::<Option<()>>,
6624                    )
6625                    .await
6626            }
6627
6628            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6629                self.c
6630                    .make_request(
6631                        &format!("/edges/tls/{id}/mutual_tls", id = id),
6632                        reqwest::Method::DELETE,
6633                        None::<Option<()>>,
6634                    )
6635                    .await
6636            }
6637        }
6638    }
6639
6640    pub mod tls_edge_tls_termination {
6641        use crate::types;
6642        use crate::Error;
6643
6644        #[derive(Debug, Clone)]
6645        pub struct Client {
6646            c: crate::Client,
6647        }
6648
6649        impl Client {
6650            pub fn new(c: crate::Client) -> Self {
6651                Self { c }
6652            }
6653
6654            pub async fn replace(
6655                &self,
6656                req: &types::EdgeTLSTerminationReplace,
6657            ) -> Result<types::EndpointTLSTermination, Error> {
6658                self.c
6659                    .make_request(
6660                        &format!("/edges/tls/{id}/tls_termination", id = req.id),
6661                        reqwest::Method::PUT,
6662                        Some(req),
6663                    )
6664                    .await
6665            }
6666
6667            pub async fn get(&self, id: &str) -> Result<types::EndpointTLSTermination, Error> {
6668                self.c
6669                    .make_request(
6670                        &format!("/edges/tls/{id}/tls_termination", id = id),
6671                        reqwest::Method::GET,
6672                        None::<Option<()>>,
6673                    )
6674                    .await
6675            }
6676
6677            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6678                self.c
6679                    .make_request(
6680                        &format!("/edges/tls/{id}/tls_termination", id = id),
6681                        reqwest::Method::DELETE,
6682                        None::<Option<()>>,
6683                    )
6684                    .await
6685            }
6686        }
6687    }
6688
6689    pub mod tls_edge_traffic_policy {
6690        use crate::types;
6691        use crate::Error;
6692
6693        #[derive(Debug, Clone)]
6694        pub struct Client {
6695            c: crate::Client,
6696        }
6697
6698        impl Client {
6699            pub fn new(c: crate::Client) -> Self {
6700                Self { c }
6701            }
6702
6703            pub async fn replace(
6704                &self,
6705                req: &types::EdgeTrafficPolicyReplace,
6706            ) -> Result<types::EndpointTrafficPolicy, Error> {
6707                self.c
6708                    .make_request(
6709                        &format!("/edges/tls/{id}/traffic_policy", id = req.id),
6710                        reqwest::Method::PUT,
6711                        Some(req),
6712                    )
6713                    .await
6714            }
6715
6716            pub async fn get(&self, id: &str) -> Result<types::EndpointTrafficPolicy, Error> {
6717                self.c
6718                    .make_request(
6719                        &format!("/edges/tls/{id}/traffic_policy", id = id),
6720                        reqwest::Method::GET,
6721                        None::<Option<()>>,
6722                    )
6723                    .await
6724            }
6725
6726            pub async fn delete(&self, id: &str) -> Result<(), Error> {
6727                self.c
6728                    .make_request(
6729                        &format!("/edges/tls/{id}/traffic_policy", id = id),
6730                        reqwest::Method::DELETE,
6731                        None::<Option<()>>,
6732                    )
6733                    .await
6734            }
6735        }
6736    }
6737    impl Client {
6738        pub fn https_edge_mutual_tls(&self) -> https_edge_mutual_tls::Client {
6739            https_edge_mutual_tls::Client::new(self.c.clone())
6740        }
6741        pub fn https_edge_tls_termination(&self) -> https_edge_tls_termination::Client {
6742            https_edge_tls_termination::Client::new(self.c.clone())
6743        }
6744        pub fn https_edge_route_backend(&self) -> https_edge_route_backend::Client {
6745            https_edge_route_backend::Client::new(self.c.clone())
6746        }
6747        pub fn https_edge_route_ip_restriction(&self) -> https_edge_route_ip_restriction::Client {
6748            https_edge_route_ip_restriction::Client::new(self.c.clone())
6749        }
6750        pub fn https_edge_route_request_headers(&self) -> https_edge_route_request_headers::Client {
6751            https_edge_route_request_headers::Client::new(self.c.clone())
6752        }
6753        pub fn https_edge_route_response_headers(
6754            &self,
6755        ) -> https_edge_route_response_headers::Client {
6756            https_edge_route_response_headers::Client::new(self.c.clone())
6757        }
6758        pub fn https_edge_route_compression(&self) -> https_edge_route_compression::Client {
6759            https_edge_route_compression::Client::new(self.c.clone())
6760        }
6761        pub fn https_edge_route_circuit_breaker(&self) -> https_edge_route_circuit_breaker::Client {
6762            https_edge_route_circuit_breaker::Client::new(self.c.clone())
6763        }
6764        pub fn https_edge_route_webhook_verification(
6765            &self,
6766        ) -> https_edge_route_webhook_verification::Client {
6767            https_edge_route_webhook_verification::Client::new(self.c.clone())
6768        }
6769        pub fn https_edge_route_oauth(&self) -> https_edge_route_oauth::Client {
6770            https_edge_route_oauth::Client::new(self.c.clone())
6771        }
6772        pub fn https_edge_route_saml(&self) -> https_edge_route_saml::Client {
6773            https_edge_route_saml::Client::new(self.c.clone())
6774        }
6775        pub fn https_edge_route_oidc(&self) -> https_edge_route_oidc::Client {
6776            https_edge_route_oidc::Client::new(self.c.clone())
6777        }
6778        pub fn https_edge_route_websocket_tcp_converter(
6779            &self,
6780        ) -> https_edge_route_websocket_tcp_converter::Client {
6781            https_edge_route_websocket_tcp_converter::Client::new(self.c.clone())
6782        }
6783        pub fn https_edge_route_user_agent_filter(
6784            &self,
6785        ) -> https_edge_route_user_agent_filter::Client {
6786            https_edge_route_user_agent_filter::Client::new(self.c.clone())
6787        }
6788        pub fn https_edge_route_traffic_policy(&self) -> https_edge_route_traffic_policy::Client {
6789            https_edge_route_traffic_policy::Client::new(self.c.clone())
6790        }
6791        pub fn tcp_edge_backend(&self) -> tcp_edge_backend::Client {
6792            tcp_edge_backend::Client::new(self.c.clone())
6793        }
6794        pub fn tcp_edge_ip_restriction(&self) -> tcp_edge_ip_restriction::Client {
6795            tcp_edge_ip_restriction::Client::new(self.c.clone())
6796        }
6797        pub fn tcp_edge_traffic_policy(&self) -> tcp_edge_traffic_policy::Client {
6798            tcp_edge_traffic_policy::Client::new(self.c.clone())
6799        }
6800        pub fn tls_edge_backend(&self) -> tls_edge_backend::Client {
6801            tls_edge_backend::Client::new(self.c.clone())
6802        }
6803        pub fn tls_edge_ip_restriction(&self) -> tls_edge_ip_restriction::Client {
6804            tls_edge_ip_restriction::Client::new(self.c.clone())
6805        }
6806        pub fn tls_edge_mutual_tls(&self) -> tls_edge_mutual_tls::Client {
6807            tls_edge_mutual_tls::Client::new(self.c.clone())
6808        }
6809        pub fn tls_edge_tls_termination(&self) -> tls_edge_tls_termination::Client {
6810            tls_edge_tls_termination::Client::new(self.c.clone())
6811        }
6812        pub fn tls_edge_traffic_policy(&self) -> tls_edge_traffic_policy::Client {
6813            tls_edge_traffic_policy::Client::new(self.c.clone())
6814        }
6815    }
6816}
6817
6818impl Client {
6819    pub fn backends(&self) -> backends::Client {
6820        backends::Client::new(self.clone())
6821    }
6822    pub fn edges(&self) -> edges::Client {
6823        edges::Client::new(self.clone())
6824    }
6825    pub fn edge_modules(&self) -> edge_modules::Client {
6826        edge_modules::Client::new(self.clone())
6827    }
6828}