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