google_cloud_spanner_admin_instance_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 instance_admin {
18    use crate::Result;
19
20    /// A builder for [InstanceAdmin][crate::client::InstanceAdmin].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_spanner_admin_instance_v1::*;
25    /// # use builder::instance_admin::ClientBuilder;
26    /// # use client::InstanceAdmin;
27    /// let builder : ClientBuilder = InstanceAdmin::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://spanner.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::InstanceAdmin;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = InstanceAdmin;
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::InstanceAdmin] 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::InstanceAdmin>,
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::InstanceAdmin>,
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 [InstanceAdmin::list_instance_configs][crate::client::InstanceAdmin::list_instance_configs] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_spanner_admin_instance_v1::builder;
79    /// use builder::instance_admin::ListInstanceConfigs;
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() -> ListInstanceConfigs {
91    ///   # panic!();
92    ///   // ... details omitted ...
93    /// }
94    /// ```
95    #[derive(Clone, Debug)]
96    pub struct ListInstanceConfigs(RequestBuilder<crate::model::ListInstanceConfigsRequest>);
97
98    impl ListInstanceConfigs {
99        pub(crate) fn new(
100            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
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::ListInstanceConfigsRequest>>(
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::ListInstanceConfigsResponse> {
122            (*self.0.stub)
123                .list_instance_configs(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<crate::model::ListInstanceConfigsResponse, gax::error::Error>
132        {
133            use std::clone::Clone;
134            let token = self.0.request.page_token.clone();
135            let execute = move |token: String| {
136                let mut builder = self.clone();
137                builder.0.request = builder.0.request.set_page_token(token);
138                builder.send()
139            };
140            gax::paginator::internal::new_paginator(token, execute)
141        }
142
143        /// Streams each item in the collection.
144        pub fn by_item(
145            self,
146        ) -> impl gax::paginator::ItemPaginator<
147            crate::model::ListInstanceConfigsResponse,
148            gax::error::Error,
149        > {
150            use gax::paginator::Paginator;
151            self.by_page().items()
152        }
153
154        /// Sets the value of [parent][crate::model::ListInstanceConfigsRequest::parent].
155        ///
156        /// This is a **required** field for requests.
157        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
158            self.0.request.parent = v.into();
159            self
160        }
161
162        /// Sets the value of [page_size][crate::model::ListInstanceConfigsRequest::page_size].
163        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
164            self.0.request.page_size = v.into();
165            self
166        }
167
168        /// Sets the value of [page_token][crate::model::ListInstanceConfigsRequest::page_token].
169        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
170            self.0.request.page_token = v.into();
171            self
172        }
173    }
174
175    #[doc(hidden)]
176    impl gax::options::internal::RequestBuilder for ListInstanceConfigs {
177        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
178            &mut self.0.options
179        }
180    }
181
182    /// The request builder for [InstanceAdmin::get_instance_config][crate::client::InstanceAdmin::get_instance_config] calls.
183    ///
184    /// # Example
185    /// ```no_run
186    /// # use google_cloud_spanner_admin_instance_v1::builder;
187    /// use builder::instance_admin::GetInstanceConfig;
188    /// # tokio_test::block_on(async {
189    ///
190    /// let builder = prepare_request_builder();
191    /// let response = builder.send().await?;
192    /// # gax::Result::<()>::Ok(()) });
193    ///
194    /// fn prepare_request_builder() -> GetInstanceConfig {
195    ///   # panic!();
196    ///   // ... details omitted ...
197    /// }
198    /// ```
199    #[derive(Clone, Debug)]
200    pub struct GetInstanceConfig(RequestBuilder<crate::model::GetInstanceConfigRequest>);
201
202    impl GetInstanceConfig {
203        pub(crate) fn new(
204            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
205        ) -> Self {
206            Self(RequestBuilder::new(stub))
207        }
208
209        /// Sets the full request, replacing any prior values.
210        pub fn with_request<V: Into<crate::model::GetInstanceConfigRequest>>(
211            mut self,
212            v: V,
213        ) -> Self {
214            self.0.request = v.into();
215            self
216        }
217
218        /// Sets all the options, replacing any prior values.
219        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
220            self.0.options = v.into();
221            self
222        }
223
224        /// Sends the request.
225        pub async fn send(self) -> Result<crate::model::InstanceConfig> {
226            (*self.0.stub)
227                .get_instance_config(self.0.request, self.0.options)
228                .await
229                .map(gax::response::Response::into_body)
230        }
231
232        /// Sets the value of [name][crate::model::GetInstanceConfigRequest::name].
233        ///
234        /// This is a **required** field for requests.
235        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
236            self.0.request.name = v.into();
237            self
238        }
239    }
240
241    #[doc(hidden)]
242    impl gax::options::internal::RequestBuilder for GetInstanceConfig {
243        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
244            &mut self.0.options
245        }
246    }
247
248    /// The request builder for [InstanceAdmin::create_instance_config][crate::client::InstanceAdmin::create_instance_config] calls.
249    ///
250    /// # Example
251    /// ```no_run
252    /// # use google_cloud_spanner_admin_instance_v1::builder;
253    /// use builder::instance_admin::CreateInstanceConfig;
254    /// # tokio_test::block_on(async {
255    /// use lro::Poller;
256    ///
257    /// let builder = prepare_request_builder();
258    /// let response = builder.poller().until_done().await?;
259    /// # gax::Result::<()>::Ok(()) });
260    ///
261    /// fn prepare_request_builder() -> CreateInstanceConfig {
262    ///   # panic!();
263    ///   // ... details omitted ...
264    /// }
265    /// ```
266    #[derive(Clone, Debug)]
267    pub struct CreateInstanceConfig(RequestBuilder<crate::model::CreateInstanceConfigRequest>);
268
269    impl CreateInstanceConfig {
270        pub(crate) fn new(
271            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
272        ) -> Self {
273            Self(RequestBuilder::new(stub))
274        }
275
276        /// Sets the full request, replacing any prior values.
277        pub fn with_request<V: Into<crate::model::CreateInstanceConfigRequest>>(
278            mut self,
279            v: V,
280        ) -> Self {
281            self.0.request = v.into();
282            self
283        }
284
285        /// Sets all the options, replacing any prior values.
286        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
287            self.0.options = v.into();
288            self
289        }
290
291        /// Sends the request.
292        ///
293        /// # Long running operations
294        ///
295        /// This starts, but does not poll, a longrunning operation. More information
296        /// on [create_instance_config][crate::client::InstanceAdmin::create_instance_config].
297        pub async fn send(self) -> Result<longrunning::model::Operation> {
298            (*self.0.stub)
299                .create_instance_config(self.0.request, self.0.options)
300                .await
301                .map(gax::response::Response::into_body)
302        }
303
304        /// Creates a [Poller][lro::Poller] to work with `create_instance_config`.
305        pub fn poller(
306            self,
307        ) -> impl lro::Poller<crate::model::InstanceConfig, crate::model::CreateInstanceConfigMetadata>
308        {
309            type Operation = lro::internal::Operation<
310                crate::model::InstanceConfig,
311                crate::model::CreateInstanceConfigMetadata,
312            >;
313            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
314            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
315
316            let stub = self.0.stub.clone();
317            let mut options = self.0.options.clone();
318            options.set_retry_policy(gax::retry_policy::NeverRetry);
319            let query = move |name| {
320                let stub = stub.clone();
321                let options = options.clone();
322                async {
323                    let op = GetOperation::new(stub)
324                        .set_name(name)
325                        .with_options(options)
326                        .send()
327                        .await?;
328                    Ok(Operation::new(op))
329                }
330            };
331
332            let start = move || async {
333                let op = self.send().await?;
334                Ok(Operation::new(op))
335            };
336
337            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
338        }
339
340        /// Sets the value of [parent][crate::model::CreateInstanceConfigRequest::parent].
341        ///
342        /// This is a **required** field for requests.
343        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
344            self.0.request.parent = v.into();
345            self
346        }
347
348        /// Sets the value of [instance_config_id][crate::model::CreateInstanceConfigRequest::instance_config_id].
349        ///
350        /// This is a **required** field for requests.
351        pub fn set_instance_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
352            self.0.request.instance_config_id = v.into();
353            self
354        }
355
356        /// Sets the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
357        ///
358        /// This is a **required** field for requests.
359        pub fn set_instance_config<T>(mut self, v: T) -> Self
360        where
361            T: std::convert::Into<crate::model::InstanceConfig>,
362        {
363            self.0.request.instance_config = std::option::Option::Some(v.into());
364            self
365        }
366
367        /// Sets or clears the value of [instance_config][crate::model::CreateInstanceConfigRequest::instance_config].
368        ///
369        /// This is a **required** field for requests.
370        pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
371        where
372            T: std::convert::Into<crate::model::InstanceConfig>,
373        {
374            self.0.request.instance_config = v.map(|x| x.into());
375            self
376        }
377
378        /// Sets the value of [validate_only][crate::model::CreateInstanceConfigRequest::validate_only].
379        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
380            self.0.request.validate_only = v.into();
381            self
382        }
383    }
384
385    #[doc(hidden)]
386    impl gax::options::internal::RequestBuilder for CreateInstanceConfig {
387        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
388            &mut self.0.options
389        }
390    }
391
392    /// The request builder for [InstanceAdmin::update_instance_config][crate::client::InstanceAdmin::update_instance_config] calls.
393    ///
394    /// # Example
395    /// ```no_run
396    /// # use google_cloud_spanner_admin_instance_v1::builder;
397    /// use builder::instance_admin::UpdateInstanceConfig;
398    /// # tokio_test::block_on(async {
399    /// use lro::Poller;
400    ///
401    /// let builder = prepare_request_builder();
402    /// let response = builder.poller().until_done().await?;
403    /// # gax::Result::<()>::Ok(()) });
404    ///
405    /// fn prepare_request_builder() -> UpdateInstanceConfig {
406    ///   # panic!();
407    ///   // ... details omitted ...
408    /// }
409    /// ```
410    #[derive(Clone, Debug)]
411    pub struct UpdateInstanceConfig(RequestBuilder<crate::model::UpdateInstanceConfigRequest>);
412
413    impl UpdateInstanceConfig {
414        pub(crate) fn new(
415            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
416        ) -> Self {
417            Self(RequestBuilder::new(stub))
418        }
419
420        /// Sets the full request, replacing any prior values.
421        pub fn with_request<V: Into<crate::model::UpdateInstanceConfigRequest>>(
422            mut self,
423            v: V,
424        ) -> Self {
425            self.0.request = v.into();
426            self
427        }
428
429        /// Sets all the options, replacing any prior values.
430        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
431            self.0.options = v.into();
432            self
433        }
434
435        /// Sends the request.
436        ///
437        /// # Long running operations
438        ///
439        /// This starts, but does not poll, a longrunning operation. More information
440        /// on [update_instance_config][crate::client::InstanceAdmin::update_instance_config].
441        pub async fn send(self) -> Result<longrunning::model::Operation> {
442            (*self.0.stub)
443                .update_instance_config(self.0.request, self.0.options)
444                .await
445                .map(gax::response::Response::into_body)
446        }
447
448        /// Creates a [Poller][lro::Poller] to work with `update_instance_config`.
449        pub fn poller(
450            self,
451        ) -> impl lro::Poller<crate::model::InstanceConfig, crate::model::UpdateInstanceConfigMetadata>
452        {
453            type Operation = lro::internal::Operation<
454                crate::model::InstanceConfig,
455                crate::model::UpdateInstanceConfigMetadata,
456            >;
457            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
458            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
459
460            let stub = self.0.stub.clone();
461            let mut options = self.0.options.clone();
462            options.set_retry_policy(gax::retry_policy::NeverRetry);
463            let query = move |name| {
464                let stub = stub.clone();
465                let options = options.clone();
466                async {
467                    let op = GetOperation::new(stub)
468                        .set_name(name)
469                        .with_options(options)
470                        .send()
471                        .await?;
472                    Ok(Operation::new(op))
473                }
474            };
475
476            let start = move || async {
477                let op = self.send().await?;
478                Ok(Operation::new(op))
479            };
480
481            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
482        }
483
484        /// Sets the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
485        ///
486        /// This is a **required** field for requests.
487        pub fn set_instance_config<T>(mut self, v: T) -> Self
488        where
489            T: std::convert::Into<crate::model::InstanceConfig>,
490        {
491            self.0.request.instance_config = std::option::Option::Some(v.into());
492            self
493        }
494
495        /// Sets or clears the value of [instance_config][crate::model::UpdateInstanceConfigRequest::instance_config].
496        ///
497        /// This is a **required** field for requests.
498        pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
499        where
500            T: std::convert::Into<crate::model::InstanceConfig>,
501        {
502            self.0.request.instance_config = v.map(|x| x.into());
503            self
504        }
505
506        /// Sets the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
507        ///
508        /// This is a **required** field for requests.
509        pub fn set_update_mask<T>(mut self, v: T) -> Self
510        where
511            T: std::convert::Into<wkt::FieldMask>,
512        {
513            self.0.request.update_mask = std::option::Option::Some(v.into());
514            self
515        }
516
517        /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceConfigRequest::update_mask].
518        ///
519        /// This is a **required** field for requests.
520        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
521        where
522            T: std::convert::Into<wkt::FieldMask>,
523        {
524            self.0.request.update_mask = v.map(|x| x.into());
525            self
526        }
527
528        /// Sets the value of [validate_only][crate::model::UpdateInstanceConfigRequest::validate_only].
529        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
530            self.0.request.validate_only = v.into();
531            self
532        }
533    }
534
535    #[doc(hidden)]
536    impl gax::options::internal::RequestBuilder for UpdateInstanceConfig {
537        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
538            &mut self.0.options
539        }
540    }
541
542    /// The request builder for [InstanceAdmin::delete_instance_config][crate::client::InstanceAdmin::delete_instance_config] calls.
543    ///
544    /// # Example
545    /// ```no_run
546    /// # use google_cloud_spanner_admin_instance_v1::builder;
547    /// use builder::instance_admin::DeleteInstanceConfig;
548    /// # tokio_test::block_on(async {
549    ///
550    /// let builder = prepare_request_builder();
551    /// let response = builder.send().await?;
552    /// # gax::Result::<()>::Ok(()) });
553    ///
554    /// fn prepare_request_builder() -> DeleteInstanceConfig {
555    ///   # panic!();
556    ///   // ... details omitted ...
557    /// }
558    /// ```
559    #[derive(Clone, Debug)]
560    pub struct DeleteInstanceConfig(RequestBuilder<crate::model::DeleteInstanceConfigRequest>);
561
562    impl DeleteInstanceConfig {
563        pub(crate) fn new(
564            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
565        ) -> Self {
566            Self(RequestBuilder::new(stub))
567        }
568
569        /// Sets the full request, replacing any prior values.
570        pub fn with_request<V: Into<crate::model::DeleteInstanceConfigRequest>>(
571            mut self,
572            v: V,
573        ) -> Self {
574            self.0.request = v.into();
575            self
576        }
577
578        /// Sets all the options, replacing any prior values.
579        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
580            self.0.options = v.into();
581            self
582        }
583
584        /// Sends the request.
585        pub async fn send(self) -> Result<()> {
586            (*self.0.stub)
587                .delete_instance_config(self.0.request, self.0.options)
588                .await
589                .map(gax::response::Response::into_body)
590        }
591
592        /// Sets the value of [name][crate::model::DeleteInstanceConfigRequest::name].
593        ///
594        /// This is a **required** field for requests.
595        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
596            self.0.request.name = v.into();
597            self
598        }
599
600        /// Sets the value of [etag][crate::model::DeleteInstanceConfigRequest::etag].
601        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
602            self.0.request.etag = v.into();
603            self
604        }
605
606        /// Sets the value of [validate_only][crate::model::DeleteInstanceConfigRequest::validate_only].
607        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
608            self.0.request.validate_only = v.into();
609            self
610        }
611    }
612
613    #[doc(hidden)]
614    impl gax::options::internal::RequestBuilder for DeleteInstanceConfig {
615        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
616            &mut self.0.options
617        }
618    }
619
620    /// The request builder for [InstanceAdmin::list_instance_config_operations][crate::client::InstanceAdmin::list_instance_config_operations] calls.
621    ///
622    /// # Example
623    /// ```no_run
624    /// # use google_cloud_spanner_admin_instance_v1::builder;
625    /// use builder::instance_admin::ListInstanceConfigOperations;
626    /// # tokio_test::block_on(async {
627    /// use gax::paginator::ItemPaginator;
628    ///
629    /// let builder = prepare_request_builder();
630    /// let mut items = builder.by_item();
631    /// while let Some(result) = items.next().await {
632    ///   let item = result?;
633    /// }
634    /// # gax::Result::<()>::Ok(()) });
635    ///
636    /// fn prepare_request_builder() -> ListInstanceConfigOperations {
637    ///   # panic!();
638    ///   // ... details omitted ...
639    /// }
640    /// ```
641    #[derive(Clone, Debug)]
642    pub struct ListInstanceConfigOperations(
643        RequestBuilder<crate::model::ListInstanceConfigOperationsRequest>,
644    );
645
646    impl ListInstanceConfigOperations {
647        pub(crate) fn new(
648            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
649        ) -> Self {
650            Self(RequestBuilder::new(stub))
651        }
652
653        /// Sets the full request, replacing any prior values.
654        pub fn with_request<V: Into<crate::model::ListInstanceConfigOperationsRequest>>(
655            mut self,
656            v: V,
657        ) -> Self {
658            self.0.request = v.into();
659            self
660        }
661
662        /// Sets all the options, replacing any prior values.
663        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
664            self.0.options = v.into();
665            self
666        }
667
668        /// Sends the request.
669        pub async fn send(self) -> Result<crate::model::ListInstanceConfigOperationsResponse> {
670            (*self.0.stub)
671                .list_instance_config_operations(self.0.request, self.0.options)
672                .await
673                .map(gax::response::Response::into_body)
674        }
675
676        /// Streams each page in the collection.
677        pub fn by_page(
678            self,
679        ) -> impl gax::paginator::Paginator<
680            crate::model::ListInstanceConfigOperationsResponse,
681            gax::error::Error,
682        > {
683            use std::clone::Clone;
684            let token = self.0.request.page_token.clone();
685            let execute = move |token: String| {
686                let mut builder = self.clone();
687                builder.0.request = builder.0.request.set_page_token(token);
688                builder.send()
689            };
690            gax::paginator::internal::new_paginator(token, execute)
691        }
692
693        /// Streams each item in the collection.
694        pub fn by_item(
695            self,
696        ) -> impl gax::paginator::ItemPaginator<
697            crate::model::ListInstanceConfigOperationsResponse,
698            gax::error::Error,
699        > {
700            use gax::paginator::Paginator;
701            self.by_page().items()
702        }
703
704        /// Sets the value of [parent][crate::model::ListInstanceConfigOperationsRequest::parent].
705        ///
706        /// This is a **required** field for requests.
707        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
708            self.0.request.parent = v.into();
709            self
710        }
711
712        /// Sets the value of [filter][crate::model::ListInstanceConfigOperationsRequest::filter].
713        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
714            self.0.request.filter = v.into();
715            self
716        }
717
718        /// Sets the value of [page_size][crate::model::ListInstanceConfigOperationsRequest::page_size].
719        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
720            self.0.request.page_size = v.into();
721            self
722        }
723
724        /// Sets the value of [page_token][crate::model::ListInstanceConfigOperationsRequest::page_token].
725        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
726            self.0.request.page_token = v.into();
727            self
728        }
729    }
730
731    #[doc(hidden)]
732    impl gax::options::internal::RequestBuilder for ListInstanceConfigOperations {
733        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
734            &mut self.0.options
735        }
736    }
737
738    /// The request builder for [InstanceAdmin::list_instances][crate::client::InstanceAdmin::list_instances] calls.
739    ///
740    /// # Example
741    /// ```no_run
742    /// # use google_cloud_spanner_admin_instance_v1::builder;
743    /// use builder::instance_admin::ListInstances;
744    /// # tokio_test::block_on(async {
745    /// use gax::paginator::ItemPaginator;
746    ///
747    /// let builder = prepare_request_builder();
748    /// let mut items = builder.by_item();
749    /// while let Some(result) = items.next().await {
750    ///   let item = result?;
751    /// }
752    /// # gax::Result::<()>::Ok(()) });
753    ///
754    /// fn prepare_request_builder() -> ListInstances {
755    ///   # panic!();
756    ///   // ... details omitted ...
757    /// }
758    /// ```
759    #[derive(Clone, Debug)]
760    pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
761
762    impl ListInstances {
763        pub(crate) fn new(
764            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
765        ) -> Self {
766            Self(RequestBuilder::new(stub))
767        }
768
769        /// Sets the full request, replacing any prior values.
770        pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
771            self.0.request = v.into();
772            self
773        }
774
775        /// Sets all the options, replacing any prior values.
776        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
777            self.0.options = v.into();
778            self
779        }
780
781        /// Sends the request.
782        pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
783            (*self.0.stub)
784                .list_instances(self.0.request, self.0.options)
785                .await
786                .map(gax::response::Response::into_body)
787        }
788
789        /// Streams each page in the collection.
790        pub fn by_page(
791            self,
792        ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
793        {
794            use std::clone::Clone;
795            let token = self.0.request.page_token.clone();
796            let execute = move |token: String| {
797                let mut builder = self.clone();
798                builder.0.request = builder.0.request.set_page_token(token);
799                builder.send()
800            };
801            gax::paginator::internal::new_paginator(token, execute)
802        }
803
804        /// Streams each item in the collection.
805        pub fn by_item(
806            self,
807        ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
808        {
809            use gax::paginator::Paginator;
810            self.by_page().items()
811        }
812
813        /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
814        ///
815        /// This is a **required** field for requests.
816        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
817            self.0.request.parent = v.into();
818            self
819        }
820
821        /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
822        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
823            self.0.request.page_size = v.into();
824            self
825        }
826
827        /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
828        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
829            self.0.request.page_token = v.into();
830            self
831        }
832
833        /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
834        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
835            self.0.request.filter = v.into();
836            self
837        }
838
839        /// Sets the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
840        pub fn set_instance_deadline<T>(mut self, v: T) -> Self
841        where
842            T: std::convert::Into<wkt::Timestamp>,
843        {
844            self.0.request.instance_deadline = std::option::Option::Some(v.into());
845            self
846        }
847
848        /// Sets or clears the value of [instance_deadline][crate::model::ListInstancesRequest::instance_deadline].
849        pub fn set_or_clear_instance_deadline<T>(mut self, v: std::option::Option<T>) -> Self
850        where
851            T: std::convert::Into<wkt::Timestamp>,
852        {
853            self.0.request.instance_deadline = v.map(|x| x.into());
854            self
855        }
856    }
857
858    #[doc(hidden)]
859    impl gax::options::internal::RequestBuilder for ListInstances {
860        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
861            &mut self.0.options
862        }
863    }
864
865    /// The request builder for [InstanceAdmin::list_instance_partitions][crate::client::InstanceAdmin::list_instance_partitions] calls.
866    ///
867    /// # Example
868    /// ```no_run
869    /// # use google_cloud_spanner_admin_instance_v1::builder;
870    /// use builder::instance_admin::ListInstancePartitions;
871    /// # tokio_test::block_on(async {
872    /// use gax::paginator::ItemPaginator;
873    ///
874    /// let builder = prepare_request_builder();
875    /// let mut items = builder.by_item();
876    /// while let Some(result) = items.next().await {
877    ///   let item = result?;
878    /// }
879    /// # gax::Result::<()>::Ok(()) });
880    ///
881    /// fn prepare_request_builder() -> ListInstancePartitions {
882    ///   # panic!();
883    ///   // ... details omitted ...
884    /// }
885    /// ```
886    #[derive(Clone, Debug)]
887    pub struct ListInstancePartitions(RequestBuilder<crate::model::ListInstancePartitionsRequest>);
888
889    impl ListInstancePartitions {
890        pub(crate) fn new(
891            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
892        ) -> Self {
893            Self(RequestBuilder::new(stub))
894        }
895
896        /// Sets the full request, replacing any prior values.
897        pub fn with_request<V: Into<crate::model::ListInstancePartitionsRequest>>(
898            mut self,
899            v: V,
900        ) -> Self {
901            self.0.request = v.into();
902            self
903        }
904
905        /// Sets all the options, replacing any prior values.
906        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
907            self.0.options = v.into();
908            self
909        }
910
911        /// Sends the request.
912        pub async fn send(self) -> Result<crate::model::ListInstancePartitionsResponse> {
913            (*self.0.stub)
914                .list_instance_partitions(self.0.request, self.0.options)
915                .await
916                .map(gax::response::Response::into_body)
917        }
918
919        /// Streams each page in the collection.
920        pub fn by_page(
921            self,
922        ) -> impl gax::paginator::Paginator<
923            crate::model::ListInstancePartitionsResponse,
924            gax::error::Error,
925        > {
926            use std::clone::Clone;
927            let token = self.0.request.page_token.clone();
928            let execute = move |token: String| {
929                let mut builder = self.clone();
930                builder.0.request = builder.0.request.set_page_token(token);
931                builder.send()
932            };
933            gax::paginator::internal::new_paginator(token, execute)
934        }
935
936        /// Streams each item in the collection.
937        pub fn by_item(
938            self,
939        ) -> impl gax::paginator::ItemPaginator<
940            crate::model::ListInstancePartitionsResponse,
941            gax::error::Error,
942        > {
943            use gax::paginator::Paginator;
944            self.by_page().items()
945        }
946
947        /// Sets the value of [parent][crate::model::ListInstancePartitionsRequest::parent].
948        ///
949        /// This is a **required** field for requests.
950        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
951            self.0.request.parent = v.into();
952            self
953        }
954
955        /// Sets the value of [page_size][crate::model::ListInstancePartitionsRequest::page_size].
956        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
957            self.0.request.page_size = v.into();
958            self
959        }
960
961        /// Sets the value of [page_token][crate::model::ListInstancePartitionsRequest::page_token].
962        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
963            self.0.request.page_token = v.into();
964            self
965        }
966
967        /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
968        pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
969        where
970            T: std::convert::Into<wkt::Timestamp>,
971        {
972            self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
973            self
974        }
975
976        /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionsRequest::instance_partition_deadline].
977        pub fn set_or_clear_instance_partition_deadline<T>(
978            mut self,
979            v: std::option::Option<T>,
980        ) -> Self
981        where
982            T: std::convert::Into<wkt::Timestamp>,
983        {
984            self.0.request.instance_partition_deadline = v.map(|x| x.into());
985            self
986        }
987    }
988
989    #[doc(hidden)]
990    impl gax::options::internal::RequestBuilder for ListInstancePartitions {
991        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
992            &mut self.0.options
993        }
994    }
995
996    /// The request builder for [InstanceAdmin::get_instance][crate::client::InstanceAdmin::get_instance] calls.
997    ///
998    /// # Example
999    /// ```no_run
1000    /// # use google_cloud_spanner_admin_instance_v1::builder;
1001    /// use builder::instance_admin::GetInstance;
1002    /// # tokio_test::block_on(async {
1003    ///
1004    /// let builder = prepare_request_builder();
1005    /// let response = builder.send().await?;
1006    /// # gax::Result::<()>::Ok(()) });
1007    ///
1008    /// fn prepare_request_builder() -> GetInstance {
1009    ///   # panic!();
1010    ///   // ... details omitted ...
1011    /// }
1012    /// ```
1013    #[derive(Clone, Debug)]
1014    pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1015
1016    impl GetInstance {
1017        pub(crate) fn new(
1018            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1019        ) -> Self {
1020            Self(RequestBuilder::new(stub))
1021        }
1022
1023        /// Sets the full request, replacing any prior values.
1024        pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1025            self.0.request = v.into();
1026            self
1027        }
1028
1029        /// Sets all the options, replacing any prior values.
1030        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1031            self.0.options = v.into();
1032            self
1033        }
1034
1035        /// Sends the request.
1036        pub async fn send(self) -> Result<crate::model::Instance> {
1037            (*self.0.stub)
1038                .get_instance(self.0.request, self.0.options)
1039                .await
1040                .map(gax::response::Response::into_body)
1041        }
1042
1043        /// Sets the value of [name][crate::model::GetInstanceRequest::name].
1044        ///
1045        /// This is a **required** field for requests.
1046        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1047            self.0.request.name = v.into();
1048            self
1049        }
1050
1051        /// Sets the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
1052        pub fn set_field_mask<T>(mut self, v: T) -> Self
1053        where
1054            T: std::convert::Into<wkt::FieldMask>,
1055        {
1056            self.0.request.field_mask = std::option::Option::Some(v.into());
1057            self
1058        }
1059
1060        /// Sets or clears the value of [field_mask][crate::model::GetInstanceRequest::field_mask].
1061        pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1062        where
1063            T: std::convert::Into<wkt::FieldMask>,
1064        {
1065            self.0.request.field_mask = v.map(|x| x.into());
1066            self
1067        }
1068    }
1069
1070    #[doc(hidden)]
1071    impl gax::options::internal::RequestBuilder for GetInstance {
1072        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1073            &mut self.0.options
1074        }
1075    }
1076
1077    /// The request builder for [InstanceAdmin::create_instance][crate::client::InstanceAdmin::create_instance] calls.
1078    ///
1079    /// # Example
1080    /// ```no_run
1081    /// # use google_cloud_spanner_admin_instance_v1::builder;
1082    /// use builder::instance_admin::CreateInstance;
1083    /// # tokio_test::block_on(async {
1084    /// use lro::Poller;
1085    ///
1086    /// let builder = prepare_request_builder();
1087    /// let response = builder.poller().until_done().await?;
1088    /// # gax::Result::<()>::Ok(()) });
1089    ///
1090    /// fn prepare_request_builder() -> CreateInstance {
1091    ///   # panic!();
1092    ///   // ... details omitted ...
1093    /// }
1094    /// ```
1095    #[derive(Clone, Debug)]
1096    pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1097
1098    impl CreateInstance {
1099        pub(crate) fn new(
1100            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1101        ) -> Self {
1102            Self(RequestBuilder::new(stub))
1103        }
1104
1105        /// Sets the full request, replacing any prior values.
1106        pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1107            self.0.request = v.into();
1108            self
1109        }
1110
1111        /// Sets all the options, replacing any prior values.
1112        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1113            self.0.options = v.into();
1114            self
1115        }
1116
1117        /// Sends the request.
1118        ///
1119        /// # Long running operations
1120        ///
1121        /// This starts, but does not poll, a longrunning operation. More information
1122        /// on [create_instance][crate::client::InstanceAdmin::create_instance].
1123        pub async fn send(self) -> Result<longrunning::model::Operation> {
1124            (*self.0.stub)
1125                .create_instance(self.0.request, self.0.options)
1126                .await
1127                .map(gax::response::Response::into_body)
1128        }
1129
1130        /// Creates a [Poller][lro::Poller] to work with `create_instance`.
1131        pub fn poller(
1132            self,
1133        ) -> impl lro::Poller<crate::model::Instance, crate::model::CreateInstanceMetadata>
1134        {
1135            type Operation = lro::internal::Operation<
1136                crate::model::Instance,
1137                crate::model::CreateInstanceMetadata,
1138            >;
1139            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1140            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1141
1142            let stub = self.0.stub.clone();
1143            let mut options = self.0.options.clone();
1144            options.set_retry_policy(gax::retry_policy::NeverRetry);
1145            let query = move |name| {
1146                let stub = stub.clone();
1147                let options = options.clone();
1148                async {
1149                    let op = GetOperation::new(stub)
1150                        .set_name(name)
1151                        .with_options(options)
1152                        .send()
1153                        .await?;
1154                    Ok(Operation::new(op))
1155                }
1156            };
1157
1158            let start = move || async {
1159                let op = self.send().await?;
1160                Ok(Operation::new(op))
1161            };
1162
1163            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1164        }
1165
1166        /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
1167        ///
1168        /// This is a **required** field for requests.
1169        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1170            self.0.request.parent = v.into();
1171            self
1172        }
1173
1174        /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
1175        ///
1176        /// This is a **required** field for requests.
1177        pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1178            self.0.request.instance_id = v.into();
1179            self
1180        }
1181
1182        /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
1183        ///
1184        /// This is a **required** field for requests.
1185        pub fn set_instance<T>(mut self, v: T) -> Self
1186        where
1187            T: std::convert::Into<crate::model::Instance>,
1188        {
1189            self.0.request.instance = std::option::Option::Some(v.into());
1190            self
1191        }
1192
1193        /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
1194        ///
1195        /// This is a **required** field for requests.
1196        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1197        where
1198            T: std::convert::Into<crate::model::Instance>,
1199        {
1200            self.0.request.instance = v.map(|x| x.into());
1201            self
1202        }
1203    }
1204
1205    #[doc(hidden)]
1206    impl gax::options::internal::RequestBuilder for CreateInstance {
1207        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1208            &mut self.0.options
1209        }
1210    }
1211
1212    /// The request builder for [InstanceAdmin::update_instance][crate::client::InstanceAdmin::update_instance] calls.
1213    ///
1214    /// # Example
1215    /// ```no_run
1216    /// # use google_cloud_spanner_admin_instance_v1::builder;
1217    /// use builder::instance_admin::UpdateInstance;
1218    /// # tokio_test::block_on(async {
1219    /// use lro::Poller;
1220    ///
1221    /// let builder = prepare_request_builder();
1222    /// let response = builder.poller().until_done().await?;
1223    /// # gax::Result::<()>::Ok(()) });
1224    ///
1225    /// fn prepare_request_builder() -> UpdateInstance {
1226    ///   # panic!();
1227    ///   // ... details omitted ...
1228    /// }
1229    /// ```
1230    #[derive(Clone, Debug)]
1231    pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
1232
1233    impl UpdateInstance {
1234        pub(crate) fn new(
1235            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1236        ) -> Self {
1237            Self(RequestBuilder::new(stub))
1238        }
1239
1240        /// Sets the full request, replacing any prior values.
1241        pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
1242            self.0.request = v.into();
1243            self
1244        }
1245
1246        /// Sets all the options, replacing any prior values.
1247        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1248            self.0.options = v.into();
1249            self
1250        }
1251
1252        /// Sends the request.
1253        ///
1254        /// # Long running operations
1255        ///
1256        /// This starts, but does not poll, a longrunning operation. More information
1257        /// on [update_instance][crate::client::InstanceAdmin::update_instance].
1258        pub async fn send(self) -> Result<longrunning::model::Operation> {
1259            (*self.0.stub)
1260                .update_instance(self.0.request, self.0.options)
1261                .await
1262                .map(gax::response::Response::into_body)
1263        }
1264
1265        /// Creates a [Poller][lro::Poller] to work with `update_instance`.
1266        pub fn poller(
1267            self,
1268        ) -> impl lro::Poller<crate::model::Instance, crate::model::UpdateInstanceMetadata>
1269        {
1270            type Operation = lro::internal::Operation<
1271                crate::model::Instance,
1272                crate::model::UpdateInstanceMetadata,
1273            >;
1274            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1275            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1276
1277            let stub = self.0.stub.clone();
1278            let mut options = self.0.options.clone();
1279            options.set_retry_policy(gax::retry_policy::NeverRetry);
1280            let query = move |name| {
1281                let stub = stub.clone();
1282                let options = options.clone();
1283                async {
1284                    let op = GetOperation::new(stub)
1285                        .set_name(name)
1286                        .with_options(options)
1287                        .send()
1288                        .await?;
1289                    Ok(Operation::new(op))
1290                }
1291            };
1292
1293            let start = move || async {
1294                let op = self.send().await?;
1295                Ok(Operation::new(op))
1296            };
1297
1298            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1299        }
1300
1301        /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
1302        ///
1303        /// This is a **required** field for requests.
1304        pub fn set_instance<T>(mut self, v: T) -> Self
1305        where
1306            T: std::convert::Into<crate::model::Instance>,
1307        {
1308            self.0.request.instance = std::option::Option::Some(v.into());
1309            self
1310        }
1311
1312        /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
1313        ///
1314        /// This is a **required** field for requests.
1315        pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1316        where
1317            T: std::convert::Into<crate::model::Instance>,
1318        {
1319            self.0.request.instance = v.map(|x| x.into());
1320            self
1321        }
1322
1323        /// Sets the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
1324        ///
1325        /// This is a **required** field for requests.
1326        pub fn set_field_mask<T>(mut self, v: T) -> Self
1327        where
1328            T: std::convert::Into<wkt::FieldMask>,
1329        {
1330            self.0.request.field_mask = std::option::Option::Some(v.into());
1331            self
1332        }
1333
1334        /// Sets or clears the value of [field_mask][crate::model::UpdateInstanceRequest::field_mask].
1335        ///
1336        /// This is a **required** field for requests.
1337        pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1338        where
1339            T: std::convert::Into<wkt::FieldMask>,
1340        {
1341            self.0.request.field_mask = v.map(|x| x.into());
1342            self
1343        }
1344    }
1345
1346    #[doc(hidden)]
1347    impl gax::options::internal::RequestBuilder for UpdateInstance {
1348        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1349            &mut self.0.options
1350        }
1351    }
1352
1353    /// The request builder for [InstanceAdmin::delete_instance][crate::client::InstanceAdmin::delete_instance] calls.
1354    ///
1355    /// # Example
1356    /// ```no_run
1357    /// # use google_cloud_spanner_admin_instance_v1::builder;
1358    /// use builder::instance_admin::DeleteInstance;
1359    /// # tokio_test::block_on(async {
1360    ///
1361    /// let builder = prepare_request_builder();
1362    /// let response = builder.send().await?;
1363    /// # gax::Result::<()>::Ok(()) });
1364    ///
1365    /// fn prepare_request_builder() -> DeleteInstance {
1366    ///   # panic!();
1367    ///   // ... details omitted ...
1368    /// }
1369    /// ```
1370    #[derive(Clone, Debug)]
1371    pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1372
1373    impl DeleteInstance {
1374        pub(crate) fn new(
1375            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1376        ) -> Self {
1377            Self(RequestBuilder::new(stub))
1378        }
1379
1380        /// Sets the full request, replacing any prior values.
1381        pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1382            self.0.request = v.into();
1383            self
1384        }
1385
1386        /// Sets all the options, replacing any prior values.
1387        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1388            self.0.options = v.into();
1389            self
1390        }
1391
1392        /// Sends the request.
1393        pub async fn send(self) -> Result<()> {
1394            (*self.0.stub)
1395                .delete_instance(self.0.request, self.0.options)
1396                .await
1397                .map(gax::response::Response::into_body)
1398        }
1399
1400        /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
1401        ///
1402        /// This is a **required** field for requests.
1403        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1404            self.0.request.name = v.into();
1405            self
1406        }
1407    }
1408
1409    #[doc(hidden)]
1410    impl gax::options::internal::RequestBuilder for DeleteInstance {
1411        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1412            &mut self.0.options
1413        }
1414    }
1415
1416    /// The request builder for [InstanceAdmin::set_iam_policy][crate::client::InstanceAdmin::set_iam_policy] calls.
1417    ///
1418    /// # Example
1419    /// ```no_run
1420    /// # use google_cloud_spanner_admin_instance_v1::builder;
1421    /// use builder::instance_admin::SetIamPolicy;
1422    /// # tokio_test::block_on(async {
1423    ///
1424    /// let builder = prepare_request_builder();
1425    /// let response = builder.send().await?;
1426    /// # gax::Result::<()>::Ok(()) });
1427    ///
1428    /// fn prepare_request_builder() -> SetIamPolicy {
1429    ///   # panic!();
1430    ///   // ... details omitted ...
1431    /// }
1432    /// ```
1433    #[derive(Clone, Debug)]
1434    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1435
1436    impl SetIamPolicy {
1437        pub(crate) fn new(
1438            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1439        ) -> Self {
1440            Self(RequestBuilder::new(stub))
1441        }
1442
1443        /// Sets the full request, replacing any prior values.
1444        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1445            self.0.request = v.into();
1446            self
1447        }
1448
1449        /// Sets all the options, replacing any prior values.
1450        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1451            self.0.options = v.into();
1452            self
1453        }
1454
1455        /// Sends the request.
1456        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1457            (*self.0.stub)
1458                .set_iam_policy(self.0.request, self.0.options)
1459                .await
1460                .map(gax::response::Response::into_body)
1461        }
1462
1463        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1464        ///
1465        /// This is a **required** field for requests.
1466        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1467            self.0.request.resource = v.into();
1468            self
1469        }
1470
1471        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1472        ///
1473        /// This is a **required** field for requests.
1474        pub fn set_policy<T>(mut self, v: T) -> Self
1475        where
1476            T: std::convert::Into<iam_v1::model::Policy>,
1477        {
1478            self.0.request.policy = std::option::Option::Some(v.into());
1479            self
1480        }
1481
1482        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1483        ///
1484        /// This is a **required** field for requests.
1485        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1486        where
1487            T: std::convert::Into<iam_v1::model::Policy>,
1488        {
1489            self.0.request.policy = v.map(|x| x.into());
1490            self
1491        }
1492
1493        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1494        pub fn set_update_mask<T>(mut self, v: T) -> Self
1495        where
1496            T: std::convert::Into<wkt::FieldMask>,
1497        {
1498            self.0.request.update_mask = std::option::Option::Some(v.into());
1499            self
1500        }
1501
1502        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1503        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1504        where
1505            T: std::convert::Into<wkt::FieldMask>,
1506        {
1507            self.0.request.update_mask = v.map(|x| x.into());
1508            self
1509        }
1510    }
1511
1512    #[doc(hidden)]
1513    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1514        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1515            &mut self.0.options
1516        }
1517    }
1518
1519    /// The request builder for [InstanceAdmin::get_iam_policy][crate::client::InstanceAdmin::get_iam_policy] calls.
1520    ///
1521    /// # Example
1522    /// ```no_run
1523    /// # use google_cloud_spanner_admin_instance_v1::builder;
1524    /// use builder::instance_admin::GetIamPolicy;
1525    /// # tokio_test::block_on(async {
1526    ///
1527    /// let builder = prepare_request_builder();
1528    /// let response = builder.send().await?;
1529    /// # gax::Result::<()>::Ok(()) });
1530    ///
1531    /// fn prepare_request_builder() -> GetIamPolicy {
1532    ///   # panic!();
1533    ///   // ... details omitted ...
1534    /// }
1535    /// ```
1536    #[derive(Clone, Debug)]
1537    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1538
1539    impl GetIamPolicy {
1540        pub(crate) fn new(
1541            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1542        ) -> Self {
1543            Self(RequestBuilder::new(stub))
1544        }
1545
1546        /// Sets the full request, replacing any prior values.
1547        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1548            self.0.request = v.into();
1549            self
1550        }
1551
1552        /// Sets all the options, replacing any prior values.
1553        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1554            self.0.options = v.into();
1555            self
1556        }
1557
1558        /// Sends the request.
1559        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1560            (*self.0.stub)
1561                .get_iam_policy(self.0.request, self.0.options)
1562                .await
1563                .map(gax::response::Response::into_body)
1564        }
1565
1566        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1567        ///
1568        /// This is a **required** field for requests.
1569        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1570            self.0.request.resource = v.into();
1571            self
1572        }
1573
1574        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1575        pub fn set_options<T>(mut self, v: T) -> Self
1576        where
1577            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1578        {
1579            self.0.request.options = std::option::Option::Some(v.into());
1580            self
1581        }
1582
1583        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1584        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1585        where
1586            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1587        {
1588            self.0.request.options = v.map(|x| x.into());
1589            self
1590        }
1591    }
1592
1593    #[doc(hidden)]
1594    impl gax::options::internal::RequestBuilder for GetIamPolicy {
1595        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1596            &mut self.0.options
1597        }
1598    }
1599
1600    /// The request builder for [InstanceAdmin::test_iam_permissions][crate::client::InstanceAdmin::test_iam_permissions] calls.
1601    ///
1602    /// # Example
1603    /// ```no_run
1604    /// # use google_cloud_spanner_admin_instance_v1::builder;
1605    /// use builder::instance_admin::TestIamPermissions;
1606    /// # tokio_test::block_on(async {
1607    ///
1608    /// let builder = prepare_request_builder();
1609    /// let response = builder.send().await?;
1610    /// # gax::Result::<()>::Ok(()) });
1611    ///
1612    /// fn prepare_request_builder() -> TestIamPermissions {
1613    ///   # panic!();
1614    ///   // ... details omitted ...
1615    /// }
1616    /// ```
1617    #[derive(Clone, Debug)]
1618    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1619
1620    impl TestIamPermissions {
1621        pub(crate) fn new(
1622            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1623        ) -> Self {
1624            Self(RequestBuilder::new(stub))
1625        }
1626
1627        /// Sets the full request, replacing any prior values.
1628        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1629            mut self,
1630            v: V,
1631        ) -> Self {
1632            self.0.request = v.into();
1633            self
1634        }
1635
1636        /// Sets all the options, replacing any prior values.
1637        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1638            self.0.options = v.into();
1639            self
1640        }
1641
1642        /// Sends the request.
1643        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1644            (*self.0.stub)
1645                .test_iam_permissions(self.0.request, self.0.options)
1646                .await
1647                .map(gax::response::Response::into_body)
1648        }
1649
1650        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1651        ///
1652        /// This is a **required** field for requests.
1653        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1654            self.0.request.resource = v.into();
1655            self
1656        }
1657
1658        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1659        ///
1660        /// This is a **required** field for requests.
1661        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1662        where
1663            T: std::iter::IntoIterator<Item = V>,
1664            V: std::convert::Into<std::string::String>,
1665        {
1666            use std::iter::Iterator;
1667            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1668            self
1669        }
1670    }
1671
1672    #[doc(hidden)]
1673    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1674        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1675            &mut self.0.options
1676        }
1677    }
1678
1679    /// The request builder for [InstanceAdmin::get_instance_partition][crate::client::InstanceAdmin::get_instance_partition] calls.
1680    ///
1681    /// # Example
1682    /// ```no_run
1683    /// # use google_cloud_spanner_admin_instance_v1::builder;
1684    /// use builder::instance_admin::GetInstancePartition;
1685    /// # tokio_test::block_on(async {
1686    ///
1687    /// let builder = prepare_request_builder();
1688    /// let response = builder.send().await?;
1689    /// # gax::Result::<()>::Ok(()) });
1690    ///
1691    /// fn prepare_request_builder() -> GetInstancePartition {
1692    ///   # panic!();
1693    ///   // ... details omitted ...
1694    /// }
1695    /// ```
1696    #[derive(Clone, Debug)]
1697    pub struct GetInstancePartition(RequestBuilder<crate::model::GetInstancePartitionRequest>);
1698
1699    impl GetInstancePartition {
1700        pub(crate) fn new(
1701            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1702        ) -> Self {
1703            Self(RequestBuilder::new(stub))
1704        }
1705
1706        /// Sets the full request, replacing any prior values.
1707        pub fn with_request<V: Into<crate::model::GetInstancePartitionRequest>>(
1708            mut self,
1709            v: V,
1710        ) -> Self {
1711            self.0.request = v.into();
1712            self
1713        }
1714
1715        /// Sets all the options, replacing any prior values.
1716        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1717            self.0.options = v.into();
1718            self
1719        }
1720
1721        /// Sends the request.
1722        pub async fn send(self) -> Result<crate::model::InstancePartition> {
1723            (*self.0.stub)
1724                .get_instance_partition(self.0.request, self.0.options)
1725                .await
1726                .map(gax::response::Response::into_body)
1727        }
1728
1729        /// Sets the value of [name][crate::model::GetInstancePartitionRequest::name].
1730        ///
1731        /// This is a **required** field for requests.
1732        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1733            self.0.request.name = v.into();
1734            self
1735        }
1736    }
1737
1738    #[doc(hidden)]
1739    impl gax::options::internal::RequestBuilder for GetInstancePartition {
1740        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1741            &mut self.0.options
1742        }
1743    }
1744
1745    /// The request builder for [InstanceAdmin::create_instance_partition][crate::client::InstanceAdmin::create_instance_partition] calls.
1746    ///
1747    /// # Example
1748    /// ```no_run
1749    /// # use google_cloud_spanner_admin_instance_v1::builder;
1750    /// use builder::instance_admin::CreateInstancePartition;
1751    /// # tokio_test::block_on(async {
1752    /// use lro::Poller;
1753    ///
1754    /// let builder = prepare_request_builder();
1755    /// let response = builder.poller().until_done().await?;
1756    /// # gax::Result::<()>::Ok(()) });
1757    ///
1758    /// fn prepare_request_builder() -> CreateInstancePartition {
1759    ///   # panic!();
1760    ///   // ... details omitted ...
1761    /// }
1762    /// ```
1763    #[derive(Clone, Debug)]
1764    pub struct CreateInstancePartition(
1765        RequestBuilder<crate::model::CreateInstancePartitionRequest>,
1766    );
1767
1768    impl CreateInstancePartition {
1769        pub(crate) fn new(
1770            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1771        ) -> Self {
1772            Self(RequestBuilder::new(stub))
1773        }
1774
1775        /// Sets the full request, replacing any prior values.
1776        pub fn with_request<V: Into<crate::model::CreateInstancePartitionRequest>>(
1777            mut self,
1778            v: V,
1779        ) -> Self {
1780            self.0.request = v.into();
1781            self
1782        }
1783
1784        /// Sets all the options, replacing any prior values.
1785        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1786            self.0.options = v.into();
1787            self
1788        }
1789
1790        /// Sends the request.
1791        ///
1792        /// # Long running operations
1793        ///
1794        /// This starts, but does not poll, a longrunning operation. More information
1795        /// on [create_instance_partition][crate::client::InstanceAdmin::create_instance_partition].
1796        pub async fn send(self) -> Result<longrunning::model::Operation> {
1797            (*self.0.stub)
1798                .create_instance_partition(self.0.request, self.0.options)
1799                .await
1800                .map(gax::response::Response::into_body)
1801        }
1802
1803        /// Creates a [Poller][lro::Poller] to work with `create_instance_partition`.
1804        pub fn poller(
1805            self,
1806        ) -> impl lro::Poller<
1807            crate::model::InstancePartition,
1808            crate::model::CreateInstancePartitionMetadata,
1809        > {
1810            type Operation = lro::internal::Operation<
1811                crate::model::InstancePartition,
1812                crate::model::CreateInstancePartitionMetadata,
1813            >;
1814            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1815            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1816
1817            let stub = self.0.stub.clone();
1818            let mut options = self.0.options.clone();
1819            options.set_retry_policy(gax::retry_policy::NeverRetry);
1820            let query = move |name| {
1821                let stub = stub.clone();
1822                let options = options.clone();
1823                async {
1824                    let op = GetOperation::new(stub)
1825                        .set_name(name)
1826                        .with_options(options)
1827                        .send()
1828                        .await?;
1829                    Ok(Operation::new(op))
1830                }
1831            };
1832
1833            let start = move || async {
1834                let op = self.send().await?;
1835                Ok(Operation::new(op))
1836            };
1837
1838            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1839        }
1840
1841        /// Sets the value of [parent][crate::model::CreateInstancePartitionRequest::parent].
1842        ///
1843        /// This is a **required** field for requests.
1844        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845            self.0.request.parent = v.into();
1846            self
1847        }
1848
1849        /// Sets the value of [instance_partition_id][crate::model::CreateInstancePartitionRequest::instance_partition_id].
1850        ///
1851        /// This is a **required** field for requests.
1852        pub fn set_instance_partition_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1853            self.0.request.instance_partition_id = v.into();
1854            self
1855        }
1856
1857        /// Sets the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
1858        ///
1859        /// This is a **required** field for requests.
1860        pub fn set_instance_partition<T>(mut self, v: T) -> Self
1861        where
1862            T: std::convert::Into<crate::model::InstancePartition>,
1863        {
1864            self.0.request.instance_partition = std::option::Option::Some(v.into());
1865            self
1866        }
1867
1868        /// Sets or clears the value of [instance_partition][crate::model::CreateInstancePartitionRequest::instance_partition].
1869        ///
1870        /// This is a **required** field for requests.
1871        pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
1872        where
1873            T: std::convert::Into<crate::model::InstancePartition>,
1874        {
1875            self.0.request.instance_partition = v.map(|x| x.into());
1876            self
1877        }
1878    }
1879
1880    #[doc(hidden)]
1881    impl gax::options::internal::RequestBuilder for CreateInstancePartition {
1882        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1883            &mut self.0.options
1884        }
1885    }
1886
1887    /// The request builder for [InstanceAdmin::delete_instance_partition][crate::client::InstanceAdmin::delete_instance_partition] calls.
1888    ///
1889    /// # Example
1890    /// ```no_run
1891    /// # use google_cloud_spanner_admin_instance_v1::builder;
1892    /// use builder::instance_admin::DeleteInstancePartition;
1893    /// # tokio_test::block_on(async {
1894    ///
1895    /// let builder = prepare_request_builder();
1896    /// let response = builder.send().await?;
1897    /// # gax::Result::<()>::Ok(()) });
1898    ///
1899    /// fn prepare_request_builder() -> DeleteInstancePartition {
1900    ///   # panic!();
1901    ///   // ... details omitted ...
1902    /// }
1903    /// ```
1904    #[derive(Clone, Debug)]
1905    pub struct DeleteInstancePartition(
1906        RequestBuilder<crate::model::DeleteInstancePartitionRequest>,
1907    );
1908
1909    impl DeleteInstancePartition {
1910        pub(crate) fn new(
1911            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1912        ) -> Self {
1913            Self(RequestBuilder::new(stub))
1914        }
1915
1916        /// Sets the full request, replacing any prior values.
1917        pub fn with_request<V: Into<crate::model::DeleteInstancePartitionRequest>>(
1918            mut self,
1919            v: V,
1920        ) -> Self {
1921            self.0.request = v.into();
1922            self
1923        }
1924
1925        /// Sets all the options, replacing any prior values.
1926        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1927            self.0.options = v.into();
1928            self
1929        }
1930
1931        /// Sends the request.
1932        pub async fn send(self) -> Result<()> {
1933            (*self.0.stub)
1934                .delete_instance_partition(self.0.request, self.0.options)
1935                .await
1936                .map(gax::response::Response::into_body)
1937        }
1938
1939        /// Sets the value of [name][crate::model::DeleteInstancePartitionRequest::name].
1940        ///
1941        /// This is a **required** field for requests.
1942        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1943            self.0.request.name = v.into();
1944            self
1945        }
1946
1947        /// Sets the value of [etag][crate::model::DeleteInstancePartitionRequest::etag].
1948        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1949            self.0.request.etag = v.into();
1950            self
1951        }
1952    }
1953
1954    #[doc(hidden)]
1955    impl gax::options::internal::RequestBuilder for DeleteInstancePartition {
1956        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1957            &mut self.0.options
1958        }
1959    }
1960
1961    /// The request builder for [InstanceAdmin::update_instance_partition][crate::client::InstanceAdmin::update_instance_partition] calls.
1962    ///
1963    /// # Example
1964    /// ```no_run
1965    /// # use google_cloud_spanner_admin_instance_v1::builder;
1966    /// use builder::instance_admin::UpdateInstancePartition;
1967    /// # tokio_test::block_on(async {
1968    /// use lro::Poller;
1969    ///
1970    /// let builder = prepare_request_builder();
1971    /// let response = builder.poller().until_done().await?;
1972    /// # gax::Result::<()>::Ok(()) });
1973    ///
1974    /// fn prepare_request_builder() -> UpdateInstancePartition {
1975    ///   # panic!();
1976    ///   // ... details omitted ...
1977    /// }
1978    /// ```
1979    #[derive(Clone, Debug)]
1980    pub struct UpdateInstancePartition(
1981        RequestBuilder<crate::model::UpdateInstancePartitionRequest>,
1982    );
1983
1984    impl UpdateInstancePartition {
1985        pub(crate) fn new(
1986            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1987        ) -> Self {
1988            Self(RequestBuilder::new(stub))
1989        }
1990
1991        /// Sets the full request, replacing any prior values.
1992        pub fn with_request<V: Into<crate::model::UpdateInstancePartitionRequest>>(
1993            mut self,
1994            v: V,
1995        ) -> Self {
1996            self.0.request = v.into();
1997            self
1998        }
1999
2000        /// Sets all the options, replacing any prior values.
2001        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2002            self.0.options = v.into();
2003            self
2004        }
2005
2006        /// Sends the request.
2007        ///
2008        /// # Long running operations
2009        ///
2010        /// This starts, but does not poll, a longrunning operation. More information
2011        /// on [update_instance_partition][crate::client::InstanceAdmin::update_instance_partition].
2012        pub async fn send(self) -> Result<longrunning::model::Operation> {
2013            (*self.0.stub)
2014                .update_instance_partition(self.0.request, self.0.options)
2015                .await
2016                .map(gax::response::Response::into_body)
2017        }
2018
2019        /// Creates a [Poller][lro::Poller] to work with `update_instance_partition`.
2020        pub fn poller(
2021            self,
2022        ) -> impl lro::Poller<
2023            crate::model::InstancePartition,
2024            crate::model::UpdateInstancePartitionMetadata,
2025        > {
2026            type Operation = lro::internal::Operation<
2027                crate::model::InstancePartition,
2028                crate::model::UpdateInstancePartitionMetadata,
2029            >;
2030            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2031            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2032
2033            let stub = self.0.stub.clone();
2034            let mut options = self.0.options.clone();
2035            options.set_retry_policy(gax::retry_policy::NeverRetry);
2036            let query = move |name| {
2037                let stub = stub.clone();
2038                let options = options.clone();
2039                async {
2040                    let op = GetOperation::new(stub)
2041                        .set_name(name)
2042                        .with_options(options)
2043                        .send()
2044                        .await?;
2045                    Ok(Operation::new(op))
2046                }
2047            };
2048
2049            let start = move || async {
2050                let op = self.send().await?;
2051                Ok(Operation::new(op))
2052            };
2053
2054            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2055        }
2056
2057        /// Sets the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
2058        ///
2059        /// This is a **required** field for requests.
2060        pub fn set_instance_partition<T>(mut self, v: T) -> Self
2061        where
2062            T: std::convert::Into<crate::model::InstancePartition>,
2063        {
2064            self.0.request.instance_partition = std::option::Option::Some(v.into());
2065            self
2066        }
2067
2068        /// Sets or clears the value of [instance_partition][crate::model::UpdateInstancePartitionRequest::instance_partition].
2069        ///
2070        /// This is a **required** field for requests.
2071        pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
2072        where
2073            T: std::convert::Into<crate::model::InstancePartition>,
2074        {
2075            self.0.request.instance_partition = v.map(|x| x.into());
2076            self
2077        }
2078
2079        /// Sets the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
2080        ///
2081        /// This is a **required** field for requests.
2082        pub fn set_field_mask<T>(mut self, v: T) -> Self
2083        where
2084            T: std::convert::Into<wkt::FieldMask>,
2085        {
2086            self.0.request.field_mask = std::option::Option::Some(v.into());
2087            self
2088        }
2089
2090        /// Sets or clears the value of [field_mask][crate::model::UpdateInstancePartitionRequest::field_mask].
2091        ///
2092        /// This is a **required** field for requests.
2093        pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
2094        where
2095            T: std::convert::Into<wkt::FieldMask>,
2096        {
2097            self.0.request.field_mask = v.map(|x| x.into());
2098            self
2099        }
2100    }
2101
2102    #[doc(hidden)]
2103    impl gax::options::internal::RequestBuilder for UpdateInstancePartition {
2104        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2105            &mut self.0.options
2106        }
2107    }
2108
2109    /// The request builder for [InstanceAdmin::list_instance_partition_operations][crate::client::InstanceAdmin::list_instance_partition_operations] calls.
2110    ///
2111    /// # Example
2112    /// ```no_run
2113    /// # use google_cloud_spanner_admin_instance_v1::builder;
2114    /// use builder::instance_admin::ListInstancePartitionOperations;
2115    /// # tokio_test::block_on(async {
2116    /// use gax::paginator::ItemPaginator;
2117    ///
2118    /// let builder = prepare_request_builder();
2119    /// let mut items = builder.by_item();
2120    /// while let Some(result) = items.next().await {
2121    ///   let item = result?;
2122    /// }
2123    /// # gax::Result::<()>::Ok(()) });
2124    ///
2125    /// fn prepare_request_builder() -> ListInstancePartitionOperations {
2126    ///   # panic!();
2127    ///   // ... details omitted ...
2128    /// }
2129    /// ```
2130    #[derive(Clone, Debug)]
2131    pub struct ListInstancePartitionOperations(
2132        RequestBuilder<crate::model::ListInstancePartitionOperationsRequest>,
2133    );
2134
2135    impl ListInstancePartitionOperations {
2136        pub(crate) fn new(
2137            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2138        ) -> Self {
2139            Self(RequestBuilder::new(stub))
2140        }
2141
2142        /// Sets the full request, replacing any prior values.
2143        pub fn with_request<V: Into<crate::model::ListInstancePartitionOperationsRequest>>(
2144            mut self,
2145            v: V,
2146        ) -> Self {
2147            self.0.request = v.into();
2148            self
2149        }
2150
2151        /// Sets all the options, replacing any prior values.
2152        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2153            self.0.options = v.into();
2154            self
2155        }
2156
2157        /// Sends the request.
2158        pub async fn send(self) -> Result<crate::model::ListInstancePartitionOperationsResponse> {
2159            (*self.0.stub)
2160                .list_instance_partition_operations(self.0.request, self.0.options)
2161                .await
2162                .map(gax::response::Response::into_body)
2163        }
2164
2165        /// Streams each page in the collection.
2166        pub fn by_page(
2167            self,
2168        ) -> impl gax::paginator::Paginator<
2169            crate::model::ListInstancePartitionOperationsResponse,
2170            gax::error::Error,
2171        > {
2172            use std::clone::Clone;
2173            let token = self.0.request.page_token.clone();
2174            let execute = move |token: String| {
2175                let mut builder = self.clone();
2176                builder.0.request = builder.0.request.set_page_token(token);
2177                builder.send()
2178            };
2179            gax::paginator::internal::new_paginator(token, execute)
2180        }
2181
2182        /// Streams each item in the collection.
2183        pub fn by_item(
2184            self,
2185        ) -> impl gax::paginator::ItemPaginator<
2186            crate::model::ListInstancePartitionOperationsResponse,
2187            gax::error::Error,
2188        > {
2189            use gax::paginator::Paginator;
2190            self.by_page().items()
2191        }
2192
2193        /// Sets the value of [parent][crate::model::ListInstancePartitionOperationsRequest::parent].
2194        ///
2195        /// This is a **required** field for requests.
2196        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2197            self.0.request.parent = v.into();
2198            self
2199        }
2200
2201        /// Sets the value of [filter][crate::model::ListInstancePartitionOperationsRequest::filter].
2202        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2203            self.0.request.filter = v.into();
2204            self
2205        }
2206
2207        /// Sets the value of [page_size][crate::model::ListInstancePartitionOperationsRequest::page_size].
2208        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2209            self.0.request.page_size = v.into();
2210            self
2211        }
2212
2213        /// Sets the value of [page_token][crate::model::ListInstancePartitionOperationsRequest::page_token].
2214        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2215            self.0.request.page_token = v.into();
2216            self
2217        }
2218
2219        /// Sets the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
2220        pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
2221        where
2222            T: std::convert::Into<wkt::Timestamp>,
2223        {
2224            self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
2225            self
2226        }
2227
2228        /// Sets or clears the value of [instance_partition_deadline][crate::model::ListInstancePartitionOperationsRequest::instance_partition_deadline].
2229        pub fn set_or_clear_instance_partition_deadline<T>(
2230            mut self,
2231            v: std::option::Option<T>,
2232        ) -> Self
2233        where
2234            T: std::convert::Into<wkt::Timestamp>,
2235        {
2236            self.0.request.instance_partition_deadline = v.map(|x| x.into());
2237            self
2238        }
2239    }
2240
2241    #[doc(hidden)]
2242    impl gax::options::internal::RequestBuilder for ListInstancePartitionOperations {
2243        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2244            &mut self.0.options
2245        }
2246    }
2247
2248    /// The request builder for [InstanceAdmin::move_instance][crate::client::InstanceAdmin::move_instance] calls.
2249    ///
2250    /// # Example
2251    /// ```no_run
2252    /// # use google_cloud_spanner_admin_instance_v1::builder;
2253    /// use builder::instance_admin::MoveInstance;
2254    /// # tokio_test::block_on(async {
2255    /// use lro::Poller;
2256    ///
2257    /// let builder = prepare_request_builder();
2258    /// let response = builder.poller().until_done().await?;
2259    /// # gax::Result::<()>::Ok(()) });
2260    ///
2261    /// fn prepare_request_builder() -> MoveInstance {
2262    ///   # panic!();
2263    ///   // ... details omitted ...
2264    /// }
2265    /// ```
2266    #[derive(Clone, Debug)]
2267    pub struct MoveInstance(RequestBuilder<crate::model::MoveInstanceRequest>);
2268
2269    impl MoveInstance {
2270        pub(crate) fn new(
2271            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2272        ) -> Self {
2273            Self(RequestBuilder::new(stub))
2274        }
2275
2276        /// Sets the full request, replacing any prior values.
2277        pub fn with_request<V: Into<crate::model::MoveInstanceRequest>>(mut self, v: V) -> Self {
2278            self.0.request = v.into();
2279            self
2280        }
2281
2282        /// Sets all the options, replacing any prior values.
2283        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2284            self.0.options = v.into();
2285            self
2286        }
2287
2288        /// Sends the request.
2289        ///
2290        /// # Long running operations
2291        ///
2292        /// This starts, but does not poll, a longrunning operation. More information
2293        /// on [move_instance][crate::client::InstanceAdmin::move_instance].
2294        pub async fn send(self) -> Result<longrunning::model::Operation> {
2295            (*self.0.stub)
2296                .move_instance(self.0.request, self.0.options)
2297                .await
2298                .map(gax::response::Response::into_body)
2299        }
2300
2301        /// Creates a [Poller][lro::Poller] to work with `move_instance`.
2302        pub fn poller(
2303            self,
2304        ) -> impl lro::Poller<crate::model::MoveInstanceResponse, crate::model::MoveInstanceMetadata>
2305        {
2306            type Operation = lro::internal::Operation<
2307                crate::model::MoveInstanceResponse,
2308                crate::model::MoveInstanceMetadata,
2309            >;
2310            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2311            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2312
2313            let stub = self.0.stub.clone();
2314            let mut options = self.0.options.clone();
2315            options.set_retry_policy(gax::retry_policy::NeverRetry);
2316            let query = move |name| {
2317                let stub = stub.clone();
2318                let options = options.clone();
2319                async {
2320                    let op = GetOperation::new(stub)
2321                        .set_name(name)
2322                        .with_options(options)
2323                        .send()
2324                        .await?;
2325                    Ok(Operation::new(op))
2326                }
2327            };
2328
2329            let start = move || async {
2330                let op = self.send().await?;
2331                Ok(Operation::new(op))
2332            };
2333
2334            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2335        }
2336
2337        /// Sets the value of [name][crate::model::MoveInstanceRequest::name].
2338        ///
2339        /// This is a **required** field for requests.
2340        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2341            self.0.request.name = v.into();
2342            self
2343        }
2344
2345        /// Sets the value of [target_config][crate::model::MoveInstanceRequest::target_config].
2346        ///
2347        /// This is a **required** field for requests.
2348        pub fn set_target_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2349            self.0.request.target_config = v.into();
2350            self
2351        }
2352    }
2353
2354    #[doc(hidden)]
2355    impl gax::options::internal::RequestBuilder for MoveInstance {
2356        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2357            &mut self.0.options
2358        }
2359    }
2360
2361    /// The request builder for [InstanceAdmin::list_operations][crate::client::InstanceAdmin::list_operations] calls.
2362    ///
2363    /// # Example
2364    /// ```no_run
2365    /// # use google_cloud_spanner_admin_instance_v1::builder;
2366    /// use builder::instance_admin::ListOperations;
2367    /// # tokio_test::block_on(async {
2368    /// use gax::paginator::ItemPaginator;
2369    ///
2370    /// let builder = prepare_request_builder();
2371    /// let mut items = builder.by_item();
2372    /// while let Some(result) = items.next().await {
2373    ///   let item = result?;
2374    /// }
2375    /// # gax::Result::<()>::Ok(()) });
2376    ///
2377    /// fn prepare_request_builder() -> ListOperations {
2378    ///   # panic!();
2379    ///   // ... details omitted ...
2380    /// }
2381    /// ```
2382    #[derive(Clone, Debug)]
2383    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2384
2385    impl ListOperations {
2386        pub(crate) fn new(
2387            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2388        ) -> Self {
2389            Self(RequestBuilder::new(stub))
2390        }
2391
2392        /// Sets the full request, replacing any prior values.
2393        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2394            mut self,
2395            v: V,
2396        ) -> Self {
2397            self.0.request = v.into();
2398            self
2399        }
2400
2401        /// Sets all the options, replacing any prior values.
2402        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2403            self.0.options = v.into();
2404            self
2405        }
2406
2407        /// Sends the request.
2408        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2409            (*self.0.stub)
2410                .list_operations(self.0.request, self.0.options)
2411                .await
2412                .map(gax::response::Response::into_body)
2413        }
2414
2415        /// Streams each page in the collection.
2416        pub fn by_page(
2417            self,
2418        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2419        {
2420            use std::clone::Clone;
2421            let token = self.0.request.page_token.clone();
2422            let execute = move |token: String| {
2423                let mut builder = self.clone();
2424                builder.0.request = builder.0.request.set_page_token(token);
2425                builder.send()
2426            };
2427            gax::paginator::internal::new_paginator(token, execute)
2428        }
2429
2430        /// Streams each item in the collection.
2431        pub fn by_item(
2432            self,
2433        ) -> impl gax::paginator::ItemPaginator<
2434            longrunning::model::ListOperationsResponse,
2435            gax::error::Error,
2436        > {
2437            use gax::paginator::Paginator;
2438            self.by_page().items()
2439        }
2440
2441        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2442        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2443            self.0.request.name = v.into();
2444            self
2445        }
2446
2447        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2448        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2449            self.0.request.filter = v.into();
2450            self
2451        }
2452
2453        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2454        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2455            self.0.request.page_size = v.into();
2456            self
2457        }
2458
2459        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2460        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2461            self.0.request.page_token = v.into();
2462            self
2463        }
2464    }
2465
2466    #[doc(hidden)]
2467    impl gax::options::internal::RequestBuilder for ListOperations {
2468        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2469            &mut self.0.options
2470        }
2471    }
2472
2473    /// The request builder for [InstanceAdmin::get_operation][crate::client::InstanceAdmin::get_operation] calls.
2474    ///
2475    /// # Example
2476    /// ```no_run
2477    /// # use google_cloud_spanner_admin_instance_v1::builder;
2478    /// use builder::instance_admin::GetOperation;
2479    /// # tokio_test::block_on(async {
2480    ///
2481    /// let builder = prepare_request_builder();
2482    /// let response = builder.send().await?;
2483    /// # gax::Result::<()>::Ok(()) });
2484    ///
2485    /// fn prepare_request_builder() -> GetOperation {
2486    ///   # panic!();
2487    ///   // ... details omitted ...
2488    /// }
2489    /// ```
2490    #[derive(Clone, Debug)]
2491    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2492
2493    impl GetOperation {
2494        pub(crate) fn new(
2495            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2496        ) -> Self {
2497            Self(RequestBuilder::new(stub))
2498        }
2499
2500        /// Sets the full request, replacing any prior values.
2501        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2502            mut self,
2503            v: V,
2504        ) -> Self {
2505            self.0.request = v.into();
2506            self
2507        }
2508
2509        /// Sets all the options, replacing any prior values.
2510        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2511            self.0.options = v.into();
2512            self
2513        }
2514
2515        /// Sends the request.
2516        pub async fn send(self) -> Result<longrunning::model::Operation> {
2517            (*self.0.stub)
2518                .get_operation(self.0.request, self.0.options)
2519                .await
2520                .map(gax::response::Response::into_body)
2521        }
2522
2523        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2524        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2525            self.0.request.name = v.into();
2526            self
2527        }
2528    }
2529
2530    #[doc(hidden)]
2531    impl gax::options::internal::RequestBuilder for GetOperation {
2532        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2533            &mut self.0.options
2534        }
2535    }
2536
2537    /// The request builder for [InstanceAdmin::delete_operation][crate::client::InstanceAdmin::delete_operation] calls.
2538    ///
2539    /// # Example
2540    /// ```no_run
2541    /// # use google_cloud_spanner_admin_instance_v1::builder;
2542    /// use builder::instance_admin::DeleteOperation;
2543    /// # tokio_test::block_on(async {
2544    ///
2545    /// let builder = prepare_request_builder();
2546    /// let response = builder.send().await?;
2547    /// # gax::Result::<()>::Ok(()) });
2548    ///
2549    /// fn prepare_request_builder() -> DeleteOperation {
2550    ///   # panic!();
2551    ///   // ... details omitted ...
2552    /// }
2553    /// ```
2554    #[derive(Clone, Debug)]
2555    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2556
2557    impl DeleteOperation {
2558        pub(crate) fn new(
2559            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2560        ) -> Self {
2561            Self(RequestBuilder::new(stub))
2562        }
2563
2564        /// Sets the full request, replacing any prior values.
2565        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2566            mut self,
2567            v: V,
2568        ) -> Self {
2569            self.0.request = v.into();
2570            self
2571        }
2572
2573        /// Sets all the options, replacing any prior values.
2574        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2575            self.0.options = v.into();
2576            self
2577        }
2578
2579        /// Sends the request.
2580        pub async fn send(self) -> Result<()> {
2581            (*self.0.stub)
2582                .delete_operation(self.0.request, self.0.options)
2583                .await
2584                .map(gax::response::Response::into_body)
2585        }
2586
2587        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
2588        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2589            self.0.request.name = v.into();
2590            self
2591        }
2592    }
2593
2594    #[doc(hidden)]
2595    impl gax::options::internal::RequestBuilder for DeleteOperation {
2596        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2597            &mut self.0.options
2598        }
2599    }
2600
2601    /// The request builder for [InstanceAdmin::cancel_operation][crate::client::InstanceAdmin::cancel_operation] calls.
2602    ///
2603    /// # Example
2604    /// ```no_run
2605    /// # use google_cloud_spanner_admin_instance_v1::builder;
2606    /// use builder::instance_admin::CancelOperation;
2607    /// # tokio_test::block_on(async {
2608    ///
2609    /// let builder = prepare_request_builder();
2610    /// let response = builder.send().await?;
2611    /// # gax::Result::<()>::Ok(()) });
2612    ///
2613    /// fn prepare_request_builder() -> CancelOperation {
2614    ///   # panic!();
2615    ///   // ... details omitted ...
2616    /// }
2617    /// ```
2618    #[derive(Clone, Debug)]
2619    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2620
2621    impl CancelOperation {
2622        pub(crate) fn new(
2623            stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2624        ) -> Self {
2625            Self(RequestBuilder::new(stub))
2626        }
2627
2628        /// Sets the full request, replacing any prior values.
2629        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2630            mut self,
2631            v: V,
2632        ) -> Self {
2633            self.0.request = v.into();
2634            self
2635        }
2636
2637        /// Sets all the options, replacing any prior values.
2638        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2639            self.0.options = v.into();
2640            self
2641        }
2642
2643        /// Sends the request.
2644        pub async fn send(self) -> Result<()> {
2645            (*self.0.stub)
2646                .cancel_operation(self.0.request, self.0.options)
2647                .await
2648                .map(gax::response::Response::into_body)
2649        }
2650
2651        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2652        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2653            self.0.request.name = v.into();
2654            self
2655        }
2656    }
2657
2658    #[doc(hidden)]
2659    impl gax::options::internal::RequestBuilder for CancelOperation {
2660        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2661            &mut self.0.options
2662        }
2663    }
2664}