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