google_cloud_datastore_admin_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod datastore_admin {
18    use crate::Result;
19    use std::sync::Arc;
20
21    /// A builder for [DatastoreAdmin][super::super::client::DatastoreAdmin].
22    ///
23    /// ```
24    /// # tokio_test::block_on(async {
25    /// # use google_cloud_datastore_admin_v1::*;
26    /// # use builder::datastore_admin::ClientBuilder;
27    /// # use client::DatastoreAdmin;
28    /// let builder : ClientBuilder = DatastoreAdmin::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://datastore.googleapis.com")
31    ///     .build().await?;
32    /// # gax::Result::<()>::Ok(()) });
33    /// ```
34    pub type ClientBuilder =
35        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37    pub(crate) mod client {
38        use super::super::super::client::DatastoreAdmin;
39        pub struct Factory;
40        impl gax::client_builder::internal::ClientFactory for Factory {
41            type Client = DatastoreAdmin;
42            type Credentials = gaxi::options::Credentials;
43            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
44                Self::Client::new(config).await
45            }
46        }
47    }
48
49    /// Common implementation for [super::super::client::DatastoreAdmin] request builders.
50    #[derive(Clone, Debug)]
51    pub(crate) struct RequestBuilder<R: std::default::Default> {
52        stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
53        request: R,
54        options: gax::options::RequestOptions,
55    }
56
57    impl<R> RequestBuilder<R>
58    where
59        R: std::default::Default,
60    {
61        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
62            Self {
63                stub,
64                request: R::default(),
65                options: gax::options::RequestOptions::default(),
66            }
67        }
68    }
69
70    /// The request builder for [DatastoreAdmin::export_entities][super::super::client::DatastoreAdmin::export_entities] calls.
71    #[derive(Clone, Debug)]
72    pub struct ExportEntities(RequestBuilder<crate::model::ExportEntitiesRequest>);
73
74    impl ExportEntities {
75        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
76            Self(RequestBuilder::new(stub))
77        }
78
79        /// Sets the full request, replacing any prior values.
80        pub fn with_request<V: Into<crate::model::ExportEntitiesRequest>>(mut self, v: V) -> Self {
81            self.0.request = v.into();
82            self
83        }
84
85        /// Sets all the options, replacing any prior values.
86        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
87            self.0.options = v.into();
88            self
89        }
90
91        /// Sends the request.
92        ///
93        /// # Long running operations
94        ///
95        /// This starts, but does not poll, a longrunning operation. More information
96        /// on [export_entities][super::super::client::DatastoreAdmin::export_entities].
97        pub async fn send(self) -> Result<longrunning::model::Operation> {
98            (*self.0.stub)
99                .export_entities(self.0.request, self.0.options)
100                .await
101                .map(gax::response::Response::into_body)
102        }
103
104        /// Creates a [Poller][lro::Poller] to work with `export_entities`.
105        pub fn poller(
106            self,
107        ) -> impl lro::Poller<crate::model::ExportEntitiesResponse, crate::model::ExportEntitiesMetadata>
108        {
109            type Operation = lro::Operation<
110                crate::model::ExportEntitiesResponse,
111                crate::model::ExportEntitiesMetadata,
112            >;
113            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
114            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
115
116            let stub = self.0.stub.clone();
117            let mut options = self.0.options.clone();
118            options.set_retry_policy(gax::retry_policy::NeverRetry);
119            let query = move |name| {
120                let stub = stub.clone();
121                let options = options.clone();
122                async {
123                    let op = GetOperation::new(stub)
124                        .set_name(name)
125                        .with_options(options)
126                        .send()
127                        .await?;
128                    Ok(Operation::new(op))
129                }
130            };
131
132            let start = move || async {
133                let op = self.send().await?;
134                Ok(Operation::new(op))
135            };
136
137            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
138        }
139
140        /// Sets the value of [project_id][crate::model::ExportEntitiesRequest::project_id].
141        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
142            self.0.request.project_id = v.into();
143            self
144        }
145
146        /// Sets the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
147        pub fn set_entity_filter<T: Into<std::option::Option<crate::model::EntityFilter>>>(
148            mut self,
149            v: T,
150        ) -> Self {
151            self.0.request.entity_filter = v.into();
152            self
153        }
154
155        /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesRequest::output_url_prefix].
156        pub fn set_output_url_prefix<T: Into<std::string::String>>(mut self, v: T) -> Self {
157            self.0.request.output_url_prefix = v.into();
158            self
159        }
160
161        /// Sets the value of [labels][crate::model::ExportEntitiesRequest::labels].
162        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
163        where
164            T: std::iter::IntoIterator<Item = (K, V)>,
165            K: std::convert::Into<std::string::String>,
166            V: std::convert::Into<std::string::String>,
167        {
168            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
169            self
170        }
171    }
172
173    #[doc(hidden)]
174    impl gax::options::internal::RequestBuilder for ExportEntities {
175        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
176            &mut self.0.options
177        }
178    }
179
180    /// The request builder for [DatastoreAdmin::import_entities][super::super::client::DatastoreAdmin::import_entities] calls.
181    #[derive(Clone, Debug)]
182    pub struct ImportEntities(RequestBuilder<crate::model::ImportEntitiesRequest>);
183
184    impl ImportEntities {
185        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
186            Self(RequestBuilder::new(stub))
187        }
188
189        /// Sets the full request, replacing any prior values.
190        pub fn with_request<V: Into<crate::model::ImportEntitiesRequest>>(mut self, v: V) -> Self {
191            self.0.request = v.into();
192            self
193        }
194
195        /// Sets all the options, replacing any prior values.
196        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
197            self.0.options = v.into();
198            self
199        }
200
201        /// Sends the request.
202        ///
203        /// # Long running operations
204        ///
205        /// This starts, but does not poll, a longrunning operation. More information
206        /// on [import_entities][super::super::client::DatastoreAdmin::import_entities].
207        pub async fn send(self) -> Result<longrunning::model::Operation> {
208            (*self.0.stub)
209                .import_entities(self.0.request, self.0.options)
210                .await
211                .map(gax::response::Response::into_body)
212        }
213
214        /// Creates a [Poller][lro::Poller] to work with `import_entities`.
215        pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::ImportEntitiesMetadata> {
216            type Operation = lro::Operation<wkt::Empty, crate::model::ImportEntitiesMetadata>;
217            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
218            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
219
220            let stub = self.0.stub.clone();
221            let mut options = self.0.options.clone();
222            options.set_retry_policy(gax::retry_policy::NeverRetry);
223            let query = move |name| {
224                let stub = stub.clone();
225                let options = options.clone();
226                async {
227                    let op = GetOperation::new(stub)
228                        .set_name(name)
229                        .with_options(options)
230                        .send()
231                        .await?;
232                    Ok(Operation::new(op))
233                }
234            };
235
236            let start = move || async {
237                let op = self.send().await?;
238                Ok(Operation::new(op))
239            };
240
241            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
242        }
243
244        /// Sets the value of [project_id][crate::model::ImportEntitiesRequest::project_id].
245        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
246            self.0.request.project_id = v.into();
247            self
248        }
249
250        /// Sets the value of [input_url][crate::model::ImportEntitiesRequest::input_url].
251        pub fn set_input_url<T: Into<std::string::String>>(mut self, v: T) -> Self {
252            self.0.request.input_url = v.into();
253            self
254        }
255
256        /// Sets the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
257        pub fn set_entity_filter<T: Into<std::option::Option<crate::model::EntityFilter>>>(
258            mut self,
259            v: T,
260        ) -> Self {
261            self.0.request.entity_filter = v.into();
262            self
263        }
264
265        /// Sets the value of [labels][crate::model::ImportEntitiesRequest::labels].
266        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
267        where
268            T: std::iter::IntoIterator<Item = (K, V)>,
269            K: std::convert::Into<std::string::String>,
270            V: std::convert::Into<std::string::String>,
271        {
272            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
273            self
274        }
275    }
276
277    #[doc(hidden)]
278    impl gax::options::internal::RequestBuilder for ImportEntities {
279        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
280            &mut self.0.options
281        }
282    }
283
284    /// The request builder for [DatastoreAdmin::create_index][super::super::client::DatastoreAdmin::create_index] calls.
285    #[derive(Clone, Debug)]
286    pub struct CreateIndex(RequestBuilder<crate::model::CreateIndexRequest>);
287
288    impl CreateIndex {
289        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
290            Self(RequestBuilder::new(stub))
291        }
292
293        /// Sets the full request, replacing any prior values.
294        pub fn with_request<V: Into<crate::model::CreateIndexRequest>>(mut self, v: V) -> Self {
295            self.0.request = v.into();
296            self
297        }
298
299        /// Sets all the options, replacing any prior values.
300        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
301            self.0.options = v.into();
302            self
303        }
304
305        /// Sends the request.
306        ///
307        /// # Long running operations
308        ///
309        /// This starts, but does not poll, a longrunning operation. More information
310        /// on [create_index][super::super::client::DatastoreAdmin::create_index].
311        pub async fn send(self) -> Result<longrunning::model::Operation> {
312            (*self.0.stub)
313                .create_index(self.0.request, self.0.options)
314                .await
315                .map(gax::response::Response::into_body)
316        }
317
318        /// Creates a [Poller][lro::Poller] to work with `create_index`.
319        pub fn poller(
320            self,
321        ) -> impl lro::Poller<crate::model::Index, crate::model::IndexOperationMetadata> {
322            type Operation =
323                lro::Operation<crate::model::Index, crate::model::IndexOperationMetadata>;
324            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
325            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
326
327            let stub = self.0.stub.clone();
328            let mut options = self.0.options.clone();
329            options.set_retry_policy(gax::retry_policy::NeverRetry);
330            let query = move |name| {
331                let stub = stub.clone();
332                let options = options.clone();
333                async {
334                    let op = GetOperation::new(stub)
335                        .set_name(name)
336                        .with_options(options)
337                        .send()
338                        .await?;
339                    Ok(Operation::new(op))
340                }
341            };
342
343            let start = move || async {
344                let op = self.send().await?;
345                Ok(Operation::new(op))
346            };
347
348            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
349        }
350
351        /// Sets the value of [project_id][crate::model::CreateIndexRequest::project_id].
352        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
353            self.0.request.project_id = v.into();
354            self
355        }
356
357        /// Sets the value of [index][crate::model::CreateIndexRequest::index].
358        pub fn set_index<T: Into<std::option::Option<crate::model::Index>>>(
359            mut self,
360            v: T,
361        ) -> Self {
362            self.0.request.index = v.into();
363            self
364        }
365    }
366
367    #[doc(hidden)]
368    impl gax::options::internal::RequestBuilder for CreateIndex {
369        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
370            &mut self.0.options
371        }
372    }
373
374    /// The request builder for [DatastoreAdmin::delete_index][super::super::client::DatastoreAdmin::delete_index] calls.
375    #[derive(Clone, Debug)]
376    pub struct DeleteIndex(RequestBuilder<crate::model::DeleteIndexRequest>);
377
378    impl DeleteIndex {
379        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
380            Self(RequestBuilder::new(stub))
381        }
382
383        /// Sets the full request, replacing any prior values.
384        pub fn with_request<V: Into<crate::model::DeleteIndexRequest>>(mut self, v: V) -> Self {
385            self.0.request = v.into();
386            self
387        }
388
389        /// Sets all the options, replacing any prior values.
390        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
391            self.0.options = v.into();
392            self
393        }
394
395        /// Sends the request.
396        ///
397        /// # Long running operations
398        ///
399        /// This starts, but does not poll, a longrunning operation. More information
400        /// on [delete_index][super::super::client::DatastoreAdmin::delete_index].
401        pub async fn send(self) -> Result<longrunning::model::Operation> {
402            (*self.0.stub)
403                .delete_index(self.0.request, self.0.options)
404                .await
405                .map(gax::response::Response::into_body)
406        }
407
408        /// Creates a [Poller][lro::Poller] to work with `delete_index`.
409        pub fn poller(
410            self,
411        ) -> impl lro::Poller<crate::model::Index, crate::model::IndexOperationMetadata> {
412            type Operation =
413                lro::Operation<crate::model::Index, crate::model::IndexOperationMetadata>;
414            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
415            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
416
417            let stub = self.0.stub.clone();
418            let mut options = self.0.options.clone();
419            options.set_retry_policy(gax::retry_policy::NeverRetry);
420            let query = move |name| {
421                let stub = stub.clone();
422                let options = options.clone();
423                async {
424                    let op = GetOperation::new(stub)
425                        .set_name(name)
426                        .with_options(options)
427                        .send()
428                        .await?;
429                    Ok(Operation::new(op))
430                }
431            };
432
433            let start = move || async {
434                let op = self.send().await?;
435                Ok(Operation::new(op))
436            };
437
438            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
439        }
440
441        /// Sets the value of [project_id][crate::model::DeleteIndexRequest::project_id].
442        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
443            self.0.request.project_id = v.into();
444            self
445        }
446
447        /// Sets the value of [index_id][crate::model::DeleteIndexRequest::index_id].
448        pub fn set_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
449            self.0.request.index_id = v.into();
450            self
451        }
452    }
453
454    #[doc(hidden)]
455    impl gax::options::internal::RequestBuilder for DeleteIndex {
456        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
457            &mut self.0.options
458        }
459    }
460
461    /// The request builder for [DatastoreAdmin::get_index][super::super::client::DatastoreAdmin::get_index] calls.
462    #[derive(Clone, Debug)]
463    pub struct GetIndex(RequestBuilder<crate::model::GetIndexRequest>);
464
465    impl GetIndex {
466        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
467            Self(RequestBuilder::new(stub))
468        }
469
470        /// Sets the full request, replacing any prior values.
471        pub fn with_request<V: Into<crate::model::GetIndexRequest>>(mut self, v: V) -> Self {
472            self.0.request = v.into();
473            self
474        }
475
476        /// Sets all the options, replacing any prior values.
477        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
478            self.0.options = v.into();
479            self
480        }
481
482        /// Sends the request.
483        pub async fn send(self) -> Result<crate::model::Index> {
484            (*self.0.stub)
485                .get_index(self.0.request, self.0.options)
486                .await
487                .map(gax::response::Response::into_body)
488        }
489
490        /// Sets the value of [project_id][crate::model::GetIndexRequest::project_id].
491        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
492            self.0.request.project_id = v.into();
493            self
494        }
495
496        /// Sets the value of [index_id][crate::model::GetIndexRequest::index_id].
497        pub fn set_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
498            self.0.request.index_id = v.into();
499            self
500        }
501    }
502
503    #[doc(hidden)]
504    impl gax::options::internal::RequestBuilder for GetIndex {
505        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
506            &mut self.0.options
507        }
508    }
509
510    /// The request builder for [DatastoreAdmin::list_indexes][super::super::client::DatastoreAdmin::list_indexes] calls.
511    #[derive(Clone, Debug)]
512    pub struct ListIndexes(RequestBuilder<crate::model::ListIndexesRequest>);
513
514    impl ListIndexes {
515        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
516            Self(RequestBuilder::new(stub))
517        }
518
519        /// Sets the full request, replacing any prior values.
520        pub fn with_request<V: Into<crate::model::ListIndexesRequest>>(mut self, v: V) -> Self {
521            self.0.request = v.into();
522            self
523        }
524
525        /// Sets all the options, replacing any prior values.
526        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
527            self.0.options = v.into();
528            self
529        }
530
531        /// Sends the request.
532        pub async fn send(self) -> Result<crate::model::ListIndexesResponse> {
533            (*self.0.stub)
534                .list_indexes(self.0.request, self.0.options)
535                .await
536                .map(gax::response::Response::into_body)
537        }
538
539        /// Streams the responses back.
540        pub async fn paginator(
541            self,
542        ) -> impl gax::paginator::Paginator<crate::model::ListIndexesResponse, gax::error::Error>
543        {
544            use std::clone::Clone;
545            let token = self.0.request.page_token.clone();
546            let execute = move |token: String| {
547                let mut builder = self.clone();
548                builder.0.request = builder.0.request.set_page_token(token);
549                builder.send()
550            };
551            gax::paginator::internal::new_paginator(token, execute)
552        }
553
554        /// Sets the value of [project_id][crate::model::ListIndexesRequest::project_id].
555        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
556            self.0.request.project_id = v.into();
557            self
558        }
559
560        /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
561        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
562            self.0.request.filter = v.into();
563            self
564        }
565
566        /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
567        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
568            self.0.request.page_size = v.into();
569            self
570        }
571
572        /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
573        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
574            self.0.request.page_token = v.into();
575            self
576        }
577    }
578
579    #[doc(hidden)]
580    impl gax::options::internal::RequestBuilder for ListIndexes {
581        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
582            &mut self.0.options
583        }
584    }
585
586    /// The request builder for [DatastoreAdmin::list_operations][super::super::client::DatastoreAdmin::list_operations] calls.
587    #[derive(Clone, Debug)]
588    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
589
590    impl ListOperations {
591        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
592            Self(RequestBuilder::new(stub))
593        }
594
595        /// Sets the full request, replacing any prior values.
596        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
597            mut self,
598            v: V,
599        ) -> Self {
600            self.0.request = v.into();
601            self
602        }
603
604        /// Sets all the options, replacing any prior values.
605        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
606            self.0.options = v.into();
607            self
608        }
609
610        /// Sends the request.
611        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
612            (*self.0.stub)
613                .list_operations(self.0.request, self.0.options)
614                .await
615                .map(gax::response::Response::into_body)
616        }
617
618        /// Streams the responses back.
619        pub async fn paginator(
620            self,
621        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
622        {
623            use std::clone::Clone;
624            let token = self.0.request.page_token.clone();
625            let execute = move |token: String| {
626                let mut builder = self.clone();
627                builder.0.request = builder.0.request.set_page_token(token);
628                builder.send()
629            };
630            gax::paginator::internal::new_paginator(token, execute)
631        }
632
633        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
634        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
635            self.0.request.name = v.into();
636            self
637        }
638
639        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
640        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
641            self.0.request.filter = v.into();
642            self
643        }
644
645        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
646        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
647            self.0.request.page_size = v.into();
648            self
649        }
650
651        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
652        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
653            self.0.request.page_token = v.into();
654            self
655        }
656    }
657
658    #[doc(hidden)]
659    impl gax::options::internal::RequestBuilder for ListOperations {
660        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
661            &mut self.0.options
662        }
663    }
664
665    /// The request builder for [DatastoreAdmin::get_operation][super::super::client::DatastoreAdmin::get_operation] calls.
666    #[derive(Clone, Debug)]
667    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
668
669    impl GetOperation {
670        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
671            Self(RequestBuilder::new(stub))
672        }
673
674        /// Sets the full request, replacing any prior values.
675        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
676            mut self,
677            v: V,
678        ) -> Self {
679            self.0.request = v.into();
680            self
681        }
682
683        /// Sets all the options, replacing any prior values.
684        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
685            self.0.options = v.into();
686            self
687        }
688
689        /// Sends the request.
690        pub async fn send(self) -> Result<longrunning::model::Operation> {
691            (*self.0.stub)
692                .get_operation(self.0.request, self.0.options)
693                .await
694                .map(gax::response::Response::into_body)
695        }
696
697        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
698        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
699            self.0.request.name = v.into();
700            self
701        }
702    }
703
704    #[doc(hidden)]
705    impl gax::options::internal::RequestBuilder for GetOperation {
706        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
707            &mut self.0.options
708        }
709    }
710
711    /// The request builder for [DatastoreAdmin::delete_operation][super::super::client::DatastoreAdmin::delete_operation] calls.
712    #[derive(Clone, Debug)]
713    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
714
715    impl DeleteOperation {
716        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
717            Self(RequestBuilder::new(stub))
718        }
719
720        /// Sets the full request, replacing any prior values.
721        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
722            mut self,
723            v: V,
724        ) -> Self {
725            self.0.request = v.into();
726            self
727        }
728
729        /// Sets all the options, replacing any prior values.
730        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
731            self.0.options = v.into();
732            self
733        }
734
735        /// Sends the request.
736        pub async fn send(self) -> Result<()> {
737            (*self.0.stub)
738                .delete_operation(self.0.request, self.0.options)
739                .await
740                .map(gax::response::Response::into_body)
741        }
742
743        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
744        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
745            self.0.request.name = v.into();
746            self
747        }
748    }
749
750    #[doc(hidden)]
751    impl gax::options::internal::RequestBuilder for DeleteOperation {
752        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
753            &mut self.0.options
754        }
755    }
756
757    /// The request builder for [DatastoreAdmin::cancel_operation][super::super::client::DatastoreAdmin::cancel_operation] calls.
758    #[derive(Clone, Debug)]
759    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
760
761    impl CancelOperation {
762        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::DatastoreAdmin>) -> Self {
763            Self(RequestBuilder::new(stub))
764        }
765
766        /// Sets the full request, replacing any prior values.
767        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
768            mut self,
769            v: V,
770        ) -> Self {
771            self.0.request = v.into();
772            self
773        }
774
775        /// Sets all the options, replacing any prior values.
776        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
777            self.0.options = v.into();
778            self
779        }
780
781        /// Sends the request.
782        pub async fn send(self) -> Result<()> {
783            (*self.0.stub)
784                .cancel_operation(self.0.request, self.0.options)
785                .await
786                .map(gax::response::Response::into_body)
787        }
788
789        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
790        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
791            self.0.request.name = v.into();
792            self
793        }
794    }
795
796    #[doc(hidden)]
797    impl gax::options::internal::RequestBuilder for CancelOperation {
798        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
799            &mut self.0.options
800        }
801    }
802}