google_cloud_networkconnectivity_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod cross_network_automation_service {
18    use crate::Result;
19
20    /// A builder for [CrossNetworkAutomationService][crate::client::CrossNetworkAutomationService].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_networkconnectivity_v1::*;
25    /// # use builder::cross_network_automation_service::ClientBuilder;
26    /// # use client::CrossNetworkAutomationService;
27    /// let builder : ClientBuilder = CrossNetworkAutomationService::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://networkconnectivity.googleapis.com")
30    ///     .build().await?;
31    /// # gax::client_builder::Result::<()>::Ok(()) });
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::CrossNetworkAutomationService;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = CrossNetworkAutomationService;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::CrossNetworkAutomationService] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [CrossNetworkAutomationService::list_service_connection_maps][crate::client::CrossNetworkAutomationService::list_service_connection_maps] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_networkconnectivity_v1::builder;
79    /// use builder::cross_network_automation_service::ListServiceConnectionMaps;
80    /// # tokio_test::block_on(async {
81    /// use gax::paginator::ItemPaginator;
82    ///
83    /// let builder = prepare_request_builder();
84    /// let mut items = builder.by_item();
85    /// while let Some(result) = items.next().await {
86    ///   let item = result?;
87    /// }
88    /// # gax::Result::<()>::Ok(()) });
89    ///
90    /// fn prepare_request_builder() -> ListServiceConnectionMaps {
91    ///   # panic!();
92    ///   // ... details omitted ...
93    /// }
94    /// ```
95    #[derive(Clone, Debug)]
96    pub struct ListServiceConnectionMaps(
97        RequestBuilder<crate::model::ListServiceConnectionMapsRequest>,
98    );
99
100    impl ListServiceConnectionMaps {
101        pub(crate) fn new(
102            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
103        ) -> Self {
104            Self(RequestBuilder::new(stub))
105        }
106
107        /// Sets the full request, replacing any prior values.
108        pub fn with_request<V: Into<crate::model::ListServiceConnectionMapsRequest>>(
109            mut self,
110            v: V,
111        ) -> Self {
112            self.0.request = v.into();
113            self
114        }
115
116        /// Sets all the options, replacing any prior values.
117        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
118            self.0.options = v.into();
119            self
120        }
121
122        /// Sends the request.
123        pub async fn send(self) -> Result<crate::model::ListServiceConnectionMapsResponse> {
124            (*self.0.stub)
125                .list_service_connection_maps(self.0.request, self.0.options)
126                .await
127                .map(gax::response::Response::into_body)
128        }
129
130        /// Streams each page in the collection.
131        pub fn by_page(
132            self,
133        ) -> impl gax::paginator::Paginator<
134            crate::model::ListServiceConnectionMapsResponse,
135            gax::error::Error,
136        > {
137            use std::clone::Clone;
138            let token = self.0.request.page_token.clone();
139            let execute = move |token: String| {
140                let mut builder = self.clone();
141                builder.0.request = builder.0.request.set_page_token(token);
142                builder.send()
143            };
144            gax::paginator::internal::new_paginator(token, execute)
145        }
146
147        /// Streams each item in the collection.
148        pub fn by_item(
149            self,
150        ) -> impl gax::paginator::ItemPaginator<
151            crate::model::ListServiceConnectionMapsResponse,
152            gax::error::Error,
153        > {
154            use gax::paginator::Paginator;
155            self.by_page().items()
156        }
157
158        /// Sets the value of [parent][crate::model::ListServiceConnectionMapsRequest::parent].
159        ///
160        /// This is a **required** field for requests.
161        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
162            self.0.request.parent = v.into();
163            self
164        }
165
166        /// Sets the value of [page_size][crate::model::ListServiceConnectionMapsRequest::page_size].
167        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
168            self.0.request.page_size = v.into();
169            self
170        }
171
172        /// Sets the value of [page_token][crate::model::ListServiceConnectionMapsRequest::page_token].
173        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
174            self.0.request.page_token = v.into();
175            self
176        }
177
178        /// Sets the value of [filter][crate::model::ListServiceConnectionMapsRequest::filter].
179        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
180            self.0.request.filter = v.into();
181            self
182        }
183
184        /// Sets the value of [order_by][crate::model::ListServiceConnectionMapsRequest::order_by].
185        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
186            self.0.request.order_by = v.into();
187            self
188        }
189    }
190
191    #[doc(hidden)]
192    impl gax::options::internal::RequestBuilder for ListServiceConnectionMaps {
193        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
194            &mut self.0.options
195        }
196    }
197
198    /// The request builder for [CrossNetworkAutomationService::get_service_connection_map][crate::client::CrossNetworkAutomationService::get_service_connection_map] calls.
199    ///
200    /// # Example
201    /// ```no_run
202    /// # use google_cloud_networkconnectivity_v1::builder;
203    /// use builder::cross_network_automation_service::GetServiceConnectionMap;
204    /// # tokio_test::block_on(async {
205    ///
206    /// let builder = prepare_request_builder();
207    /// let response = builder.send().await?;
208    /// # gax::Result::<()>::Ok(()) });
209    ///
210    /// fn prepare_request_builder() -> GetServiceConnectionMap {
211    ///   # panic!();
212    ///   // ... details omitted ...
213    /// }
214    /// ```
215    #[derive(Clone, Debug)]
216    pub struct GetServiceConnectionMap(
217        RequestBuilder<crate::model::GetServiceConnectionMapRequest>,
218    );
219
220    impl GetServiceConnectionMap {
221        pub(crate) fn new(
222            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
223        ) -> Self {
224            Self(RequestBuilder::new(stub))
225        }
226
227        /// Sets the full request, replacing any prior values.
228        pub fn with_request<V: Into<crate::model::GetServiceConnectionMapRequest>>(
229            mut self,
230            v: V,
231        ) -> Self {
232            self.0.request = v.into();
233            self
234        }
235
236        /// Sets all the options, replacing any prior values.
237        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
238            self.0.options = v.into();
239            self
240        }
241
242        /// Sends the request.
243        pub async fn send(self) -> Result<crate::model::ServiceConnectionMap> {
244            (*self.0.stub)
245                .get_service_connection_map(self.0.request, self.0.options)
246                .await
247                .map(gax::response::Response::into_body)
248        }
249
250        /// Sets the value of [name][crate::model::GetServiceConnectionMapRequest::name].
251        ///
252        /// This is a **required** field for requests.
253        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
254            self.0.request.name = v.into();
255            self
256        }
257    }
258
259    #[doc(hidden)]
260    impl gax::options::internal::RequestBuilder for GetServiceConnectionMap {
261        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
262            &mut self.0.options
263        }
264    }
265
266    /// The request builder for [CrossNetworkAutomationService::create_service_connection_map][crate::client::CrossNetworkAutomationService::create_service_connection_map] calls.
267    ///
268    /// # Example
269    /// ```no_run
270    /// # use google_cloud_networkconnectivity_v1::builder;
271    /// use builder::cross_network_automation_service::CreateServiceConnectionMap;
272    /// # tokio_test::block_on(async {
273    /// use lro::Poller;
274    ///
275    /// let builder = prepare_request_builder();
276    /// let response = builder.poller().until_done().await?;
277    /// # gax::Result::<()>::Ok(()) });
278    ///
279    /// fn prepare_request_builder() -> CreateServiceConnectionMap {
280    ///   # panic!();
281    ///   // ... details omitted ...
282    /// }
283    /// ```
284    #[derive(Clone, Debug)]
285    pub struct CreateServiceConnectionMap(
286        RequestBuilder<crate::model::CreateServiceConnectionMapRequest>,
287    );
288
289    impl CreateServiceConnectionMap {
290        pub(crate) fn new(
291            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
292        ) -> Self {
293            Self(RequestBuilder::new(stub))
294        }
295
296        /// Sets the full request, replacing any prior values.
297        pub fn with_request<V: Into<crate::model::CreateServiceConnectionMapRequest>>(
298            mut self,
299            v: V,
300        ) -> Self {
301            self.0.request = v.into();
302            self
303        }
304
305        /// Sets all the options, replacing any prior values.
306        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
307            self.0.options = v.into();
308            self
309        }
310
311        /// Sends the request.
312        ///
313        /// # Long running operations
314        ///
315        /// This starts, but does not poll, a longrunning operation. More information
316        /// on [create_service_connection_map][crate::client::CrossNetworkAutomationService::create_service_connection_map].
317        pub async fn send(self) -> Result<longrunning::model::Operation> {
318            (*self.0.stub)
319                .create_service_connection_map(self.0.request, self.0.options)
320                .await
321                .map(gax::response::Response::into_body)
322        }
323
324        /// Creates a [Poller][lro::Poller] to work with `create_service_connection_map`.
325        pub fn poller(
326            self,
327        ) -> impl lro::Poller<crate::model::ServiceConnectionMap, crate::model::OperationMetadata>
328        {
329            type Operation = lro::internal::Operation<
330                crate::model::ServiceConnectionMap,
331                crate::model::OperationMetadata,
332            >;
333            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
334            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
335
336            let stub = self.0.stub.clone();
337            let mut options = self.0.options.clone();
338            options.set_retry_policy(gax::retry_policy::NeverRetry);
339            let query = move |name| {
340                let stub = stub.clone();
341                let options = options.clone();
342                async {
343                    let op = GetOperation::new(stub)
344                        .set_name(name)
345                        .with_options(options)
346                        .send()
347                        .await?;
348                    Ok(Operation::new(op))
349                }
350            };
351
352            let start = move || async {
353                let op = self.send().await?;
354                Ok(Operation::new(op))
355            };
356
357            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
358        }
359
360        /// Sets the value of [parent][crate::model::CreateServiceConnectionMapRequest::parent].
361        ///
362        /// This is a **required** field for requests.
363        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
364            self.0.request.parent = v.into();
365            self
366        }
367
368        /// Sets the value of [service_connection_map_id][crate::model::CreateServiceConnectionMapRequest::service_connection_map_id].
369        pub fn set_service_connection_map_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
370            self.0.request.service_connection_map_id = v.into();
371            self
372        }
373
374        /// Sets the value of [service_connection_map][crate::model::CreateServiceConnectionMapRequest::service_connection_map].
375        ///
376        /// This is a **required** field for requests.
377        pub fn set_service_connection_map<T>(mut self, v: T) -> Self
378        where
379            T: std::convert::Into<crate::model::ServiceConnectionMap>,
380        {
381            self.0.request.service_connection_map = std::option::Option::Some(v.into());
382            self
383        }
384
385        /// Sets or clears the value of [service_connection_map][crate::model::CreateServiceConnectionMapRequest::service_connection_map].
386        ///
387        /// This is a **required** field for requests.
388        pub fn set_or_clear_service_connection_map<T>(mut self, v: std::option::Option<T>) -> Self
389        where
390            T: std::convert::Into<crate::model::ServiceConnectionMap>,
391        {
392            self.0.request.service_connection_map = v.map(|x| x.into());
393            self
394        }
395
396        /// Sets the value of [request_id][crate::model::CreateServiceConnectionMapRequest::request_id].
397        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
398            self.0.request.request_id = v.into();
399            self
400        }
401    }
402
403    #[doc(hidden)]
404    impl gax::options::internal::RequestBuilder for CreateServiceConnectionMap {
405        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
406            &mut self.0.options
407        }
408    }
409
410    /// The request builder for [CrossNetworkAutomationService::update_service_connection_map][crate::client::CrossNetworkAutomationService::update_service_connection_map] calls.
411    ///
412    /// # Example
413    /// ```no_run
414    /// # use google_cloud_networkconnectivity_v1::builder;
415    /// use builder::cross_network_automation_service::UpdateServiceConnectionMap;
416    /// # tokio_test::block_on(async {
417    /// use lro::Poller;
418    ///
419    /// let builder = prepare_request_builder();
420    /// let response = builder.poller().until_done().await?;
421    /// # gax::Result::<()>::Ok(()) });
422    ///
423    /// fn prepare_request_builder() -> UpdateServiceConnectionMap {
424    ///   # panic!();
425    ///   // ... details omitted ...
426    /// }
427    /// ```
428    #[derive(Clone, Debug)]
429    pub struct UpdateServiceConnectionMap(
430        RequestBuilder<crate::model::UpdateServiceConnectionMapRequest>,
431    );
432
433    impl UpdateServiceConnectionMap {
434        pub(crate) fn new(
435            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
436        ) -> Self {
437            Self(RequestBuilder::new(stub))
438        }
439
440        /// Sets the full request, replacing any prior values.
441        pub fn with_request<V: Into<crate::model::UpdateServiceConnectionMapRequest>>(
442            mut self,
443            v: V,
444        ) -> Self {
445            self.0.request = v.into();
446            self
447        }
448
449        /// Sets all the options, replacing any prior values.
450        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
451            self.0.options = v.into();
452            self
453        }
454
455        /// Sends the request.
456        ///
457        /// # Long running operations
458        ///
459        /// This starts, but does not poll, a longrunning operation. More information
460        /// on [update_service_connection_map][crate::client::CrossNetworkAutomationService::update_service_connection_map].
461        pub async fn send(self) -> Result<longrunning::model::Operation> {
462            (*self.0.stub)
463                .update_service_connection_map(self.0.request, self.0.options)
464                .await
465                .map(gax::response::Response::into_body)
466        }
467
468        /// Creates a [Poller][lro::Poller] to work with `update_service_connection_map`.
469        pub fn poller(
470            self,
471        ) -> impl lro::Poller<crate::model::ServiceConnectionMap, crate::model::OperationMetadata>
472        {
473            type Operation = lro::internal::Operation<
474                crate::model::ServiceConnectionMap,
475                crate::model::OperationMetadata,
476            >;
477            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
478            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
479
480            let stub = self.0.stub.clone();
481            let mut options = self.0.options.clone();
482            options.set_retry_policy(gax::retry_policy::NeverRetry);
483            let query = move |name| {
484                let stub = stub.clone();
485                let options = options.clone();
486                async {
487                    let op = GetOperation::new(stub)
488                        .set_name(name)
489                        .with_options(options)
490                        .send()
491                        .await?;
492                    Ok(Operation::new(op))
493                }
494            };
495
496            let start = move || async {
497                let op = self.send().await?;
498                Ok(Operation::new(op))
499            };
500
501            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
502        }
503
504        /// Sets the value of [update_mask][crate::model::UpdateServiceConnectionMapRequest::update_mask].
505        pub fn set_update_mask<T>(mut self, v: T) -> Self
506        where
507            T: std::convert::Into<wkt::FieldMask>,
508        {
509            self.0.request.update_mask = std::option::Option::Some(v.into());
510            self
511        }
512
513        /// Sets or clears the value of [update_mask][crate::model::UpdateServiceConnectionMapRequest::update_mask].
514        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
515        where
516            T: std::convert::Into<wkt::FieldMask>,
517        {
518            self.0.request.update_mask = v.map(|x| x.into());
519            self
520        }
521
522        /// Sets the value of [service_connection_map][crate::model::UpdateServiceConnectionMapRequest::service_connection_map].
523        ///
524        /// This is a **required** field for requests.
525        pub fn set_service_connection_map<T>(mut self, v: T) -> Self
526        where
527            T: std::convert::Into<crate::model::ServiceConnectionMap>,
528        {
529            self.0.request.service_connection_map = std::option::Option::Some(v.into());
530            self
531        }
532
533        /// Sets or clears the value of [service_connection_map][crate::model::UpdateServiceConnectionMapRequest::service_connection_map].
534        ///
535        /// This is a **required** field for requests.
536        pub fn set_or_clear_service_connection_map<T>(mut self, v: std::option::Option<T>) -> Self
537        where
538            T: std::convert::Into<crate::model::ServiceConnectionMap>,
539        {
540            self.0.request.service_connection_map = v.map(|x| x.into());
541            self
542        }
543
544        /// Sets the value of [request_id][crate::model::UpdateServiceConnectionMapRequest::request_id].
545        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
546            self.0.request.request_id = v.into();
547            self
548        }
549    }
550
551    #[doc(hidden)]
552    impl gax::options::internal::RequestBuilder for UpdateServiceConnectionMap {
553        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
554            &mut self.0.options
555        }
556    }
557
558    /// The request builder for [CrossNetworkAutomationService::delete_service_connection_map][crate::client::CrossNetworkAutomationService::delete_service_connection_map] calls.
559    ///
560    /// # Example
561    /// ```no_run
562    /// # use google_cloud_networkconnectivity_v1::builder;
563    /// use builder::cross_network_automation_service::DeleteServiceConnectionMap;
564    /// # tokio_test::block_on(async {
565    /// use lro::Poller;
566    ///
567    /// let builder = prepare_request_builder();
568    /// let response = builder.poller().until_done().await?;
569    /// # gax::Result::<()>::Ok(()) });
570    ///
571    /// fn prepare_request_builder() -> DeleteServiceConnectionMap {
572    ///   # panic!();
573    ///   // ... details omitted ...
574    /// }
575    /// ```
576    #[derive(Clone, Debug)]
577    pub struct DeleteServiceConnectionMap(
578        RequestBuilder<crate::model::DeleteServiceConnectionMapRequest>,
579    );
580
581    impl DeleteServiceConnectionMap {
582        pub(crate) fn new(
583            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
584        ) -> Self {
585            Self(RequestBuilder::new(stub))
586        }
587
588        /// Sets the full request, replacing any prior values.
589        pub fn with_request<V: Into<crate::model::DeleteServiceConnectionMapRequest>>(
590            mut self,
591            v: V,
592        ) -> Self {
593            self.0.request = v.into();
594            self
595        }
596
597        /// Sets all the options, replacing any prior values.
598        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
599            self.0.options = v.into();
600            self
601        }
602
603        /// Sends the request.
604        ///
605        /// # Long running operations
606        ///
607        /// This starts, but does not poll, a longrunning operation. More information
608        /// on [delete_service_connection_map][crate::client::CrossNetworkAutomationService::delete_service_connection_map].
609        pub async fn send(self) -> Result<longrunning::model::Operation> {
610            (*self.0.stub)
611                .delete_service_connection_map(self.0.request, self.0.options)
612                .await
613                .map(gax::response::Response::into_body)
614        }
615
616        /// Creates a [Poller][lro::Poller] to work with `delete_service_connection_map`.
617        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
618            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
619            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
620            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
621
622            let stub = self.0.stub.clone();
623            let mut options = self.0.options.clone();
624            options.set_retry_policy(gax::retry_policy::NeverRetry);
625            let query = move |name| {
626                let stub = stub.clone();
627                let options = options.clone();
628                async {
629                    let op = GetOperation::new(stub)
630                        .set_name(name)
631                        .with_options(options)
632                        .send()
633                        .await?;
634                    Ok(Operation::new(op))
635                }
636            };
637
638            let start = move || async {
639                let op = self.send().await?;
640                Ok(Operation::new(op))
641            };
642
643            lro::internal::new_unit_response_poller(
644                polling_error_policy,
645                polling_backoff_policy,
646                start,
647                query,
648            )
649        }
650
651        /// Sets the value of [name][crate::model::DeleteServiceConnectionMapRequest::name].
652        ///
653        /// This is a **required** field for requests.
654        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
655            self.0.request.name = v.into();
656            self
657        }
658
659        /// Sets the value of [request_id][crate::model::DeleteServiceConnectionMapRequest::request_id].
660        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
661            self.0.request.request_id = v.into();
662            self
663        }
664
665        /// Sets the value of [etag][crate::model::DeleteServiceConnectionMapRequest::etag].
666        pub fn set_etag<T>(mut self, v: T) -> Self
667        where
668            T: std::convert::Into<std::string::String>,
669        {
670            self.0.request.etag = std::option::Option::Some(v.into());
671            self
672        }
673
674        /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionMapRequest::etag].
675        pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
676        where
677            T: std::convert::Into<std::string::String>,
678        {
679            self.0.request.etag = v.map(|x| x.into());
680            self
681        }
682    }
683
684    #[doc(hidden)]
685    impl gax::options::internal::RequestBuilder for DeleteServiceConnectionMap {
686        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
687            &mut self.0.options
688        }
689    }
690
691    /// The request builder for [CrossNetworkAutomationService::list_service_connection_policies][crate::client::CrossNetworkAutomationService::list_service_connection_policies] calls.
692    ///
693    /// # Example
694    /// ```no_run
695    /// # use google_cloud_networkconnectivity_v1::builder;
696    /// use builder::cross_network_automation_service::ListServiceConnectionPolicies;
697    /// # tokio_test::block_on(async {
698    /// use gax::paginator::ItemPaginator;
699    ///
700    /// let builder = prepare_request_builder();
701    /// let mut items = builder.by_item();
702    /// while let Some(result) = items.next().await {
703    ///   let item = result?;
704    /// }
705    /// # gax::Result::<()>::Ok(()) });
706    ///
707    /// fn prepare_request_builder() -> ListServiceConnectionPolicies {
708    ///   # panic!();
709    ///   // ... details omitted ...
710    /// }
711    /// ```
712    #[derive(Clone, Debug)]
713    pub struct ListServiceConnectionPolicies(
714        RequestBuilder<crate::model::ListServiceConnectionPoliciesRequest>,
715    );
716
717    impl ListServiceConnectionPolicies {
718        pub(crate) fn new(
719            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
720        ) -> Self {
721            Self(RequestBuilder::new(stub))
722        }
723
724        /// Sets the full request, replacing any prior values.
725        pub fn with_request<V: Into<crate::model::ListServiceConnectionPoliciesRequest>>(
726            mut self,
727            v: V,
728        ) -> Self {
729            self.0.request = v.into();
730            self
731        }
732
733        /// Sets all the options, replacing any prior values.
734        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
735            self.0.options = v.into();
736            self
737        }
738
739        /// Sends the request.
740        pub async fn send(self) -> Result<crate::model::ListServiceConnectionPoliciesResponse> {
741            (*self.0.stub)
742                .list_service_connection_policies(self.0.request, self.0.options)
743                .await
744                .map(gax::response::Response::into_body)
745        }
746
747        /// Streams each page in the collection.
748        pub fn by_page(
749            self,
750        ) -> impl gax::paginator::Paginator<
751            crate::model::ListServiceConnectionPoliciesResponse,
752            gax::error::Error,
753        > {
754            use std::clone::Clone;
755            let token = self.0.request.page_token.clone();
756            let execute = move |token: String| {
757                let mut builder = self.clone();
758                builder.0.request = builder.0.request.set_page_token(token);
759                builder.send()
760            };
761            gax::paginator::internal::new_paginator(token, execute)
762        }
763
764        /// Streams each item in the collection.
765        pub fn by_item(
766            self,
767        ) -> impl gax::paginator::ItemPaginator<
768            crate::model::ListServiceConnectionPoliciesResponse,
769            gax::error::Error,
770        > {
771            use gax::paginator::Paginator;
772            self.by_page().items()
773        }
774
775        /// Sets the value of [parent][crate::model::ListServiceConnectionPoliciesRequest::parent].
776        ///
777        /// This is a **required** field for requests.
778        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
779            self.0.request.parent = v.into();
780            self
781        }
782
783        /// Sets the value of [page_size][crate::model::ListServiceConnectionPoliciesRequest::page_size].
784        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
785            self.0.request.page_size = v.into();
786            self
787        }
788
789        /// Sets the value of [page_token][crate::model::ListServiceConnectionPoliciesRequest::page_token].
790        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
791            self.0.request.page_token = v.into();
792            self
793        }
794
795        /// Sets the value of [filter][crate::model::ListServiceConnectionPoliciesRequest::filter].
796        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
797            self.0.request.filter = v.into();
798            self
799        }
800
801        /// Sets the value of [order_by][crate::model::ListServiceConnectionPoliciesRequest::order_by].
802        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
803            self.0.request.order_by = v.into();
804            self
805        }
806    }
807
808    #[doc(hidden)]
809    impl gax::options::internal::RequestBuilder for ListServiceConnectionPolicies {
810        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
811            &mut self.0.options
812        }
813    }
814
815    /// The request builder for [CrossNetworkAutomationService::get_service_connection_policy][crate::client::CrossNetworkAutomationService::get_service_connection_policy] calls.
816    ///
817    /// # Example
818    /// ```no_run
819    /// # use google_cloud_networkconnectivity_v1::builder;
820    /// use builder::cross_network_automation_service::GetServiceConnectionPolicy;
821    /// # tokio_test::block_on(async {
822    ///
823    /// let builder = prepare_request_builder();
824    /// let response = builder.send().await?;
825    /// # gax::Result::<()>::Ok(()) });
826    ///
827    /// fn prepare_request_builder() -> GetServiceConnectionPolicy {
828    ///   # panic!();
829    ///   // ... details omitted ...
830    /// }
831    /// ```
832    #[derive(Clone, Debug)]
833    pub struct GetServiceConnectionPolicy(
834        RequestBuilder<crate::model::GetServiceConnectionPolicyRequest>,
835    );
836
837    impl GetServiceConnectionPolicy {
838        pub(crate) fn new(
839            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
840        ) -> Self {
841            Self(RequestBuilder::new(stub))
842        }
843
844        /// Sets the full request, replacing any prior values.
845        pub fn with_request<V: Into<crate::model::GetServiceConnectionPolicyRequest>>(
846            mut self,
847            v: V,
848        ) -> Self {
849            self.0.request = v.into();
850            self
851        }
852
853        /// Sets all the options, replacing any prior values.
854        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
855            self.0.options = v.into();
856            self
857        }
858
859        /// Sends the request.
860        pub async fn send(self) -> Result<crate::model::ServiceConnectionPolicy> {
861            (*self.0.stub)
862                .get_service_connection_policy(self.0.request, self.0.options)
863                .await
864                .map(gax::response::Response::into_body)
865        }
866
867        /// Sets the value of [name][crate::model::GetServiceConnectionPolicyRequest::name].
868        ///
869        /// This is a **required** field for requests.
870        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
871            self.0.request.name = v.into();
872            self
873        }
874    }
875
876    #[doc(hidden)]
877    impl gax::options::internal::RequestBuilder for GetServiceConnectionPolicy {
878        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
879            &mut self.0.options
880        }
881    }
882
883    /// The request builder for [CrossNetworkAutomationService::create_service_connection_policy][crate::client::CrossNetworkAutomationService::create_service_connection_policy] calls.
884    ///
885    /// # Example
886    /// ```no_run
887    /// # use google_cloud_networkconnectivity_v1::builder;
888    /// use builder::cross_network_automation_service::CreateServiceConnectionPolicy;
889    /// # tokio_test::block_on(async {
890    /// use lro::Poller;
891    ///
892    /// let builder = prepare_request_builder();
893    /// let response = builder.poller().until_done().await?;
894    /// # gax::Result::<()>::Ok(()) });
895    ///
896    /// fn prepare_request_builder() -> CreateServiceConnectionPolicy {
897    ///   # panic!();
898    ///   // ... details omitted ...
899    /// }
900    /// ```
901    #[derive(Clone, Debug)]
902    pub struct CreateServiceConnectionPolicy(
903        RequestBuilder<crate::model::CreateServiceConnectionPolicyRequest>,
904    );
905
906    impl CreateServiceConnectionPolicy {
907        pub(crate) fn new(
908            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
909        ) -> Self {
910            Self(RequestBuilder::new(stub))
911        }
912
913        /// Sets the full request, replacing any prior values.
914        pub fn with_request<V: Into<crate::model::CreateServiceConnectionPolicyRequest>>(
915            mut self,
916            v: V,
917        ) -> Self {
918            self.0.request = v.into();
919            self
920        }
921
922        /// Sets all the options, replacing any prior values.
923        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
924            self.0.options = v.into();
925            self
926        }
927
928        /// Sends the request.
929        ///
930        /// # Long running operations
931        ///
932        /// This starts, but does not poll, a longrunning operation. More information
933        /// on [create_service_connection_policy][crate::client::CrossNetworkAutomationService::create_service_connection_policy].
934        pub async fn send(self) -> Result<longrunning::model::Operation> {
935            (*self.0.stub)
936                .create_service_connection_policy(self.0.request, self.0.options)
937                .await
938                .map(gax::response::Response::into_body)
939        }
940
941        /// Creates a [Poller][lro::Poller] to work with `create_service_connection_policy`.
942        pub fn poller(
943            self,
944        ) -> impl lro::Poller<crate::model::ServiceConnectionPolicy, crate::model::OperationMetadata>
945        {
946            type Operation = lro::internal::Operation<
947                crate::model::ServiceConnectionPolicy,
948                crate::model::OperationMetadata,
949            >;
950            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
951            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
952
953            let stub = self.0.stub.clone();
954            let mut options = self.0.options.clone();
955            options.set_retry_policy(gax::retry_policy::NeverRetry);
956            let query = move |name| {
957                let stub = stub.clone();
958                let options = options.clone();
959                async {
960                    let op = GetOperation::new(stub)
961                        .set_name(name)
962                        .with_options(options)
963                        .send()
964                        .await?;
965                    Ok(Operation::new(op))
966                }
967            };
968
969            let start = move || async {
970                let op = self.send().await?;
971                Ok(Operation::new(op))
972            };
973
974            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
975        }
976
977        /// Sets the value of [parent][crate::model::CreateServiceConnectionPolicyRequest::parent].
978        ///
979        /// This is a **required** field for requests.
980        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
981            self.0.request.parent = v.into();
982            self
983        }
984
985        /// Sets the value of [service_connection_policy_id][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy_id].
986        pub fn set_service_connection_policy_id<T: Into<std::string::String>>(
987            mut self,
988            v: T,
989        ) -> Self {
990            self.0.request.service_connection_policy_id = v.into();
991            self
992        }
993
994        /// Sets the value of [service_connection_policy][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy].
995        ///
996        /// This is a **required** field for requests.
997        pub fn set_service_connection_policy<T>(mut self, v: T) -> Self
998        where
999            T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
1000        {
1001            self.0.request.service_connection_policy = std::option::Option::Some(v.into());
1002            self
1003        }
1004
1005        /// Sets or clears the value of [service_connection_policy][crate::model::CreateServiceConnectionPolicyRequest::service_connection_policy].
1006        ///
1007        /// This is a **required** field for requests.
1008        pub fn set_or_clear_service_connection_policy<T>(
1009            mut self,
1010            v: std::option::Option<T>,
1011        ) -> Self
1012        where
1013            T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
1014        {
1015            self.0.request.service_connection_policy = v.map(|x| x.into());
1016            self
1017        }
1018
1019        /// Sets the value of [request_id][crate::model::CreateServiceConnectionPolicyRequest::request_id].
1020        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1021            self.0.request.request_id = v.into();
1022            self
1023        }
1024    }
1025
1026    #[doc(hidden)]
1027    impl gax::options::internal::RequestBuilder for CreateServiceConnectionPolicy {
1028        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1029            &mut self.0.options
1030        }
1031    }
1032
1033    /// The request builder for [CrossNetworkAutomationService::update_service_connection_policy][crate::client::CrossNetworkAutomationService::update_service_connection_policy] calls.
1034    ///
1035    /// # Example
1036    /// ```no_run
1037    /// # use google_cloud_networkconnectivity_v1::builder;
1038    /// use builder::cross_network_automation_service::UpdateServiceConnectionPolicy;
1039    /// # tokio_test::block_on(async {
1040    /// use lro::Poller;
1041    ///
1042    /// let builder = prepare_request_builder();
1043    /// let response = builder.poller().until_done().await?;
1044    /// # gax::Result::<()>::Ok(()) });
1045    ///
1046    /// fn prepare_request_builder() -> UpdateServiceConnectionPolicy {
1047    ///   # panic!();
1048    ///   // ... details omitted ...
1049    /// }
1050    /// ```
1051    #[derive(Clone, Debug)]
1052    pub struct UpdateServiceConnectionPolicy(
1053        RequestBuilder<crate::model::UpdateServiceConnectionPolicyRequest>,
1054    );
1055
1056    impl UpdateServiceConnectionPolicy {
1057        pub(crate) fn new(
1058            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1059        ) -> Self {
1060            Self(RequestBuilder::new(stub))
1061        }
1062
1063        /// Sets the full request, replacing any prior values.
1064        pub fn with_request<V: Into<crate::model::UpdateServiceConnectionPolicyRequest>>(
1065            mut self,
1066            v: V,
1067        ) -> Self {
1068            self.0.request = v.into();
1069            self
1070        }
1071
1072        /// Sets all the options, replacing any prior values.
1073        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1074            self.0.options = v.into();
1075            self
1076        }
1077
1078        /// Sends the request.
1079        ///
1080        /// # Long running operations
1081        ///
1082        /// This starts, but does not poll, a longrunning operation. More information
1083        /// on [update_service_connection_policy][crate::client::CrossNetworkAutomationService::update_service_connection_policy].
1084        pub async fn send(self) -> Result<longrunning::model::Operation> {
1085            (*self.0.stub)
1086                .update_service_connection_policy(self.0.request, self.0.options)
1087                .await
1088                .map(gax::response::Response::into_body)
1089        }
1090
1091        /// Creates a [Poller][lro::Poller] to work with `update_service_connection_policy`.
1092        pub fn poller(
1093            self,
1094        ) -> impl lro::Poller<crate::model::ServiceConnectionPolicy, crate::model::OperationMetadata>
1095        {
1096            type Operation = lro::internal::Operation<
1097                crate::model::ServiceConnectionPolicy,
1098                crate::model::OperationMetadata,
1099            >;
1100            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1101            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1102
1103            let stub = self.0.stub.clone();
1104            let mut options = self.0.options.clone();
1105            options.set_retry_policy(gax::retry_policy::NeverRetry);
1106            let query = move |name| {
1107                let stub = stub.clone();
1108                let options = options.clone();
1109                async {
1110                    let op = GetOperation::new(stub)
1111                        .set_name(name)
1112                        .with_options(options)
1113                        .send()
1114                        .await?;
1115                    Ok(Operation::new(op))
1116                }
1117            };
1118
1119            let start = move || async {
1120                let op = self.send().await?;
1121                Ok(Operation::new(op))
1122            };
1123
1124            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1125        }
1126
1127        /// Sets the value of [update_mask][crate::model::UpdateServiceConnectionPolicyRequest::update_mask].
1128        pub fn set_update_mask<T>(mut self, v: T) -> Self
1129        where
1130            T: std::convert::Into<wkt::FieldMask>,
1131        {
1132            self.0.request.update_mask = std::option::Option::Some(v.into());
1133            self
1134        }
1135
1136        /// Sets or clears the value of [update_mask][crate::model::UpdateServiceConnectionPolicyRequest::update_mask].
1137        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1138        where
1139            T: std::convert::Into<wkt::FieldMask>,
1140        {
1141            self.0.request.update_mask = v.map(|x| x.into());
1142            self
1143        }
1144
1145        /// Sets the value of [service_connection_policy][crate::model::UpdateServiceConnectionPolicyRequest::service_connection_policy].
1146        ///
1147        /// This is a **required** field for requests.
1148        pub fn set_service_connection_policy<T>(mut self, v: T) -> Self
1149        where
1150            T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
1151        {
1152            self.0.request.service_connection_policy = std::option::Option::Some(v.into());
1153            self
1154        }
1155
1156        /// Sets or clears the value of [service_connection_policy][crate::model::UpdateServiceConnectionPolicyRequest::service_connection_policy].
1157        ///
1158        /// This is a **required** field for requests.
1159        pub fn set_or_clear_service_connection_policy<T>(
1160            mut self,
1161            v: std::option::Option<T>,
1162        ) -> Self
1163        where
1164            T: std::convert::Into<crate::model::ServiceConnectionPolicy>,
1165        {
1166            self.0.request.service_connection_policy = v.map(|x| x.into());
1167            self
1168        }
1169
1170        /// Sets the value of [request_id][crate::model::UpdateServiceConnectionPolicyRequest::request_id].
1171        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1172            self.0.request.request_id = v.into();
1173            self
1174        }
1175    }
1176
1177    #[doc(hidden)]
1178    impl gax::options::internal::RequestBuilder for UpdateServiceConnectionPolicy {
1179        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1180            &mut self.0.options
1181        }
1182    }
1183
1184    /// The request builder for [CrossNetworkAutomationService::delete_service_connection_policy][crate::client::CrossNetworkAutomationService::delete_service_connection_policy] calls.
1185    ///
1186    /// # Example
1187    /// ```no_run
1188    /// # use google_cloud_networkconnectivity_v1::builder;
1189    /// use builder::cross_network_automation_service::DeleteServiceConnectionPolicy;
1190    /// # tokio_test::block_on(async {
1191    /// use lro::Poller;
1192    ///
1193    /// let builder = prepare_request_builder();
1194    /// let response = builder.poller().until_done().await?;
1195    /// # gax::Result::<()>::Ok(()) });
1196    ///
1197    /// fn prepare_request_builder() -> DeleteServiceConnectionPolicy {
1198    ///   # panic!();
1199    ///   // ... details omitted ...
1200    /// }
1201    /// ```
1202    #[derive(Clone, Debug)]
1203    pub struct DeleteServiceConnectionPolicy(
1204        RequestBuilder<crate::model::DeleteServiceConnectionPolicyRequest>,
1205    );
1206
1207    impl DeleteServiceConnectionPolicy {
1208        pub(crate) fn new(
1209            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1210        ) -> Self {
1211            Self(RequestBuilder::new(stub))
1212        }
1213
1214        /// Sets the full request, replacing any prior values.
1215        pub fn with_request<V: Into<crate::model::DeleteServiceConnectionPolicyRequest>>(
1216            mut self,
1217            v: V,
1218        ) -> Self {
1219            self.0.request = v.into();
1220            self
1221        }
1222
1223        /// Sets all the options, replacing any prior values.
1224        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1225            self.0.options = v.into();
1226            self
1227        }
1228
1229        /// Sends the request.
1230        ///
1231        /// # Long running operations
1232        ///
1233        /// This starts, but does not poll, a longrunning operation. More information
1234        /// on [delete_service_connection_policy][crate::client::CrossNetworkAutomationService::delete_service_connection_policy].
1235        pub async fn send(self) -> Result<longrunning::model::Operation> {
1236            (*self.0.stub)
1237                .delete_service_connection_policy(self.0.request, self.0.options)
1238                .await
1239                .map(gax::response::Response::into_body)
1240        }
1241
1242        /// Creates a [Poller][lro::Poller] to work with `delete_service_connection_policy`.
1243        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1244            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1245            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1246            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1247
1248            let stub = self.0.stub.clone();
1249            let mut options = self.0.options.clone();
1250            options.set_retry_policy(gax::retry_policy::NeverRetry);
1251            let query = move |name| {
1252                let stub = stub.clone();
1253                let options = options.clone();
1254                async {
1255                    let op = GetOperation::new(stub)
1256                        .set_name(name)
1257                        .with_options(options)
1258                        .send()
1259                        .await?;
1260                    Ok(Operation::new(op))
1261                }
1262            };
1263
1264            let start = move || async {
1265                let op = self.send().await?;
1266                Ok(Operation::new(op))
1267            };
1268
1269            lro::internal::new_unit_response_poller(
1270                polling_error_policy,
1271                polling_backoff_policy,
1272                start,
1273                query,
1274            )
1275        }
1276
1277        /// Sets the value of [name][crate::model::DeleteServiceConnectionPolicyRequest::name].
1278        ///
1279        /// This is a **required** field for requests.
1280        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1281            self.0.request.name = v.into();
1282            self
1283        }
1284
1285        /// Sets the value of [request_id][crate::model::DeleteServiceConnectionPolicyRequest::request_id].
1286        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1287            self.0.request.request_id = v.into();
1288            self
1289        }
1290
1291        /// Sets the value of [etag][crate::model::DeleteServiceConnectionPolicyRequest::etag].
1292        pub fn set_etag<T>(mut self, v: T) -> Self
1293        where
1294            T: std::convert::Into<std::string::String>,
1295        {
1296            self.0.request.etag = std::option::Option::Some(v.into());
1297            self
1298        }
1299
1300        /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionPolicyRequest::etag].
1301        pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
1302        where
1303            T: std::convert::Into<std::string::String>,
1304        {
1305            self.0.request.etag = v.map(|x| x.into());
1306            self
1307        }
1308    }
1309
1310    #[doc(hidden)]
1311    impl gax::options::internal::RequestBuilder for DeleteServiceConnectionPolicy {
1312        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1313            &mut self.0.options
1314        }
1315    }
1316
1317    /// The request builder for [CrossNetworkAutomationService::list_service_classes][crate::client::CrossNetworkAutomationService::list_service_classes] calls.
1318    ///
1319    /// # Example
1320    /// ```no_run
1321    /// # use google_cloud_networkconnectivity_v1::builder;
1322    /// use builder::cross_network_automation_service::ListServiceClasses;
1323    /// # tokio_test::block_on(async {
1324    /// use gax::paginator::ItemPaginator;
1325    ///
1326    /// let builder = prepare_request_builder();
1327    /// let mut items = builder.by_item();
1328    /// while let Some(result) = items.next().await {
1329    ///   let item = result?;
1330    /// }
1331    /// # gax::Result::<()>::Ok(()) });
1332    ///
1333    /// fn prepare_request_builder() -> ListServiceClasses {
1334    ///   # panic!();
1335    ///   // ... details omitted ...
1336    /// }
1337    /// ```
1338    #[derive(Clone, Debug)]
1339    pub struct ListServiceClasses(RequestBuilder<crate::model::ListServiceClassesRequest>);
1340
1341    impl ListServiceClasses {
1342        pub(crate) fn new(
1343            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1344        ) -> Self {
1345            Self(RequestBuilder::new(stub))
1346        }
1347
1348        /// Sets the full request, replacing any prior values.
1349        pub fn with_request<V: Into<crate::model::ListServiceClassesRequest>>(
1350            mut self,
1351            v: V,
1352        ) -> Self {
1353            self.0.request = v.into();
1354            self
1355        }
1356
1357        /// Sets all the options, replacing any prior values.
1358        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1359            self.0.options = v.into();
1360            self
1361        }
1362
1363        /// Sends the request.
1364        pub async fn send(self) -> Result<crate::model::ListServiceClassesResponse> {
1365            (*self.0.stub)
1366                .list_service_classes(self.0.request, self.0.options)
1367                .await
1368                .map(gax::response::Response::into_body)
1369        }
1370
1371        /// Streams each page in the collection.
1372        pub fn by_page(
1373            self,
1374        ) -> impl gax::paginator::Paginator<crate::model::ListServiceClassesResponse, gax::error::Error>
1375        {
1376            use std::clone::Clone;
1377            let token = self.0.request.page_token.clone();
1378            let execute = move |token: String| {
1379                let mut builder = self.clone();
1380                builder.0.request = builder.0.request.set_page_token(token);
1381                builder.send()
1382            };
1383            gax::paginator::internal::new_paginator(token, execute)
1384        }
1385
1386        /// Streams each item in the collection.
1387        pub fn by_item(
1388            self,
1389        ) -> impl gax::paginator::ItemPaginator<
1390            crate::model::ListServiceClassesResponse,
1391            gax::error::Error,
1392        > {
1393            use gax::paginator::Paginator;
1394            self.by_page().items()
1395        }
1396
1397        /// Sets the value of [parent][crate::model::ListServiceClassesRequest::parent].
1398        ///
1399        /// This is a **required** field for requests.
1400        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1401            self.0.request.parent = v.into();
1402            self
1403        }
1404
1405        /// Sets the value of [page_size][crate::model::ListServiceClassesRequest::page_size].
1406        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1407            self.0.request.page_size = v.into();
1408            self
1409        }
1410
1411        /// Sets the value of [page_token][crate::model::ListServiceClassesRequest::page_token].
1412        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1413            self.0.request.page_token = v.into();
1414            self
1415        }
1416
1417        /// Sets the value of [filter][crate::model::ListServiceClassesRequest::filter].
1418        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419            self.0.request.filter = v.into();
1420            self
1421        }
1422
1423        /// Sets the value of [order_by][crate::model::ListServiceClassesRequest::order_by].
1424        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1425            self.0.request.order_by = v.into();
1426            self
1427        }
1428    }
1429
1430    #[doc(hidden)]
1431    impl gax::options::internal::RequestBuilder for ListServiceClasses {
1432        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1433            &mut self.0.options
1434        }
1435    }
1436
1437    /// The request builder for [CrossNetworkAutomationService::get_service_class][crate::client::CrossNetworkAutomationService::get_service_class] calls.
1438    ///
1439    /// # Example
1440    /// ```no_run
1441    /// # use google_cloud_networkconnectivity_v1::builder;
1442    /// use builder::cross_network_automation_service::GetServiceClass;
1443    /// # tokio_test::block_on(async {
1444    ///
1445    /// let builder = prepare_request_builder();
1446    /// let response = builder.send().await?;
1447    /// # gax::Result::<()>::Ok(()) });
1448    ///
1449    /// fn prepare_request_builder() -> GetServiceClass {
1450    ///   # panic!();
1451    ///   // ... details omitted ...
1452    /// }
1453    /// ```
1454    #[derive(Clone, Debug)]
1455    pub struct GetServiceClass(RequestBuilder<crate::model::GetServiceClassRequest>);
1456
1457    impl GetServiceClass {
1458        pub(crate) fn new(
1459            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1460        ) -> Self {
1461            Self(RequestBuilder::new(stub))
1462        }
1463
1464        /// Sets the full request, replacing any prior values.
1465        pub fn with_request<V: Into<crate::model::GetServiceClassRequest>>(mut self, v: V) -> Self {
1466            self.0.request = v.into();
1467            self
1468        }
1469
1470        /// Sets all the options, replacing any prior values.
1471        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1472            self.0.options = v.into();
1473            self
1474        }
1475
1476        /// Sends the request.
1477        pub async fn send(self) -> Result<crate::model::ServiceClass> {
1478            (*self.0.stub)
1479                .get_service_class(self.0.request, self.0.options)
1480                .await
1481                .map(gax::response::Response::into_body)
1482        }
1483
1484        /// Sets the value of [name][crate::model::GetServiceClassRequest::name].
1485        ///
1486        /// This is a **required** field for requests.
1487        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1488            self.0.request.name = v.into();
1489            self
1490        }
1491    }
1492
1493    #[doc(hidden)]
1494    impl gax::options::internal::RequestBuilder for GetServiceClass {
1495        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1496            &mut self.0.options
1497        }
1498    }
1499
1500    /// The request builder for [CrossNetworkAutomationService::update_service_class][crate::client::CrossNetworkAutomationService::update_service_class] calls.
1501    ///
1502    /// # Example
1503    /// ```no_run
1504    /// # use google_cloud_networkconnectivity_v1::builder;
1505    /// use builder::cross_network_automation_service::UpdateServiceClass;
1506    /// # tokio_test::block_on(async {
1507    /// use lro::Poller;
1508    ///
1509    /// let builder = prepare_request_builder();
1510    /// let response = builder.poller().until_done().await?;
1511    /// # gax::Result::<()>::Ok(()) });
1512    ///
1513    /// fn prepare_request_builder() -> UpdateServiceClass {
1514    ///   # panic!();
1515    ///   // ... details omitted ...
1516    /// }
1517    /// ```
1518    #[derive(Clone, Debug)]
1519    pub struct UpdateServiceClass(RequestBuilder<crate::model::UpdateServiceClassRequest>);
1520
1521    impl UpdateServiceClass {
1522        pub(crate) fn new(
1523            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1524        ) -> Self {
1525            Self(RequestBuilder::new(stub))
1526        }
1527
1528        /// Sets the full request, replacing any prior values.
1529        pub fn with_request<V: Into<crate::model::UpdateServiceClassRequest>>(
1530            mut self,
1531            v: V,
1532        ) -> Self {
1533            self.0.request = v.into();
1534            self
1535        }
1536
1537        /// Sets all the options, replacing any prior values.
1538        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1539            self.0.options = v.into();
1540            self
1541        }
1542
1543        /// Sends the request.
1544        ///
1545        /// # Long running operations
1546        ///
1547        /// This starts, but does not poll, a longrunning operation. More information
1548        /// on [update_service_class][crate::client::CrossNetworkAutomationService::update_service_class].
1549        pub async fn send(self) -> Result<longrunning::model::Operation> {
1550            (*self.0.stub)
1551                .update_service_class(self.0.request, self.0.options)
1552                .await
1553                .map(gax::response::Response::into_body)
1554        }
1555
1556        /// Creates a [Poller][lro::Poller] to work with `update_service_class`.
1557        pub fn poller(
1558            self,
1559        ) -> impl lro::Poller<crate::model::ServiceClass, crate::model::OperationMetadata> {
1560            type Operation = lro::internal::Operation<
1561                crate::model::ServiceClass,
1562                crate::model::OperationMetadata,
1563            >;
1564            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1565            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1566
1567            let stub = self.0.stub.clone();
1568            let mut options = self.0.options.clone();
1569            options.set_retry_policy(gax::retry_policy::NeverRetry);
1570            let query = move |name| {
1571                let stub = stub.clone();
1572                let options = options.clone();
1573                async {
1574                    let op = GetOperation::new(stub)
1575                        .set_name(name)
1576                        .with_options(options)
1577                        .send()
1578                        .await?;
1579                    Ok(Operation::new(op))
1580                }
1581            };
1582
1583            let start = move || async {
1584                let op = self.send().await?;
1585                Ok(Operation::new(op))
1586            };
1587
1588            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1589        }
1590
1591        /// Sets the value of [update_mask][crate::model::UpdateServiceClassRequest::update_mask].
1592        pub fn set_update_mask<T>(mut self, v: T) -> Self
1593        where
1594            T: std::convert::Into<wkt::FieldMask>,
1595        {
1596            self.0.request.update_mask = std::option::Option::Some(v.into());
1597            self
1598        }
1599
1600        /// Sets or clears the value of [update_mask][crate::model::UpdateServiceClassRequest::update_mask].
1601        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1602        where
1603            T: std::convert::Into<wkt::FieldMask>,
1604        {
1605            self.0.request.update_mask = v.map(|x| x.into());
1606            self
1607        }
1608
1609        /// Sets the value of [service_class][crate::model::UpdateServiceClassRequest::service_class].
1610        ///
1611        /// This is a **required** field for requests.
1612        pub fn set_service_class<T>(mut self, v: T) -> Self
1613        where
1614            T: std::convert::Into<crate::model::ServiceClass>,
1615        {
1616            self.0.request.service_class = std::option::Option::Some(v.into());
1617            self
1618        }
1619
1620        /// Sets or clears the value of [service_class][crate::model::UpdateServiceClassRequest::service_class].
1621        ///
1622        /// This is a **required** field for requests.
1623        pub fn set_or_clear_service_class<T>(mut self, v: std::option::Option<T>) -> Self
1624        where
1625            T: std::convert::Into<crate::model::ServiceClass>,
1626        {
1627            self.0.request.service_class = v.map(|x| x.into());
1628            self
1629        }
1630
1631        /// Sets the value of [request_id][crate::model::UpdateServiceClassRequest::request_id].
1632        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1633            self.0.request.request_id = v.into();
1634            self
1635        }
1636    }
1637
1638    #[doc(hidden)]
1639    impl gax::options::internal::RequestBuilder for UpdateServiceClass {
1640        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1641            &mut self.0.options
1642        }
1643    }
1644
1645    /// The request builder for [CrossNetworkAutomationService::delete_service_class][crate::client::CrossNetworkAutomationService::delete_service_class] calls.
1646    ///
1647    /// # Example
1648    /// ```no_run
1649    /// # use google_cloud_networkconnectivity_v1::builder;
1650    /// use builder::cross_network_automation_service::DeleteServiceClass;
1651    /// # tokio_test::block_on(async {
1652    /// use lro::Poller;
1653    ///
1654    /// let builder = prepare_request_builder();
1655    /// let response = builder.poller().until_done().await?;
1656    /// # gax::Result::<()>::Ok(()) });
1657    ///
1658    /// fn prepare_request_builder() -> DeleteServiceClass {
1659    ///   # panic!();
1660    ///   // ... details omitted ...
1661    /// }
1662    /// ```
1663    #[derive(Clone, Debug)]
1664    pub struct DeleteServiceClass(RequestBuilder<crate::model::DeleteServiceClassRequest>);
1665
1666    impl DeleteServiceClass {
1667        pub(crate) fn new(
1668            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1669        ) -> Self {
1670            Self(RequestBuilder::new(stub))
1671        }
1672
1673        /// Sets the full request, replacing any prior values.
1674        pub fn with_request<V: Into<crate::model::DeleteServiceClassRequest>>(
1675            mut self,
1676            v: V,
1677        ) -> Self {
1678            self.0.request = v.into();
1679            self
1680        }
1681
1682        /// Sets all the options, replacing any prior values.
1683        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1684            self.0.options = v.into();
1685            self
1686        }
1687
1688        /// Sends the request.
1689        ///
1690        /// # Long running operations
1691        ///
1692        /// This starts, but does not poll, a longrunning operation. More information
1693        /// on [delete_service_class][crate::client::CrossNetworkAutomationService::delete_service_class].
1694        pub async fn send(self) -> Result<longrunning::model::Operation> {
1695            (*self.0.stub)
1696                .delete_service_class(self.0.request, self.0.options)
1697                .await
1698                .map(gax::response::Response::into_body)
1699        }
1700
1701        /// Creates a [Poller][lro::Poller] to work with `delete_service_class`.
1702        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1703            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1704            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1705            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1706
1707            let stub = self.0.stub.clone();
1708            let mut options = self.0.options.clone();
1709            options.set_retry_policy(gax::retry_policy::NeverRetry);
1710            let query = move |name| {
1711                let stub = stub.clone();
1712                let options = options.clone();
1713                async {
1714                    let op = GetOperation::new(stub)
1715                        .set_name(name)
1716                        .with_options(options)
1717                        .send()
1718                        .await?;
1719                    Ok(Operation::new(op))
1720                }
1721            };
1722
1723            let start = move || async {
1724                let op = self.send().await?;
1725                Ok(Operation::new(op))
1726            };
1727
1728            lro::internal::new_unit_response_poller(
1729                polling_error_policy,
1730                polling_backoff_policy,
1731                start,
1732                query,
1733            )
1734        }
1735
1736        /// Sets the value of [name][crate::model::DeleteServiceClassRequest::name].
1737        ///
1738        /// This is a **required** field for requests.
1739        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1740            self.0.request.name = v.into();
1741            self
1742        }
1743
1744        /// Sets the value of [request_id][crate::model::DeleteServiceClassRequest::request_id].
1745        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1746            self.0.request.request_id = v.into();
1747            self
1748        }
1749
1750        /// Sets the value of [etag][crate::model::DeleteServiceClassRequest::etag].
1751        pub fn set_etag<T>(mut self, v: T) -> Self
1752        where
1753            T: std::convert::Into<std::string::String>,
1754        {
1755            self.0.request.etag = std::option::Option::Some(v.into());
1756            self
1757        }
1758
1759        /// Sets or clears the value of [etag][crate::model::DeleteServiceClassRequest::etag].
1760        pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
1761        where
1762            T: std::convert::Into<std::string::String>,
1763        {
1764            self.0.request.etag = v.map(|x| x.into());
1765            self
1766        }
1767    }
1768
1769    #[doc(hidden)]
1770    impl gax::options::internal::RequestBuilder for DeleteServiceClass {
1771        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1772            &mut self.0.options
1773        }
1774    }
1775
1776    /// The request builder for [CrossNetworkAutomationService::get_service_connection_token][crate::client::CrossNetworkAutomationService::get_service_connection_token] calls.
1777    ///
1778    /// # Example
1779    /// ```no_run
1780    /// # use google_cloud_networkconnectivity_v1::builder;
1781    /// use builder::cross_network_automation_service::GetServiceConnectionToken;
1782    /// # tokio_test::block_on(async {
1783    ///
1784    /// let builder = prepare_request_builder();
1785    /// let response = builder.send().await?;
1786    /// # gax::Result::<()>::Ok(()) });
1787    ///
1788    /// fn prepare_request_builder() -> GetServiceConnectionToken {
1789    ///   # panic!();
1790    ///   // ... details omitted ...
1791    /// }
1792    /// ```
1793    #[derive(Clone, Debug)]
1794    pub struct GetServiceConnectionToken(
1795        RequestBuilder<crate::model::GetServiceConnectionTokenRequest>,
1796    );
1797
1798    impl GetServiceConnectionToken {
1799        pub(crate) fn new(
1800            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1801        ) -> Self {
1802            Self(RequestBuilder::new(stub))
1803        }
1804
1805        /// Sets the full request, replacing any prior values.
1806        pub fn with_request<V: Into<crate::model::GetServiceConnectionTokenRequest>>(
1807            mut self,
1808            v: V,
1809        ) -> Self {
1810            self.0.request = v.into();
1811            self
1812        }
1813
1814        /// Sets all the options, replacing any prior values.
1815        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1816            self.0.options = v.into();
1817            self
1818        }
1819
1820        /// Sends the request.
1821        pub async fn send(self) -> Result<crate::model::ServiceConnectionToken> {
1822            (*self.0.stub)
1823                .get_service_connection_token(self.0.request, self.0.options)
1824                .await
1825                .map(gax::response::Response::into_body)
1826        }
1827
1828        /// Sets the value of [name][crate::model::GetServiceConnectionTokenRequest::name].
1829        ///
1830        /// This is a **required** field for requests.
1831        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1832            self.0.request.name = v.into();
1833            self
1834        }
1835    }
1836
1837    #[doc(hidden)]
1838    impl gax::options::internal::RequestBuilder for GetServiceConnectionToken {
1839        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1840            &mut self.0.options
1841        }
1842    }
1843
1844    /// The request builder for [CrossNetworkAutomationService::list_service_connection_tokens][crate::client::CrossNetworkAutomationService::list_service_connection_tokens] calls.
1845    ///
1846    /// # Example
1847    /// ```no_run
1848    /// # use google_cloud_networkconnectivity_v1::builder;
1849    /// use builder::cross_network_automation_service::ListServiceConnectionTokens;
1850    /// # tokio_test::block_on(async {
1851    /// use gax::paginator::ItemPaginator;
1852    ///
1853    /// let builder = prepare_request_builder();
1854    /// let mut items = builder.by_item();
1855    /// while let Some(result) = items.next().await {
1856    ///   let item = result?;
1857    /// }
1858    /// # gax::Result::<()>::Ok(()) });
1859    ///
1860    /// fn prepare_request_builder() -> ListServiceConnectionTokens {
1861    ///   # panic!();
1862    ///   // ... details omitted ...
1863    /// }
1864    /// ```
1865    #[derive(Clone, Debug)]
1866    pub struct ListServiceConnectionTokens(
1867        RequestBuilder<crate::model::ListServiceConnectionTokensRequest>,
1868    );
1869
1870    impl ListServiceConnectionTokens {
1871        pub(crate) fn new(
1872            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1873        ) -> Self {
1874            Self(RequestBuilder::new(stub))
1875        }
1876
1877        /// Sets the full request, replacing any prior values.
1878        pub fn with_request<V: Into<crate::model::ListServiceConnectionTokensRequest>>(
1879            mut self,
1880            v: V,
1881        ) -> Self {
1882            self.0.request = v.into();
1883            self
1884        }
1885
1886        /// Sets all the options, replacing any prior values.
1887        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1888            self.0.options = v.into();
1889            self
1890        }
1891
1892        /// Sends the request.
1893        pub async fn send(self) -> Result<crate::model::ListServiceConnectionTokensResponse> {
1894            (*self.0.stub)
1895                .list_service_connection_tokens(self.0.request, self.0.options)
1896                .await
1897                .map(gax::response::Response::into_body)
1898        }
1899
1900        /// Streams each page in the collection.
1901        pub fn by_page(
1902            self,
1903        ) -> impl gax::paginator::Paginator<
1904            crate::model::ListServiceConnectionTokensResponse,
1905            gax::error::Error,
1906        > {
1907            use std::clone::Clone;
1908            let token = self.0.request.page_token.clone();
1909            let execute = move |token: String| {
1910                let mut builder = self.clone();
1911                builder.0.request = builder.0.request.set_page_token(token);
1912                builder.send()
1913            };
1914            gax::paginator::internal::new_paginator(token, execute)
1915        }
1916
1917        /// Streams each item in the collection.
1918        pub fn by_item(
1919            self,
1920        ) -> impl gax::paginator::ItemPaginator<
1921            crate::model::ListServiceConnectionTokensResponse,
1922            gax::error::Error,
1923        > {
1924            use gax::paginator::Paginator;
1925            self.by_page().items()
1926        }
1927
1928        /// Sets the value of [parent][crate::model::ListServiceConnectionTokensRequest::parent].
1929        ///
1930        /// This is a **required** field for requests.
1931        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1932            self.0.request.parent = v.into();
1933            self
1934        }
1935
1936        /// Sets the value of [page_size][crate::model::ListServiceConnectionTokensRequest::page_size].
1937        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1938            self.0.request.page_size = v.into();
1939            self
1940        }
1941
1942        /// Sets the value of [page_token][crate::model::ListServiceConnectionTokensRequest::page_token].
1943        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1944            self.0.request.page_token = v.into();
1945            self
1946        }
1947
1948        /// Sets the value of [filter][crate::model::ListServiceConnectionTokensRequest::filter].
1949        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1950            self.0.request.filter = v.into();
1951            self
1952        }
1953
1954        /// Sets the value of [order_by][crate::model::ListServiceConnectionTokensRequest::order_by].
1955        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1956            self.0.request.order_by = v.into();
1957            self
1958        }
1959    }
1960
1961    #[doc(hidden)]
1962    impl gax::options::internal::RequestBuilder for ListServiceConnectionTokens {
1963        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1964            &mut self.0.options
1965        }
1966    }
1967
1968    /// The request builder for [CrossNetworkAutomationService::create_service_connection_token][crate::client::CrossNetworkAutomationService::create_service_connection_token] calls.
1969    ///
1970    /// # Example
1971    /// ```no_run
1972    /// # use google_cloud_networkconnectivity_v1::builder;
1973    /// use builder::cross_network_automation_service::CreateServiceConnectionToken;
1974    /// # tokio_test::block_on(async {
1975    /// use lro::Poller;
1976    ///
1977    /// let builder = prepare_request_builder();
1978    /// let response = builder.poller().until_done().await?;
1979    /// # gax::Result::<()>::Ok(()) });
1980    ///
1981    /// fn prepare_request_builder() -> CreateServiceConnectionToken {
1982    ///   # panic!();
1983    ///   // ... details omitted ...
1984    /// }
1985    /// ```
1986    #[derive(Clone, Debug)]
1987    pub struct CreateServiceConnectionToken(
1988        RequestBuilder<crate::model::CreateServiceConnectionTokenRequest>,
1989    );
1990
1991    impl CreateServiceConnectionToken {
1992        pub(crate) fn new(
1993            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
1994        ) -> Self {
1995            Self(RequestBuilder::new(stub))
1996        }
1997
1998        /// Sets the full request, replacing any prior values.
1999        pub fn with_request<V: Into<crate::model::CreateServiceConnectionTokenRequest>>(
2000            mut self,
2001            v: V,
2002        ) -> Self {
2003            self.0.request = v.into();
2004            self
2005        }
2006
2007        /// Sets all the options, replacing any prior values.
2008        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2009            self.0.options = v.into();
2010            self
2011        }
2012
2013        /// Sends the request.
2014        ///
2015        /// # Long running operations
2016        ///
2017        /// This starts, but does not poll, a longrunning operation. More information
2018        /// on [create_service_connection_token][crate::client::CrossNetworkAutomationService::create_service_connection_token].
2019        pub async fn send(self) -> Result<longrunning::model::Operation> {
2020            (*self.0.stub)
2021                .create_service_connection_token(self.0.request, self.0.options)
2022                .await
2023                .map(gax::response::Response::into_body)
2024        }
2025
2026        /// Creates a [Poller][lro::Poller] to work with `create_service_connection_token`.
2027        pub fn poller(
2028            self,
2029        ) -> impl lro::Poller<crate::model::ServiceConnectionToken, crate::model::OperationMetadata>
2030        {
2031            type Operation = lro::internal::Operation<
2032                crate::model::ServiceConnectionToken,
2033                crate::model::OperationMetadata,
2034            >;
2035            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2036            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2037
2038            let stub = self.0.stub.clone();
2039            let mut options = self.0.options.clone();
2040            options.set_retry_policy(gax::retry_policy::NeverRetry);
2041            let query = move |name| {
2042                let stub = stub.clone();
2043                let options = options.clone();
2044                async {
2045                    let op = GetOperation::new(stub)
2046                        .set_name(name)
2047                        .with_options(options)
2048                        .send()
2049                        .await?;
2050                    Ok(Operation::new(op))
2051                }
2052            };
2053
2054            let start = move || async {
2055                let op = self.send().await?;
2056                Ok(Operation::new(op))
2057            };
2058
2059            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2060        }
2061
2062        /// Sets the value of [parent][crate::model::CreateServiceConnectionTokenRequest::parent].
2063        ///
2064        /// This is a **required** field for requests.
2065        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2066            self.0.request.parent = v.into();
2067            self
2068        }
2069
2070        /// Sets the value of [service_connection_token_id][crate::model::CreateServiceConnectionTokenRequest::service_connection_token_id].
2071        pub fn set_service_connection_token_id<T: Into<std::string::String>>(
2072            mut self,
2073            v: T,
2074        ) -> Self {
2075            self.0.request.service_connection_token_id = v.into();
2076            self
2077        }
2078
2079        /// Sets the value of [service_connection_token][crate::model::CreateServiceConnectionTokenRequest::service_connection_token].
2080        ///
2081        /// This is a **required** field for requests.
2082        pub fn set_service_connection_token<T>(mut self, v: T) -> Self
2083        where
2084            T: std::convert::Into<crate::model::ServiceConnectionToken>,
2085        {
2086            self.0.request.service_connection_token = std::option::Option::Some(v.into());
2087            self
2088        }
2089
2090        /// Sets or clears the value of [service_connection_token][crate::model::CreateServiceConnectionTokenRequest::service_connection_token].
2091        ///
2092        /// This is a **required** field for requests.
2093        pub fn set_or_clear_service_connection_token<T>(mut self, v: std::option::Option<T>) -> Self
2094        where
2095            T: std::convert::Into<crate::model::ServiceConnectionToken>,
2096        {
2097            self.0.request.service_connection_token = v.map(|x| x.into());
2098            self
2099        }
2100
2101        /// Sets the value of [request_id][crate::model::CreateServiceConnectionTokenRequest::request_id].
2102        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2103            self.0.request.request_id = v.into();
2104            self
2105        }
2106    }
2107
2108    #[doc(hidden)]
2109    impl gax::options::internal::RequestBuilder for CreateServiceConnectionToken {
2110        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2111            &mut self.0.options
2112        }
2113    }
2114
2115    /// The request builder for [CrossNetworkAutomationService::delete_service_connection_token][crate::client::CrossNetworkAutomationService::delete_service_connection_token] calls.
2116    ///
2117    /// # Example
2118    /// ```no_run
2119    /// # use google_cloud_networkconnectivity_v1::builder;
2120    /// use builder::cross_network_automation_service::DeleteServiceConnectionToken;
2121    /// # tokio_test::block_on(async {
2122    /// use lro::Poller;
2123    ///
2124    /// let builder = prepare_request_builder();
2125    /// let response = builder.poller().until_done().await?;
2126    /// # gax::Result::<()>::Ok(()) });
2127    ///
2128    /// fn prepare_request_builder() -> DeleteServiceConnectionToken {
2129    ///   # panic!();
2130    ///   // ... details omitted ...
2131    /// }
2132    /// ```
2133    #[derive(Clone, Debug)]
2134    pub struct DeleteServiceConnectionToken(
2135        RequestBuilder<crate::model::DeleteServiceConnectionTokenRequest>,
2136    );
2137
2138    impl DeleteServiceConnectionToken {
2139        pub(crate) fn new(
2140            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2141        ) -> Self {
2142            Self(RequestBuilder::new(stub))
2143        }
2144
2145        /// Sets the full request, replacing any prior values.
2146        pub fn with_request<V: Into<crate::model::DeleteServiceConnectionTokenRequest>>(
2147            mut self,
2148            v: V,
2149        ) -> Self {
2150            self.0.request = v.into();
2151            self
2152        }
2153
2154        /// Sets all the options, replacing any prior values.
2155        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2156            self.0.options = v.into();
2157            self
2158        }
2159
2160        /// Sends the request.
2161        ///
2162        /// # Long running operations
2163        ///
2164        /// This starts, but does not poll, a longrunning operation. More information
2165        /// on [delete_service_connection_token][crate::client::CrossNetworkAutomationService::delete_service_connection_token].
2166        pub async fn send(self) -> Result<longrunning::model::Operation> {
2167            (*self.0.stub)
2168                .delete_service_connection_token(self.0.request, self.0.options)
2169                .await
2170                .map(gax::response::Response::into_body)
2171        }
2172
2173        /// Creates a [Poller][lro::Poller] to work with `delete_service_connection_token`.
2174        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
2175            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2176            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2177            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2178
2179            let stub = self.0.stub.clone();
2180            let mut options = self.0.options.clone();
2181            options.set_retry_policy(gax::retry_policy::NeverRetry);
2182            let query = move |name| {
2183                let stub = stub.clone();
2184                let options = options.clone();
2185                async {
2186                    let op = GetOperation::new(stub)
2187                        .set_name(name)
2188                        .with_options(options)
2189                        .send()
2190                        .await?;
2191                    Ok(Operation::new(op))
2192                }
2193            };
2194
2195            let start = move || async {
2196                let op = self.send().await?;
2197                Ok(Operation::new(op))
2198            };
2199
2200            lro::internal::new_unit_response_poller(
2201                polling_error_policy,
2202                polling_backoff_policy,
2203                start,
2204                query,
2205            )
2206        }
2207
2208        /// Sets the value of [name][crate::model::DeleteServiceConnectionTokenRequest::name].
2209        ///
2210        /// This is a **required** field for requests.
2211        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2212            self.0.request.name = v.into();
2213            self
2214        }
2215
2216        /// Sets the value of [request_id][crate::model::DeleteServiceConnectionTokenRequest::request_id].
2217        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2218            self.0.request.request_id = v.into();
2219            self
2220        }
2221
2222        /// Sets the value of [etag][crate::model::DeleteServiceConnectionTokenRequest::etag].
2223        pub fn set_etag<T>(mut self, v: T) -> Self
2224        where
2225            T: std::convert::Into<std::string::String>,
2226        {
2227            self.0.request.etag = std::option::Option::Some(v.into());
2228            self
2229        }
2230
2231        /// Sets or clears the value of [etag][crate::model::DeleteServiceConnectionTokenRequest::etag].
2232        pub fn set_or_clear_etag<T>(mut self, v: std::option::Option<T>) -> Self
2233        where
2234            T: std::convert::Into<std::string::String>,
2235        {
2236            self.0.request.etag = v.map(|x| x.into());
2237            self
2238        }
2239    }
2240
2241    #[doc(hidden)]
2242    impl gax::options::internal::RequestBuilder for DeleteServiceConnectionToken {
2243        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2244            &mut self.0.options
2245        }
2246    }
2247
2248    /// The request builder for [CrossNetworkAutomationService::list_locations][crate::client::CrossNetworkAutomationService::list_locations] calls.
2249    ///
2250    /// # Example
2251    /// ```no_run
2252    /// # use google_cloud_networkconnectivity_v1::builder;
2253    /// use builder::cross_network_automation_service::ListLocations;
2254    /// # tokio_test::block_on(async {
2255    /// use gax::paginator::ItemPaginator;
2256    ///
2257    /// let builder = prepare_request_builder();
2258    /// let mut items = builder.by_item();
2259    /// while let Some(result) = items.next().await {
2260    ///   let item = result?;
2261    /// }
2262    /// # gax::Result::<()>::Ok(()) });
2263    ///
2264    /// fn prepare_request_builder() -> ListLocations {
2265    ///   # panic!();
2266    ///   // ... details omitted ...
2267    /// }
2268    /// ```
2269    #[derive(Clone, Debug)]
2270    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2271
2272    impl ListLocations {
2273        pub(crate) fn new(
2274            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2275        ) -> Self {
2276            Self(RequestBuilder::new(stub))
2277        }
2278
2279        /// Sets the full request, replacing any prior values.
2280        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
2281            mut self,
2282            v: V,
2283        ) -> Self {
2284            self.0.request = v.into();
2285            self
2286        }
2287
2288        /// Sets all the options, replacing any prior values.
2289        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2290            self.0.options = v.into();
2291            self
2292        }
2293
2294        /// Sends the request.
2295        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
2296            (*self.0.stub)
2297                .list_locations(self.0.request, self.0.options)
2298                .await
2299                .map(gax::response::Response::into_body)
2300        }
2301
2302        /// Streams each page in the collection.
2303        pub fn by_page(
2304            self,
2305        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
2306        {
2307            use std::clone::Clone;
2308            let token = self.0.request.page_token.clone();
2309            let execute = move |token: String| {
2310                let mut builder = self.clone();
2311                builder.0.request = builder.0.request.set_page_token(token);
2312                builder.send()
2313            };
2314            gax::paginator::internal::new_paginator(token, execute)
2315        }
2316
2317        /// Streams each item in the collection.
2318        pub fn by_item(
2319            self,
2320        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
2321        {
2322            use gax::paginator::Paginator;
2323            self.by_page().items()
2324        }
2325
2326        /// Sets the value of [name][location::model::ListLocationsRequest::name].
2327        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2328            self.0.request.name = v.into();
2329            self
2330        }
2331
2332        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
2333        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2334            self.0.request.filter = v.into();
2335            self
2336        }
2337
2338        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
2339        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2340            self.0.request.page_size = v.into();
2341            self
2342        }
2343
2344        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
2345        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2346            self.0.request.page_token = v.into();
2347            self
2348        }
2349    }
2350
2351    #[doc(hidden)]
2352    impl gax::options::internal::RequestBuilder for ListLocations {
2353        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2354            &mut self.0.options
2355        }
2356    }
2357
2358    /// The request builder for [CrossNetworkAutomationService::get_location][crate::client::CrossNetworkAutomationService::get_location] calls.
2359    ///
2360    /// # Example
2361    /// ```no_run
2362    /// # use google_cloud_networkconnectivity_v1::builder;
2363    /// use builder::cross_network_automation_service::GetLocation;
2364    /// # tokio_test::block_on(async {
2365    ///
2366    /// let builder = prepare_request_builder();
2367    /// let response = builder.send().await?;
2368    /// # gax::Result::<()>::Ok(()) });
2369    ///
2370    /// fn prepare_request_builder() -> GetLocation {
2371    ///   # panic!();
2372    ///   // ... details omitted ...
2373    /// }
2374    /// ```
2375    #[derive(Clone, Debug)]
2376    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
2377
2378    impl GetLocation {
2379        pub(crate) fn new(
2380            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2381        ) -> Self {
2382            Self(RequestBuilder::new(stub))
2383        }
2384
2385        /// Sets the full request, replacing any prior values.
2386        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
2387            self.0.request = v.into();
2388            self
2389        }
2390
2391        /// Sets all the options, replacing any prior values.
2392        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2393            self.0.options = v.into();
2394            self
2395        }
2396
2397        /// Sends the request.
2398        pub async fn send(self) -> Result<location::model::Location> {
2399            (*self.0.stub)
2400                .get_location(self.0.request, self.0.options)
2401                .await
2402                .map(gax::response::Response::into_body)
2403        }
2404
2405        /// Sets the value of [name][location::model::GetLocationRequest::name].
2406        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2407            self.0.request.name = v.into();
2408            self
2409        }
2410    }
2411
2412    #[doc(hidden)]
2413    impl gax::options::internal::RequestBuilder for GetLocation {
2414        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2415            &mut self.0.options
2416        }
2417    }
2418
2419    /// The request builder for [CrossNetworkAutomationService::set_iam_policy][crate::client::CrossNetworkAutomationService::set_iam_policy] calls.
2420    ///
2421    /// # Example
2422    /// ```no_run
2423    /// # use google_cloud_networkconnectivity_v1::builder;
2424    /// use builder::cross_network_automation_service::SetIamPolicy;
2425    /// # tokio_test::block_on(async {
2426    ///
2427    /// let builder = prepare_request_builder();
2428    /// let response = builder.send().await?;
2429    /// # gax::Result::<()>::Ok(()) });
2430    ///
2431    /// fn prepare_request_builder() -> SetIamPolicy {
2432    ///   # panic!();
2433    ///   // ... details omitted ...
2434    /// }
2435    /// ```
2436    #[derive(Clone, Debug)]
2437    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2438
2439    impl SetIamPolicy {
2440        pub(crate) fn new(
2441            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2442        ) -> Self {
2443            Self(RequestBuilder::new(stub))
2444        }
2445
2446        /// Sets the full request, replacing any prior values.
2447        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2448            self.0.request = v.into();
2449            self
2450        }
2451
2452        /// Sets all the options, replacing any prior values.
2453        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2454            self.0.options = v.into();
2455            self
2456        }
2457
2458        /// Sends the request.
2459        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2460            (*self.0.stub)
2461                .set_iam_policy(self.0.request, self.0.options)
2462                .await
2463                .map(gax::response::Response::into_body)
2464        }
2465
2466        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
2467        ///
2468        /// This is a **required** field for requests.
2469        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2470            self.0.request.resource = v.into();
2471            self
2472        }
2473
2474        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2475        ///
2476        /// This is a **required** field for requests.
2477        pub fn set_policy<T>(mut self, v: T) -> Self
2478        where
2479            T: std::convert::Into<iam_v1::model::Policy>,
2480        {
2481            self.0.request.policy = std::option::Option::Some(v.into());
2482            self
2483        }
2484
2485        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2486        ///
2487        /// This is a **required** field for requests.
2488        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2489        where
2490            T: std::convert::Into<iam_v1::model::Policy>,
2491        {
2492            self.0.request.policy = v.map(|x| x.into());
2493            self
2494        }
2495
2496        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2497        pub fn set_update_mask<T>(mut self, v: T) -> Self
2498        where
2499            T: std::convert::Into<wkt::FieldMask>,
2500        {
2501            self.0.request.update_mask = std::option::Option::Some(v.into());
2502            self
2503        }
2504
2505        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2506        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2507        where
2508            T: std::convert::Into<wkt::FieldMask>,
2509        {
2510            self.0.request.update_mask = v.map(|x| x.into());
2511            self
2512        }
2513    }
2514
2515    #[doc(hidden)]
2516    impl gax::options::internal::RequestBuilder for SetIamPolicy {
2517        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2518            &mut self.0.options
2519        }
2520    }
2521
2522    /// The request builder for [CrossNetworkAutomationService::get_iam_policy][crate::client::CrossNetworkAutomationService::get_iam_policy] calls.
2523    ///
2524    /// # Example
2525    /// ```no_run
2526    /// # use google_cloud_networkconnectivity_v1::builder;
2527    /// use builder::cross_network_automation_service::GetIamPolicy;
2528    /// # tokio_test::block_on(async {
2529    ///
2530    /// let builder = prepare_request_builder();
2531    /// let response = builder.send().await?;
2532    /// # gax::Result::<()>::Ok(()) });
2533    ///
2534    /// fn prepare_request_builder() -> GetIamPolicy {
2535    ///   # panic!();
2536    ///   // ... details omitted ...
2537    /// }
2538    /// ```
2539    #[derive(Clone, Debug)]
2540    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2541
2542    impl GetIamPolicy {
2543        pub(crate) fn new(
2544            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2545        ) -> Self {
2546            Self(RequestBuilder::new(stub))
2547        }
2548
2549        /// Sets the full request, replacing any prior values.
2550        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2551            self.0.request = v.into();
2552            self
2553        }
2554
2555        /// Sets all the options, replacing any prior values.
2556        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2557            self.0.options = v.into();
2558            self
2559        }
2560
2561        /// Sends the request.
2562        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2563            (*self.0.stub)
2564                .get_iam_policy(self.0.request, self.0.options)
2565                .await
2566                .map(gax::response::Response::into_body)
2567        }
2568
2569        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
2570        ///
2571        /// This is a **required** field for requests.
2572        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2573            self.0.request.resource = v.into();
2574            self
2575        }
2576
2577        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
2578        pub fn set_options<T>(mut self, v: T) -> Self
2579        where
2580            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2581        {
2582            self.0.request.options = std::option::Option::Some(v.into());
2583            self
2584        }
2585
2586        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
2587        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2588        where
2589            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2590        {
2591            self.0.request.options = v.map(|x| x.into());
2592            self
2593        }
2594    }
2595
2596    #[doc(hidden)]
2597    impl gax::options::internal::RequestBuilder for GetIamPolicy {
2598        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2599            &mut self.0.options
2600        }
2601    }
2602
2603    /// The request builder for [CrossNetworkAutomationService::test_iam_permissions][crate::client::CrossNetworkAutomationService::test_iam_permissions] calls.
2604    ///
2605    /// # Example
2606    /// ```no_run
2607    /// # use google_cloud_networkconnectivity_v1::builder;
2608    /// use builder::cross_network_automation_service::TestIamPermissions;
2609    /// # tokio_test::block_on(async {
2610    ///
2611    /// let builder = prepare_request_builder();
2612    /// let response = builder.send().await?;
2613    /// # gax::Result::<()>::Ok(()) });
2614    ///
2615    /// fn prepare_request_builder() -> TestIamPermissions {
2616    ///   # panic!();
2617    ///   // ... details omitted ...
2618    /// }
2619    /// ```
2620    #[derive(Clone, Debug)]
2621    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2622
2623    impl TestIamPermissions {
2624        pub(crate) fn new(
2625            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2626        ) -> Self {
2627            Self(RequestBuilder::new(stub))
2628        }
2629
2630        /// Sets the full request, replacing any prior values.
2631        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2632            mut self,
2633            v: V,
2634        ) -> Self {
2635            self.0.request = v.into();
2636            self
2637        }
2638
2639        /// Sets all the options, replacing any prior values.
2640        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2641            self.0.options = v.into();
2642            self
2643        }
2644
2645        /// Sends the request.
2646        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2647            (*self.0.stub)
2648                .test_iam_permissions(self.0.request, self.0.options)
2649                .await
2650                .map(gax::response::Response::into_body)
2651        }
2652
2653        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
2654        ///
2655        /// This is a **required** field for requests.
2656        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2657            self.0.request.resource = v.into();
2658            self
2659        }
2660
2661        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
2662        ///
2663        /// This is a **required** field for requests.
2664        pub fn set_permissions<T, V>(mut self, v: T) -> Self
2665        where
2666            T: std::iter::IntoIterator<Item = V>,
2667            V: std::convert::Into<std::string::String>,
2668        {
2669            use std::iter::Iterator;
2670            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2671            self
2672        }
2673    }
2674
2675    #[doc(hidden)]
2676    impl gax::options::internal::RequestBuilder for TestIamPermissions {
2677        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2678            &mut self.0.options
2679        }
2680    }
2681
2682    /// The request builder for [CrossNetworkAutomationService::list_operations][crate::client::CrossNetworkAutomationService::list_operations] calls.
2683    ///
2684    /// # Example
2685    /// ```no_run
2686    /// # use google_cloud_networkconnectivity_v1::builder;
2687    /// use builder::cross_network_automation_service::ListOperations;
2688    /// # tokio_test::block_on(async {
2689    /// use gax::paginator::ItemPaginator;
2690    ///
2691    /// let builder = prepare_request_builder();
2692    /// let mut items = builder.by_item();
2693    /// while let Some(result) = items.next().await {
2694    ///   let item = result?;
2695    /// }
2696    /// # gax::Result::<()>::Ok(()) });
2697    ///
2698    /// fn prepare_request_builder() -> ListOperations {
2699    ///   # panic!();
2700    ///   // ... details omitted ...
2701    /// }
2702    /// ```
2703    #[derive(Clone, Debug)]
2704    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2705
2706    impl ListOperations {
2707        pub(crate) fn new(
2708            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2709        ) -> Self {
2710            Self(RequestBuilder::new(stub))
2711        }
2712
2713        /// Sets the full request, replacing any prior values.
2714        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2715            mut self,
2716            v: V,
2717        ) -> Self {
2718            self.0.request = v.into();
2719            self
2720        }
2721
2722        /// Sets all the options, replacing any prior values.
2723        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2724            self.0.options = v.into();
2725            self
2726        }
2727
2728        /// Sends the request.
2729        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2730            (*self.0.stub)
2731                .list_operations(self.0.request, self.0.options)
2732                .await
2733                .map(gax::response::Response::into_body)
2734        }
2735
2736        /// Streams each page in the collection.
2737        pub fn by_page(
2738            self,
2739        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2740        {
2741            use std::clone::Clone;
2742            let token = self.0.request.page_token.clone();
2743            let execute = move |token: String| {
2744                let mut builder = self.clone();
2745                builder.0.request = builder.0.request.set_page_token(token);
2746                builder.send()
2747            };
2748            gax::paginator::internal::new_paginator(token, execute)
2749        }
2750
2751        /// Streams each item in the collection.
2752        pub fn by_item(
2753            self,
2754        ) -> impl gax::paginator::ItemPaginator<
2755            longrunning::model::ListOperationsResponse,
2756            gax::error::Error,
2757        > {
2758            use gax::paginator::Paginator;
2759            self.by_page().items()
2760        }
2761
2762        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2763        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2764            self.0.request.name = v.into();
2765            self
2766        }
2767
2768        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2769        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2770            self.0.request.filter = v.into();
2771            self
2772        }
2773
2774        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2775        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2776            self.0.request.page_size = v.into();
2777            self
2778        }
2779
2780        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2781        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2782            self.0.request.page_token = v.into();
2783            self
2784        }
2785    }
2786
2787    #[doc(hidden)]
2788    impl gax::options::internal::RequestBuilder for ListOperations {
2789        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2790            &mut self.0.options
2791        }
2792    }
2793
2794    /// The request builder for [CrossNetworkAutomationService::get_operation][crate::client::CrossNetworkAutomationService::get_operation] calls.
2795    ///
2796    /// # Example
2797    /// ```no_run
2798    /// # use google_cloud_networkconnectivity_v1::builder;
2799    /// use builder::cross_network_automation_service::GetOperation;
2800    /// # tokio_test::block_on(async {
2801    ///
2802    /// let builder = prepare_request_builder();
2803    /// let response = builder.send().await?;
2804    /// # gax::Result::<()>::Ok(()) });
2805    ///
2806    /// fn prepare_request_builder() -> GetOperation {
2807    ///   # panic!();
2808    ///   // ... details omitted ...
2809    /// }
2810    /// ```
2811    #[derive(Clone, Debug)]
2812    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2813
2814    impl GetOperation {
2815        pub(crate) fn new(
2816            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2817        ) -> Self {
2818            Self(RequestBuilder::new(stub))
2819        }
2820
2821        /// Sets the full request, replacing any prior values.
2822        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2823            mut self,
2824            v: V,
2825        ) -> Self {
2826            self.0.request = v.into();
2827            self
2828        }
2829
2830        /// Sets all the options, replacing any prior values.
2831        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2832            self.0.options = v.into();
2833            self
2834        }
2835
2836        /// Sends the request.
2837        pub async fn send(self) -> Result<longrunning::model::Operation> {
2838            (*self.0.stub)
2839                .get_operation(self.0.request, self.0.options)
2840                .await
2841                .map(gax::response::Response::into_body)
2842        }
2843
2844        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2845        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2846            self.0.request.name = v.into();
2847            self
2848        }
2849    }
2850
2851    #[doc(hidden)]
2852    impl gax::options::internal::RequestBuilder for GetOperation {
2853        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2854            &mut self.0.options
2855        }
2856    }
2857
2858    /// The request builder for [CrossNetworkAutomationService::delete_operation][crate::client::CrossNetworkAutomationService::delete_operation] calls.
2859    ///
2860    /// # Example
2861    /// ```no_run
2862    /// # use google_cloud_networkconnectivity_v1::builder;
2863    /// use builder::cross_network_automation_service::DeleteOperation;
2864    /// # tokio_test::block_on(async {
2865    ///
2866    /// let builder = prepare_request_builder();
2867    /// let response = builder.send().await?;
2868    /// # gax::Result::<()>::Ok(()) });
2869    ///
2870    /// fn prepare_request_builder() -> DeleteOperation {
2871    ///   # panic!();
2872    ///   // ... details omitted ...
2873    /// }
2874    /// ```
2875    #[derive(Clone, Debug)]
2876    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2877
2878    impl DeleteOperation {
2879        pub(crate) fn new(
2880            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2881        ) -> Self {
2882            Self(RequestBuilder::new(stub))
2883        }
2884
2885        /// Sets the full request, replacing any prior values.
2886        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2887            mut self,
2888            v: V,
2889        ) -> Self {
2890            self.0.request = v.into();
2891            self
2892        }
2893
2894        /// Sets all the options, replacing any prior values.
2895        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2896            self.0.options = v.into();
2897            self
2898        }
2899
2900        /// Sends the request.
2901        pub async fn send(self) -> Result<()> {
2902            (*self.0.stub)
2903                .delete_operation(self.0.request, self.0.options)
2904                .await
2905                .map(gax::response::Response::into_body)
2906        }
2907
2908        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
2909        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2910            self.0.request.name = v.into();
2911            self
2912        }
2913    }
2914
2915    #[doc(hidden)]
2916    impl gax::options::internal::RequestBuilder for DeleteOperation {
2917        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2918            &mut self.0.options
2919        }
2920    }
2921
2922    /// The request builder for [CrossNetworkAutomationService::cancel_operation][crate::client::CrossNetworkAutomationService::cancel_operation] calls.
2923    ///
2924    /// # Example
2925    /// ```no_run
2926    /// # use google_cloud_networkconnectivity_v1::builder;
2927    /// use builder::cross_network_automation_service::CancelOperation;
2928    /// # tokio_test::block_on(async {
2929    ///
2930    /// let builder = prepare_request_builder();
2931    /// let response = builder.send().await?;
2932    /// # gax::Result::<()>::Ok(()) });
2933    ///
2934    /// fn prepare_request_builder() -> CancelOperation {
2935    ///   # panic!();
2936    ///   // ... details omitted ...
2937    /// }
2938    /// ```
2939    #[derive(Clone, Debug)]
2940    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2941
2942    impl CancelOperation {
2943        pub(crate) fn new(
2944            stub: std::sync::Arc<dyn super::super::stub::dynamic::CrossNetworkAutomationService>,
2945        ) -> Self {
2946            Self(RequestBuilder::new(stub))
2947        }
2948
2949        /// Sets the full request, replacing any prior values.
2950        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2951            mut self,
2952            v: V,
2953        ) -> Self {
2954            self.0.request = v.into();
2955            self
2956        }
2957
2958        /// Sets all the options, replacing any prior values.
2959        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2960            self.0.options = v.into();
2961            self
2962        }
2963
2964        /// Sends the request.
2965        pub async fn send(self) -> Result<()> {
2966            (*self.0.stub)
2967                .cancel_operation(self.0.request, self.0.options)
2968                .await
2969                .map(gax::response::Response::into_body)
2970        }
2971
2972        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2973        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2974            self.0.request.name = v.into();
2975            self
2976        }
2977    }
2978
2979    #[doc(hidden)]
2980    impl gax::options::internal::RequestBuilder for CancelOperation {
2981        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2982            &mut self.0.options
2983        }
2984    }
2985}
2986
2987pub mod hub_service {
2988    use crate::Result;
2989
2990    /// A builder for [HubService][crate::client::HubService].
2991    ///
2992    /// ```
2993    /// # tokio_test::block_on(async {
2994    /// # use google_cloud_networkconnectivity_v1::*;
2995    /// # use builder::hub_service::ClientBuilder;
2996    /// # use client::HubService;
2997    /// let builder : ClientBuilder = HubService::builder();
2998    /// let client = builder
2999    ///     .with_endpoint("https://networkconnectivity.googleapis.com")
3000    ///     .build().await?;
3001    /// # gax::client_builder::Result::<()>::Ok(()) });
3002    /// ```
3003    pub type ClientBuilder =
3004        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3005
3006    pub(crate) mod client {
3007        use super::super::super::client::HubService;
3008        pub struct Factory;
3009        impl gax::client_builder::internal::ClientFactory for Factory {
3010            type Client = HubService;
3011            type Credentials = gaxi::options::Credentials;
3012            async fn build(
3013                self,
3014                config: gaxi::options::ClientConfig,
3015            ) -> gax::client_builder::Result<Self::Client> {
3016                Self::Client::new(config).await
3017            }
3018        }
3019    }
3020
3021    /// Common implementation for [crate::client::HubService] request builders.
3022    #[derive(Clone, Debug)]
3023    pub(crate) struct RequestBuilder<R: std::default::Default> {
3024        stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3025        request: R,
3026        options: gax::options::RequestOptions,
3027    }
3028
3029    impl<R> RequestBuilder<R>
3030    where
3031        R: std::default::Default,
3032    {
3033        pub(crate) fn new(
3034            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3035        ) -> Self {
3036            Self {
3037                stub,
3038                request: R::default(),
3039                options: gax::options::RequestOptions::default(),
3040            }
3041        }
3042    }
3043
3044    /// The request builder for [HubService::list_hubs][crate::client::HubService::list_hubs] calls.
3045    ///
3046    /// # Example
3047    /// ```no_run
3048    /// # use google_cloud_networkconnectivity_v1::builder;
3049    /// use builder::hub_service::ListHubs;
3050    /// # tokio_test::block_on(async {
3051    /// use gax::paginator::ItemPaginator;
3052    ///
3053    /// let builder = prepare_request_builder();
3054    /// let mut items = builder.by_item();
3055    /// while let Some(result) = items.next().await {
3056    ///   let item = result?;
3057    /// }
3058    /// # gax::Result::<()>::Ok(()) });
3059    ///
3060    /// fn prepare_request_builder() -> ListHubs {
3061    ///   # panic!();
3062    ///   // ... details omitted ...
3063    /// }
3064    /// ```
3065    #[derive(Clone, Debug)]
3066    pub struct ListHubs(RequestBuilder<crate::model::ListHubsRequest>);
3067
3068    impl ListHubs {
3069        pub(crate) fn new(
3070            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3071        ) -> Self {
3072            Self(RequestBuilder::new(stub))
3073        }
3074
3075        /// Sets the full request, replacing any prior values.
3076        pub fn with_request<V: Into<crate::model::ListHubsRequest>>(mut self, v: V) -> Self {
3077            self.0.request = v.into();
3078            self
3079        }
3080
3081        /// Sets all the options, replacing any prior values.
3082        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3083            self.0.options = v.into();
3084            self
3085        }
3086
3087        /// Sends the request.
3088        pub async fn send(self) -> Result<crate::model::ListHubsResponse> {
3089            (*self.0.stub)
3090                .list_hubs(self.0.request, self.0.options)
3091                .await
3092                .map(gax::response::Response::into_body)
3093        }
3094
3095        /// Streams each page in the collection.
3096        pub fn by_page(
3097            self,
3098        ) -> impl gax::paginator::Paginator<crate::model::ListHubsResponse, gax::error::Error>
3099        {
3100            use std::clone::Clone;
3101            let token = self.0.request.page_token.clone();
3102            let execute = move |token: String| {
3103                let mut builder = self.clone();
3104                builder.0.request = builder.0.request.set_page_token(token);
3105                builder.send()
3106            };
3107            gax::paginator::internal::new_paginator(token, execute)
3108        }
3109
3110        /// Streams each item in the collection.
3111        pub fn by_item(
3112            self,
3113        ) -> impl gax::paginator::ItemPaginator<crate::model::ListHubsResponse, gax::error::Error>
3114        {
3115            use gax::paginator::Paginator;
3116            self.by_page().items()
3117        }
3118
3119        /// Sets the value of [parent][crate::model::ListHubsRequest::parent].
3120        ///
3121        /// This is a **required** field for requests.
3122        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3123            self.0.request.parent = v.into();
3124            self
3125        }
3126
3127        /// Sets the value of [page_size][crate::model::ListHubsRequest::page_size].
3128        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3129            self.0.request.page_size = v.into();
3130            self
3131        }
3132
3133        /// Sets the value of [page_token][crate::model::ListHubsRequest::page_token].
3134        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3135            self.0.request.page_token = v.into();
3136            self
3137        }
3138
3139        /// Sets the value of [filter][crate::model::ListHubsRequest::filter].
3140        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3141            self.0.request.filter = v.into();
3142            self
3143        }
3144
3145        /// Sets the value of [order_by][crate::model::ListHubsRequest::order_by].
3146        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3147            self.0.request.order_by = v.into();
3148            self
3149        }
3150    }
3151
3152    #[doc(hidden)]
3153    impl gax::options::internal::RequestBuilder for ListHubs {
3154        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3155            &mut self.0.options
3156        }
3157    }
3158
3159    /// The request builder for [HubService::get_hub][crate::client::HubService::get_hub] calls.
3160    ///
3161    /// # Example
3162    /// ```no_run
3163    /// # use google_cloud_networkconnectivity_v1::builder;
3164    /// use builder::hub_service::GetHub;
3165    /// # tokio_test::block_on(async {
3166    ///
3167    /// let builder = prepare_request_builder();
3168    /// let response = builder.send().await?;
3169    /// # gax::Result::<()>::Ok(()) });
3170    ///
3171    /// fn prepare_request_builder() -> GetHub {
3172    ///   # panic!();
3173    ///   // ... details omitted ...
3174    /// }
3175    /// ```
3176    #[derive(Clone, Debug)]
3177    pub struct GetHub(RequestBuilder<crate::model::GetHubRequest>);
3178
3179    impl GetHub {
3180        pub(crate) fn new(
3181            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3182        ) -> Self {
3183            Self(RequestBuilder::new(stub))
3184        }
3185
3186        /// Sets the full request, replacing any prior values.
3187        pub fn with_request<V: Into<crate::model::GetHubRequest>>(mut self, v: V) -> Self {
3188            self.0.request = v.into();
3189            self
3190        }
3191
3192        /// Sets all the options, replacing any prior values.
3193        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3194            self.0.options = v.into();
3195            self
3196        }
3197
3198        /// Sends the request.
3199        pub async fn send(self) -> Result<crate::model::Hub> {
3200            (*self.0.stub)
3201                .get_hub(self.0.request, self.0.options)
3202                .await
3203                .map(gax::response::Response::into_body)
3204        }
3205
3206        /// Sets the value of [name][crate::model::GetHubRequest::name].
3207        ///
3208        /// This is a **required** field for requests.
3209        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3210            self.0.request.name = v.into();
3211            self
3212        }
3213    }
3214
3215    #[doc(hidden)]
3216    impl gax::options::internal::RequestBuilder for GetHub {
3217        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3218            &mut self.0.options
3219        }
3220    }
3221
3222    /// The request builder for [HubService::create_hub][crate::client::HubService::create_hub] calls.
3223    ///
3224    /// # Example
3225    /// ```no_run
3226    /// # use google_cloud_networkconnectivity_v1::builder;
3227    /// use builder::hub_service::CreateHub;
3228    /// # tokio_test::block_on(async {
3229    /// use lro::Poller;
3230    ///
3231    /// let builder = prepare_request_builder();
3232    /// let response = builder.poller().until_done().await?;
3233    /// # gax::Result::<()>::Ok(()) });
3234    ///
3235    /// fn prepare_request_builder() -> CreateHub {
3236    ///   # panic!();
3237    ///   // ... details omitted ...
3238    /// }
3239    /// ```
3240    #[derive(Clone, Debug)]
3241    pub struct CreateHub(RequestBuilder<crate::model::CreateHubRequest>);
3242
3243    impl CreateHub {
3244        pub(crate) fn new(
3245            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3246        ) -> Self {
3247            Self(RequestBuilder::new(stub))
3248        }
3249
3250        /// Sets the full request, replacing any prior values.
3251        pub fn with_request<V: Into<crate::model::CreateHubRequest>>(mut self, v: V) -> Self {
3252            self.0.request = v.into();
3253            self
3254        }
3255
3256        /// Sets all the options, replacing any prior values.
3257        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3258            self.0.options = v.into();
3259            self
3260        }
3261
3262        /// Sends the request.
3263        ///
3264        /// # Long running operations
3265        ///
3266        /// This starts, but does not poll, a longrunning operation. More information
3267        /// on [create_hub][crate::client::HubService::create_hub].
3268        pub async fn send(self) -> Result<longrunning::model::Operation> {
3269            (*self.0.stub)
3270                .create_hub(self.0.request, self.0.options)
3271                .await
3272                .map(gax::response::Response::into_body)
3273        }
3274
3275        /// Creates a [Poller][lro::Poller] to work with `create_hub`.
3276        pub fn poller(
3277            self,
3278        ) -> impl lro::Poller<crate::model::Hub, crate::model::OperationMetadata> {
3279            type Operation =
3280                lro::internal::Operation<crate::model::Hub, crate::model::OperationMetadata>;
3281            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3282            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3283
3284            let stub = self.0.stub.clone();
3285            let mut options = self.0.options.clone();
3286            options.set_retry_policy(gax::retry_policy::NeverRetry);
3287            let query = move |name| {
3288                let stub = stub.clone();
3289                let options = options.clone();
3290                async {
3291                    let op = GetOperation::new(stub)
3292                        .set_name(name)
3293                        .with_options(options)
3294                        .send()
3295                        .await?;
3296                    Ok(Operation::new(op))
3297                }
3298            };
3299
3300            let start = move || async {
3301                let op = self.send().await?;
3302                Ok(Operation::new(op))
3303            };
3304
3305            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3306        }
3307
3308        /// Sets the value of [parent][crate::model::CreateHubRequest::parent].
3309        ///
3310        /// This is a **required** field for requests.
3311        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3312            self.0.request.parent = v.into();
3313            self
3314        }
3315
3316        /// Sets the value of [hub_id][crate::model::CreateHubRequest::hub_id].
3317        ///
3318        /// This is a **required** field for requests.
3319        pub fn set_hub_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3320            self.0.request.hub_id = v.into();
3321            self
3322        }
3323
3324        /// Sets the value of [hub][crate::model::CreateHubRequest::hub].
3325        ///
3326        /// This is a **required** field for requests.
3327        pub fn set_hub<T>(mut self, v: T) -> Self
3328        where
3329            T: std::convert::Into<crate::model::Hub>,
3330        {
3331            self.0.request.hub = std::option::Option::Some(v.into());
3332            self
3333        }
3334
3335        /// Sets or clears the value of [hub][crate::model::CreateHubRequest::hub].
3336        ///
3337        /// This is a **required** field for requests.
3338        pub fn set_or_clear_hub<T>(mut self, v: std::option::Option<T>) -> Self
3339        where
3340            T: std::convert::Into<crate::model::Hub>,
3341        {
3342            self.0.request.hub = v.map(|x| x.into());
3343            self
3344        }
3345
3346        /// Sets the value of [request_id][crate::model::CreateHubRequest::request_id].
3347        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3348            self.0.request.request_id = v.into();
3349            self
3350        }
3351    }
3352
3353    #[doc(hidden)]
3354    impl gax::options::internal::RequestBuilder for CreateHub {
3355        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3356            &mut self.0.options
3357        }
3358    }
3359
3360    /// The request builder for [HubService::update_hub][crate::client::HubService::update_hub] calls.
3361    ///
3362    /// # Example
3363    /// ```no_run
3364    /// # use google_cloud_networkconnectivity_v1::builder;
3365    /// use builder::hub_service::UpdateHub;
3366    /// # tokio_test::block_on(async {
3367    /// use lro::Poller;
3368    ///
3369    /// let builder = prepare_request_builder();
3370    /// let response = builder.poller().until_done().await?;
3371    /// # gax::Result::<()>::Ok(()) });
3372    ///
3373    /// fn prepare_request_builder() -> UpdateHub {
3374    ///   # panic!();
3375    ///   // ... details omitted ...
3376    /// }
3377    /// ```
3378    #[derive(Clone, Debug)]
3379    pub struct UpdateHub(RequestBuilder<crate::model::UpdateHubRequest>);
3380
3381    impl UpdateHub {
3382        pub(crate) fn new(
3383            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3384        ) -> Self {
3385            Self(RequestBuilder::new(stub))
3386        }
3387
3388        /// Sets the full request, replacing any prior values.
3389        pub fn with_request<V: Into<crate::model::UpdateHubRequest>>(mut self, v: V) -> Self {
3390            self.0.request = v.into();
3391            self
3392        }
3393
3394        /// Sets all the options, replacing any prior values.
3395        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3396            self.0.options = v.into();
3397            self
3398        }
3399
3400        /// Sends the request.
3401        ///
3402        /// # Long running operations
3403        ///
3404        /// This starts, but does not poll, a longrunning operation. More information
3405        /// on [update_hub][crate::client::HubService::update_hub].
3406        pub async fn send(self) -> Result<longrunning::model::Operation> {
3407            (*self.0.stub)
3408                .update_hub(self.0.request, self.0.options)
3409                .await
3410                .map(gax::response::Response::into_body)
3411        }
3412
3413        /// Creates a [Poller][lro::Poller] to work with `update_hub`.
3414        pub fn poller(
3415            self,
3416        ) -> impl lro::Poller<crate::model::Hub, crate::model::OperationMetadata> {
3417            type Operation =
3418                lro::internal::Operation<crate::model::Hub, crate::model::OperationMetadata>;
3419            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3420            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3421
3422            let stub = self.0.stub.clone();
3423            let mut options = self.0.options.clone();
3424            options.set_retry_policy(gax::retry_policy::NeverRetry);
3425            let query = move |name| {
3426                let stub = stub.clone();
3427                let options = options.clone();
3428                async {
3429                    let op = GetOperation::new(stub)
3430                        .set_name(name)
3431                        .with_options(options)
3432                        .send()
3433                        .await?;
3434                    Ok(Operation::new(op))
3435                }
3436            };
3437
3438            let start = move || async {
3439                let op = self.send().await?;
3440                Ok(Operation::new(op))
3441            };
3442
3443            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3444        }
3445
3446        /// Sets the value of [update_mask][crate::model::UpdateHubRequest::update_mask].
3447        pub fn set_update_mask<T>(mut self, v: T) -> Self
3448        where
3449            T: std::convert::Into<wkt::FieldMask>,
3450        {
3451            self.0.request.update_mask = std::option::Option::Some(v.into());
3452            self
3453        }
3454
3455        /// Sets or clears the value of [update_mask][crate::model::UpdateHubRequest::update_mask].
3456        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3457        where
3458            T: std::convert::Into<wkt::FieldMask>,
3459        {
3460            self.0.request.update_mask = v.map(|x| x.into());
3461            self
3462        }
3463
3464        /// Sets the value of [hub][crate::model::UpdateHubRequest::hub].
3465        ///
3466        /// This is a **required** field for requests.
3467        pub fn set_hub<T>(mut self, v: T) -> Self
3468        where
3469            T: std::convert::Into<crate::model::Hub>,
3470        {
3471            self.0.request.hub = std::option::Option::Some(v.into());
3472            self
3473        }
3474
3475        /// Sets or clears the value of [hub][crate::model::UpdateHubRequest::hub].
3476        ///
3477        /// This is a **required** field for requests.
3478        pub fn set_or_clear_hub<T>(mut self, v: std::option::Option<T>) -> Self
3479        where
3480            T: std::convert::Into<crate::model::Hub>,
3481        {
3482            self.0.request.hub = v.map(|x| x.into());
3483            self
3484        }
3485
3486        /// Sets the value of [request_id][crate::model::UpdateHubRequest::request_id].
3487        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3488            self.0.request.request_id = v.into();
3489            self
3490        }
3491    }
3492
3493    #[doc(hidden)]
3494    impl gax::options::internal::RequestBuilder for UpdateHub {
3495        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3496            &mut self.0.options
3497        }
3498    }
3499
3500    /// The request builder for [HubService::delete_hub][crate::client::HubService::delete_hub] calls.
3501    ///
3502    /// # Example
3503    /// ```no_run
3504    /// # use google_cloud_networkconnectivity_v1::builder;
3505    /// use builder::hub_service::DeleteHub;
3506    /// # tokio_test::block_on(async {
3507    /// use lro::Poller;
3508    ///
3509    /// let builder = prepare_request_builder();
3510    /// let response = builder.poller().until_done().await?;
3511    /// # gax::Result::<()>::Ok(()) });
3512    ///
3513    /// fn prepare_request_builder() -> DeleteHub {
3514    ///   # panic!();
3515    ///   // ... details omitted ...
3516    /// }
3517    /// ```
3518    #[derive(Clone, Debug)]
3519    pub struct DeleteHub(RequestBuilder<crate::model::DeleteHubRequest>);
3520
3521    impl DeleteHub {
3522        pub(crate) fn new(
3523            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3524        ) -> Self {
3525            Self(RequestBuilder::new(stub))
3526        }
3527
3528        /// Sets the full request, replacing any prior values.
3529        pub fn with_request<V: Into<crate::model::DeleteHubRequest>>(mut self, v: V) -> Self {
3530            self.0.request = v.into();
3531            self
3532        }
3533
3534        /// Sets all the options, replacing any prior values.
3535        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3536            self.0.options = v.into();
3537            self
3538        }
3539
3540        /// Sends the request.
3541        ///
3542        /// # Long running operations
3543        ///
3544        /// This starts, but does not poll, a longrunning operation. More information
3545        /// on [delete_hub][crate::client::HubService::delete_hub].
3546        pub async fn send(self) -> Result<longrunning::model::Operation> {
3547            (*self.0.stub)
3548                .delete_hub(self.0.request, self.0.options)
3549                .await
3550                .map(gax::response::Response::into_body)
3551        }
3552
3553        /// Creates a [Poller][lro::Poller] to work with `delete_hub`.
3554        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
3555            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
3556            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3557            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3558
3559            let stub = self.0.stub.clone();
3560            let mut options = self.0.options.clone();
3561            options.set_retry_policy(gax::retry_policy::NeverRetry);
3562            let query = move |name| {
3563                let stub = stub.clone();
3564                let options = options.clone();
3565                async {
3566                    let op = GetOperation::new(stub)
3567                        .set_name(name)
3568                        .with_options(options)
3569                        .send()
3570                        .await?;
3571                    Ok(Operation::new(op))
3572                }
3573            };
3574
3575            let start = move || async {
3576                let op = self.send().await?;
3577                Ok(Operation::new(op))
3578            };
3579
3580            lro::internal::new_unit_response_poller(
3581                polling_error_policy,
3582                polling_backoff_policy,
3583                start,
3584                query,
3585            )
3586        }
3587
3588        /// Sets the value of [name][crate::model::DeleteHubRequest::name].
3589        ///
3590        /// This is a **required** field for requests.
3591        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3592            self.0.request.name = v.into();
3593            self
3594        }
3595
3596        /// Sets the value of [request_id][crate::model::DeleteHubRequest::request_id].
3597        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3598            self.0.request.request_id = v.into();
3599            self
3600        }
3601    }
3602
3603    #[doc(hidden)]
3604    impl gax::options::internal::RequestBuilder for DeleteHub {
3605        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3606            &mut self.0.options
3607        }
3608    }
3609
3610    /// The request builder for [HubService::list_hub_spokes][crate::client::HubService::list_hub_spokes] calls.
3611    ///
3612    /// # Example
3613    /// ```no_run
3614    /// # use google_cloud_networkconnectivity_v1::builder;
3615    /// use builder::hub_service::ListHubSpokes;
3616    /// # tokio_test::block_on(async {
3617    /// use gax::paginator::ItemPaginator;
3618    ///
3619    /// let builder = prepare_request_builder();
3620    /// let mut items = builder.by_item();
3621    /// while let Some(result) = items.next().await {
3622    ///   let item = result?;
3623    /// }
3624    /// # gax::Result::<()>::Ok(()) });
3625    ///
3626    /// fn prepare_request_builder() -> ListHubSpokes {
3627    ///   # panic!();
3628    ///   // ... details omitted ...
3629    /// }
3630    /// ```
3631    #[derive(Clone, Debug)]
3632    pub struct ListHubSpokes(RequestBuilder<crate::model::ListHubSpokesRequest>);
3633
3634    impl ListHubSpokes {
3635        pub(crate) fn new(
3636            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3637        ) -> Self {
3638            Self(RequestBuilder::new(stub))
3639        }
3640
3641        /// Sets the full request, replacing any prior values.
3642        pub fn with_request<V: Into<crate::model::ListHubSpokesRequest>>(mut self, v: V) -> Self {
3643            self.0.request = v.into();
3644            self
3645        }
3646
3647        /// Sets all the options, replacing any prior values.
3648        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3649            self.0.options = v.into();
3650            self
3651        }
3652
3653        /// Sends the request.
3654        pub async fn send(self) -> Result<crate::model::ListHubSpokesResponse> {
3655            (*self.0.stub)
3656                .list_hub_spokes(self.0.request, self.0.options)
3657                .await
3658                .map(gax::response::Response::into_body)
3659        }
3660
3661        /// Streams each page in the collection.
3662        pub fn by_page(
3663            self,
3664        ) -> impl gax::paginator::Paginator<crate::model::ListHubSpokesResponse, gax::error::Error>
3665        {
3666            use std::clone::Clone;
3667            let token = self.0.request.page_token.clone();
3668            let execute = move |token: String| {
3669                let mut builder = self.clone();
3670                builder.0.request = builder.0.request.set_page_token(token);
3671                builder.send()
3672            };
3673            gax::paginator::internal::new_paginator(token, execute)
3674        }
3675
3676        /// Streams each item in the collection.
3677        pub fn by_item(
3678            self,
3679        ) -> impl gax::paginator::ItemPaginator<crate::model::ListHubSpokesResponse, gax::error::Error>
3680        {
3681            use gax::paginator::Paginator;
3682            self.by_page().items()
3683        }
3684
3685        /// Sets the value of [name][crate::model::ListHubSpokesRequest::name].
3686        ///
3687        /// This is a **required** field for requests.
3688        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3689            self.0.request.name = v.into();
3690            self
3691        }
3692
3693        /// Sets the value of [spoke_locations][crate::model::ListHubSpokesRequest::spoke_locations].
3694        pub fn set_spoke_locations<T, V>(mut self, v: T) -> Self
3695        where
3696            T: std::iter::IntoIterator<Item = V>,
3697            V: std::convert::Into<std::string::String>,
3698        {
3699            use std::iter::Iterator;
3700            self.0.request.spoke_locations = v.into_iter().map(|i| i.into()).collect();
3701            self
3702        }
3703
3704        /// Sets the value of [page_size][crate::model::ListHubSpokesRequest::page_size].
3705        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3706            self.0.request.page_size = v.into();
3707            self
3708        }
3709
3710        /// Sets the value of [page_token][crate::model::ListHubSpokesRequest::page_token].
3711        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3712            self.0.request.page_token = v.into();
3713            self
3714        }
3715
3716        /// Sets the value of [filter][crate::model::ListHubSpokesRequest::filter].
3717        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3718            self.0.request.filter = v.into();
3719            self
3720        }
3721
3722        /// Sets the value of [order_by][crate::model::ListHubSpokesRequest::order_by].
3723        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3724            self.0.request.order_by = v.into();
3725            self
3726        }
3727
3728        /// Sets the value of [view][crate::model::ListHubSpokesRequest::view].
3729        pub fn set_view<T: Into<crate::model::list_hub_spokes_request::SpokeView>>(
3730            mut self,
3731            v: T,
3732        ) -> Self {
3733            self.0.request.view = v.into();
3734            self
3735        }
3736    }
3737
3738    #[doc(hidden)]
3739    impl gax::options::internal::RequestBuilder for ListHubSpokes {
3740        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3741            &mut self.0.options
3742        }
3743    }
3744
3745    /// The request builder for [HubService::query_hub_status][crate::client::HubService::query_hub_status] calls.
3746    ///
3747    /// # Example
3748    /// ```no_run
3749    /// # use google_cloud_networkconnectivity_v1::builder;
3750    /// use builder::hub_service::QueryHubStatus;
3751    /// # tokio_test::block_on(async {
3752    /// use gax::paginator::ItemPaginator;
3753    ///
3754    /// let builder = prepare_request_builder();
3755    /// let mut items = builder.by_item();
3756    /// while let Some(result) = items.next().await {
3757    ///   let item = result?;
3758    /// }
3759    /// # gax::Result::<()>::Ok(()) });
3760    ///
3761    /// fn prepare_request_builder() -> QueryHubStatus {
3762    ///   # panic!();
3763    ///   // ... details omitted ...
3764    /// }
3765    /// ```
3766    #[derive(Clone, Debug)]
3767    pub struct QueryHubStatus(RequestBuilder<crate::model::QueryHubStatusRequest>);
3768
3769    impl QueryHubStatus {
3770        pub(crate) fn new(
3771            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3772        ) -> Self {
3773            Self(RequestBuilder::new(stub))
3774        }
3775
3776        /// Sets the full request, replacing any prior values.
3777        pub fn with_request<V: Into<crate::model::QueryHubStatusRequest>>(mut self, v: V) -> Self {
3778            self.0.request = v.into();
3779            self
3780        }
3781
3782        /// Sets all the options, replacing any prior values.
3783        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3784            self.0.options = v.into();
3785            self
3786        }
3787
3788        /// Sends the request.
3789        pub async fn send(self) -> Result<crate::model::QueryHubStatusResponse> {
3790            (*self.0.stub)
3791                .query_hub_status(self.0.request, self.0.options)
3792                .await
3793                .map(gax::response::Response::into_body)
3794        }
3795
3796        /// Streams each page in the collection.
3797        pub fn by_page(
3798            self,
3799        ) -> impl gax::paginator::Paginator<crate::model::QueryHubStatusResponse, gax::error::Error>
3800        {
3801            use std::clone::Clone;
3802            let token = self.0.request.page_token.clone();
3803            let execute = move |token: String| {
3804                let mut builder = self.clone();
3805                builder.0.request = builder.0.request.set_page_token(token);
3806                builder.send()
3807            };
3808            gax::paginator::internal::new_paginator(token, execute)
3809        }
3810
3811        /// Streams each item in the collection.
3812        pub fn by_item(
3813            self,
3814        ) -> impl gax::paginator::ItemPaginator<crate::model::QueryHubStatusResponse, gax::error::Error>
3815        {
3816            use gax::paginator::Paginator;
3817            self.by_page().items()
3818        }
3819
3820        /// Sets the value of [name][crate::model::QueryHubStatusRequest::name].
3821        ///
3822        /// This is a **required** field for requests.
3823        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3824            self.0.request.name = v.into();
3825            self
3826        }
3827
3828        /// Sets the value of [page_size][crate::model::QueryHubStatusRequest::page_size].
3829        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3830            self.0.request.page_size = v.into();
3831            self
3832        }
3833
3834        /// Sets the value of [page_token][crate::model::QueryHubStatusRequest::page_token].
3835        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3836            self.0.request.page_token = v.into();
3837            self
3838        }
3839
3840        /// Sets the value of [filter][crate::model::QueryHubStatusRequest::filter].
3841        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3842            self.0.request.filter = v.into();
3843            self
3844        }
3845
3846        /// Sets the value of [order_by][crate::model::QueryHubStatusRequest::order_by].
3847        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3848            self.0.request.order_by = v.into();
3849            self
3850        }
3851
3852        /// Sets the value of [group_by][crate::model::QueryHubStatusRequest::group_by].
3853        pub fn set_group_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3854            self.0.request.group_by = v.into();
3855            self
3856        }
3857    }
3858
3859    #[doc(hidden)]
3860    impl gax::options::internal::RequestBuilder for QueryHubStatus {
3861        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3862            &mut self.0.options
3863        }
3864    }
3865
3866    /// The request builder for [HubService::list_spokes][crate::client::HubService::list_spokes] calls.
3867    ///
3868    /// # Example
3869    /// ```no_run
3870    /// # use google_cloud_networkconnectivity_v1::builder;
3871    /// use builder::hub_service::ListSpokes;
3872    /// # tokio_test::block_on(async {
3873    /// use gax::paginator::ItemPaginator;
3874    ///
3875    /// let builder = prepare_request_builder();
3876    /// let mut items = builder.by_item();
3877    /// while let Some(result) = items.next().await {
3878    ///   let item = result?;
3879    /// }
3880    /// # gax::Result::<()>::Ok(()) });
3881    ///
3882    /// fn prepare_request_builder() -> ListSpokes {
3883    ///   # panic!();
3884    ///   // ... details omitted ...
3885    /// }
3886    /// ```
3887    #[derive(Clone, Debug)]
3888    pub struct ListSpokes(RequestBuilder<crate::model::ListSpokesRequest>);
3889
3890    impl ListSpokes {
3891        pub(crate) fn new(
3892            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
3893        ) -> Self {
3894            Self(RequestBuilder::new(stub))
3895        }
3896
3897        /// Sets the full request, replacing any prior values.
3898        pub fn with_request<V: Into<crate::model::ListSpokesRequest>>(mut self, v: V) -> Self {
3899            self.0.request = v.into();
3900            self
3901        }
3902
3903        /// Sets all the options, replacing any prior values.
3904        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3905            self.0.options = v.into();
3906            self
3907        }
3908
3909        /// Sends the request.
3910        pub async fn send(self) -> Result<crate::model::ListSpokesResponse> {
3911            (*self.0.stub)
3912                .list_spokes(self.0.request, self.0.options)
3913                .await
3914                .map(gax::response::Response::into_body)
3915        }
3916
3917        /// Streams each page in the collection.
3918        pub fn by_page(
3919            self,
3920        ) -> impl gax::paginator::Paginator<crate::model::ListSpokesResponse, gax::error::Error>
3921        {
3922            use std::clone::Clone;
3923            let token = self.0.request.page_token.clone();
3924            let execute = move |token: String| {
3925                let mut builder = self.clone();
3926                builder.0.request = builder.0.request.set_page_token(token);
3927                builder.send()
3928            };
3929            gax::paginator::internal::new_paginator(token, execute)
3930        }
3931
3932        /// Streams each item in the collection.
3933        pub fn by_item(
3934            self,
3935        ) -> impl gax::paginator::ItemPaginator<crate::model::ListSpokesResponse, gax::error::Error>
3936        {
3937            use gax::paginator::Paginator;
3938            self.by_page().items()
3939        }
3940
3941        /// Sets the value of [parent][crate::model::ListSpokesRequest::parent].
3942        ///
3943        /// This is a **required** field for requests.
3944        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3945            self.0.request.parent = v.into();
3946            self
3947        }
3948
3949        /// Sets the value of [page_size][crate::model::ListSpokesRequest::page_size].
3950        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3951            self.0.request.page_size = v.into();
3952            self
3953        }
3954
3955        /// Sets the value of [page_token][crate::model::ListSpokesRequest::page_token].
3956        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3957            self.0.request.page_token = v.into();
3958            self
3959        }
3960
3961        /// Sets the value of [filter][crate::model::ListSpokesRequest::filter].
3962        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3963            self.0.request.filter = v.into();
3964            self
3965        }
3966
3967        /// Sets the value of [order_by][crate::model::ListSpokesRequest::order_by].
3968        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3969            self.0.request.order_by = v.into();
3970            self
3971        }
3972    }
3973
3974    #[doc(hidden)]
3975    impl gax::options::internal::RequestBuilder for ListSpokes {
3976        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3977            &mut self.0.options
3978        }
3979    }
3980
3981    /// The request builder for [HubService::get_spoke][crate::client::HubService::get_spoke] calls.
3982    ///
3983    /// # Example
3984    /// ```no_run
3985    /// # use google_cloud_networkconnectivity_v1::builder;
3986    /// use builder::hub_service::GetSpoke;
3987    /// # tokio_test::block_on(async {
3988    ///
3989    /// let builder = prepare_request_builder();
3990    /// let response = builder.send().await?;
3991    /// # gax::Result::<()>::Ok(()) });
3992    ///
3993    /// fn prepare_request_builder() -> GetSpoke {
3994    ///   # panic!();
3995    ///   // ... details omitted ...
3996    /// }
3997    /// ```
3998    #[derive(Clone, Debug)]
3999    pub struct GetSpoke(RequestBuilder<crate::model::GetSpokeRequest>);
4000
4001    impl GetSpoke {
4002        pub(crate) fn new(
4003            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4004        ) -> Self {
4005            Self(RequestBuilder::new(stub))
4006        }
4007
4008        /// Sets the full request, replacing any prior values.
4009        pub fn with_request<V: Into<crate::model::GetSpokeRequest>>(mut self, v: V) -> Self {
4010            self.0.request = v.into();
4011            self
4012        }
4013
4014        /// Sets all the options, replacing any prior values.
4015        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4016            self.0.options = v.into();
4017            self
4018        }
4019
4020        /// Sends the request.
4021        pub async fn send(self) -> Result<crate::model::Spoke> {
4022            (*self.0.stub)
4023                .get_spoke(self.0.request, self.0.options)
4024                .await
4025                .map(gax::response::Response::into_body)
4026        }
4027
4028        /// Sets the value of [name][crate::model::GetSpokeRequest::name].
4029        ///
4030        /// This is a **required** field for requests.
4031        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4032            self.0.request.name = v.into();
4033            self
4034        }
4035    }
4036
4037    #[doc(hidden)]
4038    impl gax::options::internal::RequestBuilder for GetSpoke {
4039        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4040            &mut self.0.options
4041        }
4042    }
4043
4044    /// The request builder for [HubService::create_spoke][crate::client::HubService::create_spoke] calls.
4045    ///
4046    /// # Example
4047    /// ```no_run
4048    /// # use google_cloud_networkconnectivity_v1::builder;
4049    /// use builder::hub_service::CreateSpoke;
4050    /// # tokio_test::block_on(async {
4051    /// use lro::Poller;
4052    ///
4053    /// let builder = prepare_request_builder();
4054    /// let response = builder.poller().until_done().await?;
4055    /// # gax::Result::<()>::Ok(()) });
4056    ///
4057    /// fn prepare_request_builder() -> CreateSpoke {
4058    ///   # panic!();
4059    ///   // ... details omitted ...
4060    /// }
4061    /// ```
4062    #[derive(Clone, Debug)]
4063    pub struct CreateSpoke(RequestBuilder<crate::model::CreateSpokeRequest>);
4064
4065    impl CreateSpoke {
4066        pub(crate) fn new(
4067            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4068        ) -> Self {
4069            Self(RequestBuilder::new(stub))
4070        }
4071
4072        /// Sets the full request, replacing any prior values.
4073        pub fn with_request<V: Into<crate::model::CreateSpokeRequest>>(mut self, v: V) -> Self {
4074            self.0.request = v.into();
4075            self
4076        }
4077
4078        /// Sets all the options, replacing any prior values.
4079        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4080            self.0.options = v.into();
4081            self
4082        }
4083
4084        /// Sends the request.
4085        ///
4086        /// # Long running operations
4087        ///
4088        /// This starts, but does not poll, a longrunning operation. More information
4089        /// on [create_spoke][crate::client::HubService::create_spoke].
4090        pub async fn send(self) -> Result<longrunning::model::Operation> {
4091            (*self.0.stub)
4092                .create_spoke(self.0.request, self.0.options)
4093                .await
4094                .map(gax::response::Response::into_body)
4095        }
4096
4097        /// Creates a [Poller][lro::Poller] to work with `create_spoke`.
4098        pub fn poller(
4099            self,
4100        ) -> impl lro::Poller<crate::model::Spoke, crate::model::OperationMetadata> {
4101            type Operation =
4102                lro::internal::Operation<crate::model::Spoke, crate::model::OperationMetadata>;
4103            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4104            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4105
4106            let stub = self.0.stub.clone();
4107            let mut options = self.0.options.clone();
4108            options.set_retry_policy(gax::retry_policy::NeverRetry);
4109            let query = move |name| {
4110                let stub = stub.clone();
4111                let options = options.clone();
4112                async {
4113                    let op = GetOperation::new(stub)
4114                        .set_name(name)
4115                        .with_options(options)
4116                        .send()
4117                        .await?;
4118                    Ok(Operation::new(op))
4119                }
4120            };
4121
4122            let start = move || async {
4123                let op = self.send().await?;
4124                Ok(Operation::new(op))
4125            };
4126
4127            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4128        }
4129
4130        /// Sets the value of [parent][crate::model::CreateSpokeRequest::parent].
4131        ///
4132        /// This is a **required** field for requests.
4133        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4134            self.0.request.parent = v.into();
4135            self
4136        }
4137
4138        /// Sets the value of [spoke_id][crate::model::CreateSpokeRequest::spoke_id].
4139        ///
4140        /// This is a **required** field for requests.
4141        pub fn set_spoke_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4142            self.0.request.spoke_id = v.into();
4143            self
4144        }
4145
4146        /// Sets the value of [spoke][crate::model::CreateSpokeRequest::spoke].
4147        ///
4148        /// This is a **required** field for requests.
4149        pub fn set_spoke<T>(mut self, v: T) -> Self
4150        where
4151            T: std::convert::Into<crate::model::Spoke>,
4152        {
4153            self.0.request.spoke = std::option::Option::Some(v.into());
4154            self
4155        }
4156
4157        /// Sets or clears the value of [spoke][crate::model::CreateSpokeRequest::spoke].
4158        ///
4159        /// This is a **required** field for requests.
4160        pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
4161        where
4162            T: std::convert::Into<crate::model::Spoke>,
4163        {
4164            self.0.request.spoke = v.map(|x| x.into());
4165            self
4166        }
4167
4168        /// Sets the value of [request_id][crate::model::CreateSpokeRequest::request_id].
4169        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4170            self.0.request.request_id = v.into();
4171            self
4172        }
4173    }
4174
4175    #[doc(hidden)]
4176    impl gax::options::internal::RequestBuilder for CreateSpoke {
4177        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4178            &mut self.0.options
4179        }
4180    }
4181
4182    /// The request builder for [HubService::update_spoke][crate::client::HubService::update_spoke] calls.
4183    ///
4184    /// # Example
4185    /// ```no_run
4186    /// # use google_cloud_networkconnectivity_v1::builder;
4187    /// use builder::hub_service::UpdateSpoke;
4188    /// # tokio_test::block_on(async {
4189    /// use lro::Poller;
4190    ///
4191    /// let builder = prepare_request_builder();
4192    /// let response = builder.poller().until_done().await?;
4193    /// # gax::Result::<()>::Ok(()) });
4194    ///
4195    /// fn prepare_request_builder() -> UpdateSpoke {
4196    ///   # panic!();
4197    ///   // ... details omitted ...
4198    /// }
4199    /// ```
4200    #[derive(Clone, Debug)]
4201    pub struct UpdateSpoke(RequestBuilder<crate::model::UpdateSpokeRequest>);
4202
4203    impl UpdateSpoke {
4204        pub(crate) fn new(
4205            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4206        ) -> Self {
4207            Self(RequestBuilder::new(stub))
4208        }
4209
4210        /// Sets the full request, replacing any prior values.
4211        pub fn with_request<V: Into<crate::model::UpdateSpokeRequest>>(mut self, v: V) -> Self {
4212            self.0.request = v.into();
4213            self
4214        }
4215
4216        /// Sets all the options, replacing any prior values.
4217        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4218            self.0.options = v.into();
4219            self
4220        }
4221
4222        /// Sends the request.
4223        ///
4224        /// # Long running operations
4225        ///
4226        /// This starts, but does not poll, a longrunning operation. More information
4227        /// on [update_spoke][crate::client::HubService::update_spoke].
4228        pub async fn send(self) -> Result<longrunning::model::Operation> {
4229            (*self.0.stub)
4230                .update_spoke(self.0.request, self.0.options)
4231                .await
4232                .map(gax::response::Response::into_body)
4233        }
4234
4235        /// Creates a [Poller][lro::Poller] to work with `update_spoke`.
4236        pub fn poller(
4237            self,
4238        ) -> impl lro::Poller<crate::model::Spoke, crate::model::OperationMetadata> {
4239            type Operation =
4240                lro::internal::Operation<crate::model::Spoke, crate::model::OperationMetadata>;
4241            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4242            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4243
4244            let stub = self.0.stub.clone();
4245            let mut options = self.0.options.clone();
4246            options.set_retry_policy(gax::retry_policy::NeverRetry);
4247            let query = move |name| {
4248                let stub = stub.clone();
4249                let options = options.clone();
4250                async {
4251                    let op = GetOperation::new(stub)
4252                        .set_name(name)
4253                        .with_options(options)
4254                        .send()
4255                        .await?;
4256                    Ok(Operation::new(op))
4257                }
4258            };
4259
4260            let start = move || async {
4261                let op = self.send().await?;
4262                Ok(Operation::new(op))
4263            };
4264
4265            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4266        }
4267
4268        /// Sets the value of [update_mask][crate::model::UpdateSpokeRequest::update_mask].
4269        pub fn set_update_mask<T>(mut self, v: T) -> Self
4270        where
4271            T: std::convert::Into<wkt::FieldMask>,
4272        {
4273            self.0.request.update_mask = std::option::Option::Some(v.into());
4274            self
4275        }
4276
4277        /// Sets or clears the value of [update_mask][crate::model::UpdateSpokeRequest::update_mask].
4278        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4279        where
4280            T: std::convert::Into<wkt::FieldMask>,
4281        {
4282            self.0.request.update_mask = v.map(|x| x.into());
4283            self
4284        }
4285
4286        /// Sets the value of [spoke][crate::model::UpdateSpokeRequest::spoke].
4287        ///
4288        /// This is a **required** field for requests.
4289        pub fn set_spoke<T>(mut self, v: T) -> Self
4290        where
4291            T: std::convert::Into<crate::model::Spoke>,
4292        {
4293            self.0.request.spoke = std::option::Option::Some(v.into());
4294            self
4295        }
4296
4297        /// Sets or clears the value of [spoke][crate::model::UpdateSpokeRequest::spoke].
4298        ///
4299        /// This is a **required** field for requests.
4300        pub fn set_or_clear_spoke<T>(mut self, v: std::option::Option<T>) -> Self
4301        where
4302            T: std::convert::Into<crate::model::Spoke>,
4303        {
4304            self.0.request.spoke = v.map(|x| x.into());
4305            self
4306        }
4307
4308        /// Sets the value of [request_id][crate::model::UpdateSpokeRequest::request_id].
4309        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4310            self.0.request.request_id = v.into();
4311            self
4312        }
4313    }
4314
4315    #[doc(hidden)]
4316    impl gax::options::internal::RequestBuilder for UpdateSpoke {
4317        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4318            &mut self.0.options
4319        }
4320    }
4321
4322    /// The request builder for [HubService::reject_hub_spoke][crate::client::HubService::reject_hub_spoke] calls.
4323    ///
4324    /// # Example
4325    /// ```no_run
4326    /// # use google_cloud_networkconnectivity_v1::builder;
4327    /// use builder::hub_service::RejectHubSpoke;
4328    /// # tokio_test::block_on(async {
4329    /// use lro::Poller;
4330    ///
4331    /// let builder = prepare_request_builder();
4332    /// let response = builder.poller().until_done().await?;
4333    /// # gax::Result::<()>::Ok(()) });
4334    ///
4335    /// fn prepare_request_builder() -> RejectHubSpoke {
4336    ///   # panic!();
4337    ///   // ... details omitted ...
4338    /// }
4339    /// ```
4340    #[derive(Clone, Debug)]
4341    pub struct RejectHubSpoke(RequestBuilder<crate::model::RejectHubSpokeRequest>);
4342
4343    impl RejectHubSpoke {
4344        pub(crate) fn new(
4345            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4346        ) -> Self {
4347            Self(RequestBuilder::new(stub))
4348        }
4349
4350        /// Sets the full request, replacing any prior values.
4351        pub fn with_request<V: Into<crate::model::RejectHubSpokeRequest>>(mut self, v: V) -> Self {
4352            self.0.request = v.into();
4353            self
4354        }
4355
4356        /// Sets all the options, replacing any prior values.
4357        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4358            self.0.options = v.into();
4359            self
4360        }
4361
4362        /// Sends the request.
4363        ///
4364        /// # Long running operations
4365        ///
4366        /// This starts, but does not poll, a longrunning operation. More information
4367        /// on [reject_hub_spoke][crate::client::HubService::reject_hub_spoke].
4368        pub async fn send(self) -> Result<longrunning::model::Operation> {
4369            (*self.0.stub)
4370                .reject_hub_spoke(self.0.request, self.0.options)
4371                .await
4372                .map(gax::response::Response::into_body)
4373        }
4374
4375        /// Creates a [Poller][lro::Poller] to work with `reject_hub_spoke`.
4376        pub fn poller(
4377            self,
4378        ) -> impl lro::Poller<crate::model::RejectHubSpokeResponse, crate::model::OperationMetadata>
4379        {
4380            type Operation = lro::internal::Operation<
4381                crate::model::RejectHubSpokeResponse,
4382                crate::model::OperationMetadata,
4383            >;
4384            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4385            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4386
4387            let stub = self.0.stub.clone();
4388            let mut options = self.0.options.clone();
4389            options.set_retry_policy(gax::retry_policy::NeverRetry);
4390            let query = move |name| {
4391                let stub = stub.clone();
4392                let options = options.clone();
4393                async {
4394                    let op = GetOperation::new(stub)
4395                        .set_name(name)
4396                        .with_options(options)
4397                        .send()
4398                        .await?;
4399                    Ok(Operation::new(op))
4400                }
4401            };
4402
4403            let start = move || async {
4404                let op = self.send().await?;
4405                Ok(Operation::new(op))
4406            };
4407
4408            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4409        }
4410
4411        /// Sets the value of [name][crate::model::RejectHubSpokeRequest::name].
4412        ///
4413        /// This is a **required** field for requests.
4414        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4415            self.0.request.name = v.into();
4416            self
4417        }
4418
4419        /// Sets the value of [spoke_uri][crate::model::RejectHubSpokeRequest::spoke_uri].
4420        ///
4421        /// This is a **required** field for requests.
4422        pub fn set_spoke_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
4423            self.0.request.spoke_uri = v.into();
4424            self
4425        }
4426
4427        /// Sets the value of [request_id][crate::model::RejectHubSpokeRequest::request_id].
4428        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4429            self.0.request.request_id = v.into();
4430            self
4431        }
4432
4433        /// Sets the value of [details][crate::model::RejectHubSpokeRequest::details].
4434        pub fn set_details<T: Into<std::string::String>>(mut self, v: T) -> Self {
4435            self.0.request.details = v.into();
4436            self
4437        }
4438    }
4439
4440    #[doc(hidden)]
4441    impl gax::options::internal::RequestBuilder for RejectHubSpoke {
4442        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4443            &mut self.0.options
4444        }
4445    }
4446
4447    /// The request builder for [HubService::accept_hub_spoke][crate::client::HubService::accept_hub_spoke] calls.
4448    ///
4449    /// # Example
4450    /// ```no_run
4451    /// # use google_cloud_networkconnectivity_v1::builder;
4452    /// use builder::hub_service::AcceptHubSpoke;
4453    /// # tokio_test::block_on(async {
4454    /// use lro::Poller;
4455    ///
4456    /// let builder = prepare_request_builder();
4457    /// let response = builder.poller().until_done().await?;
4458    /// # gax::Result::<()>::Ok(()) });
4459    ///
4460    /// fn prepare_request_builder() -> AcceptHubSpoke {
4461    ///   # panic!();
4462    ///   // ... details omitted ...
4463    /// }
4464    /// ```
4465    #[derive(Clone, Debug)]
4466    pub struct AcceptHubSpoke(RequestBuilder<crate::model::AcceptHubSpokeRequest>);
4467
4468    impl AcceptHubSpoke {
4469        pub(crate) fn new(
4470            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4471        ) -> Self {
4472            Self(RequestBuilder::new(stub))
4473        }
4474
4475        /// Sets the full request, replacing any prior values.
4476        pub fn with_request<V: Into<crate::model::AcceptHubSpokeRequest>>(mut self, v: V) -> Self {
4477            self.0.request = v.into();
4478            self
4479        }
4480
4481        /// Sets all the options, replacing any prior values.
4482        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4483            self.0.options = v.into();
4484            self
4485        }
4486
4487        /// Sends the request.
4488        ///
4489        /// # Long running operations
4490        ///
4491        /// This starts, but does not poll, a longrunning operation. More information
4492        /// on [accept_hub_spoke][crate::client::HubService::accept_hub_spoke].
4493        pub async fn send(self) -> Result<longrunning::model::Operation> {
4494            (*self.0.stub)
4495                .accept_hub_spoke(self.0.request, self.0.options)
4496                .await
4497                .map(gax::response::Response::into_body)
4498        }
4499
4500        /// Creates a [Poller][lro::Poller] to work with `accept_hub_spoke`.
4501        pub fn poller(
4502            self,
4503        ) -> impl lro::Poller<crate::model::AcceptHubSpokeResponse, crate::model::OperationMetadata>
4504        {
4505            type Operation = lro::internal::Operation<
4506                crate::model::AcceptHubSpokeResponse,
4507                crate::model::OperationMetadata,
4508            >;
4509            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4510            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4511
4512            let stub = self.0.stub.clone();
4513            let mut options = self.0.options.clone();
4514            options.set_retry_policy(gax::retry_policy::NeverRetry);
4515            let query = move |name| {
4516                let stub = stub.clone();
4517                let options = options.clone();
4518                async {
4519                    let op = GetOperation::new(stub)
4520                        .set_name(name)
4521                        .with_options(options)
4522                        .send()
4523                        .await?;
4524                    Ok(Operation::new(op))
4525                }
4526            };
4527
4528            let start = move || async {
4529                let op = self.send().await?;
4530                Ok(Operation::new(op))
4531            };
4532
4533            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4534        }
4535
4536        /// Sets the value of [name][crate::model::AcceptHubSpokeRequest::name].
4537        ///
4538        /// This is a **required** field for requests.
4539        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4540            self.0.request.name = v.into();
4541            self
4542        }
4543
4544        /// Sets the value of [spoke_uri][crate::model::AcceptHubSpokeRequest::spoke_uri].
4545        ///
4546        /// This is a **required** field for requests.
4547        pub fn set_spoke_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
4548            self.0.request.spoke_uri = v.into();
4549            self
4550        }
4551
4552        /// Sets the value of [request_id][crate::model::AcceptHubSpokeRequest::request_id].
4553        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4554            self.0.request.request_id = v.into();
4555            self
4556        }
4557    }
4558
4559    #[doc(hidden)]
4560    impl gax::options::internal::RequestBuilder for AcceptHubSpoke {
4561        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4562            &mut self.0.options
4563        }
4564    }
4565
4566    /// The request builder for [HubService::accept_spoke_update][crate::client::HubService::accept_spoke_update] calls.
4567    ///
4568    /// # Example
4569    /// ```no_run
4570    /// # use google_cloud_networkconnectivity_v1::builder;
4571    /// use builder::hub_service::AcceptSpokeUpdate;
4572    /// # tokio_test::block_on(async {
4573    /// use lro::Poller;
4574    ///
4575    /// let builder = prepare_request_builder();
4576    /// let response = builder.poller().until_done().await?;
4577    /// # gax::Result::<()>::Ok(()) });
4578    ///
4579    /// fn prepare_request_builder() -> AcceptSpokeUpdate {
4580    ///   # panic!();
4581    ///   // ... details omitted ...
4582    /// }
4583    /// ```
4584    #[derive(Clone, Debug)]
4585    pub struct AcceptSpokeUpdate(RequestBuilder<crate::model::AcceptSpokeUpdateRequest>);
4586
4587    impl AcceptSpokeUpdate {
4588        pub(crate) fn new(
4589            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4590        ) -> Self {
4591            Self(RequestBuilder::new(stub))
4592        }
4593
4594        /// Sets the full request, replacing any prior values.
4595        pub fn with_request<V: Into<crate::model::AcceptSpokeUpdateRequest>>(
4596            mut self,
4597            v: V,
4598        ) -> Self {
4599            self.0.request = v.into();
4600            self
4601        }
4602
4603        /// Sets all the options, replacing any prior values.
4604        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4605            self.0.options = v.into();
4606            self
4607        }
4608
4609        /// Sends the request.
4610        ///
4611        /// # Long running operations
4612        ///
4613        /// This starts, but does not poll, a longrunning operation. More information
4614        /// on [accept_spoke_update][crate::client::HubService::accept_spoke_update].
4615        pub async fn send(self) -> Result<longrunning::model::Operation> {
4616            (*self.0.stub)
4617                .accept_spoke_update(self.0.request, self.0.options)
4618                .await
4619                .map(gax::response::Response::into_body)
4620        }
4621
4622        /// Creates a [Poller][lro::Poller] to work with `accept_spoke_update`.
4623        pub fn poller(
4624            self,
4625        ) -> impl lro::Poller<crate::model::AcceptSpokeUpdateResponse, crate::model::OperationMetadata>
4626        {
4627            type Operation = lro::internal::Operation<
4628                crate::model::AcceptSpokeUpdateResponse,
4629                crate::model::OperationMetadata,
4630            >;
4631            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4632            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4633
4634            let stub = self.0.stub.clone();
4635            let mut options = self.0.options.clone();
4636            options.set_retry_policy(gax::retry_policy::NeverRetry);
4637            let query = move |name| {
4638                let stub = stub.clone();
4639                let options = options.clone();
4640                async {
4641                    let op = GetOperation::new(stub)
4642                        .set_name(name)
4643                        .with_options(options)
4644                        .send()
4645                        .await?;
4646                    Ok(Operation::new(op))
4647                }
4648            };
4649
4650            let start = move || async {
4651                let op = self.send().await?;
4652                Ok(Operation::new(op))
4653            };
4654
4655            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4656        }
4657
4658        /// Sets the value of [name][crate::model::AcceptSpokeUpdateRequest::name].
4659        ///
4660        /// This is a **required** field for requests.
4661        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4662            self.0.request.name = v.into();
4663            self
4664        }
4665
4666        /// Sets the value of [spoke_uri][crate::model::AcceptSpokeUpdateRequest::spoke_uri].
4667        ///
4668        /// This is a **required** field for requests.
4669        pub fn set_spoke_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
4670            self.0.request.spoke_uri = v.into();
4671            self
4672        }
4673
4674        /// Sets the value of [spoke_etag][crate::model::AcceptSpokeUpdateRequest::spoke_etag].
4675        ///
4676        /// This is a **required** field for requests.
4677        pub fn set_spoke_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4678            self.0.request.spoke_etag = v.into();
4679            self
4680        }
4681
4682        /// Sets the value of [request_id][crate::model::AcceptSpokeUpdateRequest::request_id].
4683        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4684            self.0.request.request_id = v.into();
4685            self
4686        }
4687    }
4688
4689    #[doc(hidden)]
4690    impl gax::options::internal::RequestBuilder for AcceptSpokeUpdate {
4691        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4692            &mut self.0.options
4693        }
4694    }
4695
4696    /// The request builder for [HubService::reject_spoke_update][crate::client::HubService::reject_spoke_update] calls.
4697    ///
4698    /// # Example
4699    /// ```no_run
4700    /// # use google_cloud_networkconnectivity_v1::builder;
4701    /// use builder::hub_service::RejectSpokeUpdate;
4702    /// # tokio_test::block_on(async {
4703    /// use lro::Poller;
4704    ///
4705    /// let builder = prepare_request_builder();
4706    /// let response = builder.poller().until_done().await?;
4707    /// # gax::Result::<()>::Ok(()) });
4708    ///
4709    /// fn prepare_request_builder() -> RejectSpokeUpdate {
4710    ///   # panic!();
4711    ///   // ... details omitted ...
4712    /// }
4713    /// ```
4714    #[derive(Clone, Debug)]
4715    pub struct RejectSpokeUpdate(RequestBuilder<crate::model::RejectSpokeUpdateRequest>);
4716
4717    impl RejectSpokeUpdate {
4718        pub(crate) fn new(
4719            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4720        ) -> Self {
4721            Self(RequestBuilder::new(stub))
4722        }
4723
4724        /// Sets the full request, replacing any prior values.
4725        pub fn with_request<V: Into<crate::model::RejectSpokeUpdateRequest>>(
4726            mut self,
4727            v: V,
4728        ) -> Self {
4729            self.0.request = v.into();
4730            self
4731        }
4732
4733        /// Sets all the options, replacing any prior values.
4734        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4735            self.0.options = v.into();
4736            self
4737        }
4738
4739        /// Sends the request.
4740        ///
4741        /// # Long running operations
4742        ///
4743        /// This starts, but does not poll, a longrunning operation. More information
4744        /// on [reject_spoke_update][crate::client::HubService::reject_spoke_update].
4745        pub async fn send(self) -> Result<longrunning::model::Operation> {
4746            (*self.0.stub)
4747                .reject_spoke_update(self.0.request, self.0.options)
4748                .await
4749                .map(gax::response::Response::into_body)
4750        }
4751
4752        /// Creates a [Poller][lro::Poller] to work with `reject_spoke_update`.
4753        pub fn poller(
4754            self,
4755        ) -> impl lro::Poller<crate::model::RejectSpokeUpdateResponse, crate::model::OperationMetadata>
4756        {
4757            type Operation = lro::internal::Operation<
4758                crate::model::RejectSpokeUpdateResponse,
4759                crate::model::OperationMetadata,
4760            >;
4761            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4762            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4763
4764            let stub = self.0.stub.clone();
4765            let mut options = self.0.options.clone();
4766            options.set_retry_policy(gax::retry_policy::NeverRetry);
4767            let query = move |name| {
4768                let stub = stub.clone();
4769                let options = options.clone();
4770                async {
4771                    let op = GetOperation::new(stub)
4772                        .set_name(name)
4773                        .with_options(options)
4774                        .send()
4775                        .await?;
4776                    Ok(Operation::new(op))
4777                }
4778            };
4779
4780            let start = move || async {
4781                let op = self.send().await?;
4782                Ok(Operation::new(op))
4783            };
4784
4785            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4786        }
4787
4788        /// Sets the value of [name][crate::model::RejectSpokeUpdateRequest::name].
4789        ///
4790        /// This is a **required** field for requests.
4791        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4792            self.0.request.name = v.into();
4793            self
4794        }
4795
4796        /// Sets the value of [spoke_uri][crate::model::RejectSpokeUpdateRequest::spoke_uri].
4797        ///
4798        /// This is a **required** field for requests.
4799        pub fn set_spoke_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
4800            self.0.request.spoke_uri = v.into();
4801            self
4802        }
4803
4804        /// Sets the value of [spoke_etag][crate::model::RejectSpokeUpdateRequest::spoke_etag].
4805        ///
4806        /// This is a **required** field for requests.
4807        pub fn set_spoke_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4808            self.0.request.spoke_etag = v.into();
4809            self
4810        }
4811
4812        /// Sets the value of [details][crate::model::RejectSpokeUpdateRequest::details].
4813        pub fn set_details<T: Into<std::string::String>>(mut self, v: T) -> Self {
4814            self.0.request.details = v.into();
4815            self
4816        }
4817
4818        /// Sets the value of [request_id][crate::model::RejectSpokeUpdateRequest::request_id].
4819        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4820            self.0.request.request_id = v.into();
4821            self
4822        }
4823    }
4824
4825    #[doc(hidden)]
4826    impl gax::options::internal::RequestBuilder for RejectSpokeUpdate {
4827        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4828            &mut self.0.options
4829        }
4830    }
4831
4832    /// The request builder for [HubService::delete_spoke][crate::client::HubService::delete_spoke] calls.
4833    ///
4834    /// # Example
4835    /// ```no_run
4836    /// # use google_cloud_networkconnectivity_v1::builder;
4837    /// use builder::hub_service::DeleteSpoke;
4838    /// # tokio_test::block_on(async {
4839    /// use lro::Poller;
4840    ///
4841    /// let builder = prepare_request_builder();
4842    /// let response = builder.poller().until_done().await?;
4843    /// # gax::Result::<()>::Ok(()) });
4844    ///
4845    /// fn prepare_request_builder() -> DeleteSpoke {
4846    ///   # panic!();
4847    ///   // ... details omitted ...
4848    /// }
4849    /// ```
4850    #[derive(Clone, Debug)]
4851    pub struct DeleteSpoke(RequestBuilder<crate::model::DeleteSpokeRequest>);
4852
4853    impl DeleteSpoke {
4854        pub(crate) fn new(
4855            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4856        ) -> Self {
4857            Self(RequestBuilder::new(stub))
4858        }
4859
4860        /// Sets the full request, replacing any prior values.
4861        pub fn with_request<V: Into<crate::model::DeleteSpokeRequest>>(mut self, v: V) -> Self {
4862            self.0.request = v.into();
4863            self
4864        }
4865
4866        /// Sets all the options, replacing any prior values.
4867        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4868            self.0.options = v.into();
4869            self
4870        }
4871
4872        /// Sends the request.
4873        ///
4874        /// # Long running operations
4875        ///
4876        /// This starts, but does not poll, a longrunning operation. More information
4877        /// on [delete_spoke][crate::client::HubService::delete_spoke].
4878        pub async fn send(self) -> Result<longrunning::model::Operation> {
4879            (*self.0.stub)
4880                .delete_spoke(self.0.request, self.0.options)
4881                .await
4882                .map(gax::response::Response::into_body)
4883        }
4884
4885        /// Creates a [Poller][lro::Poller] to work with `delete_spoke`.
4886        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
4887            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
4888            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4889            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4890
4891            let stub = self.0.stub.clone();
4892            let mut options = self.0.options.clone();
4893            options.set_retry_policy(gax::retry_policy::NeverRetry);
4894            let query = move |name| {
4895                let stub = stub.clone();
4896                let options = options.clone();
4897                async {
4898                    let op = GetOperation::new(stub)
4899                        .set_name(name)
4900                        .with_options(options)
4901                        .send()
4902                        .await?;
4903                    Ok(Operation::new(op))
4904                }
4905            };
4906
4907            let start = move || async {
4908                let op = self.send().await?;
4909                Ok(Operation::new(op))
4910            };
4911
4912            lro::internal::new_unit_response_poller(
4913                polling_error_policy,
4914                polling_backoff_policy,
4915                start,
4916                query,
4917            )
4918        }
4919
4920        /// Sets the value of [name][crate::model::DeleteSpokeRequest::name].
4921        ///
4922        /// This is a **required** field for requests.
4923        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4924            self.0.request.name = v.into();
4925            self
4926        }
4927
4928        /// Sets the value of [request_id][crate::model::DeleteSpokeRequest::request_id].
4929        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4930            self.0.request.request_id = v.into();
4931            self
4932        }
4933    }
4934
4935    #[doc(hidden)]
4936    impl gax::options::internal::RequestBuilder for DeleteSpoke {
4937        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4938            &mut self.0.options
4939        }
4940    }
4941
4942    /// The request builder for [HubService::get_route_table][crate::client::HubService::get_route_table] calls.
4943    ///
4944    /// # Example
4945    /// ```no_run
4946    /// # use google_cloud_networkconnectivity_v1::builder;
4947    /// use builder::hub_service::GetRouteTable;
4948    /// # tokio_test::block_on(async {
4949    ///
4950    /// let builder = prepare_request_builder();
4951    /// let response = builder.send().await?;
4952    /// # gax::Result::<()>::Ok(()) });
4953    ///
4954    /// fn prepare_request_builder() -> GetRouteTable {
4955    ///   # panic!();
4956    ///   // ... details omitted ...
4957    /// }
4958    /// ```
4959    #[derive(Clone, Debug)]
4960    pub struct GetRouteTable(RequestBuilder<crate::model::GetRouteTableRequest>);
4961
4962    impl GetRouteTable {
4963        pub(crate) fn new(
4964            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
4965        ) -> Self {
4966            Self(RequestBuilder::new(stub))
4967        }
4968
4969        /// Sets the full request, replacing any prior values.
4970        pub fn with_request<V: Into<crate::model::GetRouteTableRequest>>(mut self, v: V) -> Self {
4971            self.0.request = v.into();
4972            self
4973        }
4974
4975        /// Sets all the options, replacing any prior values.
4976        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4977            self.0.options = v.into();
4978            self
4979        }
4980
4981        /// Sends the request.
4982        pub async fn send(self) -> Result<crate::model::RouteTable> {
4983            (*self.0.stub)
4984                .get_route_table(self.0.request, self.0.options)
4985                .await
4986                .map(gax::response::Response::into_body)
4987        }
4988
4989        /// Sets the value of [name][crate::model::GetRouteTableRequest::name].
4990        ///
4991        /// This is a **required** field for requests.
4992        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4993            self.0.request.name = v.into();
4994            self
4995        }
4996    }
4997
4998    #[doc(hidden)]
4999    impl gax::options::internal::RequestBuilder for GetRouteTable {
5000        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5001            &mut self.0.options
5002        }
5003    }
5004
5005    /// The request builder for [HubService::get_route][crate::client::HubService::get_route] calls.
5006    ///
5007    /// # Example
5008    /// ```no_run
5009    /// # use google_cloud_networkconnectivity_v1::builder;
5010    /// use builder::hub_service::GetRoute;
5011    /// # tokio_test::block_on(async {
5012    ///
5013    /// let builder = prepare_request_builder();
5014    /// let response = builder.send().await?;
5015    /// # gax::Result::<()>::Ok(()) });
5016    ///
5017    /// fn prepare_request_builder() -> GetRoute {
5018    ///   # panic!();
5019    ///   // ... details omitted ...
5020    /// }
5021    /// ```
5022    #[derive(Clone, Debug)]
5023    pub struct GetRoute(RequestBuilder<crate::model::GetRouteRequest>);
5024
5025    impl GetRoute {
5026        pub(crate) fn new(
5027            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5028        ) -> Self {
5029            Self(RequestBuilder::new(stub))
5030        }
5031
5032        /// Sets the full request, replacing any prior values.
5033        pub fn with_request<V: Into<crate::model::GetRouteRequest>>(mut self, v: V) -> Self {
5034            self.0.request = v.into();
5035            self
5036        }
5037
5038        /// Sets all the options, replacing any prior values.
5039        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5040            self.0.options = v.into();
5041            self
5042        }
5043
5044        /// Sends the request.
5045        pub async fn send(self) -> Result<crate::model::Route> {
5046            (*self.0.stub)
5047                .get_route(self.0.request, self.0.options)
5048                .await
5049                .map(gax::response::Response::into_body)
5050        }
5051
5052        /// Sets the value of [name][crate::model::GetRouteRequest::name].
5053        ///
5054        /// This is a **required** field for requests.
5055        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5056            self.0.request.name = v.into();
5057            self
5058        }
5059    }
5060
5061    #[doc(hidden)]
5062    impl gax::options::internal::RequestBuilder for GetRoute {
5063        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5064            &mut self.0.options
5065        }
5066    }
5067
5068    /// The request builder for [HubService::list_routes][crate::client::HubService::list_routes] calls.
5069    ///
5070    /// # Example
5071    /// ```no_run
5072    /// # use google_cloud_networkconnectivity_v1::builder;
5073    /// use builder::hub_service::ListRoutes;
5074    /// # tokio_test::block_on(async {
5075    /// use gax::paginator::ItemPaginator;
5076    ///
5077    /// let builder = prepare_request_builder();
5078    /// let mut items = builder.by_item();
5079    /// while let Some(result) = items.next().await {
5080    ///   let item = result?;
5081    /// }
5082    /// # gax::Result::<()>::Ok(()) });
5083    ///
5084    /// fn prepare_request_builder() -> ListRoutes {
5085    ///   # panic!();
5086    ///   // ... details omitted ...
5087    /// }
5088    /// ```
5089    #[derive(Clone, Debug)]
5090    pub struct ListRoutes(RequestBuilder<crate::model::ListRoutesRequest>);
5091
5092    impl ListRoutes {
5093        pub(crate) fn new(
5094            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5095        ) -> Self {
5096            Self(RequestBuilder::new(stub))
5097        }
5098
5099        /// Sets the full request, replacing any prior values.
5100        pub fn with_request<V: Into<crate::model::ListRoutesRequest>>(mut self, v: V) -> Self {
5101            self.0.request = v.into();
5102            self
5103        }
5104
5105        /// Sets all the options, replacing any prior values.
5106        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5107            self.0.options = v.into();
5108            self
5109        }
5110
5111        /// Sends the request.
5112        pub async fn send(self) -> Result<crate::model::ListRoutesResponse> {
5113            (*self.0.stub)
5114                .list_routes(self.0.request, self.0.options)
5115                .await
5116                .map(gax::response::Response::into_body)
5117        }
5118
5119        /// Streams each page in the collection.
5120        pub fn by_page(
5121            self,
5122        ) -> impl gax::paginator::Paginator<crate::model::ListRoutesResponse, gax::error::Error>
5123        {
5124            use std::clone::Clone;
5125            let token = self.0.request.page_token.clone();
5126            let execute = move |token: String| {
5127                let mut builder = self.clone();
5128                builder.0.request = builder.0.request.set_page_token(token);
5129                builder.send()
5130            };
5131            gax::paginator::internal::new_paginator(token, execute)
5132        }
5133
5134        /// Streams each item in the collection.
5135        pub fn by_item(
5136            self,
5137        ) -> impl gax::paginator::ItemPaginator<crate::model::ListRoutesResponse, gax::error::Error>
5138        {
5139            use gax::paginator::Paginator;
5140            self.by_page().items()
5141        }
5142
5143        /// Sets the value of [parent][crate::model::ListRoutesRequest::parent].
5144        ///
5145        /// This is a **required** field for requests.
5146        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5147            self.0.request.parent = v.into();
5148            self
5149        }
5150
5151        /// Sets the value of [page_size][crate::model::ListRoutesRequest::page_size].
5152        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5153            self.0.request.page_size = v.into();
5154            self
5155        }
5156
5157        /// Sets the value of [page_token][crate::model::ListRoutesRequest::page_token].
5158        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5159            self.0.request.page_token = v.into();
5160            self
5161        }
5162
5163        /// Sets the value of [filter][crate::model::ListRoutesRequest::filter].
5164        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5165            self.0.request.filter = v.into();
5166            self
5167        }
5168
5169        /// Sets the value of [order_by][crate::model::ListRoutesRequest::order_by].
5170        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
5171            self.0.request.order_by = v.into();
5172            self
5173        }
5174    }
5175
5176    #[doc(hidden)]
5177    impl gax::options::internal::RequestBuilder for ListRoutes {
5178        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5179            &mut self.0.options
5180        }
5181    }
5182
5183    /// The request builder for [HubService::list_route_tables][crate::client::HubService::list_route_tables] calls.
5184    ///
5185    /// # Example
5186    /// ```no_run
5187    /// # use google_cloud_networkconnectivity_v1::builder;
5188    /// use builder::hub_service::ListRouteTables;
5189    /// # tokio_test::block_on(async {
5190    /// use gax::paginator::ItemPaginator;
5191    ///
5192    /// let builder = prepare_request_builder();
5193    /// let mut items = builder.by_item();
5194    /// while let Some(result) = items.next().await {
5195    ///   let item = result?;
5196    /// }
5197    /// # gax::Result::<()>::Ok(()) });
5198    ///
5199    /// fn prepare_request_builder() -> ListRouteTables {
5200    ///   # panic!();
5201    ///   // ... details omitted ...
5202    /// }
5203    /// ```
5204    #[derive(Clone, Debug)]
5205    pub struct ListRouteTables(RequestBuilder<crate::model::ListRouteTablesRequest>);
5206
5207    impl ListRouteTables {
5208        pub(crate) fn new(
5209            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5210        ) -> Self {
5211            Self(RequestBuilder::new(stub))
5212        }
5213
5214        /// Sets the full request, replacing any prior values.
5215        pub fn with_request<V: Into<crate::model::ListRouteTablesRequest>>(mut self, v: V) -> Self {
5216            self.0.request = v.into();
5217            self
5218        }
5219
5220        /// Sets all the options, replacing any prior values.
5221        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5222            self.0.options = v.into();
5223            self
5224        }
5225
5226        /// Sends the request.
5227        pub async fn send(self) -> Result<crate::model::ListRouteTablesResponse> {
5228            (*self.0.stub)
5229                .list_route_tables(self.0.request, self.0.options)
5230                .await
5231                .map(gax::response::Response::into_body)
5232        }
5233
5234        /// Streams each page in the collection.
5235        pub fn by_page(
5236            self,
5237        ) -> impl gax::paginator::Paginator<crate::model::ListRouteTablesResponse, gax::error::Error>
5238        {
5239            use std::clone::Clone;
5240            let token = self.0.request.page_token.clone();
5241            let execute = move |token: String| {
5242                let mut builder = self.clone();
5243                builder.0.request = builder.0.request.set_page_token(token);
5244                builder.send()
5245            };
5246            gax::paginator::internal::new_paginator(token, execute)
5247        }
5248
5249        /// Streams each item in the collection.
5250        pub fn by_item(
5251            self,
5252        ) -> impl gax::paginator::ItemPaginator<crate::model::ListRouteTablesResponse, gax::error::Error>
5253        {
5254            use gax::paginator::Paginator;
5255            self.by_page().items()
5256        }
5257
5258        /// Sets the value of [parent][crate::model::ListRouteTablesRequest::parent].
5259        ///
5260        /// This is a **required** field for requests.
5261        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5262            self.0.request.parent = v.into();
5263            self
5264        }
5265
5266        /// Sets the value of [page_size][crate::model::ListRouteTablesRequest::page_size].
5267        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5268            self.0.request.page_size = v.into();
5269            self
5270        }
5271
5272        /// Sets the value of [page_token][crate::model::ListRouteTablesRequest::page_token].
5273        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5274            self.0.request.page_token = v.into();
5275            self
5276        }
5277
5278        /// Sets the value of [filter][crate::model::ListRouteTablesRequest::filter].
5279        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5280            self.0.request.filter = v.into();
5281            self
5282        }
5283
5284        /// Sets the value of [order_by][crate::model::ListRouteTablesRequest::order_by].
5285        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
5286            self.0.request.order_by = v.into();
5287            self
5288        }
5289    }
5290
5291    #[doc(hidden)]
5292    impl gax::options::internal::RequestBuilder for ListRouteTables {
5293        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5294            &mut self.0.options
5295        }
5296    }
5297
5298    /// The request builder for [HubService::get_group][crate::client::HubService::get_group] calls.
5299    ///
5300    /// # Example
5301    /// ```no_run
5302    /// # use google_cloud_networkconnectivity_v1::builder;
5303    /// use builder::hub_service::GetGroup;
5304    /// # tokio_test::block_on(async {
5305    ///
5306    /// let builder = prepare_request_builder();
5307    /// let response = builder.send().await?;
5308    /// # gax::Result::<()>::Ok(()) });
5309    ///
5310    /// fn prepare_request_builder() -> GetGroup {
5311    ///   # panic!();
5312    ///   // ... details omitted ...
5313    /// }
5314    /// ```
5315    #[derive(Clone, Debug)]
5316    pub struct GetGroup(RequestBuilder<crate::model::GetGroupRequest>);
5317
5318    impl GetGroup {
5319        pub(crate) fn new(
5320            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5321        ) -> Self {
5322            Self(RequestBuilder::new(stub))
5323        }
5324
5325        /// Sets the full request, replacing any prior values.
5326        pub fn with_request<V: Into<crate::model::GetGroupRequest>>(mut self, v: V) -> Self {
5327            self.0.request = v.into();
5328            self
5329        }
5330
5331        /// Sets all the options, replacing any prior values.
5332        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5333            self.0.options = v.into();
5334            self
5335        }
5336
5337        /// Sends the request.
5338        pub async fn send(self) -> Result<crate::model::Group> {
5339            (*self.0.stub)
5340                .get_group(self.0.request, self.0.options)
5341                .await
5342                .map(gax::response::Response::into_body)
5343        }
5344
5345        /// Sets the value of [name][crate::model::GetGroupRequest::name].
5346        ///
5347        /// This is a **required** field for requests.
5348        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5349            self.0.request.name = v.into();
5350            self
5351        }
5352    }
5353
5354    #[doc(hidden)]
5355    impl gax::options::internal::RequestBuilder for GetGroup {
5356        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5357            &mut self.0.options
5358        }
5359    }
5360
5361    /// The request builder for [HubService::list_groups][crate::client::HubService::list_groups] calls.
5362    ///
5363    /// # Example
5364    /// ```no_run
5365    /// # use google_cloud_networkconnectivity_v1::builder;
5366    /// use builder::hub_service::ListGroups;
5367    /// # tokio_test::block_on(async {
5368    /// use gax::paginator::ItemPaginator;
5369    ///
5370    /// let builder = prepare_request_builder();
5371    /// let mut items = builder.by_item();
5372    /// while let Some(result) = items.next().await {
5373    ///   let item = result?;
5374    /// }
5375    /// # gax::Result::<()>::Ok(()) });
5376    ///
5377    /// fn prepare_request_builder() -> ListGroups {
5378    ///   # panic!();
5379    ///   // ... details omitted ...
5380    /// }
5381    /// ```
5382    #[derive(Clone, Debug)]
5383    pub struct ListGroups(RequestBuilder<crate::model::ListGroupsRequest>);
5384
5385    impl ListGroups {
5386        pub(crate) fn new(
5387            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5388        ) -> Self {
5389            Self(RequestBuilder::new(stub))
5390        }
5391
5392        /// Sets the full request, replacing any prior values.
5393        pub fn with_request<V: Into<crate::model::ListGroupsRequest>>(mut self, v: V) -> Self {
5394            self.0.request = v.into();
5395            self
5396        }
5397
5398        /// Sets all the options, replacing any prior values.
5399        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5400            self.0.options = v.into();
5401            self
5402        }
5403
5404        /// Sends the request.
5405        pub async fn send(self) -> Result<crate::model::ListGroupsResponse> {
5406            (*self.0.stub)
5407                .list_groups(self.0.request, self.0.options)
5408                .await
5409                .map(gax::response::Response::into_body)
5410        }
5411
5412        /// Streams each page in the collection.
5413        pub fn by_page(
5414            self,
5415        ) -> impl gax::paginator::Paginator<crate::model::ListGroupsResponse, gax::error::Error>
5416        {
5417            use std::clone::Clone;
5418            let token = self.0.request.page_token.clone();
5419            let execute = move |token: String| {
5420                let mut builder = self.clone();
5421                builder.0.request = builder.0.request.set_page_token(token);
5422                builder.send()
5423            };
5424            gax::paginator::internal::new_paginator(token, execute)
5425        }
5426
5427        /// Streams each item in the collection.
5428        pub fn by_item(
5429            self,
5430        ) -> impl gax::paginator::ItemPaginator<crate::model::ListGroupsResponse, gax::error::Error>
5431        {
5432            use gax::paginator::Paginator;
5433            self.by_page().items()
5434        }
5435
5436        /// Sets the value of [parent][crate::model::ListGroupsRequest::parent].
5437        ///
5438        /// This is a **required** field for requests.
5439        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5440            self.0.request.parent = v.into();
5441            self
5442        }
5443
5444        /// Sets the value of [page_size][crate::model::ListGroupsRequest::page_size].
5445        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5446            self.0.request.page_size = v.into();
5447            self
5448        }
5449
5450        /// Sets the value of [page_token][crate::model::ListGroupsRequest::page_token].
5451        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5452            self.0.request.page_token = v.into();
5453            self
5454        }
5455
5456        /// Sets the value of [filter][crate::model::ListGroupsRequest::filter].
5457        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5458            self.0.request.filter = v.into();
5459            self
5460        }
5461
5462        /// Sets the value of [order_by][crate::model::ListGroupsRequest::order_by].
5463        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
5464            self.0.request.order_by = v.into();
5465            self
5466        }
5467    }
5468
5469    #[doc(hidden)]
5470    impl gax::options::internal::RequestBuilder for ListGroups {
5471        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5472            &mut self.0.options
5473        }
5474    }
5475
5476    /// The request builder for [HubService::update_group][crate::client::HubService::update_group] calls.
5477    ///
5478    /// # Example
5479    /// ```no_run
5480    /// # use google_cloud_networkconnectivity_v1::builder;
5481    /// use builder::hub_service::UpdateGroup;
5482    /// # tokio_test::block_on(async {
5483    /// use lro::Poller;
5484    ///
5485    /// let builder = prepare_request_builder();
5486    /// let response = builder.poller().until_done().await?;
5487    /// # gax::Result::<()>::Ok(()) });
5488    ///
5489    /// fn prepare_request_builder() -> UpdateGroup {
5490    ///   # panic!();
5491    ///   // ... details omitted ...
5492    /// }
5493    /// ```
5494    #[derive(Clone, Debug)]
5495    pub struct UpdateGroup(RequestBuilder<crate::model::UpdateGroupRequest>);
5496
5497    impl UpdateGroup {
5498        pub(crate) fn new(
5499            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5500        ) -> Self {
5501            Self(RequestBuilder::new(stub))
5502        }
5503
5504        /// Sets the full request, replacing any prior values.
5505        pub fn with_request<V: Into<crate::model::UpdateGroupRequest>>(mut self, v: V) -> Self {
5506            self.0.request = v.into();
5507            self
5508        }
5509
5510        /// Sets all the options, replacing any prior values.
5511        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5512            self.0.options = v.into();
5513            self
5514        }
5515
5516        /// Sends the request.
5517        ///
5518        /// # Long running operations
5519        ///
5520        /// This starts, but does not poll, a longrunning operation. More information
5521        /// on [update_group][crate::client::HubService::update_group].
5522        pub async fn send(self) -> Result<longrunning::model::Operation> {
5523            (*self.0.stub)
5524                .update_group(self.0.request, self.0.options)
5525                .await
5526                .map(gax::response::Response::into_body)
5527        }
5528
5529        /// Creates a [Poller][lro::Poller] to work with `update_group`.
5530        pub fn poller(
5531            self,
5532        ) -> impl lro::Poller<crate::model::Group, crate::model::OperationMetadata> {
5533            type Operation =
5534                lro::internal::Operation<crate::model::Group, crate::model::OperationMetadata>;
5535            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5536            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5537
5538            let stub = self.0.stub.clone();
5539            let mut options = self.0.options.clone();
5540            options.set_retry_policy(gax::retry_policy::NeverRetry);
5541            let query = move |name| {
5542                let stub = stub.clone();
5543                let options = options.clone();
5544                async {
5545                    let op = GetOperation::new(stub)
5546                        .set_name(name)
5547                        .with_options(options)
5548                        .send()
5549                        .await?;
5550                    Ok(Operation::new(op))
5551                }
5552            };
5553
5554            let start = move || async {
5555                let op = self.send().await?;
5556                Ok(Operation::new(op))
5557            };
5558
5559            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5560        }
5561
5562        /// Sets the value of [update_mask][crate::model::UpdateGroupRequest::update_mask].
5563        pub fn set_update_mask<T>(mut self, v: T) -> Self
5564        where
5565            T: std::convert::Into<wkt::FieldMask>,
5566        {
5567            self.0.request.update_mask = std::option::Option::Some(v.into());
5568            self
5569        }
5570
5571        /// Sets or clears the value of [update_mask][crate::model::UpdateGroupRequest::update_mask].
5572        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5573        where
5574            T: std::convert::Into<wkt::FieldMask>,
5575        {
5576            self.0.request.update_mask = v.map(|x| x.into());
5577            self
5578        }
5579
5580        /// Sets the value of [group][crate::model::UpdateGroupRequest::group].
5581        ///
5582        /// This is a **required** field for requests.
5583        pub fn set_group<T>(mut self, v: T) -> Self
5584        where
5585            T: std::convert::Into<crate::model::Group>,
5586        {
5587            self.0.request.group = std::option::Option::Some(v.into());
5588            self
5589        }
5590
5591        /// Sets or clears the value of [group][crate::model::UpdateGroupRequest::group].
5592        ///
5593        /// This is a **required** field for requests.
5594        pub fn set_or_clear_group<T>(mut self, v: std::option::Option<T>) -> Self
5595        where
5596            T: std::convert::Into<crate::model::Group>,
5597        {
5598            self.0.request.group = v.map(|x| x.into());
5599            self
5600        }
5601
5602        /// Sets the value of [request_id][crate::model::UpdateGroupRequest::request_id].
5603        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5604            self.0.request.request_id = v.into();
5605            self
5606        }
5607    }
5608
5609    #[doc(hidden)]
5610    impl gax::options::internal::RequestBuilder for UpdateGroup {
5611        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5612            &mut self.0.options
5613        }
5614    }
5615
5616    /// The request builder for [HubService::list_locations][crate::client::HubService::list_locations] calls.
5617    ///
5618    /// # Example
5619    /// ```no_run
5620    /// # use google_cloud_networkconnectivity_v1::builder;
5621    /// use builder::hub_service::ListLocations;
5622    /// # tokio_test::block_on(async {
5623    /// use gax::paginator::ItemPaginator;
5624    ///
5625    /// let builder = prepare_request_builder();
5626    /// let mut items = builder.by_item();
5627    /// while let Some(result) = items.next().await {
5628    ///   let item = result?;
5629    /// }
5630    /// # gax::Result::<()>::Ok(()) });
5631    ///
5632    /// fn prepare_request_builder() -> ListLocations {
5633    ///   # panic!();
5634    ///   // ... details omitted ...
5635    /// }
5636    /// ```
5637    #[derive(Clone, Debug)]
5638    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
5639
5640    impl ListLocations {
5641        pub(crate) fn new(
5642            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5643        ) -> Self {
5644            Self(RequestBuilder::new(stub))
5645        }
5646
5647        /// Sets the full request, replacing any prior values.
5648        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
5649            mut self,
5650            v: V,
5651        ) -> Self {
5652            self.0.request = v.into();
5653            self
5654        }
5655
5656        /// Sets all the options, replacing any prior values.
5657        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5658            self.0.options = v.into();
5659            self
5660        }
5661
5662        /// Sends the request.
5663        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
5664            (*self.0.stub)
5665                .list_locations(self.0.request, self.0.options)
5666                .await
5667                .map(gax::response::Response::into_body)
5668        }
5669
5670        /// Streams each page in the collection.
5671        pub fn by_page(
5672            self,
5673        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
5674        {
5675            use std::clone::Clone;
5676            let token = self.0.request.page_token.clone();
5677            let execute = move |token: String| {
5678                let mut builder = self.clone();
5679                builder.0.request = builder.0.request.set_page_token(token);
5680                builder.send()
5681            };
5682            gax::paginator::internal::new_paginator(token, execute)
5683        }
5684
5685        /// Streams each item in the collection.
5686        pub fn by_item(
5687            self,
5688        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
5689        {
5690            use gax::paginator::Paginator;
5691            self.by_page().items()
5692        }
5693
5694        /// Sets the value of [name][location::model::ListLocationsRequest::name].
5695        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5696            self.0.request.name = v.into();
5697            self
5698        }
5699
5700        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
5701        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5702            self.0.request.filter = v.into();
5703            self
5704        }
5705
5706        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
5707        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5708            self.0.request.page_size = v.into();
5709            self
5710        }
5711
5712        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
5713        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5714            self.0.request.page_token = v.into();
5715            self
5716        }
5717    }
5718
5719    #[doc(hidden)]
5720    impl gax::options::internal::RequestBuilder for ListLocations {
5721        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5722            &mut self.0.options
5723        }
5724    }
5725
5726    /// The request builder for [HubService::get_location][crate::client::HubService::get_location] calls.
5727    ///
5728    /// # Example
5729    /// ```no_run
5730    /// # use google_cloud_networkconnectivity_v1::builder;
5731    /// use builder::hub_service::GetLocation;
5732    /// # tokio_test::block_on(async {
5733    ///
5734    /// let builder = prepare_request_builder();
5735    /// let response = builder.send().await?;
5736    /// # gax::Result::<()>::Ok(()) });
5737    ///
5738    /// fn prepare_request_builder() -> GetLocation {
5739    ///   # panic!();
5740    ///   // ... details omitted ...
5741    /// }
5742    /// ```
5743    #[derive(Clone, Debug)]
5744    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
5745
5746    impl GetLocation {
5747        pub(crate) fn new(
5748            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5749        ) -> Self {
5750            Self(RequestBuilder::new(stub))
5751        }
5752
5753        /// Sets the full request, replacing any prior values.
5754        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
5755            self.0.request = v.into();
5756            self
5757        }
5758
5759        /// Sets all the options, replacing any prior values.
5760        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5761            self.0.options = v.into();
5762            self
5763        }
5764
5765        /// Sends the request.
5766        pub async fn send(self) -> Result<location::model::Location> {
5767            (*self.0.stub)
5768                .get_location(self.0.request, self.0.options)
5769                .await
5770                .map(gax::response::Response::into_body)
5771        }
5772
5773        /// Sets the value of [name][location::model::GetLocationRequest::name].
5774        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5775            self.0.request.name = v.into();
5776            self
5777        }
5778    }
5779
5780    #[doc(hidden)]
5781    impl gax::options::internal::RequestBuilder for GetLocation {
5782        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5783            &mut self.0.options
5784        }
5785    }
5786
5787    /// The request builder for [HubService::set_iam_policy][crate::client::HubService::set_iam_policy] calls.
5788    ///
5789    /// # Example
5790    /// ```no_run
5791    /// # use google_cloud_networkconnectivity_v1::builder;
5792    /// use builder::hub_service::SetIamPolicy;
5793    /// # tokio_test::block_on(async {
5794    ///
5795    /// let builder = prepare_request_builder();
5796    /// let response = builder.send().await?;
5797    /// # gax::Result::<()>::Ok(()) });
5798    ///
5799    /// fn prepare_request_builder() -> SetIamPolicy {
5800    ///   # panic!();
5801    ///   // ... details omitted ...
5802    /// }
5803    /// ```
5804    #[derive(Clone, Debug)]
5805    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5806
5807    impl SetIamPolicy {
5808        pub(crate) fn new(
5809            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5810        ) -> Self {
5811            Self(RequestBuilder::new(stub))
5812        }
5813
5814        /// Sets the full request, replacing any prior values.
5815        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5816            self.0.request = v.into();
5817            self
5818        }
5819
5820        /// Sets all the options, replacing any prior values.
5821        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5822            self.0.options = v.into();
5823            self
5824        }
5825
5826        /// Sends the request.
5827        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5828            (*self.0.stub)
5829                .set_iam_policy(self.0.request, self.0.options)
5830                .await
5831                .map(gax::response::Response::into_body)
5832        }
5833
5834        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
5835        ///
5836        /// This is a **required** field for requests.
5837        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5838            self.0.request.resource = v.into();
5839            self
5840        }
5841
5842        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5843        ///
5844        /// This is a **required** field for requests.
5845        pub fn set_policy<T>(mut self, v: T) -> Self
5846        where
5847            T: std::convert::Into<iam_v1::model::Policy>,
5848        {
5849            self.0.request.policy = std::option::Option::Some(v.into());
5850            self
5851        }
5852
5853        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5854        ///
5855        /// This is a **required** field for requests.
5856        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5857        where
5858            T: std::convert::Into<iam_v1::model::Policy>,
5859        {
5860            self.0.request.policy = v.map(|x| x.into());
5861            self
5862        }
5863
5864        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5865        pub fn set_update_mask<T>(mut self, v: T) -> Self
5866        where
5867            T: std::convert::Into<wkt::FieldMask>,
5868        {
5869            self.0.request.update_mask = std::option::Option::Some(v.into());
5870            self
5871        }
5872
5873        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5874        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5875        where
5876            T: std::convert::Into<wkt::FieldMask>,
5877        {
5878            self.0.request.update_mask = v.map(|x| x.into());
5879            self
5880        }
5881    }
5882
5883    #[doc(hidden)]
5884    impl gax::options::internal::RequestBuilder for SetIamPolicy {
5885        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5886            &mut self.0.options
5887        }
5888    }
5889
5890    /// The request builder for [HubService::get_iam_policy][crate::client::HubService::get_iam_policy] calls.
5891    ///
5892    /// # Example
5893    /// ```no_run
5894    /// # use google_cloud_networkconnectivity_v1::builder;
5895    /// use builder::hub_service::GetIamPolicy;
5896    /// # tokio_test::block_on(async {
5897    ///
5898    /// let builder = prepare_request_builder();
5899    /// let response = builder.send().await?;
5900    /// # gax::Result::<()>::Ok(()) });
5901    ///
5902    /// fn prepare_request_builder() -> GetIamPolicy {
5903    ///   # panic!();
5904    ///   // ... details omitted ...
5905    /// }
5906    /// ```
5907    #[derive(Clone, Debug)]
5908    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5909
5910    impl GetIamPolicy {
5911        pub(crate) fn new(
5912            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5913        ) -> Self {
5914            Self(RequestBuilder::new(stub))
5915        }
5916
5917        /// Sets the full request, replacing any prior values.
5918        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5919            self.0.request = v.into();
5920            self
5921        }
5922
5923        /// Sets all the options, replacing any prior values.
5924        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5925            self.0.options = v.into();
5926            self
5927        }
5928
5929        /// Sends the request.
5930        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5931            (*self.0.stub)
5932                .get_iam_policy(self.0.request, self.0.options)
5933                .await
5934                .map(gax::response::Response::into_body)
5935        }
5936
5937        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
5938        ///
5939        /// This is a **required** field for requests.
5940        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5941            self.0.request.resource = v.into();
5942            self
5943        }
5944
5945        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5946        pub fn set_options<T>(mut self, v: T) -> Self
5947        where
5948            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5949        {
5950            self.0.request.options = std::option::Option::Some(v.into());
5951            self
5952        }
5953
5954        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5955        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5956        where
5957            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5958        {
5959            self.0.request.options = v.map(|x| x.into());
5960            self
5961        }
5962    }
5963
5964    #[doc(hidden)]
5965    impl gax::options::internal::RequestBuilder for GetIamPolicy {
5966        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5967            &mut self.0.options
5968        }
5969    }
5970
5971    /// The request builder for [HubService::test_iam_permissions][crate::client::HubService::test_iam_permissions] calls.
5972    ///
5973    /// # Example
5974    /// ```no_run
5975    /// # use google_cloud_networkconnectivity_v1::builder;
5976    /// use builder::hub_service::TestIamPermissions;
5977    /// # tokio_test::block_on(async {
5978    ///
5979    /// let builder = prepare_request_builder();
5980    /// let response = builder.send().await?;
5981    /// # gax::Result::<()>::Ok(()) });
5982    ///
5983    /// fn prepare_request_builder() -> TestIamPermissions {
5984    ///   # panic!();
5985    ///   // ... details omitted ...
5986    /// }
5987    /// ```
5988    #[derive(Clone, Debug)]
5989    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5990
5991    impl TestIamPermissions {
5992        pub(crate) fn new(
5993            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
5994        ) -> Self {
5995            Self(RequestBuilder::new(stub))
5996        }
5997
5998        /// Sets the full request, replacing any prior values.
5999        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
6000            mut self,
6001            v: V,
6002        ) -> Self {
6003            self.0.request = v.into();
6004            self
6005        }
6006
6007        /// Sets all the options, replacing any prior values.
6008        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6009            self.0.options = v.into();
6010            self
6011        }
6012
6013        /// Sends the request.
6014        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
6015            (*self.0.stub)
6016                .test_iam_permissions(self.0.request, self.0.options)
6017                .await
6018                .map(gax::response::Response::into_body)
6019        }
6020
6021        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
6022        ///
6023        /// This is a **required** field for requests.
6024        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6025            self.0.request.resource = v.into();
6026            self
6027        }
6028
6029        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
6030        ///
6031        /// This is a **required** field for requests.
6032        pub fn set_permissions<T, V>(mut self, v: T) -> Self
6033        where
6034            T: std::iter::IntoIterator<Item = V>,
6035            V: std::convert::Into<std::string::String>,
6036        {
6037            use std::iter::Iterator;
6038            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6039            self
6040        }
6041    }
6042
6043    #[doc(hidden)]
6044    impl gax::options::internal::RequestBuilder for TestIamPermissions {
6045        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6046            &mut self.0.options
6047        }
6048    }
6049
6050    /// The request builder for [HubService::list_operations][crate::client::HubService::list_operations] calls.
6051    ///
6052    /// # Example
6053    /// ```no_run
6054    /// # use google_cloud_networkconnectivity_v1::builder;
6055    /// use builder::hub_service::ListOperations;
6056    /// # tokio_test::block_on(async {
6057    /// use gax::paginator::ItemPaginator;
6058    ///
6059    /// let builder = prepare_request_builder();
6060    /// let mut items = builder.by_item();
6061    /// while let Some(result) = items.next().await {
6062    ///   let item = result?;
6063    /// }
6064    /// # gax::Result::<()>::Ok(()) });
6065    ///
6066    /// fn prepare_request_builder() -> ListOperations {
6067    ///   # panic!();
6068    ///   // ... details omitted ...
6069    /// }
6070    /// ```
6071    #[derive(Clone, Debug)]
6072    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6073
6074    impl ListOperations {
6075        pub(crate) fn new(
6076            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
6077        ) -> Self {
6078            Self(RequestBuilder::new(stub))
6079        }
6080
6081        /// Sets the full request, replacing any prior values.
6082        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6083            mut self,
6084            v: V,
6085        ) -> Self {
6086            self.0.request = v.into();
6087            self
6088        }
6089
6090        /// Sets all the options, replacing any prior values.
6091        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6092            self.0.options = v.into();
6093            self
6094        }
6095
6096        /// Sends the request.
6097        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6098            (*self.0.stub)
6099                .list_operations(self.0.request, self.0.options)
6100                .await
6101                .map(gax::response::Response::into_body)
6102        }
6103
6104        /// Streams each page in the collection.
6105        pub fn by_page(
6106            self,
6107        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6108        {
6109            use std::clone::Clone;
6110            let token = self.0.request.page_token.clone();
6111            let execute = move |token: String| {
6112                let mut builder = self.clone();
6113                builder.0.request = builder.0.request.set_page_token(token);
6114                builder.send()
6115            };
6116            gax::paginator::internal::new_paginator(token, execute)
6117        }
6118
6119        /// Streams each item in the collection.
6120        pub fn by_item(
6121            self,
6122        ) -> impl gax::paginator::ItemPaginator<
6123            longrunning::model::ListOperationsResponse,
6124            gax::error::Error,
6125        > {
6126            use gax::paginator::Paginator;
6127            self.by_page().items()
6128        }
6129
6130        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
6131        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6132            self.0.request.name = v.into();
6133            self
6134        }
6135
6136        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
6137        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6138            self.0.request.filter = v.into();
6139            self
6140        }
6141
6142        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
6143        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6144            self.0.request.page_size = v.into();
6145            self
6146        }
6147
6148        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
6149        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6150            self.0.request.page_token = v.into();
6151            self
6152        }
6153    }
6154
6155    #[doc(hidden)]
6156    impl gax::options::internal::RequestBuilder for ListOperations {
6157        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6158            &mut self.0.options
6159        }
6160    }
6161
6162    /// The request builder for [HubService::get_operation][crate::client::HubService::get_operation] calls.
6163    ///
6164    /// # Example
6165    /// ```no_run
6166    /// # use google_cloud_networkconnectivity_v1::builder;
6167    /// use builder::hub_service::GetOperation;
6168    /// # tokio_test::block_on(async {
6169    ///
6170    /// let builder = prepare_request_builder();
6171    /// let response = builder.send().await?;
6172    /// # gax::Result::<()>::Ok(()) });
6173    ///
6174    /// fn prepare_request_builder() -> GetOperation {
6175    ///   # panic!();
6176    ///   // ... details omitted ...
6177    /// }
6178    /// ```
6179    #[derive(Clone, Debug)]
6180    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6181
6182    impl GetOperation {
6183        pub(crate) fn new(
6184            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
6185        ) -> Self {
6186            Self(RequestBuilder::new(stub))
6187        }
6188
6189        /// Sets the full request, replacing any prior values.
6190        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6191            mut self,
6192            v: V,
6193        ) -> Self {
6194            self.0.request = v.into();
6195            self
6196        }
6197
6198        /// Sets all the options, replacing any prior values.
6199        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6200            self.0.options = v.into();
6201            self
6202        }
6203
6204        /// Sends the request.
6205        pub async fn send(self) -> Result<longrunning::model::Operation> {
6206            (*self.0.stub)
6207                .get_operation(self.0.request, self.0.options)
6208                .await
6209                .map(gax::response::Response::into_body)
6210        }
6211
6212        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
6213        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6214            self.0.request.name = v.into();
6215            self
6216        }
6217    }
6218
6219    #[doc(hidden)]
6220    impl gax::options::internal::RequestBuilder for GetOperation {
6221        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6222            &mut self.0.options
6223        }
6224    }
6225
6226    /// The request builder for [HubService::delete_operation][crate::client::HubService::delete_operation] calls.
6227    ///
6228    /// # Example
6229    /// ```no_run
6230    /// # use google_cloud_networkconnectivity_v1::builder;
6231    /// use builder::hub_service::DeleteOperation;
6232    /// # tokio_test::block_on(async {
6233    ///
6234    /// let builder = prepare_request_builder();
6235    /// let response = builder.send().await?;
6236    /// # gax::Result::<()>::Ok(()) });
6237    ///
6238    /// fn prepare_request_builder() -> DeleteOperation {
6239    ///   # panic!();
6240    ///   // ... details omitted ...
6241    /// }
6242    /// ```
6243    #[derive(Clone, Debug)]
6244    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
6245
6246    impl DeleteOperation {
6247        pub(crate) fn new(
6248            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
6249        ) -> Self {
6250            Self(RequestBuilder::new(stub))
6251        }
6252
6253        /// Sets the full request, replacing any prior values.
6254        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
6255            mut self,
6256            v: V,
6257        ) -> Self {
6258            self.0.request = v.into();
6259            self
6260        }
6261
6262        /// Sets all the options, replacing any prior values.
6263        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6264            self.0.options = v.into();
6265            self
6266        }
6267
6268        /// Sends the request.
6269        pub async fn send(self) -> Result<()> {
6270            (*self.0.stub)
6271                .delete_operation(self.0.request, self.0.options)
6272                .await
6273                .map(gax::response::Response::into_body)
6274        }
6275
6276        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
6277        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6278            self.0.request.name = v.into();
6279            self
6280        }
6281    }
6282
6283    #[doc(hidden)]
6284    impl gax::options::internal::RequestBuilder for DeleteOperation {
6285        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6286            &mut self.0.options
6287        }
6288    }
6289
6290    /// The request builder for [HubService::cancel_operation][crate::client::HubService::cancel_operation] calls.
6291    ///
6292    /// # Example
6293    /// ```no_run
6294    /// # use google_cloud_networkconnectivity_v1::builder;
6295    /// use builder::hub_service::CancelOperation;
6296    /// # tokio_test::block_on(async {
6297    ///
6298    /// let builder = prepare_request_builder();
6299    /// let response = builder.send().await?;
6300    /// # gax::Result::<()>::Ok(()) });
6301    ///
6302    /// fn prepare_request_builder() -> CancelOperation {
6303    ///   # panic!();
6304    ///   // ... details omitted ...
6305    /// }
6306    /// ```
6307    #[derive(Clone, Debug)]
6308    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6309
6310    impl CancelOperation {
6311        pub(crate) fn new(
6312            stub: std::sync::Arc<dyn super::super::stub::dynamic::HubService>,
6313        ) -> Self {
6314            Self(RequestBuilder::new(stub))
6315        }
6316
6317        /// Sets the full request, replacing any prior values.
6318        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6319            mut self,
6320            v: V,
6321        ) -> Self {
6322            self.0.request = v.into();
6323            self
6324        }
6325
6326        /// Sets all the options, replacing any prior values.
6327        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6328            self.0.options = v.into();
6329            self
6330        }
6331
6332        /// Sends the request.
6333        pub async fn send(self) -> Result<()> {
6334            (*self.0.stub)
6335                .cancel_operation(self.0.request, self.0.options)
6336                .await
6337                .map(gax::response::Response::into_body)
6338        }
6339
6340        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
6341        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6342            self.0.request.name = v.into();
6343            self
6344        }
6345    }
6346
6347    #[doc(hidden)]
6348    impl gax::options::internal::RequestBuilder for CancelOperation {
6349        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6350            &mut self.0.options
6351        }
6352    }
6353}
6354
6355pub mod policy_based_routing_service {
6356    use crate::Result;
6357
6358    /// A builder for [PolicyBasedRoutingService][crate::client::PolicyBasedRoutingService].
6359    ///
6360    /// ```
6361    /// # tokio_test::block_on(async {
6362    /// # use google_cloud_networkconnectivity_v1::*;
6363    /// # use builder::policy_based_routing_service::ClientBuilder;
6364    /// # use client::PolicyBasedRoutingService;
6365    /// let builder : ClientBuilder = PolicyBasedRoutingService::builder();
6366    /// let client = builder
6367    ///     .with_endpoint("https://networkconnectivity.googleapis.com")
6368    ///     .build().await?;
6369    /// # gax::client_builder::Result::<()>::Ok(()) });
6370    /// ```
6371    pub type ClientBuilder =
6372        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6373
6374    pub(crate) mod client {
6375        use super::super::super::client::PolicyBasedRoutingService;
6376        pub struct Factory;
6377        impl gax::client_builder::internal::ClientFactory for Factory {
6378            type Client = PolicyBasedRoutingService;
6379            type Credentials = gaxi::options::Credentials;
6380            async fn build(
6381                self,
6382                config: gaxi::options::ClientConfig,
6383            ) -> gax::client_builder::Result<Self::Client> {
6384                Self::Client::new(config).await
6385            }
6386        }
6387    }
6388
6389    /// Common implementation for [crate::client::PolicyBasedRoutingService] request builders.
6390    #[derive(Clone, Debug)]
6391    pub(crate) struct RequestBuilder<R: std::default::Default> {
6392        stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6393        request: R,
6394        options: gax::options::RequestOptions,
6395    }
6396
6397    impl<R> RequestBuilder<R>
6398    where
6399        R: std::default::Default,
6400    {
6401        pub(crate) fn new(
6402            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6403        ) -> Self {
6404            Self {
6405                stub,
6406                request: R::default(),
6407                options: gax::options::RequestOptions::default(),
6408            }
6409        }
6410    }
6411
6412    /// The request builder for [PolicyBasedRoutingService::list_policy_based_routes][crate::client::PolicyBasedRoutingService::list_policy_based_routes] calls.
6413    ///
6414    /// # Example
6415    /// ```no_run
6416    /// # use google_cloud_networkconnectivity_v1::builder;
6417    /// use builder::policy_based_routing_service::ListPolicyBasedRoutes;
6418    /// # tokio_test::block_on(async {
6419    /// use gax::paginator::ItemPaginator;
6420    ///
6421    /// let builder = prepare_request_builder();
6422    /// let mut items = builder.by_item();
6423    /// while let Some(result) = items.next().await {
6424    ///   let item = result?;
6425    /// }
6426    /// # gax::Result::<()>::Ok(()) });
6427    ///
6428    /// fn prepare_request_builder() -> ListPolicyBasedRoutes {
6429    ///   # panic!();
6430    ///   // ... details omitted ...
6431    /// }
6432    /// ```
6433    #[derive(Clone, Debug)]
6434    pub struct ListPolicyBasedRoutes(RequestBuilder<crate::model::ListPolicyBasedRoutesRequest>);
6435
6436    impl ListPolicyBasedRoutes {
6437        pub(crate) fn new(
6438            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6439        ) -> Self {
6440            Self(RequestBuilder::new(stub))
6441        }
6442
6443        /// Sets the full request, replacing any prior values.
6444        pub fn with_request<V: Into<crate::model::ListPolicyBasedRoutesRequest>>(
6445            mut self,
6446            v: V,
6447        ) -> Self {
6448            self.0.request = v.into();
6449            self
6450        }
6451
6452        /// Sets all the options, replacing any prior values.
6453        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6454            self.0.options = v.into();
6455            self
6456        }
6457
6458        /// Sends the request.
6459        pub async fn send(self) -> Result<crate::model::ListPolicyBasedRoutesResponse> {
6460            (*self.0.stub)
6461                .list_policy_based_routes(self.0.request, self.0.options)
6462                .await
6463                .map(gax::response::Response::into_body)
6464        }
6465
6466        /// Streams each page in the collection.
6467        pub fn by_page(
6468            self,
6469        ) -> impl gax::paginator::Paginator<crate::model::ListPolicyBasedRoutesResponse, gax::error::Error>
6470        {
6471            use std::clone::Clone;
6472            let token = self.0.request.page_token.clone();
6473            let execute = move |token: String| {
6474                let mut builder = self.clone();
6475                builder.0.request = builder.0.request.set_page_token(token);
6476                builder.send()
6477            };
6478            gax::paginator::internal::new_paginator(token, execute)
6479        }
6480
6481        /// Streams each item in the collection.
6482        pub fn by_item(
6483            self,
6484        ) -> impl gax::paginator::ItemPaginator<
6485            crate::model::ListPolicyBasedRoutesResponse,
6486            gax::error::Error,
6487        > {
6488            use gax::paginator::Paginator;
6489            self.by_page().items()
6490        }
6491
6492        /// Sets the value of [parent][crate::model::ListPolicyBasedRoutesRequest::parent].
6493        ///
6494        /// This is a **required** field for requests.
6495        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6496            self.0.request.parent = v.into();
6497            self
6498        }
6499
6500        /// Sets the value of [page_size][crate::model::ListPolicyBasedRoutesRequest::page_size].
6501        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6502            self.0.request.page_size = v.into();
6503            self
6504        }
6505
6506        /// Sets the value of [page_token][crate::model::ListPolicyBasedRoutesRequest::page_token].
6507        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6508            self.0.request.page_token = v.into();
6509            self
6510        }
6511
6512        /// Sets the value of [filter][crate::model::ListPolicyBasedRoutesRequest::filter].
6513        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6514            self.0.request.filter = v.into();
6515            self
6516        }
6517
6518        /// Sets the value of [order_by][crate::model::ListPolicyBasedRoutesRequest::order_by].
6519        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
6520            self.0.request.order_by = v.into();
6521            self
6522        }
6523    }
6524
6525    #[doc(hidden)]
6526    impl gax::options::internal::RequestBuilder for ListPolicyBasedRoutes {
6527        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6528            &mut self.0.options
6529        }
6530    }
6531
6532    /// The request builder for [PolicyBasedRoutingService::get_policy_based_route][crate::client::PolicyBasedRoutingService::get_policy_based_route] calls.
6533    ///
6534    /// # Example
6535    /// ```no_run
6536    /// # use google_cloud_networkconnectivity_v1::builder;
6537    /// use builder::policy_based_routing_service::GetPolicyBasedRoute;
6538    /// # tokio_test::block_on(async {
6539    ///
6540    /// let builder = prepare_request_builder();
6541    /// let response = builder.send().await?;
6542    /// # gax::Result::<()>::Ok(()) });
6543    ///
6544    /// fn prepare_request_builder() -> GetPolicyBasedRoute {
6545    ///   # panic!();
6546    ///   // ... details omitted ...
6547    /// }
6548    /// ```
6549    #[derive(Clone, Debug)]
6550    pub struct GetPolicyBasedRoute(RequestBuilder<crate::model::GetPolicyBasedRouteRequest>);
6551
6552    impl GetPolicyBasedRoute {
6553        pub(crate) fn new(
6554            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6555        ) -> Self {
6556            Self(RequestBuilder::new(stub))
6557        }
6558
6559        /// Sets the full request, replacing any prior values.
6560        pub fn with_request<V: Into<crate::model::GetPolicyBasedRouteRequest>>(
6561            mut self,
6562            v: V,
6563        ) -> Self {
6564            self.0.request = v.into();
6565            self
6566        }
6567
6568        /// Sets all the options, replacing any prior values.
6569        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6570            self.0.options = v.into();
6571            self
6572        }
6573
6574        /// Sends the request.
6575        pub async fn send(self) -> Result<crate::model::PolicyBasedRoute> {
6576            (*self.0.stub)
6577                .get_policy_based_route(self.0.request, self.0.options)
6578                .await
6579                .map(gax::response::Response::into_body)
6580        }
6581
6582        /// Sets the value of [name][crate::model::GetPolicyBasedRouteRequest::name].
6583        ///
6584        /// This is a **required** field for requests.
6585        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6586            self.0.request.name = v.into();
6587            self
6588        }
6589    }
6590
6591    #[doc(hidden)]
6592    impl gax::options::internal::RequestBuilder for GetPolicyBasedRoute {
6593        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6594            &mut self.0.options
6595        }
6596    }
6597
6598    /// The request builder for [PolicyBasedRoutingService::create_policy_based_route][crate::client::PolicyBasedRoutingService::create_policy_based_route] calls.
6599    ///
6600    /// # Example
6601    /// ```no_run
6602    /// # use google_cloud_networkconnectivity_v1::builder;
6603    /// use builder::policy_based_routing_service::CreatePolicyBasedRoute;
6604    /// # tokio_test::block_on(async {
6605    /// use lro::Poller;
6606    ///
6607    /// let builder = prepare_request_builder();
6608    /// let response = builder.poller().until_done().await?;
6609    /// # gax::Result::<()>::Ok(()) });
6610    ///
6611    /// fn prepare_request_builder() -> CreatePolicyBasedRoute {
6612    ///   # panic!();
6613    ///   // ... details omitted ...
6614    /// }
6615    /// ```
6616    #[derive(Clone, Debug)]
6617    pub struct CreatePolicyBasedRoute(RequestBuilder<crate::model::CreatePolicyBasedRouteRequest>);
6618
6619    impl CreatePolicyBasedRoute {
6620        pub(crate) fn new(
6621            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6622        ) -> Self {
6623            Self(RequestBuilder::new(stub))
6624        }
6625
6626        /// Sets the full request, replacing any prior values.
6627        pub fn with_request<V: Into<crate::model::CreatePolicyBasedRouteRequest>>(
6628            mut self,
6629            v: V,
6630        ) -> Self {
6631            self.0.request = v.into();
6632            self
6633        }
6634
6635        /// Sets all the options, replacing any prior values.
6636        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6637            self.0.options = v.into();
6638            self
6639        }
6640
6641        /// Sends the request.
6642        ///
6643        /// # Long running operations
6644        ///
6645        /// This starts, but does not poll, a longrunning operation. More information
6646        /// on [create_policy_based_route][crate::client::PolicyBasedRoutingService::create_policy_based_route].
6647        pub async fn send(self) -> Result<longrunning::model::Operation> {
6648            (*self.0.stub)
6649                .create_policy_based_route(self.0.request, self.0.options)
6650                .await
6651                .map(gax::response::Response::into_body)
6652        }
6653
6654        /// Creates a [Poller][lro::Poller] to work with `create_policy_based_route`.
6655        pub fn poller(
6656            self,
6657        ) -> impl lro::Poller<crate::model::PolicyBasedRoute, crate::model::OperationMetadata>
6658        {
6659            type Operation = lro::internal::Operation<
6660                crate::model::PolicyBasedRoute,
6661                crate::model::OperationMetadata,
6662            >;
6663            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6664            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6665
6666            let stub = self.0.stub.clone();
6667            let mut options = self.0.options.clone();
6668            options.set_retry_policy(gax::retry_policy::NeverRetry);
6669            let query = move |name| {
6670                let stub = stub.clone();
6671                let options = options.clone();
6672                async {
6673                    let op = GetOperation::new(stub)
6674                        .set_name(name)
6675                        .with_options(options)
6676                        .send()
6677                        .await?;
6678                    Ok(Operation::new(op))
6679                }
6680            };
6681
6682            let start = move || async {
6683                let op = self.send().await?;
6684                Ok(Operation::new(op))
6685            };
6686
6687            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6688        }
6689
6690        /// Sets the value of [parent][crate::model::CreatePolicyBasedRouteRequest::parent].
6691        ///
6692        /// This is a **required** field for requests.
6693        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6694            self.0.request.parent = v.into();
6695            self
6696        }
6697
6698        /// Sets the value of [policy_based_route_id][crate::model::CreatePolicyBasedRouteRequest::policy_based_route_id].
6699        ///
6700        /// This is a **required** field for requests.
6701        pub fn set_policy_based_route_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6702            self.0.request.policy_based_route_id = v.into();
6703            self
6704        }
6705
6706        /// Sets the value of [policy_based_route][crate::model::CreatePolicyBasedRouteRequest::policy_based_route].
6707        ///
6708        /// This is a **required** field for requests.
6709        pub fn set_policy_based_route<T>(mut self, v: T) -> Self
6710        where
6711            T: std::convert::Into<crate::model::PolicyBasedRoute>,
6712        {
6713            self.0.request.policy_based_route = std::option::Option::Some(v.into());
6714            self
6715        }
6716
6717        /// Sets or clears the value of [policy_based_route][crate::model::CreatePolicyBasedRouteRequest::policy_based_route].
6718        ///
6719        /// This is a **required** field for requests.
6720        pub fn set_or_clear_policy_based_route<T>(mut self, v: std::option::Option<T>) -> Self
6721        where
6722            T: std::convert::Into<crate::model::PolicyBasedRoute>,
6723        {
6724            self.0.request.policy_based_route = v.map(|x| x.into());
6725            self
6726        }
6727
6728        /// Sets the value of [request_id][crate::model::CreatePolicyBasedRouteRequest::request_id].
6729        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6730            self.0.request.request_id = v.into();
6731            self
6732        }
6733    }
6734
6735    #[doc(hidden)]
6736    impl gax::options::internal::RequestBuilder for CreatePolicyBasedRoute {
6737        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6738            &mut self.0.options
6739        }
6740    }
6741
6742    /// The request builder for [PolicyBasedRoutingService::delete_policy_based_route][crate::client::PolicyBasedRoutingService::delete_policy_based_route] calls.
6743    ///
6744    /// # Example
6745    /// ```no_run
6746    /// # use google_cloud_networkconnectivity_v1::builder;
6747    /// use builder::policy_based_routing_service::DeletePolicyBasedRoute;
6748    /// # tokio_test::block_on(async {
6749    /// use lro::Poller;
6750    ///
6751    /// let builder = prepare_request_builder();
6752    /// let response = builder.poller().until_done().await?;
6753    /// # gax::Result::<()>::Ok(()) });
6754    ///
6755    /// fn prepare_request_builder() -> DeletePolicyBasedRoute {
6756    ///   # panic!();
6757    ///   // ... details omitted ...
6758    /// }
6759    /// ```
6760    #[derive(Clone, Debug)]
6761    pub struct DeletePolicyBasedRoute(RequestBuilder<crate::model::DeletePolicyBasedRouteRequest>);
6762
6763    impl DeletePolicyBasedRoute {
6764        pub(crate) fn new(
6765            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6766        ) -> Self {
6767            Self(RequestBuilder::new(stub))
6768        }
6769
6770        /// Sets the full request, replacing any prior values.
6771        pub fn with_request<V: Into<crate::model::DeletePolicyBasedRouteRequest>>(
6772            mut self,
6773            v: V,
6774        ) -> Self {
6775            self.0.request = v.into();
6776            self
6777        }
6778
6779        /// Sets all the options, replacing any prior values.
6780        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6781            self.0.options = v.into();
6782            self
6783        }
6784
6785        /// Sends the request.
6786        ///
6787        /// # Long running operations
6788        ///
6789        /// This starts, but does not poll, a longrunning operation. More information
6790        /// on [delete_policy_based_route][crate::client::PolicyBasedRoutingService::delete_policy_based_route].
6791        pub async fn send(self) -> Result<longrunning::model::Operation> {
6792            (*self.0.stub)
6793                .delete_policy_based_route(self.0.request, self.0.options)
6794                .await
6795                .map(gax::response::Response::into_body)
6796        }
6797
6798        /// Creates a [Poller][lro::Poller] to work with `delete_policy_based_route`.
6799        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
6800            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
6801            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6802            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6803
6804            let stub = self.0.stub.clone();
6805            let mut options = self.0.options.clone();
6806            options.set_retry_policy(gax::retry_policy::NeverRetry);
6807            let query = move |name| {
6808                let stub = stub.clone();
6809                let options = options.clone();
6810                async {
6811                    let op = GetOperation::new(stub)
6812                        .set_name(name)
6813                        .with_options(options)
6814                        .send()
6815                        .await?;
6816                    Ok(Operation::new(op))
6817                }
6818            };
6819
6820            let start = move || async {
6821                let op = self.send().await?;
6822                Ok(Operation::new(op))
6823            };
6824
6825            lro::internal::new_unit_response_poller(
6826                polling_error_policy,
6827                polling_backoff_policy,
6828                start,
6829                query,
6830            )
6831        }
6832
6833        /// Sets the value of [name][crate::model::DeletePolicyBasedRouteRequest::name].
6834        ///
6835        /// This is a **required** field for requests.
6836        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6837            self.0.request.name = v.into();
6838            self
6839        }
6840
6841        /// Sets the value of [request_id][crate::model::DeletePolicyBasedRouteRequest::request_id].
6842        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6843            self.0.request.request_id = v.into();
6844            self
6845        }
6846    }
6847
6848    #[doc(hidden)]
6849    impl gax::options::internal::RequestBuilder for DeletePolicyBasedRoute {
6850        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6851            &mut self.0.options
6852        }
6853    }
6854
6855    /// The request builder for [PolicyBasedRoutingService::list_locations][crate::client::PolicyBasedRoutingService::list_locations] calls.
6856    ///
6857    /// # Example
6858    /// ```no_run
6859    /// # use google_cloud_networkconnectivity_v1::builder;
6860    /// use builder::policy_based_routing_service::ListLocations;
6861    /// # tokio_test::block_on(async {
6862    /// use gax::paginator::ItemPaginator;
6863    ///
6864    /// let builder = prepare_request_builder();
6865    /// let mut items = builder.by_item();
6866    /// while let Some(result) = items.next().await {
6867    ///   let item = result?;
6868    /// }
6869    /// # gax::Result::<()>::Ok(()) });
6870    ///
6871    /// fn prepare_request_builder() -> ListLocations {
6872    ///   # panic!();
6873    ///   // ... details omitted ...
6874    /// }
6875    /// ```
6876    #[derive(Clone, Debug)]
6877    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
6878
6879    impl ListLocations {
6880        pub(crate) fn new(
6881            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6882        ) -> Self {
6883            Self(RequestBuilder::new(stub))
6884        }
6885
6886        /// Sets the full request, replacing any prior values.
6887        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
6888            mut self,
6889            v: V,
6890        ) -> Self {
6891            self.0.request = v.into();
6892            self
6893        }
6894
6895        /// Sets all the options, replacing any prior values.
6896        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6897            self.0.options = v.into();
6898            self
6899        }
6900
6901        /// Sends the request.
6902        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
6903            (*self.0.stub)
6904                .list_locations(self.0.request, self.0.options)
6905                .await
6906                .map(gax::response::Response::into_body)
6907        }
6908
6909        /// Streams each page in the collection.
6910        pub fn by_page(
6911            self,
6912        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
6913        {
6914            use std::clone::Clone;
6915            let token = self.0.request.page_token.clone();
6916            let execute = move |token: String| {
6917                let mut builder = self.clone();
6918                builder.0.request = builder.0.request.set_page_token(token);
6919                builder.send()
6920            };
6921            gax::paginator::internal::new_paginator(token, execute)
6922        }
6923
6924        /// Streams each item in the collection.
6925        pub fn by_item(
6926            self,
6927        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
6928        {
6929            use gax::paginator::Paginator;
6930            self.by_page().items()
6931        }
6932
6933        /// Sets the value of [name][location::model::ListLocationsRequest::name].
6934        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6935            self.0.request.name = v.into();
6936            self
6937        }
6938
6939        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
6940        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6941            self.0.request.filter = v.into();
6942            self
6943        }
6944
6945        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
6946        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6947            self.0.request.page_size = v.into();
6948            self
6949        }
6950
6951        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
6952        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6953            self.0.request.page_token = v.into();
6954            self
6955        }
6956    }
6957
6958    #[doc(hidden)]
6959    impl gax::options::internal::RequestBuilder for ListLocations {
6960        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6961            &mut self.0.options
6962        }
6963    }
6964
6965    /// The request builder for [PolicyBasedRoutingService::get_location][crate::client::PolicyBasedRoutingService::get_location] calls.
6966    ///
6967    /// # Example
6968    /// ```no_run
6969    /// # use google_cloud_networkconnectivity_v1::builder;
6970    /// use builder::policy_based_routing_service::GetLocation;
6971    /// # tokio_test::block_on(async {
6972    ///
6973    /// let builder = prepare_request_builder();
6974    /// let response = builder.send().await?;
6975    /// # gax::Result::<()>::Ok(()) });
6976    ///
6977    /// fn prepare_request_builder() -> GetLocation {
6978    ///   # panic!();
6979    ///   // ... details omitted ...
6980    /// }
6981    /// ```
6982    #[derive(Clone, Debug)]
6983    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
6984
6985    impl GetLocation {
6986        pub(crate) fn new(
6987            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
6988        ) -> Self {
6989            Self(RequestBuilder::new(stub))
6990        }
6991
6992        /// Sets the full request, replacing any prior values.
6993        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
6994            self.0.request = v.into();
6995            self
6996        }
6997
6998        /// Sets all the options, replacing any prior values.
6999        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7000            self.0.options = v.into();
7001            self
7002        }
7003
7004        /// Sends the request.
7005        pub async fn send(self) -> Result<location::model::Location> {
7006            (*self.0.stub)
7007                .get_location(self.0.request, self.0.options)
7008                .await
7009                .map(gax::response::Response::into_body)
7010        }
7011
7012        /// Sets the value of [name][location::model::GetLocationRequest::name].
7013        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7014            self.0.request.name = v.into();
7015            self
7016        }
7017    }
7018
7019    #[doc(hidden)]
7020    impl gax::options::internal::RequestBuilder for GetLocation {
7021        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7022            &mut self.0.options
7023        }
7024    }
7025
7026    /// The request builder for [PolicyBasedRoutingService::set_iam_policy][crate::client::PolicyBasedRoutingService::set_iam_policy] calls.
7027    ///
7028    /// # Example
7029    /// ```no_run
7030    /// # use google_cloud_networkconnectivity_v1::builder;
7031    /// use builder::policy_based_routing_service::SetIamPolicy;
7032    /// # tokio_test::block_on(async {
7033    ///
7034    /// let builder = prepare_request_builder();
7035    /// let response = builder.send().await?;
7036    /// # gax::Result::<()>::Ok(()) });
7037    ///
7038    /// fn prepare_request_builder() -> SetIamPolicy {
7039    ///   # panic!();
7040    ///   // ... details omitted ...
7041    /// }
7042    /// ```
7043    #[derive(Clone, Debug)]
7044    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
7045
7046    impl SetIamPolicy {
7047        pub(crate) fn new(
7048            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
7049        ) -> Self {
7050            Self(RequestBuilder::new(stub))
7051        }
7052
7053        /// Sets the full request, replacing any prior values.
7054        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
7055            self.0.request = v.into();
7056            self
7057        }
7058
7059        /// Sets all the options, replacing any prior values.
7060        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7061            self.0.options = v.into();
7062            self
7063        }
7064
7065        /// Sends the request.
7066        pub async fn send(self) -> Result<iam_v1::model::Policy> {
7067            (*self.0.stub)
7068                .set_iam_policy(self.0.request, self.0.options)
7069                .await
7070                .map(gax::response::Response::into_body)
7071        }
7072
7073        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
7074        ///
7075        /// This is a **required** field for requests.
7076        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7077            self.0.request.resource = v.into();
7078            self
7079        }
7080
7081        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
7082        ///
7083        /// This is a **required** field for requests.
7084        pub fn set_policy<T>(mut self, v: T) -> Self
7085        where
7086            T: std::convert::Into<iam_v1::model::Policy>,
7087        {
7088            self.0.request.policy = std::option::Option::Some(v.into());
7089            self
7090        }
7091
7092        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
7093        ///
7094        /// This is a **required** field for requests.
7095        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
7096        where
7097            T: std::convert::Into<iam_v1::model::Policy>,
7098        {
7099            self.0.request.policy = v.map(|x| x.into());
7100            self
7101        }
7102
7103        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
7104        pub fn set_update_mask<T>(mut self, v: T) -> Self
7105        where
7106            T: std::convert::Into<wkt::FieldMask>,
7107        {
7108            self.0.request.update_mask = std::option::Option::Some(v.into());
7109            self
7110        }
7111
7112        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
7113        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7114        where
7115            T: std::convert::Into<wkt::FieldMask>,
7116        {
7117            self.0.request.update_mask = v.map(|x| x.into());
7118            self
7119        }
7120    }
7121
7122    #[doc(hidden)]
7123    impl gax::options::internal::RequestBuilder for SetIamPolicy {
7124        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7125            &mut self.0.options
7126        }
7127    }
7128
7129    /// The request builder for [PolicyBasedRoutingService::get_iam_policy][crate::client::PolicyBasedRoutingService::get_iam_policy] calls.
7130    ///
7131    /// # Example
7132    /// ```no_run
7133    /// # use google_cloud_networkconnectivity_v1::builder;
7134    /// use builder::policy_based_routing_service::GetIamPolicy;
7135    /// # tokio_test::block_on(async {
7136    ///
7137    /// let builder = prepare_request_builder();
7138    /// let response = builder.send().await?;
7139    /// # gax::Result::<()>::Ok(()) });
7140    ///
7141    /// fn prepare_request_builder() -> GetIamPolicy {
7142    ///   # panic!();
7143    ///   // ... details omitted ...
7144    /// }
7145    /// ```
7146    #[derive(Clone, Debug)]
7147    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
7148
7149    impl GetIamPolicy {
7150        pub(crate) fn new(
7151            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
7152        ) -> Self {
7153            Self(RequestBuilder::new(stub))
7154        }
7155
7156        /// Sets the full request, replacing any prior values.
7157        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
7158            self.0.request = v.into();
7159            self
7160        }
7161
7162        /// Sets all the options, replacing any prior values.
7163        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7164            self.0.options = v.into();
7165            self
7166        }
7167
7168        /// Sends the request.
7169        pub async fn send(self) -> Result<iam_v1::model::Policy> {
7170            (*self.0.stub)
7171                .get_iam_policy(self.0.request, self.0.options)
7172                .await
7173                .map(gax::response::Response::into_body)
7174        }
7175
7176        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
7177        ///
7178        /// This is a **required** field for requests.
7179        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7180            self.0.request.resource = v.into();
7181            self
7182        }
7183
7184        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
7185        pub fn set_options<T>(mut self, v: T) -> Self
7186        where
7187            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7188        {
7189            self.0.request.options = std::option::Option::Some(v.into());
7190            self
7191        }
7192
7193        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
7194        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
7195        where
7196            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
7197        {
7198            self.0.request.options = v.map(|x| x.into());
7199            self
7200        }
7201    }
7202
7203    #[doc(hidden)]
7204    impl gax::options::internal::RequestBuilder for GetIamPolicy {
7205        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7206            &mut self.0.options
7207        }
7208    }
7209
7210    /// The request builder for [PolicyBasedRoutingService::test_iam_permissions][crate::client::PolicyBasedRoutingService::test_iam_permissions] calls.
7211    ///
7212    /// # Example
7213    /// ```no_run
7214    /// # use google_cloud_networkconnectivity_v1::builder;
7215    /// use builder::policy_based_routing_service::TestIamPermissions;
7216    /// # tokio_test::block_on(async {
7217    ///
7218    /// let builder = prepare_request_builder();
7219    /// let response = builder.send().await?;
7220    /// # gax::Result::<()>::Ok(()) });
7221    ///
7222    /// fn prepare_request_builder() -> TestIamPermissions {
7223    ///   # panic!();
7224    ///   // ... details omitted ...
7225    /// }
7226    /// ```
7227    #[derive(Clone, Debug)]
7228    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
7229
7230    impl TestIamPermissions {
7231        pub(crate) fn new(
7232            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
7233        ) -> Self {
7234            Self(RequestBuilder::new(stub))
7235        }
7236
7237        /// Sets the full request, replacing any prior values.
7238        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
7239            mut self,
7240            v: V,
7241        ) -> Self {
7242            self.0.request = v.into();
7243            self
7244        }
7245
7246        /// Sets all the options, replacing any prior values.
7247        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7248            self.0.options = v.into();
7249            self
7250        }
7251
7252        /// Sends the request.
7253        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
7254            (*self.0.stub)
7255                .test_iam_permissions(self.0.request, self.0.options)
7256                .await
7257                .map(gax::response::Response::into_body)
7258        }
7259
7260        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
7261        ///
7262        /// This is a **required** field for requests.
7263        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
7264            self.0.request.resource = v.into();
7265            self
7266        }
7267
7268        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
7269        ///
7270        /// This is a **required** field for requests.
7271        pub fn set_permissions<T, V>(mut self, v: T) -> Self
7272        where
7273            T: std::iter::IntoIterator<Item = V>,
7274            V: std::convert::Into<std::string::String>,
7275        {
7276            use std::iter::Iterator;
7277            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
7278            self
7279        }
7280    }
7281
7282    #[doc(hidden)]
7283    impl gax::options::internal::RequestBuilder for TestIamPermissions {
7284        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7285            &mut self.0.options
7286        }
7287    }
7288
7289    /// The request builder for [PolicyBasedRoutingService::list_operations][crate::client::PolicyBasedRoutingService::list_operations] calls.
7290    ///
7291    /// # Example
7292    /// ```no_run
7293    /// # use google_cloud_networkconnectivity_v1::builder;
7294    /// use builder::policy_based_routing_service::ListOperations;
7295    /// # tokio_test::block_on(async {
7296    /// use gax::paginator::ItemPaginator;
7297    ///
7298    /// let builder = prepare_request_builder();
7299    /// let mut items = builder.by_item();
7300    /// while let Some(result) = items.next().await {
7301    ///   let item = result?;
7302    /// }
7303    /// # gax::Result::<()>::Ok(()) });
7304    ///
7305    /// fn prepare_request_builder() -> ListOperations {
7306    ///   # panic!();
7307    ///   // ... details omitted ...
7308    /// }
7309    /// ```
7310    #[derive(Clone, Debug)]
7311    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7312
7313    impl ListOperations {
7314        pub(crate) fn new(
7315            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
7316        ) -> Self {
7317            Self(RequestBuilder::new(stub))
7318        }
7319
7320        /// Sets the full request, replacing any prior values.
7321        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7322            mut self,
7323            v: V,
7324        ) -> Self {
7325            self.0.request = v.into();
7326            self
7327        }
7328
7329        /// Sets all the options, replacing any prior values.
7330        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7331            self.0.options = v.into();
7332            self
7333        }
7334
7335        /// Sends the request.
7336        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7337            (*self.0.stub)
7338                .list_operations(self.0.request, self.0.options)
7339                .await
7340                .map(gax::response::Response::into_body)
7341        }
7342
7343        /// Streams each page in the collection.
7344        pub fn by_page(
7345            self,
7346        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7347        {
7348            use std::clone::Clone;
7349            let token = self.0.request.page_token.clone();
7350            let execute = move |token: String| {
7351                let mut builder = self.clone();
7352                builder.0.request = builder.0.request.set_page_token(token);
7353                builder.send()
7354            };
7355            gax::paginator::internal::new_paginator(token, execute)
7356        }
7357
7358        /// Streams each item in the collection.
7359        pub fn by_item(
7360            self,
7361        ) -> impl gax::paginator::ItemPaginator<
7362            longrunning::model::ListOperationsResponse,
7363            gax::error::Error,
7364        > {
7365            use gax::paginator::Paginator;
7366            self.by_page().items()
7367        }
7368
7369        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
7370        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7371            self.0.request.name = v.into();
7372            self
7373        }
7374
7375        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
7376        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7377            self.0.request.filter = v.into();
7378            self
7379        }
7380
7381        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
7382        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7383            self.0.request.page_size = v.into();
7384            self
7385        }
7386
7387        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
7388        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7389            self.0.request.page_token = v.into();
7390            self
7391        }
7392    }
7393
7394    #[doc(hidden)]
7395    impl gax::options::internal::RequestBuilder for ListOperations {
7396        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7397            &mut self.0.options
7398        }
7399    }
7400
7401    /// The request builder for [PolicyBasedRoutingService::get_operation][crate::client::PolicyBasedRoutingService::get_operation] calls.
7402    ///
7403    /// # Example
7404    /// ```no_run
7405    /// # use google_cloud_networkconnectivity_v1::builder;
7406    /// use builder::policy_based_routing_service::GetOperation;
7407    /// # tokio_test::block_on(async {
7408    ///
7409    /// let builder = prepare_request_builder();
7410    /// let response = builder.send().await?;
7411    /// # gax::Result::<()>::Ok(()) });
7412    ///
7413    /// fn prepare_request_builder() -> GetOperation {
7414    ///   # panic!();
7415    ///   // ... details omitted ...
7416    /// }
7417    /// ```
7418    #[derive(Clone, Debug)]
7419    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7420
7421    impl GetOperation {
7422        pub(crate) fn new(
7423            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
7424        ) -> Self {
7425            Self(RequestBuilder::new(stub))
7426        }
7427
7428        /// Sets the full request, replacing any prior values.
7429        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7430            mut self,
7431            v: V,
7432        ) -> Self {
7433            self.0.request = v.into();
7434            self
7435        }
7436
7437        /// Sets all the options, replacing any prior values.
7438        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7439            self.0.options = v.into();
7440            self
7441        }
7442
7443        /// Sends the request.
7444        pub async fn send(self) -> Result<longrunning::model::Operation> {
7445            (*self.0.stub)
7446                .get_operation(self.0.request, self.0.options)
7447                .await
7448                .map(gax::response::Response::into_body)
7449        }
7450
7451        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
7452        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7453            self.0.request.name = v.into();
7454            self
7455        }
7456    }
7457
7458    #[doc(hidden)]
7459    impl gax::options::internal::RequestBuilder for GetOperation {
7460        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7461            &mut self.0.options
7462        }
7463    }
7464
7465    /// The request builder for [PolicyBasedRoutingService::delete_operation][crate::client::PolicyBasedRoutingService::delete_operation] calls.
7466    ///
7467    /// # Example
7468    /// ```no_run
7469    /// # use google_cloud_networkconnectivity_v1::builder;
7470    /// use builder::policy_based_routing_service::DeleteOperation;
7471    /// # tokio_test::block_on(async {
7472    ///
7473    /// let builder = prepare_request_builder();
7474    /// let response = builder.send().await?;
7475    /// # gax::Result::<()>::Ok(()) });
7476    ///
7477    /// fn prepare_request_builder() -> DeleteOperation {
7478    ///   # panic!();
7479    ///   // ... details omitted ...
7480    /// }
7481    /// ```
7482    #[derive(Clone, Debug)]
7483    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
7484
7485    impl DeleteOperation {
7486        pub(crate) fn new(
7487            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
7488        ) -> Self {
7489            Self(RequestBuilder::new(stub))
7490        }
7491
7492        /// Sets the full request, replacing any prior values.
7493        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
7494            mut self,
7495            v: V,
7496        ) -> Self {
7497            self.0.request = v.into();
7498            self
7499        }
7500
7501        /// Sets all the options, replacing any prior values.
7502        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7503            self.0.options = v.into();
7504            self
7505        }
7506
7507        /// Sends the request.
7508        pub async fn send(self) -> Result<()> {
7509            (*self.0.stub)
7510                .delete_operation(self.0.request, self.0.options)
7511                .await
7512                .map(gax::response::Response::into_body)
7513        }
7514
7515        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
7516        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7517            self.0.request.name = v.into();
7518            self
7519        }
7520    }
7521
7522    #[doc(hidden)]
7523    impl gax::options::internal::RequestBuilder for DeleteOperation {
7524        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7525            &mut self.0.options
7526        }
7527    }
7528
7529    /// The request builder for [PolicyBasedRoutingService::cancel_operation][crate::client::PolicyBasedRoutingService::cancel_operation] calls.
7530    ///
7531    /// # Example
7532    /// ```no_run
7533    /// # use google_cloud_networkconnectivity_v1::builder;
7534    /// use builder::policy_based_routing_service::CancelOperation;
7535    /// # tokio_test::block_on(async {
7536    ///
7537    /// let builder = prepare_request_builder();
7538    /// let response = builder.send().await?;
7539    /// # gax::Result::<()>::Ok(()) });
7540    ///
7541    /// fn prepare_request_builder() -> CancelOperation {
7542    ///   # panic!();
7543    ///   // ... details omitted ...
7544    /// }
7545    /// ```
7546    #[derive(Clone, Debug)]
7547    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7548
7549    impl CancelOperation {
7550        pub(crate) fn new(
7551            stub: std::sync::Arc<dyn super::super::stub::dynamic::PolicyBasedRoutingService>,
7552        ) -> Self {
7553            Self(RequestBuilder::new(stub))
7554        }
7555
7556        /// Sets the full request, replacing any prior values.
7557        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7558            mut self,
7559            v: V,
7560        ) -> Self {
7561            self.0.request = v.into();
7562            self
7563        }
7564
7565        /// Sets all the options, replacing any prior values.
7566        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7567            self.0.options = v.into();
7568            self
7569        }
7570
7571        /// Sends the request.
7572        pub async fn send(self) -> Result<()> {
7573            (*self.0.stub)
7574                .cancel_operation(self.0.request, self.0.options)
7575                .await
7576                .map(gax::response::Response::into_body)
7577        }
7578
7579        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
7580        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7581            self.0.request.name = v.into();
7582            self
7583        }
7584    }
7585
7586    #[doc(hidden)]
7587    impl gax::options::internal::RequestBuilder for CancelOperation {
7588        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7589            &mut self.0.options
7590        }
7591    }
7592}