Skip to main content

google_cloud_datafusion_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 data_fusion {
18    use crate::Result;
19
20    /// A builder for [DataFusion][crate::client::DataFusion].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_datafusion_v1::*;
25    /// # use builder::data_fusion::ClientBuilder;
26    /// # use client::DataFusion;
27    /// let builder : ClientBuilder = DataFusion::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://datafusion.googleapis.com")
30    ///     .build().await?;
31    /// # 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::DataFusion;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = DataFusion;
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::DataFusion] 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::DataFusion>,
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::DataFusion>,
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 [DataFusion::list_available_versions][crate::client::DataFusion::list_available_versions] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_datafusion_v1::builder::data_fusion::ListAvailableVersions;
79    /// # async fn sample() -> gax::Result<()> {
80    /// use gax::paginator::ItemPaginator;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let mut items = builder.by_item();
84    /// while let Some(result) = items.next().await {
85    ///   let item = result?;
86    /// }
87    /// # Ok(()) }
88    ///
89    /// fn prepare_request_builder() -> ListAvailableVersions {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[derive(Clone, Debug)]
95    pub struct ListAvailableVersions(RequestBuilder<crate::model::ListAvailableVersionsRequest>);
96
97    impl ListAvailableVersions {
98        pub(crate) fn new(
99            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
100        ) -> Self {
101            Self(RequestBuilder::new(stub))
102        }
103
104        /// Sets the full request, replacing any prior values.
105        pub fn with_request<V: Into<crate::model::ListAvailableVersionsRequest>>(
106            mut self,
107            v: V,
108        ) -> Self {
109            self.0.request = v.into();
110            self
111        }
112
113        /// Sets all the options, replacing any prior values.
114        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
115            self.0.options = v.into();
116            self
117        }
118
119        /// Sends the request.
120        pub async fn send(self) -> Result<crate::model::ListAvailableVersionsResponse> {
121            (*self.0.stub)
122                .list_available_versions(self.0.request, self.0.options)
123                .await
124                .map(gax::response::Response::into_body)
125        }
126
127        /// Streams each page in the collection.
128        pub fn by_page(
129            self,
130        ) -> impl gax::paginator::Paginator<crate::model::ListAvailableVersionsResponse, gax::error::Error>
131        {
132            use std::clone::Clone;
133            let token = self.0.request.page_token.clone();
134            let execute = move |token: String| {
135                let mut builder = self.clone();
136                builder.0.request = builder.0.request.set_page_token(token);
137                builder.send()
138            };
139            gax::paginator::internal::new_paginator(token, execute)
140        }
141
142        /// Streams each item in the collection.
143        pub fn by_item(
144            self,
145        ) -> impl gax::paginator::ItemPaginator<
146            crate::model::ListAvailableVersionsResponse,
147            gax::error::Error,
148        > {
149            use gax::paginator::Paginator;
150            self.by_page().items()
151        }
152
153        /// Sets the value of [parent][crate::model::ListAvailableVersionsRequest::parent].
154        ///
155        /// This is a **required** field for requests.
156        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
157            self.0.request.parent = v.into();
158            self
159        }
160
161        /// Sets the value of [page_size][crate::model::ListAvailableVersionsRequest::page_size].
162        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
163            self.0.request.page_size = v.into();
164            self
165        }
166
167        /// Sets the value of [page_token][crate::model::ListAvailableVersionsRequest::page_token].
168        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
169            self.0.request.page_token = v.into();
170            self
171        }
172
173        /// Sets the value of [latest_patch_only][crate::model::ListAvailableVersionsRequest::latest_patch_only].
174        pub fn set_latest_patch_only<T: Into<bool>>(mut self, v: T) -> Self {
175            self.0.request.latest_patch_only = v.into();
176            self
177        }
178    }
179
180    #[doc(hidden)]
181    impl gax::options::internal::RequestBuilder for ListAvailableVersions {
182        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
183            &mut self.0.options
184        }
185    }
186
187    /// The request builder for [DataFusion::list_instances][crate::client::DataFusion::list_instances] calls.
188    ///
189    /// # Example
190    /// ```
191    /// # use google_cloud_datafusion_v1::builder::data_fusion::ListInstances;
192    /// # async fn sample() -> gax::Result<()> {
193    /// use gax::paginator::ItemPaginator;
194    ///
195    /// let builder = prepare_request_builder();
196    /// let mut items = builder.by_item();
197    /// while let Some(result) = items.next().await {
198    ///   let item = result?;
199    /// }
200    /// # Ok(()) }
201    ///
202    /// fn prepare_request_builder() -> ListInstances {
203    ///   # panic!();
204    ///   // ... details omitted ...
205    /// }
206    /// ```
207    #[derive(Clone, Debug)]
208    pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
209
210    impl ListInstances {
211        pub(crate) fn new(
212            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
213        ) -> Self {
214            Self(RequestBuilder::new(stub))
215        }
216
217        /// Sets the full request, replacing any prior values.
218        pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
219            self.0.request = v.into();
220            self
221        }
222
223        /// Sets all the options, replacing any prior values.
224        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
225            self.0.options = v.into();
226            self
227        }
228
229        /// Sends the request.
230        pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
231            (*self.0.stub)
232                .list_instances(self.0.request, self.0.options)
233                .await
234                .map(gax::response::Response::into_body)
235        }
236
237        /// Streams each page in the collection.
238        pub fn by_page(
239            self,
240        ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
241        {
242            use std::clone::Clone;
243            let token = self.0.request.page_token.clone();
244            let execute = move |token: String| {
245                let mut builder = self.clone();
246                builder.0.request = builder.0.request.set_page_token(token);
247                builder.send()
248            };
249            gax::paginator::internal::new_paginator(token, execute)
250        }
251
252        /// Streams each item in the collection.
253        pub fn by_item(
254            self,
255        ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
256        {
257            use gax::paginator::Paginator;
258            self.by_page().items()
259        }
260
261        /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
262        ///
263        /// This is a **required** field for requests.
264        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
265            self.0.request.parent = v.into();
266            self
267        }
268
269        /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
270        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
271            self.0.request.page_size = v.into();
272            self
273        }
274
275        /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
276        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
277            self.0.request.page_token = v.into();
278            self
279        }
280
281        /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
282        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
283            self.0.request.filter = v.into();
284            self
285        }
286
287        /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
288        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
289            self.0.request.order_by = v.into();
290            self
291        }
292    }
293
294    #[doc(hidden)]
295    impl gax::options::internal::RequestBuilder for ListInstances {
296        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
297            &mut self.0.options
298        }
299    }
300
301    /// The request builder for [DataFusion::get_instance][crate::client::DataFusion::get_instance] calls.
302    ///
303    /// # Example
304    /// ```
305    /// # use google_cloud_datafusion_v1::builder::data_fusion::GetInstance;
306    /// # async fn sample() -> gax::Result<()> {
307    ///
308    /// let builder = prepare_request_builder();
309    /// let response = builder.send().await?;
310    /// # Ok(()) }
311    ///
312    /// fn prepare_request_builder() -> GetInstance {
313    ///   # panic!();
314    ///   // ... details omitted ...
315    /// }
316    /// ```
317    #[derive(Clone, Debug)]
318    pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
319
320    impl GetInstance {
321        pub(crate) fn new(
322            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
323        ) -> Self {
324            Self(RequestBuilder::new(stub))
325        }
326
327        /// Sets the full request, replacing any prior values.
328        pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
329            self.0.request = v.into();
330            self
331        }
332
333        /// Sets all the options, replacing any prior values.
334        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
335            self.0.options = v.into();
336            self
337        }
338
339        /// Sends the request.
340        pub async fn send(self) -> Result<crate::model::Instance> {
341            (*self.0.stub)
342                .get_instance(self.0.request, self.0.options)
343                .await
344                .map(gax::response::Response::into_body)
345        }
346
347        /// Sets the value of [name][crate::model::GetInstanceRequest::name].
348        ///
349        /// This is a **required** field for requests.
350        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
351            self.0.request.name = v.into();
352            self
353        }
354    }
355
356    #[doc(hidden)]
357    impl gax::options::internal::RequestBuilder for GetInstance {
358        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
359            &mut self.0.options
360        }
361    }
362
363    /// The request builder for [DataFusion::create_instance][crate::client::DataFusion::create_instance] calls.
364    ///
365    /// # Example
366    /// ```
367    /// # use google_cloud_datafusion_v1::builder::data_fusion::CreateInstance;
368    /// # async fn sample() -> gax::Result<()> {
369    /// use lro::Poller;
370    ///
371    /// let builder = prepare_request_builder();
372    /// let response = builder.poller().until_done().await?;
373    /// # Ok(()) }
374    ///
375    /// fn prepare_request_builder() -> CreateInstance {
376    ///   # panic!();
377    ///   // ... details omitted ...
378    /// }
379    /// ```
380    #[derive(Clone, Debug)]
381    pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
382
383    impl CreateInstance {
384        pub(crate) fn new(
385            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
386        ) -> Self {
387            Self(RequestBuilder::new(stub))
388        }
389
390        /// Sets the full request, replacing any prior values.
391        pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
392            self.0.request = v.into();
393            self
394        }
395
396        /// Sets all the options, replacing any prior values.
397        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
398            self.0.options = v.into();
399            self
400        }
401
402        /// Sends the request.
403        ///
404        /// # Long running operations
405        ///
406        /// This starts, but does not poll, a longrunning operation. More information
407        /// on [create_instance][crate::client::DataFusion::create_instance].
408        pub async fn send(self) -> Result<longrunning::model::Operation> {
409            (*self.0.stub)
410                .create_instance(self.0.request, self.0.options)
411                .await
412                .map(gax::response::Response::into_body)
413        }
414
415        /// Creates a [Poller][lro::Poller] to work with `create_instance`.
416        pub fn poller(
417            self,
418        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
419            type Operation =
420                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
421            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
422            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
423
424            let stub = self.0.stub.clone();
425            let mut options = self.0.options.clone();
426            options.set_retry_policy(gax::retry_policy::NeverRetry);
427            let query = move |name| {
428                let stub = stub.clone();
429                let options = options.clone();
430                async {
431                    let op = GetOperation::new(stub)
432                        .set_name(name)
433                        .with_options(options)
434                        .send()
435                        .await?;
436                    Ok(Operation::new(op))
437                }
438            };
439
440            let start = move || async {
441                let op = self.send().await?;
442                Ok(Operation::new(op))
443            };
444
445            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
446        }
447
448        /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
449        ///
450        /// This is a **required** field for requests.
451        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
452            self.0.request.parent = v.into();
453            self
454        }
455
456        /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
457        ///
458        /// This is a **required** field for requests.
459        pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
460            self.0.request.instance_id = v.into();
461            self
462        }
463
464        /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
465        pub fn set_instance<T>(mut self, v: T) -> Self
466        where
467            T: std::convert::Into<crate::model::Instance>,
468        {
469            self.0.request.instance = std::option::Option::Some(v.into());
470            self
471        }
472
473        /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
474        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
475        where
476            T: std::convert::Into<crate::model::Instance>,
477        {
478            self.0.request.instance = v.map(|x| x.into());
479            self
480        }
481    }
482
483    #[doc(hidden)]
484    impl gax::options::internal::RequestBuilder for CreateInstance {
485        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
486            &mut self.0.options
487        }
488    }
489
490    /// The request builder for [DataFusion::delete_instance][crate::client::DataFusion::delete_instance] calls.
491    ///
492    /// # Example
493    /// ```
494    /// # use google_cloud_datafusion_v1::builder::data_fusion::DeleteInstance;
495    /// # async fn sample() -> gax::Result<()> {
496    /// use lro::Poller;
497    ///
498    /// let builder = prepare_request_builder();
499    /// let response = builder.poller().until_done().await?;
500    /// # Ok(()) }
501    ///
502    /// fn prepare_request_builder() -> DeleteInstance {
503    ///   # panic!();
504    ///   // ... details omitted ...
505    /// }
506    /// ```
507    #[derive(Clone, Debug)]
508    pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
509
510    impl DeleteInstance {
511        pub(crate) fn new(
512            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
513        ) -> Self {
514            Self(RequestBuilder::new(stub))
515        }
516
517        /// Sets the full request, replacing any prior values.
518        pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
519            self.0.request = v.into();
520            self
521        }
522
523        /// Sets all the options, replacing any prior values.
524        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
525            self.0.options = v.into();
526            self
527        }
528
529        /// Sends the request.
530        ///
531        /// # Long running operations
532        ///
533        /// This starts, but does not poll, a longrunning operation. More information
534        /// on [delete_instance][crate::client::DataFusion::delete_instance].
535        pub async fn send(self) -> Result<longrunning::model::Operation> {
536            (*self.0.stub)
537                .delete_instance(self.0.request, self.0.options)
538                .await
539                .map(gax::response::Response::into_body)
540        }
541
542        /// Creates a [Poller][lro::Poller] to work with `delete_instance`.
543        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
544            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
545            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
546            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
547
548            let stub = self.0.stub.clone();
549            let mut options = self.0.options.clone();
550            options.set_retry_policy(gax::retry_policy::NeverRetry);
551            let query = move |name| {
552                let stub = stub.clone();
553                let options = options.clone();
554                async {
555                    let op = GetOperation::new(stub)
556                        .set_name(name)
557                        .with_options(options)
558                        .send()
559                        .await?;
560                    Ok(Operation::new(op))
561                }
562            };
563
564            let start = move || async {
565                let op = self.send().await?;
566                Ok(Operation::new(op))
567            };
568
569            lro::internal::new_unit_response_poller(
570                polling_error_policy,
571                polling_backoff_policy,
572                start,
573                query,
574            )
575        }
576
577        /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
578        ///
579        /// This is a **required** field for requests.
580        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
581            self.0.request.name = v.into();
582            self
583        }
584    }
585
586    #[doc(hidden)]
587    impl gax::options::internal::RequestBuilder for DeleteInstance {
588        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
589            &mut self.0.options
590        }
591    }
592
593    /// The request builder for [DataFusion::update_instance][crate::client::DataFusion::update_instance] calls.
594    ///
595    /// # Example
596    /// ```
597    /// # use google_cloud_datafusion_v1::builder::data_fusion::UpdateInstance;
598    /// # async fn sample() -> gax::Result<()> {
599    /// use lro::Poller;
600    ///
601    /// let builder = prepare_request_builder();
602    /// let response = builder.poller().until_done().await?;
603    /// # Ok(()) }
604    ///
605    /// fn prepare_request_builder() -> UpdateInstance {
606    ///   # panic!();
607    ///   // ... details omitted ...
608    /// }
609    /// ```
610    #[derive(Clone, Debug)]
611    pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
612
613    impl UpdateInstance {
614        pub(crate) fn new(
615            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
616        ) -> Self {
617            Self(RequestBuilder::new(stub))
618        }
619
620        /// Sets the full request, replacing any prior values.
621        pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
622            self.0.request = v.into();
623            self
624        }
625
626        /// Sets all the options, replacing any prior values.
627        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
628            self.0.options = v.into();
629            self
630        }
631
632        /// Sends the request.
633        ///
634        /// # Long running operations
635        ///
636        /// This starts, but does not poll, a longrunning operation. More information
637        /// on [update_instance][crate::client::DataFusion::update_instance].
638        pub async fn send(self) -> Result<longrunning::model::Operation> {
639            (*self.0.stub)
640                .update_instance(self.0.request, self.0.options)
641                .await
642                .map(gax::response::Response::into_body)
643        }
644
645        /// Creates a [Poller][lro::Poller] to work with `update_instance`.
646        pub fn poller(
647            self,
648        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
649            type Operation =
650                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
651            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
652            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
653
654            let stub = self.0.stub.clone();
655            let mut options = self.0.options.clone();
656            options.set_retry_policy(gax::retry_policy::NeverRetry);
657            let query = move |name| {
658                let stub = stub.clone();
659                let options = options.clone();
660                async {
661                    let op = GetOperation::new(stub)
662                        .set_name(name)
663                        .with_options(options)
664                        .send()
665                        .await?;
666                    Ok(Operation::new(op))
667                }
668            };
669
670            let start = move || async {
671                let op = self.send().await?;
672                Ok(Operation::new(op))
673            };
674
675            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
676        }
677
678        /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
679        ///
680        /// This is a **required** field for requests.
681        pub fn set_instance<T>(mut self, v: T) -> Self
682        where
683            T: std::convert::Into<crate::model::Instance>,
684        {
685            self.0.request.instance = std::option::Option::Some(v.into());
686            self
687        }
688
689        /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
690        ///
691        /// This is a **required** field for requests.
692        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
693        where
694            T: std::convert::Into<crate::model::Instance>,
695        {
696            self.0.request.instance = v.map(|x| x.into());
697            self
698        }
699
700        /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
701        pub fn set_update_mask<T>(mut self, v: T) -> Self
702        where
703            T: std::convert::Into<wkt::FieldMask>,
704        {
705            self.0.request.update_mask = std::option::Option::Some(v.into());
706            self
707        }
708
709        /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
710        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
711        where
712            T: std::convert::Into<wkt::FieldMask>,
713        {
714            self.0.request.update_mask = v.map(|x| x.into());
715            self
716        }
717    }
718
719    #[doc(hidden)]
720    impl gax::options::internal::RequestBuilder for UpdateInstance {
721        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
722            &mut self.0.options
723        }
724    }
725
726    /// The request builder for [DataFusion::restart_instance][crate::client::DataFusion::restart_instance] calls.
727    ///
728    /// # Example
729    /// ```
730    /// # use google_cloud_datafusion_v1::builder::data_fusion::RestartInstance;
731    /// # async fn sample() -> gax::Result<()> {
732    /// use lro::Poller;
733    ///
734    /// let builder = prepare_request_builder();
735    /// let response = builder.poller().until_done().await?;
736    /// # Ok(()) }
737    ///
738    /// fn prepare_request_builder() -> RestartInstance {
739    ///   # panic!();
740    ///   // ... details omitted ...
741    /// }
742    /// ```
743    #[derive(Clone, Debug)]
744    pub struct RestartInstance(RequestBuilder<crate::model::RestartInstanceRequest>);
745
746    impl RestartInstance {
747        pub(crate) fn new(
748            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
749        ) -> Self {
750            Self(RequestBuilder::new(stub))
751        }
752
753        /// Sets the full request, replacing any prior values.
754        pub fn with_request<V: Into<crate::model::RestartInstanceRequest>>(mut self, v: V) -> Self {
755            self.0.request = v.into();
756            self
757        }
758
759        /// Sets all the options, replacing any prior values.
760        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
761            self.0.options = v.into();
762            self
763        }
764
765        /// Sends the request.
766        ///
767        /// # Long running operations
768        ///
769        /// This starts, but does not poll, a longrunning operation. More information
770        /// on [restart_instance][crate::client::DataFusion::restart_instance].
771        pub async fn send(self) -> Result<longrunning::model::Operation> {
772            (*self.0.stub)
773                .restart_instance(self.0.request, self.0.options)
774                .await
775                .map(gax::response::Response::into_body)
776        }
777
778        /// Creates a [Poller][lro::Poller] to work with `restart_instance`.
779        pub fn poller(
780            self,
781        ) -> impl lro::Poller<crate::model::Instance, crate::model::OperationMetadata> {
782            type Operation =
783                lro::internal::Operation<crate::model::Instance, crate::model::OperationMetadata>;
784            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
785            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
786
787            let stub = self.0.stub.clone();
788            let mut options = self.0.options.clone();
789            options.set_retry_policy(gax::retry_policy::NeverRetry);
790            let query = move |name| {
791                let stub = stub.clone();
792                let options = options.clone();
793                async {
794                    let op = GetOperation::new(stub)
795                        .set_name(name)
796                        .with_options(options)
797                        .send()
798                        .await?;
799                    Ok(Operation::new(op))
800                }
801            };
802
803            let start = move || async {
804                let op = self.send().await?;
805                Ok(Operation::new(op))
806            };
807
808            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
809        }
810
811        /// Sets the value of [name][crate::model::RestartInstanceRequest::name].
812        ///
813        /// This is a **required** field for requests.
814        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
815            self.0.request.name = v.into();
816            self
817        }
818    }
819
820    #[doc(hidden)]
821    impl gax::options::internal::RequestBuilder for RestartInstance {
822        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
823            &mut self.0.options
824        }
825    }
826
827    /// The request builder for [DataFusion::list_operations][crate::client::DataFusion::list_operations] calls.
828    ///
829    /// # Example
830    /// ```
831    /// # use google_cloud_datafusion_v1::builder::data_fusion::ListOperations;
832    /// # async fn sample() -> gax::Result<()> {
833    /// use gax::paginator::ItemPaginator;
834    ///
835    /// let builder = prepare_request_builder();
836    /// let mut items = builder.by_item();
837    /// while let Some(result) = items.next().await {
838    ///   let item = result?;
839    /// }
840    /// # Ok(()) }
841    ///
842    /// fn prepare_request_builder() -> ListOperations {
843    ///   # panic!();
844    ///   // ... details omitted ...
845    /// }
846    /// ```
847    #[derive(Clone, Debug)]
848    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
849
850    impl ListOperations {
851        pub(crate) fn new(
852            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
853        ) -> Self {
854            Self(RequestBuilder::new(stub))
855        }
856
857        /// Sets the full request, replacing any prior values.
858        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
859            mut self,
860            v: V,
861        ) -> Self {
862            self.0.request = v.into();
863            self
864        }
865
866        /// Sets all the options, replacing any prior values.
867        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
868            self.0.options = v.into();
869            self
870        }
871
872        /// Sends the request.
873        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
874            (*self.0.stub)
875                .list_operations(self.0.request, self.0.options)
876                .await
877                .map(gax::response::Response::into_body)
878        }
879
880        /// Streams each page in the collection.
881        pub fn by_page(
882            self,
883        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
884        {
885            use std::clone::Clone;
886            let token = self.0.request.page_token.clone();
887            let execute = move |token: String| {
888                let mut builder = self.clone();
889                builder.0.request = builder.0.request.set_page_token(token);
890                builder.send()
891            };
892            gax::paginator::internal::new_paginator(token, execute)
893        }
894
895        /// Streams each item in the collection.
896        pub fn by_item(
897            self,
898        ) -> impl gax::paginator::ItemPaginator<
899            longrunning::model::ListOperationsResponse,
900            gax::error::Error,
901        > {
902            use gax::paginator::Paginator;
903            self.by_page().items()
904        }
905
906        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
907        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
908            self.0.request.name = v.into();
909            self
910        }
911
912        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
913        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
914            self.0.request.filter = v.into();
915            self
916        }
917
918        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
919        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
920            self.0.request.page_size = v.into();
921            self
922        }
923
924        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
925        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
926            self.0.request.page_token = v.into();
927            self
928        }
929
930        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
931        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
932            self.0.request.return_partial_success = v.into();
933            self
934        }
935    }
936
937    #[doc(hidden)]
938    impl gax::options::internal::RequestBuilder for ListOperations {
939        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
940            &mut self.0.options
941        }
942    }
943
944    /// The request builder for [DataFusion::get_operation][crate::client::DataFusion::get_operation] calls.
945    ///
946    /// # Example
947    /// ```
948    /// # use google_cloud_datafusion_v1::builder::data_fusion::GetOperation;
949    /// # async fn sample() -> gax::Result<()> {
950    ///
951    /// let builder = prepare_request_builder();
952    /// let response = builder.send().await?;
953    /// # Ok(()) }
954    ///
955    /// fn prepare_request_builder() -> GetOperation {
956    ///   # panic!();
957    ///   // ... details omitted ...
958    /// }
959    /// ```
960    #[derive(Clone, Debug)]
961    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
962
963    impl GetOperation {
964        pub(crate) fn new(
965            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
966        ) -> Self {
967            Self(RequestBuilder::new(stub))
968        }
969
970        /// Sets the full request, replacing any prior values.
971        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
972            mut self,
973            v: V,
974        ) -> Self {
975            self.0.request = v.into();
976            self
977        }
978
979        /// Sets all the options, replacing any prior values.
980        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
981            self.0.options = v.into();
982            self
983        }
984
985        /// Sends the request.
986        pub async fn send(self) -> Result<longrunning::model::Operation> {
987            (*self.0.stub)
988                .get_operation(self.0.request, self.0.options)
989                .await
990                .map(gax::response::Response::into_body)
991        }
992
993        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
994        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
995            self.0.request.name = v.into();
996            self
997        }
998    }
999
1000    #[doc(hidden)]
1001    impl gax::options::internal::RequestBuilder for GetOperation {
1002        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1003            &mut self.0.options
1004        }
1005    }
1006
1007    /// The request builder for [DataFusion::delete_operation][crate::client::DataFusion::delete_operation] calls.
1008    ///
1009    /// # Example
1010    /// ```
1011    /// # use google_cloud_datafusion_v1::builder::data_fusion::DeleteOperation;
1012    /// # async fn sample() -> gax::Result<()> {
1013    ///
1014    /// let builder = prepare_request_builder();
1015    /// let response = builder.send().await?;
1016    /// # Ok(()) }
1017    ///
1018    /// fn prepare_request_builder() -> DeleteOperation {
1019    ///   # panic!();
1020    ///   // ... details omitted ...
1021    /// }
1022    /// ```
1023    #[derive(Clone, Debug)]
1024    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1025
1026    impl DeleteOperation {
1027        pub(crate) fn new(
1028            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
1029        ) -> Self {
1030            Self(RequestBuilder::new(stub))
1031        }
1032
1033        /// Sets the full request, replacing any prior values.
1034        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1035            mut self,
1036            v: V,
1037        ) -> Self {
1038            self.0.request = v.into();
1039            self
1040        }
1041
1042        /// Sets all the options, replacing any prior values.
1043        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1044            self.0.options = v.into();
1045            self
1046        }
1047
1048        /// Sends the request.
1049        pub async fn send(self) -> Result<()> {
1050            (*self.0.stub)
1051                .delete_operation(self.0.request, self.0.options)
1052                .await
1053                .map(gax::response::Response::into_body)
1054        }
1055
1056        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1057        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1058            self.0.request.name = v.into();
1059            self
1060        }
1061    }
1062
1063    #[doc(hidden)]
1064    impl gax::options::internal::RequestBuilder for DeleteOperation {
1065        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1066            &mut self.0.options
1067        }
1068    }
1069
1070    /// The request builder for [DataFusion::cancel_operation][crate::client::DataFusion::cancel_operation] calls.
1071    ///
1072    /// # Example
1073    /// ```
1074    /// # use google_cloud_datafusion_v1::builder::data_fusion::CancelOperation;
1075    /// # async fn sample() -> gax::Result<()> {
1076    ///
1077    /// let builder = prepare_request_builder();
1078    /// let response = builder.send().await?;
1079    /// # Ok(()) }
1080    ///
1081    /// fn prepare_request_builder() -> CancelOperation {
1082    ///   # panic!();
1083    ///   // ... details omitted ...
1084    /// }
1085    /// ```
1086    #[derive(Clone, Debug)]
1087    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1088
1089    impl CancelOperation {
1090        pub(crate) fn new(
1091            stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
1092        ) -> Self {
1093            Self(RequestBuilder::new(stub))
1094        }
1095
1096        /// Sets the full request, replacing any prior values.
1097        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1098            mut self,
1099            v: V,
1100        ) -> Self {
1101            self.0.request = v.into();
1102            self
1103        }
1104
1105        /// Sets all the options, replacing any prior values.
1106        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1107            self.0.options = v.into();
1108            self
1109        }
1110
1111        /// Sends the request.
1112        pub async fn send(self) -> Result<()> {
1113            (*self.0.stub)
1114                .cancel_operation(self.0.request, self.0.options)
1115                .await
1116                .map(gax::response::Response::into_body)
1117        }
1118
1119        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1120        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1121            self.0.request.name = v.into();
1122            self
1123        }
1124    }
1125
1126    #[doc(hidden)]
1127    impl gax::options::internal::RequestBuilder for CancelOperation {
1128        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1129            &mut self.0.options
1130        }
1131    }
1132}