google_cloud_datastream_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 datastream {
18    use crate::Result;
19
20    /// A builder for [Datastream][crate::client::Datastream].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_datastream_v1::*;
25    /// # use builder::datastream::ClientBuilder;
26    /// # use client::Datastream;
27    /// let builder : ClientBuilder = Datastream::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://datastream.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::Datastream;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = Datastream;
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::Datastream] 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::Datastream>,
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::Datastream>,
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 [Datastream::list_connection_profiles][crate::client::Datastream::list_connection_profiles] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_datastream_v1::builder;
79    /// use builder::datastream::ListConnectionProfiles;
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() -> ListConnectionProfiles {
91    ///   # panic!();
92    ///   // ... details omitted ...
93    /// }
94    /// ```
95    #[derive(Clone, Debug)]
96    pub struct ListConnectionProfiles(RequestBuilder<crate::model::ListConnectionProfilesRequest>);
97
98    impl ListConnectionProfiles {
99        pub(crate) fn new(
100            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
101        ) -> Self {
102            Self(RequestBuilder::new(stub))
103        }
104
105        /// Sets the full request, replacing any prior values.
106        pub fn with_request<V: Into<crate::model::ListConnectionProfilesRequest>>(
107            mut self,
108            v: V,
109        ) -> Self {
110            self.0.request = v.into();
111            self
112        }
113
114        /// Sets all the options, replacing any prior values.
115        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
116            self.0.options = v.into();
117            self
118        }
119
120        /// Sends the request.
121        pub async fn send(self) -> Result<crate::model::ListConnectionProfilesResponse> {
122            (*self.0.stub)
123                .list_connection_profiles(self.0.request, self.0.options)
124                .await
125                .map(gax::response::Response::into_body)
126        }
127
128        /// Streams each page in the collection.
129        pub fn by_page(
130            self,
131        ) -> impl gax::paginator::Paginator<
132            crate::model::ListConnectionProfilesResponse,
133            gax::error::Error,
134        > {
135            use std::clone::Clone;
136            let token = self.0.request.page_token.clone();
137            let execute = move |token: String| {
138                let mut builder = self.clone();
139                builder.0.request = builder.0.request.set_page_token(token);
140                builder.send()
141            };
142            gax::paginator::internal::new_paginator(token, execute)
143        }
144
145        /// Streams each item in the collection.
146        pub fn by_item(
147            self,
148        ) -> impl gax::paginator::ItemPaginator<
149            crate::model::ListConnectionProfilesResponse,
150            gax::error::Error,
151        > {
152            use gax::paginator::Paginator;
153            self.by_page().items()
154        }
155
156        /// Sets the value of [parent][crate::model::ListConnectionProfilesRequest::parent].
157        ///
158        /// This is a **required** field for requests.
159        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
160            self.0.request.parent = v.into();
161            self
162        }
163
164        /// Sets the value of [page_size][crate::model::ListConnectionProfilesRequest::page_size].
165        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
166            self.0.request.page_size = v.into();
167            self
168        }
169
170        /// Sets the value of [page_token][crate::model::ListConnectionProfilesRequest::page_token].
171        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
172            self.0.request.page_token = v.into();
173            self
174        }
175
176        /// Sets the value of [filter][crate::model::ListConnectionProfilesRequest::filter].
177        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
178            self.0.request.filter = v.into();
179            self
180        }
181
182        /// Sets the value of [order_by][crate::model::ListConnectionProfilesRequest::order_by].
183        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
184            self.0.request.order_by = v.into();
185            self
186        }
187    }
188
189    #[doc(hidden)]
190    impl gax::options::internal::RequestBuilder for ListConnectionProfiles {
191        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
192            &mut self.0.options
193        }
194    }
195
196    /// The request builder for [Datastream::get_connection_profile][crate::client::Datastream::get_connection_profile] calls.
197    ///
198    /// # Example
199    /// ```no_run
200    /// # use google_cloud_datastream_v1::builder;
201    /// use builder::datastream::GetConnectionProfile;
202    /// # tokio_test::block_on(async {
203    ///
204    /// let builder = prepare_request_builder();
205    /// let response = builder.send().await?;
206    /// # gax::Result::<()>::Ok(()) });
207    ///
208    /// fn prepare_request_builder() -> GetConnectionProfile {
209    ///   # panic!();
210    ///   // ... details omitted ...
211    /// }
212    /// ```
213    #[derive(Clone, Debug)]
214    pub struct GetConnectionProfile(RequestBuilder<crate::model::GetConnectionProfileRequest>);
215
216    impl GetConnectionProfile {
217        pub(crate) fn new(
218            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
219        ) -> Self {
220            Self(RequestBuilder::new(stub))
221        }
222
223        /// Sets the full request, replacing any prior values.
224        pub fn with_request<V: Into<crate::model::GetConnectionProfileRequest>>(
225            mut self,
226            v: V,
227        ) -> Self {
228            self.0.request = v.into();
229            self
230        }
231
232        /// Sets all the options, replacing any prior values.
233        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
234            self.0.options = v.into();
235            self
236        }
237
238        /// Sends the request.
239        pub async fn send(self) -> Result<crate::model::ConnectionProfile> {
240            (*self.0.stub)
241                .get_connection_profile(self.0.request, self.0.options)
242                .await
243                .map(gax::response::Response::into_body)
244        }
245
246        /// Sets the value of [name][crate::model::GetConnectionProfileRequest::name].
247        ///
248        /// This is a **required** field for requests.
249        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
250            self.0.request.name = v.into();
251            self
252        }
253    }
254
255    #[doc(hidden)]
256    impl gax::options::internal::RequestBuilder for GetConnectionProfile {
257        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
258            &mut self.0.options
259        }
260    }
261
262    /// The request builder for [Datastream::create_connection_profile][crate::client::Datastream::create_connection_profile] calls.
263    ///
264    /// # Example
265    /// ```no_run
266    /// # use google_cloud_datastream_v1::builder;
267    /// use builder::datastream::CreateConnectionProfile;
268    /// # tokio_test::block_on(async {
269    /// use lro::Poller;
270    ///
271    /// let builder = prepare_request_builder();
272    /// let response = builder.poller().until_done().await?;
273    /// # gax::Result::<()>::Ok(()) });
274    ///
275    /// fn prepare_request_builder() -> CreateConnectionProfile {
276    ///   # panic!();
277    ///   // ... details omitted ...
278    /// }
279    /// ```
280    #[derive(Clone, Debug)]
281    pub struct CreateConnectionProfile(
282        RequestBuilder<crate::model::CreateConnectionProfileRequest>,
283    );
284
285    impl CreateConnectionProfile {
286        pub(crate) fn new(
287            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
288        ) -> Self {
289            Self(RequestBuilder::new(stub))
290        }
291
292        /// Sets the full request, replacing any prior values.
293        pub fn with_request<V: Into<crate::model::CreateConnectionProfileRequest>>(
294            mut self,
295            v: V,
296        ) -> Self {
297            self.0.request = v.into();
298            self
299        }
300
301        /// Sets all the options, replacing any prior values.
302        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
303            self.0.options = v.into();
304            self
305        }
306
307        /// Sends the request.
308        ///
309        /// # Long running operations
310        ///
311        /// This starts, but does not poll, a longrunning operation. More information
312        /// on [create_connection_profile][crate::client::Datastream::create_connection_profile].
313        pub async fn send(self) -> Result<longrunning::model::Operation> {
314            (*self.0.stub)
315                .create_connection_profile(self.0.request, self.0.options)
316                .await
317                .map(gax::response::Response::into_body)
318        }
319
320        /// Creates a [Poller][lro::Poller] to work with `create_connection_profile`.
321        pub fn poller(
322            self,
323        ) -> impl lro::Poller<crate::model::ConnectionProfile, crate::model::OperationMetadata>
324        {
325            type Operation = lro::internal::Operation<
326                crate::model::ConnectionProfile,
327                crate::model::OperationMetadata,
328            >;
329            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
330            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
331
332            let stub = self.0.stub.clone();
333            let mut options = self.0.options.clone();
334            options.set_retry_policy(gax::retry_policy::NeverRetry);
335            let query = move |name| {
336                let stub = stub.clone();
337                let options = options.clone();
338                async {
339                    let op = GetOperation::new(stub)
340                        .set_name(name)
341                        .with_options(options)
342                        .send()
343                        .await?;
344                    Ok(Operation::new(op))
345                }
346            };
347
348            let start = move || async {
349                let op = self.send().await?;
350                Ok(Operation::new(op))
351            };
352
353            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
354        }
355
356        /// Sets the value of [parent][crate::model::CreateConnectionProfileRequest::parent].
357        ///
358        /// This is a **required** field for requests.
359        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
360            self.0.request.parent = v.into();
361            self
362        }
363
364        /// Sets the value of [connection_profile_id][crate::model::CreateConnectionProfileRequest::connection_profile_id].
365        ///
366        /// This is a **required** field for requests.
367        pub fn set_connection_profile_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
368            self.0.request.connection_profile_id = v.into();
369            self
370        }
371
372        /// Sets the value of [connection_profile][crate::model::CreateConnectionProfileRequest::connection_profile].
373        ///
374        /// This is a **required** field for requests.
375        pub fn set_connection_profile<T>(mut self, v: T) -> Self
376        where
377            T: std::convert::Into<crate::model::ConnectionProfile>,
378        {
379            self.0.request.connection_profile = std::option::Option::Some(v.into());
380            self
381        }
382
383        /// Sets or clears the value of [connection_profile][crate::model::CreateConnectionProfileRequest::connection_profile].
384        ///
385        /// This is a **required** field for requests.
386        pub fn set_or_clear_connection_profile<T>(mut self, v: std::option::Option<T>) -> Self
387        where
388            T: std::convert::Into<crate::model::ConnectionProfile>,
389        {
390            self.0.request.connection_profile = v.map(|x| x.into());
391            self
392        }
393
394        /// Sets the value of [request_id][crate::model::CreateConnectionProfileRequest::request_id].
395        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
396            self.0.request.request_id = v.into();
397            self
398        }
399
400        /// Sets the value of [validate_only][crate::model::CreateConnectionProfileRequest::validate_only].
401        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
402            self.0.request.validate_only = v.into();
403            self
404        }
405
406        /// Sets the value of [force][crate::model::CreateConnectionProfileRequest::force].
407        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
408            self.0.request.force = v.into();
409            self
410        }
411    }
412
413    #[doc(hidden)]
414    impl gax::options::internal::RequestBuilder for CreateConnectionProfile {
415        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
416            &mut self.0.options
417        }
418    }
419
420    /// The request builder for [Datastream::update_connection_profile][crate::client::Datastream::update_connection_profile] calls.
421    ///
422    /// # Example
423    /// ```no_run
424    /// # use google_cloud_datastream_v1::builder;
425    /// use builder::datastream::UpdateConnectionProfile;
426    /// # tokio_test::block_on(async {
427    /// use lro::Poller;
428    ///
429    /// let builder = prepare_request_builder();
430    /// let response = builder.poller().until_done().await?;
431    /// # gax::Result::<()>::Ok(()) });
432    ///
433    /// fn prepare_request_builder() -> UpdateConnectionProfile {
434    ///   # panic!();
435    ///   // ... details omitted ...
436    /// }
437    /// ```
438    #[derive(Clone, Debug)]
439    pub struct UpdateConnectionProfile(
440        RequestBuilder<crate::model::UpdateConnectionProfileRequest>,
441    );
442
443    impl UpdateConnectionProfile {
444        pub(crate) fn new(
445            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
446        ) -> Self {
447            Self(RequestBuilder::new(stub))
448        }
449
450        /// Sets the full request, replacing any prior values.
451        pub fn with_request<V: Into<crate::model::UpdateConnectionProfileRequest>>(
452            mut self,
453            v: V,
454        ) -> Self {
455            self.0.request = v.into();
456            self
457        }
458
459        /// Sets all the options, replacing any prior values.
460        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
461            self.0.options = v.into();
462            self
463        }
464
465        /// Sends the request.
466        ///
467        /// # Long running operations
468        ///
469        /// This starts, but does not poll, a longrunning operation. More information
470        /// on [update_connection_profile][crate::client::Datastream::update_connection_profile].
471        pub async fn send(self) -> Result<longrunning::model::Operation> {
472            (*self.0.stub)
473                .update_connection_profile(self.0.request, self.0.options)
474                .await
475                .map(gax::response::Response::into_body)
476        }
477
478        /// Creates a [Poller][lro::Poller] to work with `update_connection_profile`.
479        pub fn poller(
480            self,
481        ) -> impl lro::Poller<crate::model::ConnectionProfile, crate::model::OperationMetadata>
482        {
483            type Operation = lro::internal::Operation<
484                crate::model::ConnectionProfile,
485                crate::model::OperationMetadata,
486            >;
487            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
488            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
489
490            let stub = self.0.stub.clone();
491            let mut options = self.0.options.clone();
492            options.set_retry_policy(gax::retry_policy::NeverRetry);
493            let query = move |name| {
494                let stub = stub.clone();
495                let options = options.clone();
496                async {
497                    let op = GetOperation::new(stub)
498                        .set_name(name)
499                        .with_options(options)
500                        .send()
501                        .await?;
502                    Ok(Operation::new(op))
503                }
504            };
505
506            let start = move || async {
507                let op = self.send().await?;
508                Ok(Operation::new(op))
509            };
510
511            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
512        }
513
514        /// Sets the value of [update_mask][crate::model::UpdateConnectionProfileRequest::update_mask].
515        pub fn set_update_mask<T>(mut self, v: T) -> Self
516        where
517            T: std::convert::Into<wkt::FieldMask>,
518        {
519            self.0.request.update_mask = std::option::Option::Some(v.into());
520            self
521        }
522
523        /// Sets or clears the value of [update_mask][crate::model::UpdateConnectionProfileRequest::update_mask].
524        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
525        where
526            T: std::convert::Into<wkt::FieldMask>,
527        {
528            self.0.request.update_mask = v.map(|x| x.into());
529            self
530        }
531
532        /// Sets the value of [connection_profile][crate::model::UpdateConnectionProfileRequest::connection_profile].
533        ///
534        /// This is a **required** field for requests.
535        pub fn set_connection_profile<T>(mut self, v: T) -> Self
536        where
537            T: std::convert::Into<crate::model::ConnectionProfile>,
538        {
539            self.0.request.connection_profile = std::option::Option::Some(v.into());
540            self
541        }
542
543        /// Sets or clears the value of [connection_profile][crate::model::UpdateConnectionProfileRequest::connection_profile].
544        ///
545        /// This is a **required** field for requests.
546        pub fn set_or_clear_connection_profile<T>(mut self, v: std::option::Option<T>) -> Self
547        where
548            T: std::convert::Into<crate::model::ConnectionProfile>,
549        {
550            self.0.request.connection_profile = v.map(|x| x.into());
551            self
552        }
553
554        /// Sets the value of [request_id][crate::model::UpdateConnectionProfileRequest::request_id].
555        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
556            self.0.request.request_id = v.into();
557            self
558        }
559
560        /// Sets the value of [validate_only][crate::model::UpdateConnectionProfileRequest::validate_only].
561        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
562            self.0.request.validate_only = v.into();
563            self
564        }
565
566        /// Sets the value of [force][crate::model::UpdateConnectionProfileRequest::force].
567        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
568            self.0.request.force = v.into();
569            self
570        }
571    }
572
573    #[doc(hidden)]
574    impl gax::options::internal::RequestBuilder for UpdateConnectionProfile {
575        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
576            &mut self.0.options
577        }
578    }
579
580    /// The request builder for [Datastream::delete_connection_profile][crate::client::Datastream::delete_connection_profile] calls.
581    ///
582    /// # Example
583    /// ```no_run
584    /// # use google_cloud_datastream_v1::builder;
585    /// use builder::datastream::DeleteConnectionProfile;
586    /// # tokio_test::block_on(async {
587    /// use lro::Poller;
588    ///
589    /// let builder = prepare_request_builder();
590    /// let response = builder.poller().until_done().await?;
591    /// # gax::Result::<()>::Ok(()) });
592    ///
593    /// fn prepare_request_builder() -> DeleteConnectionProfile {
594    ///   # panic!();
595    ///   // ... details omitted ...
596    /// }
597    /// ```
598    #[derive(Clone, Debug)]
599    pub struct DeleteConnectionProfile(
600        RequestBuilder<crate::model::DeleteConnectionProfileRequest>,
601    );
602
603    impl DeleteConnectionProfile {
604        pub(crate) fn new(
605            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
606        ) -> Self {
607            Self(RequestBuilder::new(stub))
608        }
609
610        /// Sets the full request, replacing any prior values.
611        pub fn with_request<V: Into<crate::model::DeleteConnectionProfileRequest>>(
612            mut self,
613            v: V,
614        ) -> Self {
615            self.0.request = v.into();
616            self
617        }
618
619        /// Sets all the options, replacing any prior values.
620        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
621            self.0.options = v.into();
622            self
623        }
624
625        /// Sends the request.
626        ///
627        /// # Long running operations
628        ///
629        /// This starts, but does not poll, a longrunning operation. More information
630        /// on [delete_connection_profile][crate::client::Datastream::delete_connection_profile].
631        pub async fn send(self) -> Result<longrunning::model::Operation> {
632            (*self.0.stub)
633                .delete_connection_profile(self.0.request, self.0.options)
634                .await
635                .map(gax::response::Response::into_body)
636        }
637
638        /// Creates a [Poller][lro::Poller] to work with `delete_connection_profile`.
639        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
640            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
641            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
642            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
643
644            let stub = self.0.stub.clone();
645            let mut options = self.0.options.clone();
646            options.set_retry_policy(gax::retry_policy::NeverRetry);
647            let query = move |name| {
648                let stub = stub.clone();
649                let options = options.clone();
650                async {
651                    let op = GetOperation::new(stub)
652                        .set_name(name)
653                        .with_options(options)
654                        .send()
655                        .await?;
656                    Ok(Operation::new(op))
657                }
658            };
659
660            let start = move || async {
661                let op = self.send().await?;
662                Ok(Operation::new(op))
663            };
664
665            lro::internal::new_unit_response_poller(
666                polling_error_policy,
667                polling_backoff_policy,
668                start,
669                query,
670            )
671        }
672
673        /// Sets the value of [name][crate::model::DeleteConnectionProfileRequest::name].
674        ///
675        /// This is a **required** field for requests.
676        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
677            self.0.request.name = v.into();
678            self
679        }
680
681        /// Sets the value of [request_id][crate::model::DeleteConnectionProfileRequest::request_id].
682        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
683            self.0.request.request_id = v.into();
684            self
685        }
686    }
687
688    #[doc(hidden)]
689    impl gax::options::internal::RequestBuilder for DeleteConnectionProfile {
690        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
691            &mut self.0.options
692        }
693    }
694
695    /// The request builder for [Datastream::discover_connection_profile][crate::client::Datastream::discover_connection_profile] calls.
696    ///
697    /// # Example
698    /// ```no_run
699    /// # use google_cloud_datastream_v1::builder;
700    /// use builder::datastream::DiscoverConnectionProfile;
701    /// # tokio_test::block_on(async {
702    ///
703    /// let builder = prepare_request_builder();
704    /// let response = builder.send().await?;
705    /// # gax::Result::<()>::Ok(()) });
706    ///
707    /// fn prepare_request_builder() -> DiscoverConnectionProfile {
708    ///   # panic!();
709    ///   // ... details omitted ...
710    /// }
711    /// ```
712    #[derive(Clone, Debug)]
713    pub struct DiscoverConnectionProfile(
714        RequestBuilder<crate::model::DiscoverConnectionProfileRequest>,
715    );
716
717    impl DiscoverConnectionProfile {
718        pub(crate) fn new(
719            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
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::DiscoverConnectionProfileRequest>>(
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::DiscoverConnectionProfileResponse> {
741            (*self.0.stub)
742                .discover_connection_profile(self.0.request, self.0.options)
743                .await
744                .map(gax::response::Response::into_body)
745        }
746
747        /// Sets the value of [parent][crate::model::DiscoverConnectionProfileRequest::parent].
748        ///
749        /// This is a **required** field for requests.
750        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
751            self.0.request.parent = v.into();
752            self
753        }
754
755        /// Sets the value of [target][crate::model::DiscoverConnectionProfileRequest::target].
756        ///
757        /// Note that all the setters affecting `target` are
758        /// mutually exclusive.
759        pub fn set_target<
760            T: Into<Option<crate::model::discover_connection_profile_request::Target>>,
761        >(
762            mut self,
763            v: T,
764        ) -> Self {
765            self.0.request.target = v.into();
766            self
767        }
768
769        /// Sets the value of [target][crate::model::DiscoverConnectionProfileRequest::target]
770        /// to hold a `ConnectionProfile`.
771        ///
772        /// Note that all the setters affecting `target` are
773        /// mutually exclusive.
774        pub fn set_connection_profile<
775            T: std::convert::Into<std::boxed::Box<crate::model::ConnectionProfile>>,
776        >(
777            mut self,
778            v: T,
779        ) -> Self {
780            self.0.request = self.0.request.set_connection_profile(v);
781            self
782        }
783
784        /// Sets the value of [target][crate::model::DiscoverConnectionProfileRequest::target]
785        /// to hold a `ConnectionProfileName`.
786        ///
787        /// Note that all the setters affecting `target` are
788        /// mutually exclusive.
789        pub fn set_connection_profile_name<T: std::convert::Into<std::string::String>>(
790            mut self,
791            v: T,
792        ) -> Self {
793            self.0.request = self.0.request.set_connection_profile_name(v);
794            self
795        }
796
797        /// Sets the value of [hierarchy][crate::model::DiscoverConnectionProfileRequest::hierarchy].
798        ///
799        /// Note that all the setters affecting `hierarchy` are
800        /// mutually exclusive.
801        pub fn set_hierarchy<
802            T: Into<Option<crate::model::discover_connection_profile_request::Hierarchy>>,
803        >(
804            mut self,
805            v: T,
806        ) -> Self {
807            self.0.request.hierarchy = v.into();
808            self
809        }
810
811        /// Sets the value of [hierarchy][crate::model::DiscoverConnectionProfileRequest::hierarchy]
812        /// to hold a `FullHierarchy`.
813        ///
814        /// Note that all the setters affecting `hierarchy` are
815        /// mutually exclusive.
816        pub fn set_full_hierarchy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
817            self.0.request = self.0.request.set_full_hierarchy(v);
818            self
819        }
820
821        /// Sets the value of [hierarchy][crate::model::DiscoverConnectionProfileRequest::hierarchy]
822        /// to hold a `HierarchyDepth`.
823        ///
824        /// Note that all the setters affecting `hierarchy` are
825        /// mutually exclusive.
826        pub fn set_hierarchy_depth<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
827            self.0.request = self.0.request.set_hierarchy_depth(v);
828            self
829        }
830
831        /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object].
832        ///
833        /// Note that all the setters affecting `data_object` are
834        /// mutually exclusive.
835        pub fn set_data_object<
836            T: Into<Option<crate::model::discover_connection_profile_request::DataObject>>,
837        >(
838            mut self,
839            v: T,
840        ) -> Self {
841            self.0.request.data_object = v.into();
842            self
843        }
844
845        /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
846        /// to hold a `OracleRdbms`.
847        ///
848        /// Note that all the setters affecting `data_object` are
849        /// mutually exclusive.
850        pub fn set_oracle_rdbms<
851            T: std::convert::Into<std::boxed::Box<crate::model::OracleRdbms>>,
852        >(
853            mut self,
854            v: T,
855        ) -> Self {
856            self.0.request = self.0.request.set_oracle_rdbms(v);
857            self
858        }
859
860        /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
861        /// to hold a `MysqlRdbms`.
862        ///
863        /// Note that all the setters affecting `data_object` are
864        /// mutually exclusive.
865        pub fn set_mysql_rdbms<T: std::convert::Into<std::boxed::Box<crate::model::MysqlRdbms>>>(
866            mut self,
867            v: T,
868        ) -> Self {
869            self.0.request = self.0.request.set_mysql_rdbms(v);
870            self
871        }
872
873        /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
874        /// to hold a `PostgresqlRdbms`.
875        ///
876        /// Note that all the setters affecting `data_object` are
877        /// mutually exclusive.
878        pub fn set_postgresql_rdbms<
879            T: std::convert::Into<std::boxed::Box<crate::model::PostgresqlRdbms>>,
880        >(
881            mut self,
882            v: T,
883        ) -> Self {
884            self.0.request = self.0.request.set_postgresql_rdbms(v);
885            self
886        }
887
888        /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
889        /// to hold a `SqlServerRdbms`.
890        ///
891        /// Note that all the setters affecting `data_object` are
892        /// mutually exclusive.
893        pub fn set_sql_server_rdbms<
894            T: std::convert::Into<std::boxed::Box<crate::model::SqlServerRdbms>>,
895        >(
896            mut self,
897            v: T,
898        ) -> Self {
899            self.0.request = self.0.request.set_sql_server_rdbms(v);
900            self
901        }
902
903        /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
904        /// to hold a `SalesforceOrg`.
905        ///
906        /// Note that all the setters affecting `data_object` are
907        /// mutually exclusive.
908        pub fn set_salesforce_org<
909            T: std::convert::Into<std::boxed::Box<crate::model::SalesforceOrg>>,
910        >(
911            mut self,
912            v: T,
913        ) -> Self {
914            self.0.request = self.0.request.set_salesforce_org(v);
915            self
916        }
917
918        /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
919        /// to hold a `MongodbCluster`.
920        ///
921        /// Note that all the setters affecting `data_object` are
922        /// mutually exclusive.
923        pub fn set_mongodb_cluster<
924            T: std::convert::Into<std::boxed::Box<crate::model::MongodbCluster>>,
925        >(
926            mut self,
927            v: T,
928        ) -> Self {
929            self.0.request = self.0.request.set_mongodb_cluster(v);
930            self
931        }
932    }
933
934    #[doc(hidden)]
935    impl gax::options::internal::RequestBuilder for DiscoverConnectionProfile {
936        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
937            &mut self.0.options
938        }
939    }
940
941    /// The request builder for [Datastream::list_streams][crate::client::Datastream::list_streams] calls.
942    ///
943    /// # Example
944    /// ```no_run
945    /// # use google_cloud_datastream_v1::builder;
946    /// use builder::datastream::ListStreams;
947    /// # tokio_test::block_on(async {
948    /// use gax::paginator::ItemPaginator;
949    ///
950    /// let builder = prepare_request_builder();
951    /// let mut items = builder.by_item();
952    /// while let Some(result) = items.next().await {
953    ///   let item = result?;
954    /// }
955    /// # gax::Result::<()>::Ok(()) });
956    ///
957    /// fn prepare_request_builder() -> ListStreams {
958    ///   # panic!();
959    ///   // ... details omitted ...
960    /// }
961    /// ```
962    #[derive(Clone, Debug)]
963    pub struct ListStreams(RequestBuilder<crate::model::ListStreamsRequest>);
964
965    impl ListStreams {
966        pub(crate) fn new(
967            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
968        ) -> Self {
969            Self(RequestBuilder::new(stub))
970        }
971
972        /// Sets the full request, replacing any prior values.
973        pub fn with_request<V: Into<crate::model::ListStreamsRequest>>(mut self, v: V) -> Self {
974            self.0.request = v.into();
975            self
976        }
977
978        /// Sets all the options, replacing any prior values.
979        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
980            self.0.options = v.into();
981            self
982        }
983
984        /// Sends the request.
985        pub async fn send(self) -> Result<crate::model::ListStreamsResponse> {
986            (*self.0.stub)
987                .list_streams(self.0.request, self.0.options)
988                .await
989                .map(gax::response::Response::into_body)
990        }
991
992        /// Streams each page in the collection.
993        pub fn by_page(
994            self,
995        ) -> impl gax::paginator::Paginator<crate::model::ListStreamsResponse, gax::error::Error>
996        {
997            use std::clone::Clone;
998            let token = self.0.request.page_token.clone();
999            let execute = move |token: String| {
1000                let mut builder = self.clone();
1001                builder.0.request = builder.0.request.set_page_token(token);
1002                builder.send()
1003            };
1004            gax::paginator::internal::new_paginator(token, execute)
1005        }
1006
1007        /// Streams each item in the collection.
1008        pub fn by_item(
1009            self,
1010        ) -> impl gax::paginator::ItemPaginator<crate::model::ListStreamsResponse, gax::error::Error>
1011        {
1012            use gax::paginator::Paginator;
1013            self.by_page().items()
1014        }
1015
1016        /// Sets the value of [parent][crate::model::ListStreamsRequest::parent].
1017        ///
1018        /// This is a **required** field for requests.
1019        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1020            self.0.request.parent = v.into();
1021            self
1022        }
1023
1024        /// Sets the value of [page_size][crate::model::ListStreamsRequest::page_size].
1025        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1026            self.0.request.page_size = v.into();
1027            self
1028        }
1029
1030        /// Sets the value of [page_token][crate::model::ListStreamsRequest::page_token].
1031        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1032            self.0.request.page_token = v.into();
1033            self
1034        }
1035
1036        /// Sets the value of [filter][crate::model::ListStreamsRequest::filter].
1037        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1038            self.0.request.filter = v.into();
1039            self
1040        }
1041
1042        /// Sets the value of [order_by][crate::model::ListStreamsRequest::order_by].
1043        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1044            self.0.request.order_by = v.into();
1045            self
1046        }
1047    }
1048
1049    #[doc(hidden)]
1050    impl gax::options::internal::RequestBuilder for ListStreams {
1051        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1052            &mut self.0.options
1053        }
1054    }
1055
1056    /// The request builder for [Datastream::get_stream][crate::client::Datastream::get_stream] calls.
1057    ///
1058    /// # Example
1059    /// ```no_run
1060    /// # use google_cloud_datastream_v1::builder;
1061    /// use builder::datastream::GetStream;
1062    /// # tokio_test::block_on(async {
1063    ///
1064    /// let builder = prepare_request_builder();
1065    /// let response = builder.send().await?;
1066    /// # gax::Result::<()>::Ok(()) });
1067    ///
1068    /// fn prepare_request_builder() -> GetStream {
1069    ///   # panic!();
1070    ///   // ... details omitted ...
1071    /// }
1072    /// ```
1073    #[derive(Clone, Debug)]
1074    pub struct GetStream(RequestBuilder<crate::model::GetStreamRequest>);
1075
1076    impl GetStream {
1077        pub(crate) fn new(
1078            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1079        ) -> Self {
1080            Self(RequestBuilder::new(stub))
1081        }
1082
1083        /// Sets the full request, replacing any prior values.
1084        pub fn with_request<V: Into<crate::model::GetStreamRequest>>(mut self, v: V) -> Self {
1085            self.0.request = v.into();
1086            self
1087        }
1088
1089        /// Sets all the options, replacing any prior values.
1090        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1091            self.0.options = v.into();
1092            self
1093        }
1094
1095        /// Sends the request.
1096        pub async fn send(self) -> Result<crate::model::Stream> {
1097            (*self.0.stub)
1098                .get_stream(self.0.request, self.0.options)
1099                .await
1100                .map(gax::response::Response::into_body)
1101        }
1102
1103        /// Sets the value of [name][crate::model::GetStreamRequest::name].
1104        ///
1105        /// This is a **required** field for requests.
1106        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1107            self.0.request.name = v.into();
1108            self
1109        }
1110    }
1111
1112    #[doc(hidden)]
1113    impl gax::options::internal::RequestBuilder for GetStream {
1114        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1115            &mut self.0.options
1116        }
1117    }
1118
1119    /// The request builder for [Datastream::create_stream][crate::client::Datastream::create_stream] calls.
1120    ///
1121    /// # Example
1122    /// ```no_run
1123    /// # use google_cloud_datastream_v1::builder;
1124    /// use builder::datastream::CreateStream;
1125    /// # tokio_test::block_on(async {
1126    /// use lro::Poller;
1127    ///
1128    /// let builder = prepare_request_builder();
1129    /// let response = builder.poller().until_done().await?;
1130    /// # gax::Result::<()>::Ok(()) });
1131    ///
1132    /// fn prepare_request_builder() -> CreateStream {
1133    ///   # panic!();
1134    ///   // ... details omitted ...
1135    /// }
1136    /// ```
1137    #[derive(Clone, Debug)]
1138    pub struct CreateStream(RequestBuilder<crate::model::CreateStreamRequest>);
1139
1140    impl CreateStream {
1141        pub(crate) fn new(
1142            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1143        ) -> Self {
1144            Self(RequestBuilder::new(stub))
1145        }
1146
1147        /// Sets the full request, replacing any prior values.
1148        pub fn with_request<V: Into<crate::model::CreateStreamRequest>>(mut self, v: V) -> Self {
1149            self.0.request = v.into();
1150            self
1151        }
1152
1153        /// Sets all the options, replacing any prior values.
1154        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1155            self.0.options = v.into();
1156            self
1157        }
1158
1159        /// Sends the request.
1160        ///
1161        /// # Long running operations
1162        ///
1163        /// This starts, but does not poll, a longrunning operation. More information
1164        /// on [create_stream][crate::client::Datastream::create_stream].
1165        pub async fn send(self) -> Result<longrunning::model::Operation> {
1166            (*self.0.stub)
1167                .create_stream(self.0.request, self.0.options)
1168                .await
1169                .map(gax::response::Response::into_body)
1170        }
1171
1172        /// Creates a [Poller][lro::Poller] to work with `create_stream`.
1173        pub fn poller(
1174            self,
1175        ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
1176            type Operation =
1177                lro::internal::Operation<crate::model::Stream, crate::model::OperationMetadata>;
1178            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1179            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1180
1181            let stub = self.0.stub.clone();
1182            let mut options = self.0.options.clone();
1183            options.set_retry_policy(gax::retry_policy::NeverRetry);
1184            let query = move |name| {
1185                let stub = stub.clone();
1186                let options = options.clone();
1187                async {
1188                    let op = GetOperation::new(stub)
1189                        .set_name(name)
1190                        .with_options(options)
1191                        .send()
1192                        .await?;
1193                    Ok(Operation::new(op))
1194                }
1195            };
1196
1197            let start = move || async {
1198                let op = self.send().await?;
1199                Ok(Operation::new(op))
1200            };
1201
1202            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1203        }
1204
1205        /// Sets the value of [parent][crate::model::CreateStreamRequest::parent].
1206        ///
1207        /// This is a **required** field for requests.
1208        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1209            self.0.request.parent = v.into();
1210            self
1211        }
1212
1213        /// Sets the value of [stream_id][crate::model::CreateStreamRequest::stream_id].
1214        ///
1215        /// This is a **required** field for requests.
1216        pub fn set_stream_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1217            self.0.request.stream_id = v.into();
1218            self
1219        }
1220
1221        /// Sets the value of [stream][crate::model::CreateStreamRequest::stream].
1222        ///
1223        /// This is a **required** field for requests.
1224        pub fn set_stream<T>(mut self, v: T) -> Self
1225        where
1226            T: std::convert::Into<crate::model::Stream>,
1227        {
1228            self.0.request.stream = std::option::Option::Some(v.into());
1229            self
1230        }
1231
1232        /// Sets or clears the value of [stream][crate::model::CreateStreamRequest::stream].
1233        ///
1234        /// This is a **required** field for requests.
1235        pub fn set_or_clear_stream<T>(mut self, v: std::option::Option<T>) -> Self
1236        where
1237            T: std::convert::Into<crate::model::Stream>,
1238        {
1239            self.0.request.stream = v.map(|x| x.into());
1240            self
1241        }
1242
1243        /// Sets the value of [request_id][crate::model::CreateStreamRequest::request_id].
1244        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1245            self.0.request.request_id = v.into();
1246            self
1247        }
1248
1249        /// Sets the value of [validate_only][crate::model::CreateStreamRequest::validate_only].
1250        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1251            self.0.request.validate_only = v.into();
1252            self
1253        }
1254
1255        /// Sets the value of [force][crate::model::CreateStreamRequest::force].
1256        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1257            self.0.request.force = v.into();
1258            self
1259        }
1260    }
1261
1262    #[doc(hidden)]
1263    impl gax::options::internal::RequestBuilder for CreateStream {
1264        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1265            &mut self.0.options
1266        }
1267    }
1268
1269    /// The request builder for [Datastream::update_stream][crate::client::Datastream::update_stream] calls.
1270    ///
1271    /// # Example
1272    /// ```no_run
1273    /// # use google_cloud_datastream_v1::builder;
1274    /// use builder::datastream::UpdateStream;
1275    /// # tokio_test::block_on(async {
1276    /// use lro::Poller;
1277    ///
1278    /// let builder = prepare_request_builder();
1279    /// let response = builder.poller().until_done().await?;
1280    /// # gax::Result::<()>::Ok(()) });
1281    ///
1282    /// fn prepare_request_builder() -> UpdateStream {
1283    ///   # panic!();
1284    ///   // ... details omitted ...
1285    /// }
1286    /// ```
1287    #[derive(Clone, Debug)]
1288    pub struct UpdateStream(RequestBuilder<crate::model::UpdateStreamRequest>);
1289
1290    impl UpdateStream {
1291        pub(crate) fn new(
1292            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1293        ) -> Self {
1294            Self(RequestBuilder::new(stub))
1295        }
1296
1297        /// Sets the full request, replacing any prior values.
1298        pub fn with_request<V: Into<crate::model::UpdateStreamRequest>>(mut self, v: V) -> Self {
1299            self.0.request = v.into();
1300            self
1301        }
1302
1303        /// Sets all the options, replacing any prior values.
1304        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1305            self.0.options = v.into();
1306            self
1307        }
1308
1309        /// Sends the request.
1310        ///
1311        /// # Long running operations
1312        ///
1313        /// This starts, but does not poll, a longrunning operation. More information
1314        /// on [update_stream][crate::client::Datastream::update_stream].
1315        pub async fn send(self) -> Result<longrunning::model::Operation> {
1316            (*self.0.stub)
1317                .update_stream(self.0.request, self.0.options)
1318                .await
1319                .map(gax::response::Response::into_body)
1320        }
1321
1322        /// Creates a [Poller][lro::Poller] to work with `update_stream`.
1323        pub fn poller(
1324            self,
1325        ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
1326            type Operation =
1327                lro::internal::Operation<crate::model::Stream, crate::model::OperationMetadata>;
1328            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1329            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1330
1331            let stub = self.0.stub.clone();
1332            let mut options = self.0.options.clone();
1333            options.set_retry_policy(gax::retry_policy::NeverRetry);
1334            let query = move |name| {
1335                let stub = stub.clone();
1336                let options = options.clone();
1337                async {
1338                    let op = GetOperation::new(stub)
1339                        .set_name(name)
1340                        .with_options(options)
1341                        .send()
1342                        .await?;
1343                    Ok(Operation::new(op))
1344                }
1345            };
1346
1347            let start = move || async {
1348                let op = self.send().await?;
1349                Ok(Operation::new(op))
1350            };
1351
1352            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1353        }
1354
1355        /// Sets the value of [update_mask][crate::model::UpdateStreamRequest::update_mask].
1356        pub fn set_update_mask<T>(mut self, v: T) -> Self
1357        where
1358            T: std::convert::Into<wkt::FieldMask>,
1359        {
1360            self.0.request.update_mask = std::option::Option::Some(v.into());
1361            self
1362        }
1363
1364        /// Sets or clears the value of [update_mask][crate::model::UpdateStreamRequest::update_mask].
1365        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1366        where
1367            T: std::convert::Into<wkt::FieldMask>,
1368        {
1369            self.0.request.update_mask = v.map(|x| x.into());
1370            self
1371        }
1372
1373        /// Sets the value of [stream][crate::model::UpdateStreamRequest::stream].
1374        ///
1375        /// This is a **required** field for requests.
1376        pub fn set_stream<T>(mut self, v: T) -> Self
1377        where
1378            T: std::convert::Into<crate::model::Stream>,
1379        {
1380            self.0.request.stream = std::option::Option::Some(v.into());
1381            self
1382        }
1383
1384        /// Sets or clears the value of [stream][crate::model::UpdateStreamRequest::stream].
1385        ///
1386        /// This is a **required** field for requests.
1387        pub fn set_or_clear_stream<T>(mut self, v: std::option::Option<T>) -> Self
1388        where
1389            T: std::convert::Into<crate::model::Stream>,
1390        {
1391            self.0.request.stream = v.map(|x| x.into());
1392            self
1393        }
1394
1395        /// Sets the value of [request_id][crate::model::UpdateStreamRequest::request_id].
1396        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1397            self.0.request.request_id = v.into();
1398            self
1399        }
1400
1401        /// Sets the value of [validate_only][crate::model::UpdateStreamRequest::validate_only].
1402        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1403            self.0.request.validate_only = v.into();
1404            self
1405        }
1406
1407        /// Sets the value of [force][crate::model::UpdateStreamRequest::force].
1408        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1409            self.0.request.force = v.into();
1410            self
1411        }
1412    }
1413
1414    #[doc(hidden)]
1415    impl gax::options::internal::RequestBuilder for UpdateStream {
1416        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1417            &mut self.0.options
1418        }
1419    }
1420
1421    /// The request builder for [Datastream::delete_stream][crate::client::Datastream::delete_stream] calls.
1422    ///
1423    /// # Example
1424    /// ```no_run
1425    /// # use google_cloud_datastream_v1::builder;
1426    /// use builder::datastream::DeleteStream;
1427    /// # tokio_test::block_on(async {
1428    /// use lro::Poller;
1429    ///
1430    /// let builder = prepare_request_builder();
1431    /// let response = builder.poller().until_done().await?;
1432    /// # gax::Result::<()>::Ok(()) });
1433    ///
1434    /// fn prepare_request_builder() -> DeleteStream {
1435    ///   # panic!();
1436    ///   // ... details omitted ...
1437    /// }
1438    /// ```
1439    #[derive(Clone, Debug)]
1440    pub struct DeleteStream(RequestBuilder<crate::model::DeleteStreamRequest>);
1441
1442    impl DeleteStream {
1443        pub(crate) fn new(
1444            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1445        ) -> Self {
1446            Self(RequestBuilder::new(stub))
1447        }
1448
1449        /// Sets the full request, replacing any prior values.
1450        pub fn with_request<V: Into<crate::model::DeleteStreamRequest>>(mut self, v: V) -> Self {
1451            self.0.request = v.into();
1452            self
1453        }
1454
1455        /// Sets all the options, replacing any prior values.
1456        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1457            self.0.options = v.into();
1458            self
1459        }
1460
1461        /// Sends the request.
1462        ///
1463        /// # Long running operations
1464        ///
1465        /// This starts, but does not poll, a longrunning operation. More information
1466        /// on [delete_stream][crate::client::Datastream::delete_stream].
1467        pub async fn send(self) -> Result<longrunning::model::Operation> {
1468            (*self.0.stub)
1469                .delete_stream(self.0.request, self.0.options)
1470                .await
1471                .map(gax::response::Response::into_body)
1472        }
1473
1474        /// Creates a [Poller][lro::Poller] to work with `delete_stream`.
1475        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1476            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1477            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1478            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1479
1480            let stub = self.0.stub.clone();
1481            let mut options = self.0.options.clone();
1482            options.set_retry_policy(gax::retry_policy::NeverRetry);
1483            let query = move |name| {
1484                let stub = stub.clone();
1485                let options = options.clone();
1486                async {
1487                    let op = GetOperation::new(stub)
1488                        .set_name(name)
1489                        .with_options(options)
1490                        .send()
1491                        .await?;
1492                    Ok(Operation::new(op))
1493                }
1494            };
1495
1496            let start = move || async {
1497                let op = self.send().await?;
1498                Ok(Operation::new(op))
1499            };
1500
1501            lro::internal::new_unit_response_poller(
1502                polling_error_policy,
1503                polling_backoff_policy,
1504                start,
1505                query,
1506            )
1507        }
1508
1509        /// Sets the value of [name][crate::model::DeleteStreamRequest::name].
1510        ///
1511        /// This is a **required** field for requests.
1512        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1513            self.0.request.name = v.into();
1514            self
1515        }
1516
1517        /// Sets the value of [request_id][crate::model::DeleteStreamRequest::request_id].
1518        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1519            self.0.request.request_id = v.into();
1520            self
1521        }
1522    }
1523
1524    #[doc(hidden)]
1525    impl gax::options::internal::RequestBuilder for DeleteStream {
1526        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1527            &mut self.0.options
1528        }
1529    }
1530
1531    /// The request builder for [Datastream::run_stream][crate::client::Datastream::run_stream] calls.
1532    ///
1533    /// # Example
1534    /// ```no_run
1535    /// # use google_cloud_datastream_v1::builder;
1536    /// use builder::datastream::RunStream;
1537    /// # tokio_test::block_on(async {
1538    /// use lro::Poller;
1539    ///
1540    /// let builder = prepare_request_builder();
1541    /// let response = builder.poller().until_done().await?;
1542    /// # gax::Result::<()>::Ok(()) });
1543    ///
1544    /// fn prepare_request_builder() -> RunStream {
1545    ///   # panic!();
1546    ///   // ... details omitted ...
1547    /// }
1548    /// ```
1549    #[derive(Clone, Debug)]
1550    pub struct RunStream(RequestBuilder<crate::model::RunStreamRequest>);
1551
1552    impl RunStream {
1553        pub(crate) fn new(
1554            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1555        ) -> Self {
1556            Self(RequestBuilder::new(stub))
1557        }
1558
1559        /// Sets the full request, replacing any prior values.
1560        pub fn with_request<V: Into<crate::model::RunStreamRequest>>(mut self, v: V) -> Self {
1561            self.0.request = v.into();
1562            self
1563        }
1564
1565        /// Sets all the options, replacing any prior values.
1566        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1567            self.0.options = v.into();
1568            self
1569        }
1570
1571        /// Sends the request.
1572        ///
1573        /// # Long running operations
1574        ///
1575        /// This starts, but does not poll, a longrunning operation. More information
1576        /// on [run_stream][crate::client::Datastream::run_stream].
1577        pub async fn send(self) -> Result<longrunning::model::Operation> {
1578            (*self.0.stub)
1579                .run_stream(self.0.request, self.0.options)
1580                .await
1581                .map(gax::response::Response::into_body)
1582        }
1583
1584        /// Creates a [Poller][lro::Poller] to work with `run_stream`.
1585        pub fn poller(
1586            self,
1587        ) -> impl lro::Poller<crate::model::Stream, crate::model::OperationMetadata> {
1588            type Operation =
1589                lro::internal::Operation<crate::model::Stream, crate::model::OperationMetadata>;
1590            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1591            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1592
1593            let stub = self.0.stub.clone();
1594            let mut options = self.0.options.clone();
1595            options.set_retry_policy(gax::retry_policy::NeverRetry);
1596            let query = move |name| {
1597                let stub = stub.clone();
1598                let options = options.clone();
1599                async {
1600                    let op = GetOperation::new(stub)
1601                        .set_name(name)
1602                        .with_options(options)
1603                        .send()
1604                        .await?;
1605                    Ok(Operation::new(op))
1606                }
1607            };
1608
1609            let start = move || async {
1610                let op = self.send().await?;
1611                Ok(Operation::new(op))
1612            };
1613
1614            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1615        }
1616
1617        /// Sets the value of [name][crate::model::RunStreamRequest::name].
1618        ///
1619        /// This is a **required** field for requests.
1620        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1621            self.0.request.name = v.into();
1622            self
1623        }
1624
1625        /// Sets the value of [cdc_strategy][crate::model::RunStreamRequest::cdc_strategy].
1626        pub fn set_cdc_strategy<T>(mut self, v: T) -> Self
1627        where
1628            T: std::convert::Into<crate::model::CdcStrategy>,
1629        {
1630            self.0.request.cdc_strategy = std::option::Option::Some(v.into());
1631            self
1632        }
1633
1634        /// Sets or clears the value of [cdc_strategy][crate::model::RunStreamRequest::cdc_strategy].
1635        pub fn set_or_clear_cdc_strategy<T>(mut self, v: std::option::Option<T>) -> Self
1636        where
1637            T: std::convert::Into<crate::model::CdcStrategy>,
1638        {
1639            self.0.request.cdc_strategy = v.map(|x| x.into());
1640            self
1641        }
1642
1643        /// Sets the value of [force][crate::model::RunStreamRequest::force].
1644        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1645            self.0.request.force = v.into();
1646            self
1647        }
1648    }
1649
1650    #[doc(hidden)]
1651    impl gax::options::internal::RequestBuilder for RunStream {
1652        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1653            &mut self.0.options
1654        }
1655    }
1656
1657    /// The request builder for [Datastream::get_stream_object][crate::client::Datastream::get_stream_object] calls.
1658    ///
1659    /// # Example
1660    /// ```no_run
1661    /// # use google_cloud_datastream_v1::builder;
1662    /// use builder::datastream::GetStreamObject;
1663    /// # tokio_test::block_on(async {
1664    ///
1665    /// let builder = prepare_request_builder();
1666    /// let response = builder.send().await?;
1667    /// # gax::Result::<()>::Ok(()) });
1668    ///
1669    /// fn prepare_request_builder() -> GetStreamObject {
1670    ///   # panic!();
1671    ///   // ... details omitted ...
1672    /// }
1673    /// ```
1674    #[derive(Clone, Debug)]
1675    pub struct GetStreamObject(RequestBuilder<crate::model::GetStreamObjectRequest>);
1676
1677    impl GetStreamObject {
1678        pub(crate) fn new(
1679            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1680        ) -> Self {
1681            Self(RequestBuilder::new(stub))
1682        }
1683
1684        /// Sets the full request, replacing any prior values.
1685        pub fn with_request<V: Into<crate::model::GetStreamObjectRequest>>(mut self, v: V) -> Self {
1686            self.0.request = v.into();
1687            self
1688        }
1689
1690        /// Sets all the options, replacing any prior values.
1691        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1692            self.0.options = v.into();
1693            self
1694        }
1695
1696        /// Sends the request.
1697        pub async fn send(self) -> Result<crate::model::StreamObject> {
1698            (*self.0.stub)
1699                .get_stream_object(self.0.request, self.0.options)
1700                .await
1701                .map(gax::response::Response::into_body)
1702        }
1703
1704        /// Sets the value of [name][crate::model::GetStreamObjectRequest::name].
1705        ///
1706        /// This is a **required** field for requests.
1707        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1708            self.0.request.name = v.into();
1709            self
1710        }
1711    }
1712
1713    #[doc(hidden)]
1714    impl gax::options::internal::RequestBuilder for GetStreamObject {
1715        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1716            &mut self.0.options
1717        }
1718    }
1719
1720    /// The request builder for [Datastream::lookup_stream_object][crate::client::Datastream::lookup_stream_object] calls.
1721    ///
1722    /// # Example
1723    /// ```no_run
1724    /// # use google_cloud_datastream_v1::builder;
1725    /// use builder::datastream::LookupStreamObject;
1726    /// # tokio_test::block_on(async {
1727    ///
1728    /// let builder = prepare_request_builder();
1729    /// let response = builder.send().await?;
1730    /// # gax::Result::<()>::Ok(()) });
1731    ///
1732    /// fn prepare_request_builder() -> LookupStreamObject {
1733    ///   # panic!();
1734    ///   // ... details omitted ...
1735    /// }
1736    /// ```
1737    #[derive(Clone, Debug)]
1738    pub struct LookupStreamObject(RequestBuilder<crate::model::LookupStreamObjectRequest>);
1739
1740    impl LookupStreamObject {
1741        pub(crate) fn new(
1742            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1743        ) -> Self {
1744            Self(RequestBuilder::new(stub))
1745        }
1746
1747        /// Sets the full request, replacing any prior values.
1748        pub fn with_request<V: Into<crate::model::LookupStreamObjectRequest>>(
1749            mut self,
1750            v: V,
1751        ) -> Self {
1752            self.0.request = v.into();
1753            self
1754        }
1755
1756        /// Sets all the options, replacing any prior values.
1757        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1758            self.0.options = v.into();
1759            self
1760        }
1761
1762        /// Sends the request.
1763        pub async fn send(self) -> Result<crate::model::StreamObject> {
1764            (*self.0.stub)
1765                .lookup_stream_object(self.0.request, self.0.options)
1766                .await
1767                .map(gax::response::Response::into_body)
1768        }
1769
1770        /// Sets the value of [parent][crate::model::LookupStreamObjectRequest::parent].
1771        ///
1772        /// This is a **required** field for requests.
1773        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1774            self.0.request.parent = v.into();
1775            self
1776        }
1777
1778        /// Sets the value of [source_object_identifier][crate::model::LookupStreamObjectRequest::source_object_identifier].
1779        ///
1780        /// This is a **required** field for requests.
1781        pub fn set_source_object_identifier<T>(mut self, v: T) -> Self
1782        where
1783            T: std::convert::Into<crate::model::SourceObjectIdentifier>,
1784        {
1785            self.0.request.source_object_identifier = std::option::Option::Some(v.into());
1786            self
1787        }
1788
1789        /// Sets or clears the value of [source_object_identifier][crate::model::LookupStreamObjectRequest::source_object_identifier].
1790        ///
1791        /// This is a **required** field for requests.
1792        pub fn set_or_clear_source_object_identifier<T>(mut self, v: std::option::Option<T>) -> Self
1793        where
1794            T: std::convert::Into<crate::model::SourceObjectIdentifier>,
1795        {
1796            self.0.request.source_object_identifier = v.map(|x| x.into());
1797            self
1798        }
1799    }
1800
1801    #[doc(hidden)]
1802    impl gax::options::internal::RequestBuilder for LookupStreamObject {
1803        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1804            &mut self.0.options
1805        }
1806    }
1807
1808    /// The request builder for [Datastream::list_stream_objects][crate::client::Datastream::list_stream_objects] calls.
1809    ///
1810    /// # Example
1811    /// ```no_run
1812    /// # use google_cloud_datastream_v1::builder;
1813    /// use builder::datastream::ListStreamObjects;
1814    /// # tokio_test::block_on(async {
1815    /// use gax::paginator::ItemPaginator;
1816    ///
1817    /// let builder = prepare_request_builder();
1818    /// let mut items = builder.by_item();
1819    /// while let Some(result) = items.next().await {
1820    ///   let item = result?;
1821    /// }
1822    /// # gax::Result::<()>::Ok(()) });
1823    ///
1824    /// fn prepare_request_builder() -> ListStreamObjects {
1825    ///   # panic!();
1826    ///   // ... details omitted ...
1827    /// }
1828    /// ```
1829    #[derive(Clone, Debug)]
1830    pub struct ListStreamObjects(RequestBuilder<crate::model::ListStreamObjectsRequest>);
1831
1832    impl ListStreamObjects {
1833        pub(crate) fn new(
1834            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1835        ) -> Self {
1836            Self(RequestBuilder::new(stub))
1837        }
1838
1839        /// Sets the full request, replacing any prior values.
1840        pub fn with_request<V: Into<crate::model::ListStreamObjectsRequest>>(
1841            mut self,
1842            v: V,
1843        ) -> Self {
1844            self.0.request = v.into();
1845            self
1846        }
1847
1848        /// Sets all the options, replacing any prior values.
1849        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1850            self.0.options = v.into();
1851            self
1852        }
1853
1854        /// Sends the request.
1855        pub async fn send(self) -> Result<crate::model::ListStreamObjectsResponse> {
1856            (*self.0.stub)
1857                .list_stream_objects(self.0.request, self.0.options)
1858                .await
1859                .map(gax::response::Response::into_body)
1860        }
1861
1862        /// Streams each page in the collection.
1863        pub fn by_page(
1864            self,
1865        ) -> impl gax::paginator::Paginator<crate::model::ListStreamObjectsResponse, gax::error::Error>
1866        {
1867            use std::clone::Clone;
1868            let token = self.0.request.page_token.clone();
1869            let execute = move |token: String| {
1870                let mut builder = self.clone();
1871                builder.0.request = builder.0.request.set_page_token(token);
1872                builder.send()
1873            };
1874            gax::paginator::internal::new_paginator(token, execute)
1875        }
1876
1877        /// Streams each item in the collection.
1878        pub fn by_item(
1879            self,
1880        ) -> impl gax::paginator::ItemPaginator<crate::model::ListStreamObjectsResponse, gax::error::Error>
1881        {
1882            use gax::paginator::Paginator;
1883            self.by_page().items()
1884        }
1885
1886        /// Sets the value of [parent][crate::model::ListStreamObjectsRequest::parent].
1887        ///
1888        /// This is a **required** field for requests.
1889        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1890            self.0.request.parent = v.into();
1891            self
1892        }
1893
1894        /// Sets the value of [page_size][crate::model::ListStreamObjectsRequest::page_size].
1895        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1896            self.0.request.page_size = v.into();
1897            self
1898        }
1899
1900        /// Sets the value of [page_token][crate::model::ListStreamObjectsRequest::page_token].
1901        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1902            self.0.request.page_token = v.into();
1903            self
1904        }
1905    }
1906
1907    #[doc(hidden)]
1908    impl gax::options::internal::RequestBuilder for ListStreamObjects {
1909        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1910            &mut self.0.options
1911        }
1912    }
1913
1914    /// The request builder for [Datastream::start_backfill_job][crate::client::Datastream::start_backfill_job] calls.
1915    ///
1916    /// # Example
1917    /// ```no_run
1918    /// # use google_cloud_datastream_v1::builder;
1919    /// use builder::datastream::StartBackfillJob;
1920    /// # tokio_test::block_on(async {
1921    ///
1922    /// let builder = prepare_request_builder();
1923    /// let response = builder.send().await?;
1924    /// # gax::Result::<()>::Ok(()) });
1925    ///
1926    /// fn prepare_request_builder() -> StartBackfillJob {
1927    ///   # panic!();
1928    ///   // ... details omitted ...
1929    /// }
1930    /// ```
1931    #[derive(Clone, Debug)]
1932    pub struct StartBackfillJob(RequestBuilder<crate::model::StartBackfillJobRequest>);
1933
1934    impl StartBackfillJob {
1935        pub(crate) fn new(
1936            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1937        ) -> Self {
1938            Self(RequestBuilder::new(stub))
1939        }
1940
1941        /// Sets the full request, replacing any prior values.
1942        pub fn with_request<V: Into<crate::model::StartBackfillJobRequest>>(
1943            mut self,
1944            v: V,
1945        ) -> Self {
1946            self.0.request = v.into();
1947            self
1948        }
1949
1950        /// Sets all the options, replacing any prior values.
1951        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1952            self.0.options = v.into();
1953            self
1954        }
1955
1956        /// Sends the request.
1957        pub async fn send(self) -> Result<crate::model::StartBackfillJobResponse> {
1958            (*self.0.stub)
1959                .start_backfill_job(self.0.request, self.0.options)
1960                .await
1961                .map(gax::response::Response::into_body)
1962        }
1963
1964        /// Sets the value of [object][crate::model::StartBackfillJobRequest::object].
1965        ///
1966        /// This is a **required** field for requests.
1967        pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
1968            self.0.request.object = v.into();
1969            self
1970        }
1971    }
1972
1973    #[doc(hidden)]
1974    impl gax::options::internal::RequestBuilder for StartBackfillJob {
1975        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1976            &mut self.0.options
1977        }
1978    }
1979
1980    /// The request builder for [Datastream::stop_backfill_job][crate::client::Datastream::stop_backfill_job] calls.
1981    ///
1982    /// # Example
1983    /// ```no_run
1984    /// # use google_cloud_datastream_v1::builder;
1985    /// use builder::datastream::StopBackfillJob;
1986    /// # tokio_test::block_on(async {
1987    ///
1988    /// let builder = prepare_request_builder();
1989    /// let response = builder.send().await?;
1990    /// # gax::Result::<()>::Ok(()) });
1991    ///
1992    /// fn prepare_request_builder() -> StopBackfillJob {
1993    ///   # panic!();
1994    ///   // ... details omitted ...
1995    /// }
1996    /// ```
1997    #[derive(Clone, Debug)]
1998    pub struct StopBackfillJob(RequestBuilder<crate::model::StopBackfillJobRequest>);
1999
2000    impl StopBackfillJob {
2001        pub(crate) fn new(
2002            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2003        ) -> Self {
2004            Self(RequestBuilder::new(stub))
2005        }
2006
2007        /// Sets the full request, replacing any prior values.
2008        pub fn with_request<V: Into<crate::model::StopBackfillJobRequest>>(mut self, v: V) -> Self {
2009            self.0.request = v.into();
2010            self
2011        }
2012
2013        /// Sets all the options, replacing any prior values.
2014        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2015            self.0.options = v.into();
2016            self
2017        }
2018
2019        /// Sends the request.
2020        pub async fn send(self) -> Result<crate::model::StopBackfillJobResponse> {
2021            (*self.0.stub)
2022                .stop_backfill_job(self.0.request, self.0.options)
2023                .await
2024                .map(gax::response::Response::into_body)
2025        }
2026
2027        /// Sets the value of [object][crate::model::StopBackfillJobRequest::object].
2028        ///
2029        /// This is a **required** field for requests.
2030        pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
2031            self.0.request.object = v.into();
2032            self
2033        }
2034    }
2035
2036    #[doc(hidden)]
2037    impl gax::options::internal::RequestBuilder for StopBackfillJob {
2038        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2039            &mut self.0.options
2040        }
2041    }
2042
2043    /// The request builder for [Datastream::fetch_static_ips][crate::client::Datastream::fetch_static_ips] calls.
2044    ///
2045    /// # Example
2046    /// ```no_run
2047    /// # use google_cloud_datastream_v1::builder;
2048    /// use builder::datastream::FetchStaticIps;
2049    /// # tokio_test::block_on(async {
2050    ///
2051    /// let builder = prepare_request_builder();
2052    /// let response = builder.send().await?;
2053    /// # gax::Result::<()>::Ok(()) });
2054    ///
2055    /// fn prepare_request_builder() -> FetchStaticIps {
2056    ///   # panic!();
2057    ///   // ... details omitted ...
2058    /// }
2059    /// ```
2060    #[derive(Clone, Debug)]
2061    pub struct FetchStaticIps(RequestBuilder<crate::model::FetchStaticIpsRequest>);
2062
2063    impl FetchStaticIps {
2064        pub(crate) fn new(
2065            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2066        ) -> Self {
2067            Self(RequestBuilder::new(stub))
2068        }
2069
2070        /// Sets the full request, replacing any prior values.
2071        pub fn with_request<V: Into<crate::model::FetchStaticIpsRequest>>(mut self, v: V) -> Self {
2072            self.0.request = v.into();
2073            self
2074        }
2075
2076        /// Sets all the options, replacing any prior values.
2077        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2078            self.0.options = v.into();
2079            self
2080        }
2081
2082        /// Sends the request.
2083        pub async fn send(self) -> Result<crate::model::FetchStaticIpsResponse> {
2084            (*self.0.stub)
2085                .fetch_static_ips(self.0.request, self.0.options)
2086                .await
2087                .map(gax::response::Response::into_body)
2088        }
2089
2090        /// Sets the value of [name][crate::model::FetchStaticIpsRequest::name].
2091        ///
2092        /// This is a **required** field for requests.
2093        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2094            self.0.request.name = v.into();
2095            self
2096        }
2097
2098        /// Sets the value of [page_size][crate::model::FetchStaticIpsRequest::page_size].
2099        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2100            self.0.request.page_size = v.into();
2101            self
2102        }
2103
2104        /// Sets the value of [page_token][crate::model::FetchStaticIpsRequest::page_token].
2105        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2106            self.0.request.page_token = v.into();
2107            self
2108        }
2109    }
2110
2111    #[doc(hidden)]
2112    impl gax::options::internal::RequestBuilder for FetchStaticIps {
2113        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2114            &mut self.0.options
2115        }
2116    }
2117
2118    /// The request builder for [Datastream::create_private_connection][crate::client::Datastream::create_private_connection] calls.
2119    ///
2120    /// # Example
2121    /// ```no_run
2122    /// # use google_cloud_datastream_v1::builder;
2123    /// use builder::datastream::CreatePrivateConnection;
2124    /// # tokio_test::block_on(async {
2125    /// use lro::Poller;
2126    ///
2127    /// let builder = prepare_request_builder();
2128    /// let response = builder.poller().until_done().await?;
2129    /// # gax::Result::<()>::Ok(()) });
2130    ///
2131    /// fn prepare_request_builder() -> CreatePrivateConnection {
2132    ///   # panic!();
2133    ///   // ... details omitted ...
2134    /// }
2135    /// ```
2136    #[derive(Clone, Debug)]
2137    pub struct CreatePrivateConnection(
2138        RequestBuilder<crate::model::CreatePrivateConnectionRequest>,
2139    );
2140
2141    impl CreatePrivateConnection {
2142        pub(crate) fn new(
2143            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2144        ) -> Self {
2145            Self(RequestBuilder::new(stub))
2146        }
2147
2148        /// Sets the full request, replacing any prior values.
2149        pub fn with_request<V: Into<crate::model::CreatePrivateConnectionRequest>>(
2150            mut self,
2151            v: V,
2152        ) -> Self {
2153            self.0.request = v.into();
2154            self
2155        }
2156
2157        /// Sets all the options, replacing any prior values.
2158        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2159            self.0.options = v.into();
2160            self
2161        }
2162
2163        /// Sends the request.
2164        ///
2165        /// # Long running operations
2166        ///
2167        /// This starts, but does not poll, a longrunning operation. More information
2168        /// on [create_private_connection][crate::client::Datastream::create_private_connection].
2169        pub async fn send(self) -> Result<longrunning::model::Operation> {
2170            (*self.0.stub)
2171                .create_private_connection(self.0.request, self.0.options)
2172                .await
2173                .map(gax::response::Response::into_body)
2174        }
2175
2176        /// Creates a [Poller][lro::Poller] to work with `create_private_connection`.
2177        pub fn poller(
2178            self,
2179        ) -> impl lro::Poller<crate::model::PrivateConnection, crate::model::OperationMetadata>
2180        {
2181            type Operation = lro::internal::Operation<
2182                crate::model::PrivateConnection,
2183                crate::model::OperationMetadata,
2184            >;
2185            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2186            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2187
2188            let stub = self.0.stub.clone();
2189            let mut options = self.0.options.clone();
2190            options.set_retry_policy(gax::retry_policy::NeverRetry);
2191            let query = move |name| {
2192                let stub = stub.clone();
2193                let options = options.clone();
2194                async {
2195                    let op = GetOperation::new(stub)
2196                        .set_name(name)
2197                        .with_options(options)
2198                        .send()
2199                        .await?;
2200                    Ok(Operation::new(op))
2201                }
2202            };
2203
2204            let start = move || async {
2205                let op = self.send().await?;
2206                Ok(Operation::new(op))
2207            };
2208
2209            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2210        }
2211
2212        /// Sets the value of [parent][crate::model::CreatePrivateConnectionRequest::parent].
2213        ///
2214        /// This is a **required** field for requests.
2215        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2216            self.0.request.parent = v.into();
2217            self
2218        }
2219
2220        /// Sets the value of [private_connection_id][crate::model::CreatePrivateConnectionRequest::private_connection_id].
2221        ///
2222        /// This is a **required** field for requests.
2223        pub fn set_private_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2224            self.0.request.private_connection_id = v.into();
2225            self
2226        }
2227
2228        /// Sets the value of [private_connection][crate::model::CreatePrivateConnectionRequest::private_connection].
2229        ///
2230        /// This is a **required** field for requests.
2231        pub fn set_private_connection<T>(mut self, v: T) -> Self
2232        where
2233            T: std::convert::Into<crate::model::PrivateConnection>,
2234        {
2235            self.0.request.private_connection = std::option::Option::Some(v.into());
2236            self
2237        }
2238
2239        /// Sets or clears the value of [private_connection][crate::model::CreatePrivateConnectionRequest::private_connection].
2240        ///
2241        /// This is a **required** field for requests.
2242        pub fn set_or_clear_private_connection<T>(mut self, v: std::option::Option<T>) -> Self
2243        where
2244            T: std::convert::Into<crate::model::PrivateConnection>,
2245        {
2246            self.0.request.private_connection = v.map(|x| x.into());
2247            self
2248        }
2249
2250        /// Sets the value of [request_id][crate::model::CreatePrivateConnectionRequest::request_id].
2251        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2252            self.0.request.request_id = v.into();
2253            self
2254        }
2255
2256        /// Sets the value of [force][crate::model::CreatePrivateConnectionRequest::force].
2257        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
2258            self.0.request.force = v.into();
2259            self
2260        }
2261
2262        /// Sets the value of [validate_only][crate::model::CreatePrivateConnectionRequest::validate_only].
2263        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2264            self.0.request.validate_only = v.into();
2265            self
2266        }
2267    }
2268
2269    #[doc(hidden)]
2270    impl gax::options::internal::RequestBuilder for CreatePrivateConnection {
2271        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2272            &mut self.0.options
2273        }
2274    }
2275
2276    /// The request builder for [Datastream::get_private_connection][crate::client::Datastream::get_private_connection] calls.
2277    ///
2278    /// # Example
2279    /// ```no_run
2280    /// # use google_cloud_datastream_v1::builder;
2281    /// use builder::datastream::GetPrivateConnection;
2282    /// # tokio_test::block_on(async {
2283    ///
2284    /// let builder = prepare_request_builder();
2285    /// let response = builder.send().await?;
2286    /// # gax::Result::<()>::Ok(()) });
2287    ///
2288    /// fn prepare_request_builder() -> GetPrivateConnection {
2289    ///   # panic!();
2290    ///   // ... details omitted ...
2291    /// }
2292    /// ```
2293    #[derive(Clone, Debug)]
2294    pub struct GetPrivateConnection(RequestBuilder<crate::model::GetPrivateConnectionRequest>);
2295
2296    impl GetPrivateConnection {
2297        pub(crate) fn new(
2298            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2299        ) -> Self {
2300            Self(RequestBuilder::new(stub))
2301        }
2302
2303        /// Sets the full request, replacing any prior values.
2304        pub fn with_request<V: Into<crate::model::GetPrivateConnectionRequest>>(
2305            mut self,
2306            v: V,
2307        ) -> Self {
2308            self.0.request = v.into();
2309            self
2310        }
2311
2312        /// Sets all the options, replacing any prior values.
2313        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2314            self.0.options = v.into();
2315            self
2316        }
2317
2318        /// Sends the request.
2319        pub async fn send(self) -> Result<crate::model::PrivateConnection> {
2320            (*self.0.stub)
2321                .get_private_connection(self.0.request, self.0.options)
2322                .await
2323                .map(gax::response::Response::into_body)
2324        }
2325
2326        /// Sets the value of [name][crate::model::GetPrivateConnectionRequest::name].
2327        ///
2328        /// This is a **required** field for requests.
2329        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2330            self.0.request.name = v.into();
2331            self
2332        }
2333    }
2334
2335    #[doc(hidden)]
2336    impl gax::options::internal::RequestBuilder for GetPrivateConnection {
2337        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2338            &mut self.0.options
2339        }
2340    }
2341
2342    /// The request builder for [Datastream::list_private_connections][crate::client::Datastream::list_private_connections] calls.
2343    ///
2344    /// # Example
2345    /// ```no_run
2346    /// # use google_cloud_datastream_v1::builder;
2347    /// use builder::datastream::ListPrivateConnections;
2348    /// # tokio_test::block_on(async {
2349    /// use gax::paginator::ItemPaginator;
2350    ///
2351    /// let builder = prepare_request_builder();
2352    /// let mut items = builder.by_item();
2353    /// while let Some(result) = items.next().await {
2354    ///   let item = result?;
2355    /// }
2356    /// # gax::Result::<()>::Ok(()) });
2357    ///
2358    /// fn prepare_request_builder() -> ListPrivateConnections {
2359    ///   # panic!();
2360    ///   // ... details omitted ...
2361    /// }
2362    /// ```
2363    #[derive(Clone, Debug)]
2364    pub struct ListPrivateConnections(RequestBuilder<crate::model::ListPrivateConnectionsRequest>);
2365
2366    impl ListPrivateConnections {
2367        pub(crate) fn new(
2368            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2369        ) -> Self {
2370            Self(RequestBuilder::new(stub))
2371        }
2372
2373        /// Sets the full request, replacing any prior values.
2374        pub fn with_request<V: Into<crate::model::ListPrivateConnectionsRequest>>(
2375            mut self,
2376            v: V,
2377        ) -> Self {
2378            self.0.request = v.into();
2379            self
2380        }
2381
2382        /// Sets all the options, replacing any prior values.
2383        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2384            self.0.options = v.into();
2385            self
2386        }
2387
2388        /// Sends the request.
2389        pub async fn send(self) -> Result<crate::model::ListPrivateConnectionsResponse> {
2390            (*self.0.stub)
2391                .list_private_connections(self.0.request, self.0.options)
2392                .await
2393                .map(gax::response::Response::into_body)
2394        }
2395
2396        /// Streams each page in the collection.
2397        pub fn by_page(
2398            self,
2399        ) -> impl gax::paginator::Paginator<
2400            crate::model::ListPrivateConnectionsResponse,
2401            gax::error::Error,
2402        > {
2403            use std::clone::Clone;
2404            let token = self.0.request.page_token.clone();
2405            let execute = move |token: String| {
2406                let mut builder = self.clone();
2407                builder.0.request = builder.0.request.set_page_token(token);
2408                builder.send()
2409            };
2410            gax::paginator::internal::new_paginator(token, execute)
2411        }
2412
2413        /// Streams each item in the collection.
2414        pub fn by_item(
2415            self,
2416        ) -> impl gax::paginator::ItemPaginator<
2417            crate::model::ListPrivateConnectionsResponse,
2418            gax::error::Error,
2419        > {
2420            use gax::paginator::Paginator;
2421            self.by_page().items()
2422        }
2423
2424        /// Sets the value of [parent][crate::model::ListPrivateConnectionsRequest::parent].
2425        ///
2426        /// This is a **required** field for requests.
2427        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2428            self.0.request.parent = v.into();
2429            self
2430        }
2431
2432        /// Sets the value of [page_size][crate::model::ListPrivateConnectionsRequest::page_size].
2433        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2434            self.0.request.page_size = v.into();
2435            self
2436        }
2437
2438        /// Sets the value of [page_token][crate::model::ListPrivateConnectionsRequest::page_token].
2439        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2440            self.0.request.page_token = v.into();
2441            self
2442        }
2443
2444        /// Sets the value of [filter][crate::model::ListPrivateConnectionsRequest::filter].
2445        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2446            self.0.request.filter = v.into();
2447            self
2448        }
2449
2450        /// Sets the value of [order_by][crate::model::ListPrivateConnectionsRequest::order_by].
2451        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2452            self.0.request.order_by = v.into();
2453            self
2454        }
2455    }
2456
2457    #[doc(hidden)]
2458    impl gax::options::internal::RequestBuilder for ListPrivateConnections {
2459        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2460            &mut self.0.options
2461        }
2462    }
2463
2464    /// The request builder for [Datastream::delete_private_connection][crate::client::Datastream::delete_private_connection] calls.
2465    ///
2466    /// # Example
2467    /// ```no_run
2468    /// # use google_cloud_datastream_v1::builder;
2469    /// use builder::datastream::DeletePrivateConnection;
2470    /// # tokio_test::block_on(async {
2471    /// use lro::Poller;
2472    ///
2473    /// let builder = prepare_request_builder();
2474    /// let response = builder.poller().until_done().await?;
2475    /// # gax::Result::<()>::Ok(()) });
2476    ///
2477    /// fn prepare_request_builder() -> DeletePrivateConnection {
2478    ///   # panic!();
2479    ///   // ... details omitted ...
2480    /// }
2481    /// ```
2482    #[derive(Clone, Debug)]
2483    pub struct DeletePrivateConnection(
2484        RequestBuilder<crate::model::DeletePrivateConnectionRequest>,
2485    );
2486
2487    impl DeletePrivateConnection {
2488        pub(crate) fn new(
2489            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2490        ) -> Self {
2491            Self(RequestBuilder::new(stub))
2492        }
2493
2494        /// Sets the full request, replacing any prior values.
2495        pub fn with_request<V: Into<crate::model::DeletePrivateConnectionRequest>>(
2496            mut self,
2497            v: V,
2498        ) -> Self {
2499            self.0.request = v.into();
2500            self
2501        }
2502
2503        /// Sets all the options, replacing any prior values.
2504        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2505            self.0.options = v.into();
2506            self
2507        }
2508
2509        /// Sends the request.
2510        ///
2511        /// # Long running operations
2512        ///
2513        /// This starts, but does not poll, a longrunning operation. More information
2514        /// on [delete_private_connection][crate::client::Datastream::delete_private_connection].
2515        pub async fn send(self) -> Result<longrunning::model::Operation> {
2516            (*self.0.stub)
2517                .delete_private_connection(self.0.request, self.0.options)
2518                .await
2519                .map(gax::response::Response::into_body)
2520        }
2521
2522        /// Creates a [Poller][lro::Poller] to work with `delete_private_connection`.
2523        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
2524            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2525            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2526            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2527
2528            let stub = self.0.stub.clone();
2529            let mut options = self.0.options.clone();
2530            options.set_retry_policy(gax::retry_policy::NeverRetry);
2531            let query = move |name| {
2532                let stub = stub.clone();
2533                let options = options.clone();
2534                async {
2535                    let op = GetOperation::new(stub)
2536                        .set_name(name)
2537                        .with_options(options)
2538                        .send()
2539                        .await?;
2540                    Ok(Operation::new(op))
2541                }
2542            };
2543
2544            let start = move || async {
2545                let op = self.send().await?;
2546                Ok(Operation::new(op))
2547            };
2548
2549            lro::internal::new_unit_response_poller(
2550                polling_error_policy,
2551                polling_backoff_policy,
2552                start,
2553                query,
2554            )
2555        }
2556
2557        /// Sets the value of [name][crate::model::DeletePrivateConnectionRequest::name].
2558        ///
2559        /// This is a **required** field for requests.
2560        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2561            self.0.request.name = v.into();
2562            self
2563        }
2564
2565        /// Sets the value of [request_id][crate::model::DeletePrivateConnectionRequest::request_id].
2566        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2567            self.0.request.request_id = v.into();
2568            self
2569        }
2570
2571        /// Sets the value of [force][crate::model::DeletePrivateConnectionRequest::force].
2572        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
2573            self.0.request.force = v.into();
2574            self
2575        }
2576    }
2577
2578    #[doc(hidden)]
2579    impl gax::options::internal::RequestBuilder for DeletePrivateConnection {
2580        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2581            &mut self.0.options
2582        }
2583    }
2584
2585    /// The request builder for [Datastream::create_route][crate::client::Datastream::create_route] calls.
2586    ///
2587    /// # Example
2588    /// ```no_run
2589    /// # use google_cloud_datastream_v1::builder;
2590    /// use builder::datastream::CreateRoute;
2591    /// # tokio_test::block_on(async {
2592    /// use lro::Poller;
2593    ///
2594    /// let builder = prepare_request_builder();
2595    /// let response = builder.poller().until_done().await?;
2596    /// # gax::Result::<()>::Ok(()) });
2597    ///
2598    /// fn prepare_request_builder() -> CreateRoute {
2599    ///   # panic!();
2600    ///   // ... details omitted ...
2601    /// }
2602    /// ```
2603    #[derive(Clone, Debug)]
2604    pub struct CreateRoute(RequestBuilder<crate::model::CreateRouteRequest>);
2605
2606    impl CreateRoute {
2607        pub(crate) fn new(
2608            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2609        ) -> Self {
2610            Self(RequestBuilder::new(stub))
2611        }
2612
2613        /// Sets the full request, replacing any prior values.
2614        pub fn with_request<V: Into<crate::model::CreateRouteRequest>>(mut self, v: V) -> Self {
2615            self.0.request = v.into();
2616            self
2617        }
2618
2619        /// Sets all the options, replacing any prior values.
2620        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2621            self.0.options = v.into();
2622            self
2623        }
2624
2625        /// Sends the request.
2626        ///
2627        /// # Long running operations
2628        ///
2629        /// This starts, but does not poll, a longrunning operation. More information
2630        /// on [create_route][crate::client::Datastream::create_route].
2631        pub async fn send(self) -> Result<longrunning::model::Operation> {
2632            (*self.0.stub)
2633                .create_route(self.0.request, self.0.options)
2634                .await
2635                .map(gax::response::Response::into_body)
2636        }
2637
2638        /// Creates a [Poller][lro::Poller] to work with `create_route`.
2639        pub fn poller(
2640            self,
2641        ) -> impl lro::Poller<crate::model::Route, crate::model::OperationMetadata> {
2642            type Operation =
2643                lro::internal::Operation<crate::model::Route, crate::model::OperationMetadata>;
2644            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2645            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2646
2647            let stub = self.0.stub.clone();
2648            let mut options = self.0.options.clone();
2649            options.set_retry_policy(gax::retry_policy::NeverRetry);
2650            let query = move |name| {
2651                let stub = stub.clone();
2652                let options = options.clone();
2653                async {
2654                    let op = GetOperation::new(stub)
2655                        .set_name(name)
2656                        .with_options(options)
2657                        .send()
2658                        .await?;
2659                    Ok(Operation::new(op))
2660                }
2661            };
2662
2663            let start = move || async {
2664                let op = self.send().await?;
2665                Ok(Operation::new(op))
2666            };
2667
2668            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2669        }
2670
2671        /// Sets the value of [parent][crate::model::CreateRouteRequest::parent].
2672        ///
2673        /// This is a **required** field for requests.
2674        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2675            self.0.request.parent = v.into();
2676            self
2677        }
2678
2679        /// Sets the value of [route_id][crate::model::CreateRouteRequest::route_id].
2680        ///
2681        /// This is a **required** field for requests.
2682        pub fn set_route_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2683            self.0.request.route_id = v.into();
2684            self
2685        }
2686
2687        /// Sets the value of [route][crate::model::CreateRouteRequest::route].
2688        ///
2689        /// This is a **required** field for requests.
2690        pub fn set_route<T>(mut self, v: T) -> Self
2691        where
2692            T: std::convert::Into<crate::model::Route>,
2693        {
2694            self.0.request.route = std::option::Option::Some(v.into());
2695            self
2696        }
2697
2698        /// Sets or clears the value of [route][crate::model::CreateRouteRequest::route].
2699        ///
2700        /// This is a **required** field for requests.
2701        pub fn set_or_clear_route<T>(mut self, v: std::option::Option<T>) -> Self
2702        where
2703            T: std::convert::Into<crate::model::Route>,
2704        {
2705            self.0.request.route = v.map(|x| x.into());
2706            self
2707        }
2708
2709        /// Sets the value of [request_id][crate::model::CreateRouteRequest::request_id].
2710        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2711            self.0.request.request_id = v.into();
2712            self
2713        }
2714    }
2715
2716    #[doc(hidden)]
2717    impl gax::options::internal::RequestBuilder for CreateRoute {
2718        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2719            &mut self.0.options
2720        }
2721    }
2722
2723    /// The request builder for [Datastream::get_route][crate::client::Datastream::get_route] calls.
2724    ///
2725    /// # Example
2726    /// ```no_run
2727    /// # use google_cloud_datastream_v1::builder;
2728    /// use builder::datastream::GetRoute;
2729    /// # tokio_test::block_on(async {
2730    ///
2731    /// let builder = prepare_request_builder();
2732    /// let response = builder.send().await?;
2733    /// # gax::Result::<()>::Ok(()) });
2734    ///
2735    /// fn prepare_request_builder() -> GetRoute {
2736    ///   # panic!();
2737    ///   // ... details omitted ...
2738    /// }
2739    /// ```
2740    #[derive(Clone, Debug)]
2741    pub struct GetRoute(RequestBuilder<crate::model::GetRouteRequest>);
2742
2743    impl GetRoute {
2744        pub(crate) fn new(
2745            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2746        ) -> Self {
2747            Self(RequestBuilder::new(stub))
2748        }
2749
2750        /// Sets the full request, replacing any prior values.
2751        pub fn with_request<V: Into<crate::model::GetRouteRequest>>(mut self, v: V) -> Self {
2752            self.0.request = v.into();
2753            self
2754        }
2755
2756        /// Sets all the options, replacing any prior values.
2757        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2758            self.0.options = v.into();
2759            self
2760        }
2761
2762        /// Sends the request.
2763        pub async fn send(self) -> Result<crate::model::Route> {
2764            (*self.0.stub)
2765                .get_route(self.0.request, self.0.options)
2766                .await
2767                .map(gax::response::Response::into_body)
2768        }
2769
2770        /// Sets the value of [name][crate::model::GetRouteRequest::name].
2771        ///
2772        /// This is a **required** field for requests.
2773        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2774            self.0.request.name = v.into();
2775            self
2776        }
2777    }
2778
2779    #[doc(hidden)]
2780    impl gax::options::internal::RequestBuilder for GetRoute {
2781        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2782            &mut self.0.options
2783        }
2784    }
2785
2786    /// The request builder for [Datastream::list_routes][crate::client::Datastream::list_routes] calls.
2787    ///
2788    /// # Example
2789    /// ```no_run
2790    /// # use google_cloud_datastream_v1::builder;
2791    /// use builder::datastream::ListRoutes;
2792    /// # tokio_test::block_on(async {
2793    /// use gax::paginator::ItemPaginator;
2794    ///
2795    /// let builder = prepare_request_builder();
2796    /// let mut items = builder.by_item();
2797    /// while let Some(result) = items.next().await {
2798    ///   let item = result?;
2799    /// }
2800    /// # gax::Result::<()>::Ok(()) });
2801    ///
2802    /// fn prepare_request_builder() -> ListRoutes {
2803    ///   # panic!();
2804    ///   // ... details omitted ...
2805    /// }
2806    /// ```
2807    #[derive(Clone, Debug)]
2808    pub struct ListRoutes(RequestBuilder<crate::model::ListRoutesRequest>);
2809
2810    impl ListRoutes {
2811        pub(crate) fn new(
2812            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2813        ) -> Self {
2814            Self(RequestBuilder::new(stub))
2815        }
2816
2817        /// Sets the full request, replacing any prior values.
2818        pub fn with_request<V: Into<crate::model::ListRoutesRequest>>(mut self, v: V) -> Self {
2819            self.0.request = v.into();
2820            self
2821        }
2822
2823        /// Sets all the options, replacing any prior values.
2824        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2825            self.0.options = v.into();
2826            self
2827        }
2828
2829        /// Sends the request.
2830        pub async fn send(self) -> Result<crate::model::ListRoutesResponse> {
2831            (*self.0.stub)
2832                .list_routes(self.0.request, self.0.options)
2833                .await
2834                .map(gax::response::Response::into_body)
2835        }
2836
2837        /// Streams each page in the collection.
2838        pub fn by_page(
2839            self,
2840        ) -> impl gax::paginator::Paginator<crate::model::ListRoutesResponse, gax::error::Error>
2841        {
2842            use std::clone::Clone;
2843            let token = self.0.request.page_token.clone();
2844            let execute = move |token: String| {
2845                let mut builder = self.clone();
2846                builder.0.request = builder.0.request.set_page_token(token);
2847                builder.send()
2848            };
2849            gax::paginator::internal::new_paginator(token, execute)
2850        }
2851
2852        /// Streams each item in the collection.
2853        pub fn by_item(
2854            self,
2855        ) -> impl gax::paginator::ItemPaginator<crate::model::ListRoutesResponse, gax::error::Error>
2856        {
2857            use gax::paginator::Paginator;
2858            self.by_page().items()
2859        }
2860
2861        /// Sets the value of [parent][crate::model::ListRoutesRequest::parent].
2862        ///
2863        /// This is a **required** field for requests.
2864        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2865            self.0.request.parent = v.into();
2866            self
2867        }
2868
2869        /// Sets the value of [page_size][crate::model::ListRoutesRequest::page_size].
2870        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2871            self.0.request.page_size = v.into();
2872            self
2873        }
2874
2875        /// Sets the value of [page_token][crate::model::ListRoutesRequest::page_token].
2876        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2877            self.0.request.page_token = v.into();
2878            self
2879        }
2880
2881        /// Sets the value of [filter][crate::model::ListRoutesRequest::filter].
2882        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2883            self.0.request.filter = v.into();
2884            self
2885        }
2886
2887        /// Sets the value of [order_by][crate::model::ListRoutesRequest::order_by].
2888        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2889            self.0.request.order_by = v.into();
2890            self
2891        }
2892    }
2893
2894    #[doc(hidden)]
2895    impl gax::options::internal::RequestBuilder for ListRoutes {
2896        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2897            &mut self.0.options
2898        }
2899    }
2900
2901    /// The request builder for [Datastream::delete_route][crate::client::Datastream::delete_route] calls.
2902    ///
2903    /// # Example
2904    /// ```no_run
2905    /// # use google_cloud_datastream_v1::builder;
2906    /// use builder::datastream::DeleteRoute;
2907    /// # tokio_test::block_on(async {
2908    /// use lro::Poller;
2909    ///
2910    /// let builder = prepare_request_builder();
2911    /// let response = builder.poller().until_done().await?;
2912    /// # gax::Result::<()>::Ok(()) });
2913    ///
2914    /// fn prepare_request_builder() -> DeleteRoute {
2915    ///   # panic!();
2916    ///   // ... details omitted ...
2917    /// }
2918    /// ```
2919    #[derive(Clone, Debug)]
2920    pub struct DeleteRoute(RequestBuilder<crate::model::DeleteRouteRequest>);
2921
2922    impl DeleteRoute {
2923        pub(crate) fn new(
2924            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2925        ) -> Self {
2926            Self(RequestBuilder::new(stub))
2927        }
2928
2929        /// Sets the full request, replacing any prior values.
2930        pub fn with_request<V: Into<crate::model::DeleteRouteRequest>>(mut self, v: V) -> Self {
2931            self.0.request = v.into();
2932            self
2933        }
2934
2935        /// Sets all the options, replacing any prior values.
2936        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2937            self.0.options = v.into();
2938            self
2939        }
2940
2941        /// Sends the request.
2942        ///
2943        /// # Long running operations
2944        ///
2945        /// This starts, but does not poll, a longrunning operation. More information
2946        /// on [delete_route][crate::client::Datastream::delete_route].
2947        pub async fn send(self) -> Result<longrunning::model::Operation> {
2948            (*self.0.stub)
2949                .delete_route(self.0.request, self.0.options)
2950                .await
2951                .map(gax::response::Response::into_body)
2952        }
2953
2954        /// Creates a [Poller][lro::Poller] to work with `delete_route`.
2955        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
2956            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2957            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2958            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2959
2960            let stub = self.0.stub.clone();
2961            let mut options = self.0.options.clone();
2962            options.set_retry_policy(gax::retry_policy::NeverRetry);
2963            let query = move |name| {
2964                let stub = stub.clone();
2965                let options = options.clone();
2966                async {
2967                    let op = GetOperation::new(stub)
2968                        .set_name(name)
2969                        .with_options(options)
2970                        .send()
2971                        .await?;
2972                    Ok(Operation::new(op))
2973                }
2974            };
2975
2976            let start = move || async {
2977                let op = self.send().await?;
2978                Ok(Operation::new(op))
2979            };
2980
2981            lro::internal::new_unit_response_poller(
2982                polling_error_policy,
2983                polling_backoff_policy,
2984                start,
2985                query,
2986            )
2987        }
2988
2989        /// Sets the value of [name][crate::model::DeleteRouteRequest::name].
2990        ///
2991        /// This is a **required** field for requests.
2992        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2993            self.0.request.name = v.into();
2994            self
2995        }
2996
2997        /// Sets the value of [request_id][crate::model::DeleteRouteRequest::request_id].
2998        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2999            self.0.request.request_id = v.into();
3000            self
3001        }
3002    }
3003
3004    #[doc(hidden)]
3005    impl gax::options::internal::RequestBuilder for DeleteRoute {
3006        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3007            &mut self.0.options
3008        }
3009    }
3010
3011    /// The request builder for [Datastream::list_locations][crate::client::Datastream::list_locations] calls.
3012    ///
3013    /// # Example
3014    /// ```no_run
3015    /// # use google_cloud_datastream_v1::builder;
3016    /// use builder::datastream::ListLocations;
3017    /// # tokio_test::block_on(async {
3018    /// use gax::paginator::ItemPaginator;
3019    ///
3020    /// let builder = prepare_request_builder();
3021    /// let mut items = builder.by_item();
3022    /// while let Some(result) = items.next().await {
3023    ///   let item = result?;
3024    /// }
3025    /// # gax::Result::<()>::Ok(()) });
3026    ///
3027    /// fn prepare_request_builder() -> ListLocations {
3028    ///   # panic!();
3029    ///   // ... details omitted ...
3030    /// }
3031    /// ```
3032    #[derive(Clone, Debug)]
3033    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
3034
3035    impl ListLocations {
3036        pub(crate) fn new(
3037            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3038        ) -> Self {
3039            Self(RequestBuilder::new(stub))
3040        }
3041
3042        /// Sets the full request, replacing any prior values.
3043        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
3044            mut self,
3045            v: V,
3046        ) -> Self {
3047            self.0.request = v.into();
3048            self
3049        }
3050
3051        /// Sets all the options, replacing any prior values.
3052        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3053            self.0.options = v.into();
3054            self
3055        }
3056
3057        /// Sends the request.
3058        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
3059            (*self.0.stub)
3060                .list_locations(self.0.request, self.0.options)
3061                .await
3062                .map(gax::response::Response::into_body)
3063        }
3064
3065        /// Streams each page in the collection.
3066        pub fn by_page(
3067            self,
3068        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
3069        {
3070            use std::clone::Clone;
3071            let token = self.0.request.page_token.clone();
3072            let execute = move |token: String| {
3073                let mut builder = self.clone();
3074                builder.0.request = builder.0.request.set_page_token(token);
3075                builder.send()
3076            };
3077            gax::paginator::internal::new_paginator(token, execute)
3078        }
3079
3080        /// Streams each item in the collection.
3081        pub fn by_item(
3082            self,
3083        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
3084        {
3085            use gax::paginator::Paginator;
3086            self.by_page().items()
3087        }
3088
3089        /// Sets the value of [name][location::model::ListLocationsRequest::name].
3090        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3091            self.0.request.name = v.into();
3092            self
3093        }
3094
3095        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
3096        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3097            self.0.request.filter = v.into();
3098            self
3099        }
3100
3101        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
3102        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3103            self.0.request.page_size = v.into();
3104            self
3105        }
3106
3107        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
3108        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3109            self.0.request.page_token = v.into();
3110            self
3111        }
3112    }
3113
3114    #[doc(hidden)]
3115    impl gax::options::internal::RequestBuilder for ListLocations {
3116        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3117            &mut self.0.options
3118        }
3119    }
3120
3121    /// The request builder for [Datastream::get_location][crate::client::Datastream::get_location] calls.
3122    ///
3123    /// # Example
3124    /// ```no_run
3125    /// # use google_cloud_datastream_v1::builder;
3126    /// use builder::datastream::GetLocation;
3127    /// # tokio_test::block_on(async {
3128    ///
3129    /// let builder = prepare_request_builder();
3130    /// let response = builder.send().await?;
3131    /// # gax::Result::<()>::Ok(()) });
3132    ///
3133    /// fn prepare_request_builder() -> GetLocation {
3134    ///   # panic!();
3135    ///   // ... details omitted ...
3136    /// }
3137    /// ```
3138    #[derive(Clone, Debug)]
3139    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
3140
3141    impl GetLocation {
3142        pub(crate) fn new(
3143            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3144        ) -> Self {
3145            Self(RequestBuilder::new(stub))
3146        }
3147
3148        /// Sets the full request, replacing any prior values.
3149        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
3150            self.0.request = v.into();
3151            self
3152        }
3153
3154        /// Sets all the options, replacing any prior values.
3155        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3156            self.0.options = v.into();
3157            self
3158        }
3159
3160        /// Sends the request.
3161        pub async fn send(self) -> Result<location::model::Location> {
3162            (*self.0.stub)
3163                .get_location(self.0.request, self.0.options)
3164                .await
3165                .map(gax::response::Response::into_body)
3166        }
3167
3168        /// Sets the value of [name][location::model::GetLocationRequest::name].
3169        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3170            self.0.request.name = v.into();
3171            self
3172        }
3173    }
3174
3175    #[doc(hidden)]
3176    impl gax::options::internal::RequestBuilder for GetLocation {
3177        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3178            &mut self.0.options
3179        }
3180    }
3181
3182    /// The request builder for [Datastream::list_operations][crate::client::Datastream::list_operations] calls.
3183    ///
3184    /// # Example
3185    /// ```no_run
3186    /// # use google_cloud_datastream_v1::builder;
3187    /// use builder::datastream::ListOperations;
3188    /// # tokio_test::block_on(async {
3189    /// use gax::paginator::ItemPaginator;
3190    ///
3191    /// let builder = prepare_request_builder();
3192    /// let mut items = builder.by_item();
3193    /// while let Some(result) = items.next().await {
3194    ///   let item = result?;
3195    /// }
3196    /// # gax::Result::<()>::Ok(()) });
3197    ///
3198    /// fn prepare_request_builder() -> ListOperations {
3199    ///   # panic!();
3200    ///   // ... details omitted ...
3201    /// }
3202    /// ```
3203    #[derive(Clone, Debug)]
3204    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3205
3206    impl ListOperations {
3207        pub(crate) fn new(
3208            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3209        ) -> Self {
3210            Self(RequestBuilder::new(stub))
3211        }
3212
3213        /// Sets the full request, replacing any prior values.
3214        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3215            mut self,
3216            v: V,
3217        ) -> Self {
3218            self.0.request = v.into();
3219            self
3220        }
3221
3222        /// Sets all the options, replacing any prior values.
3223        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3224            self.0.options = v.into();
3225            self
3226        }
3227
3228        /// Sends the request.
3229        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3230            (*self.0.stub)
3231                .list_operations(self.0.request, self.0.options)
3232                .await
3233                .map(gax::response::Response::into_body)
3234        }
3235
3236        /// Streams each page in the collection.
3237        pub fn by_page(
3238            self,
3239        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3240        {
3241            use std::clone::Clone;
3242            let token = self.0.request.page_token.clone();
3243            let execute = move |token: String| {
3244                let mut builder = self.clone();
3245                builder.0.request = builder.0.request.set_page_token(token);
3246                builder.send()
3247            };
3248            gax::paginator::internal::new_paginator(token, execute)
3249        }
3250
3251        /// Streams each item in the collection.
3252        pub fn by_item(
3253            self,
3254        ) -> impl gax::paginator::ItemPaginator<
3255            longrunning::model::ListOperationsResponse,
3256            gax::error::Error,
3257        > {
3258            use gax::paginator::Paginator;
3259            self.by_page().items()
3260        }
3261
3262        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3263        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3264            self.0.request.name = v.into();
3265            self
3266        }
3267
3268        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3269        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3270            self.0.request.filter = v.into();
3271            self
3272        }
3273
3274        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3275        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3276            self.0.request.page_size = v.into();
3277            self
3278        }
3279
3280        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3281        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3282            self.0.request.page_token = v.into();
3283            self
3284        }
3285    }
3286
3287    #[doc(hidden)]
3288    impl gax::options::internal::RequestBuilder for ListOperations {
3289        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3290            &mut self.0.options
3291        }
3292    }
3293
3294    /// The request builder for [Datastream::get_operation][crate::client::Datastream::get_operation] calls.
3295    ///
3296    /// # Example
3297    /// ```no_run
3298    /// # use google_cloud_datastream_v1::builder;
3299    /// use builder::datastream::GetOperation;
3300    /// # tokio_test::block_on(async {
3301    ///
3302    /// let builder = prepare_request_builder();
3303    /// let response = builder.send().await?;
3304    /// # gax::Result::<()>::Ok(()) });
3305    ///
3306    /// fn prepare_request_builder() -> GetOperation {
3307    ///   # panic!();
3308    ///   // ... details omitted ...
3309    /// }
3310    /// ```
3311    #[derive(Clone, Debug)]
3312    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3313
3314    impl GetOperation {
3315        pub(crate) fn new(
3316            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3317        ) -> Self {
3318            Self(RequestBuilder::new(stub))
3319        }
3320
3321        /// Sets the full request, replacing any prior values.
3322        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3323            mut self,
3324            v: V,
3325        ) -> Self {
3326            self.0.request = v.into();
3327            self
3328        }
3329
3330        /// Sets all the options, replacing any prior values.
3331        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3332            self.0.options = v.into();
3333            self
3334        }
3335
3336        /// Sends the request.
3337        pub async fn send(self) -> Result<longrunning::model::Operation> {
3338            (*self.0.stub)
3339                .get_operation(self.0.request, self.0.options)
3340                .await
3341                .map(gax::response::Response::into_body)
3342        }
3343
3344        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3345        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3346            self.0.request.name = v.into();
3347            self
3348        }
3349    }
3350
3351    #[doc(hidden)]
3352    impl gax::options::internal::RequestBuilder for GetOperation {
3353        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3354            &mut self.0.options
3355        }
3356    }
3357
3358    /// The request builder for [Datastream::delete_operation][crate::client::Datastream::delete_operation] calls.
3359    ///
3360    /// # Example
3361    /// ```no_run
3362    /// # use google_cloud_datastream_v1::builder;
3363    /// use builder::datastream::DeleteOperation;
3364    /// # tokio_test::block_on(async {
3365    ///
3366    /// let builder = prepare_request_builder();
3367    /// let response = builder.send().await?;
3368    /// # gax::Result::<()>::Ok(()) });
3369    ///
3370    /// fn prepare_request_builder() -> DeleteOperation {
3371    ///   # panic!();
3372    ///   // ... details omitted ...
3373    /// }
3374    /// ```
3375    #[derive(Clone, Debug)]
3376    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3377
3378    impl DeleteOperation {
3379        pub(crate) fn new(
3380            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3381        ) -> Self {
3382            Self(RequestBuilder::new(stub))
3383        }
3384
3385        /// Sets the full request, replacing any prior values.
3386        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3387            mut self,
3388            v: V,
3389        ) -> 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        pub async fn send(self) -> Result<()> {
3402            (*self.0.stub)
3403                .delete_operation(self.0.request, self.0.options)
3404                .await
3405                .map(gax::response::Response::into_body)
3406        }
3407
3408        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
3409        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3410            self.0.request.name = v.into();
3411            self
3412        }
3413    }
3414
3415    #[doc(hidden)]
3416    impl gax::options::internal::RequestBuilder for DeleteOperation {
3417        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3418            &mut self.0.options
3419        }
3420    }
3421
3422    /// The request builder for [Datastream::cancel_operation][crate::client::Datastream::cancel_operation] calls.
3423    ///
3424    /// # Example
3425    /// ```no_run
3426    /// # use google_cloud_datastream_v1::builder;
3427    /// use builder::datastream::CancelOperation;
3428    /// # tokio_test::block_on(async {
3429    ///
3430    /// let builder = prepare_request_builder();
3431    /// let response = builder.send().await?;
3432    /// # gax::Result::<()>::Ok(()) });
3433    ///
3434    /// fn prepare_request_builder() -> CancelOperation {
3435    ///   # panic!();
3436    ///   // ... details omitted ...
3437    /// }
3438    /// ```
3439    #[derive(Clone, Debug)]
3440    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
3441
3442    impl CancelOperation {
3443        pub(crate) fn new(
3444            stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3445        ) -> Self {
3446            Self(RequestBuilder::new(stub))
3447        }
3448
3449        /// Sets the full request, replacing any prior values.
3450        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
3451            mut self,
3452            v: V,
3453        ) -> Self {
3454            self.0.request = v.into();
3455            self
3456        }
3457
3458        /// Sets all the options, replacing any prior values.
3459        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3460            self.0.options = v.into();
3461            self
3462        }
3463
3464        /// Sends the request.
3465        pub async fn send(self) -> Result<()> {
3466            (*self.0.stub)
3467                .cancel_operation(self.0.request, self.0.options)
3468                .await
3469                .map(gax::response::Response::into_body)
3470        }
3471
3472        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
3473        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3474            self.0.request.name = v.into();
3475            self
3476        }
3477    }
3478
3479    #[doc(hidden)]
3480    impl gax::options::internal::RequestBuilder for CancelOperation {
3481        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3482            &mut self.0.options
3483        }
3484    }
3485}