Skip to main content

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