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