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
20    /// A builder for [DatastoreAdmin][crate::client::DatastoreAdmin].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_datastore_admin_v1::*;
25    /// # use builder::datastore_admin::ClientBuilder;
26    /// # use client::DatastoreAdmin;
27    /// let builder : ClientBuilder = DatastoreAdmin::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://datastore.googleapis.com")
30    ///     .build().await?;
31    /// # gax::client_builder::Result::<()>::Ok(()) });
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::DatastoreAdmin;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = DatastoreAdmin;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::DatastoreAdmin] 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::DatastoreAdmin>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [DatastoreAdmin::export_entities][crate::client::DatastoreAdmin::export_entities] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_datastore_admin_v1::builder;
79    /// use builder::datastore_admin::ExportEntities;
80    /// # tokio_test::block_on(async {
81    /// use lro::Poller;
82    ///
83    /// let builder = prepare_request_builder();
84    /// let response = builder.poller().until_done().await?;
85    /// # gax::Result::<()>::Ok(()) });
86    ///
87    /// fn prepare_request_builder() -> ExportEntities {
88    ///   # panic!();
89    ///   // ... details omitted ...
90    /// }
91    /// ```
92    #[derive(Clone, Debug)]
93    pub struct ExportEntities(RequestBuilder<crate::model::ExportEntitiesRequest>);
94
95    impl ExportEntities {
96        pub(crate) fn new(
97            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
98        ) -> Self {
99            Self(RequestBuilder::new(stub))
100        }
101
102        /// Sets the full request, replacing any prior values.
103        pub fn with_request<V: Into<crate::model::ExportEntitiesRequest>>(mut self, v: V) -> Self {
104            self.0.request = v.into();
105            self
106        }
107
108        /// Sets all the options, replacing any prior values.
109        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
110            self.0.options = v.into();
111            self
112        }
113
114        /// Sends the request.
115        ///
116        /// # Long running operations
117        ///
118        /// This starts, but does not poll, a longrunning operation. More information
119        /// on [export_entities][crate::client::DatastoreAdmin::export_entities].
120        pub async fn send(self) -> Result<longrunning::model::Operation> {
121            (*self.0.stub)
122                .export_entities(self.0.request, self.0.options)
123                .await
124                .map(gax::response::Response::into_body)
125        }
126
127        /// Creates a [Poller][lro::Poller] to work with `export_entities`.
128        pub fn poller(
129            self,
130        ) -> impl lro::Poller<crate::model::ExportEntitiesResponse, crate::model::ExportEntitiesMetadata>
131        {
132            type Operation = lro::internal::Operation<
133                crate::model::ExportEntitiesResponse,
134                crate::model::ExportEntitiesMetadata,
135            >;
136            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
137            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
138
139            let stub = self.0.stub.clone();
140            let mut options = self.0.options.clone();
141            options.set_retry_policy(gax::retry_policy::NeverRetry);
142            let query = move |name| {
143                let stub = stub.clone();
144                let options = options.clone();
145                async {
146                    let op = GetOperation::new(stub)
147                        .set_name(name)
148                        .with_options(options)
149                        .send()
150                        .await?;
151                    Ok(Operation::new(op))
152                }
153            };
154
155            let start = move || async {
156                let op = self.send().await?;
157                Ok(Operation::new(op))
158            };
159
160            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
161        }
162
163        /// Sets the value of [project_id][crate::model::ExportEntitiesRequest::project_id].
164        ///
165        /// This is a **required** field for requests.
166        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
167            self.0.request.project_id = v.into();
168            self
169        }
170
171        /// Sets the value of [labels][crate::model::ExportEntitiesRequest::labels].
172        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
173        where
174            T: std::iter::IntoIterator<Item = (K, V)>,
175            K: std::convert::Into<std::string::String>,
176            V: std::convert::Into<std::string::String>,
177        {
178            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
179            self
180        }
181
182        /// Sets the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
183        pub fn set_entity_filter<T>(mut self, v: T) -> Self
184        where
185            T: std::convert::Into<crate::model::EntityFilter>,
186        {
187            self.0.request.entity_filter = std::option::Option::Some(v.into());
188            self
189        }
190
191        /// Sets or clears the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
192        pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
193        where
194            T: std::convert::Into<crate::model::EntityFilter>,
195        {
196            self.0.request.entity_filter = v.map(|x| x.into());
197            self
198        }
199
200        /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesRequest::output_url_prefix].
201        ///
202        /// This is a **required** field for requests.
203        pub fn set_output_url_prefix<T: Into<std::string::String>>(mut self, v: T) -> Self {
204            self.0.request.output_url_prefix = v.into();
205            self
206        }
207    }
208
209    #[doc(hidden)]
210    impl gax::options::internal::RequestBuilder for ExportEntities {
211        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
212            &mut self.0.options
213        }
214    }
215
216    /// The request builder for [DatastoreAdmin::import_entities][crate::client::DatastoreAdmin::import_entities] calls.
217    ///
218    /// # Example
219    /// ```no_run
220    /// # use google_cloud_datastore_admin_v1::builder;
221    /// use builder::datastore_admin::ImportEntities;
222    /// # tokio_test::block_on(async {
223    /// use lro::Poller;
224    ///
225    /// let builder = prepare_request_builder();
226    /// let response = builder.poller().until_done().await?;
227    /// # gax::Result::<()>::Ok(()) });
228    ///
229    /// fn prepare_request_builder() -> ImportEntities {
230    ///   # panic!();
231    ///   // ... details omitted ...
232    /// }
233    /// ```
234    #[derive(Clone, Debug)]
235    pub struct ImportEntities(RequestBuilder<crate::model::ImportEntitiesRequest>);
236
237    impl ImportEntities {
238        pub(crate) fn new(
239            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
240        ) -> Self {
241            Self(RequestBuilder::new(stub))
242        }
243
244        /// Sets the full request, replacing any prior values.
245        pub fn with_request<V: Into<crate::model::ImportEntitiesRequest>>(mut self, v: V) -> Self {
246            self.0.request = v.into();
247            self
248        }
249
250        /// Sets all the options, replacing any prior values.
251        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
252            self.0.options = v.into();
253            self
254        }
255
256        /// Sends the request.
257        ///
258        /// # Long running operations
259        ///
260        /// This starts, but does not poll, a longrunning operation. More information
261        /// on [import_entities][crate::client::DatastoreAdmin::import_entities].
262        pub async fn send(self) -> Result<longrunning::model::Operation> {
263            (*self.0.stub)
264                .import_entities(self.0.request, self.0.options)
265                .await
266                .map(gax::response::Response::into_body)
267        }
268
269        /// Creates a [Poller][lro::Poller] to work with `import_entities`.
270        pub fn poller(self) -> impl lro::Poller<(), crate::model::ImportEntitiesMetadata> {
271            type Operation =
272                lro::internal::Operation<wkt::Empty, crate::model::ImportEntitiesMetadata>;
273            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
274            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
275
276            let stub = self.0.stub.clone();
277            let mut options = self.0.options.clone();
278            options.set_retry_policy(gax::retry_policy::NeverRetry);
279            let query = move |name| {
280                let stub = stub.clone();
281                let options = options.clone();
282                async {
283                    let op = GetOperation::new(stub)
284                        .set_name(name)
285                        .with_options(options)
286                        .send()
287                        .await?;
288                    Ok(Operation::new(op))
289                }
290            };
291
292            let start = move || async {
293                let op = self.send().await?;
294                Ok(Operation::new(op))
295            };
296
297            lro::internal::new_unit_response_poller(
298                polling_error_policy,
299                polling_backoff_policy,
300                start,
301                query,
302            )
303        }
304
305        /// Sets the value of [project_id][crate::model::ImportEntitiesRequest::project_id].
306        ///
307        /// This is a **required** field for requests.
308        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
309            self.0.request.project_id = v.into();
310            self
311        }
312
313        /// Sets the value of [labels][crate::model::ImportEntitiesRequest::labels].
314        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
315        where
316            T: std::iter::IntoIterator<Item = (K, V)>,
317            K: std::convert::Into<std::string::String>,
318            V: std::convert::Into<std::string::String>,
319        {
320            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
321            self
322        }
323
324        /// Sets the value of [input_url][crate::model::ImportEntitiesRequest::input_url].
325        ///
326        /// This is a **required** field for requests.
327        pub fn set_input_url<T: Into<std::string::String>>(mut self, v: T) -> Self {
328            self.0.request.input_url = v.into();
329            self
330        }
331
332        /// Sets the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
333        pub fn set_entity_filter<T>(mut self, v: T) -> Self
334        where
335            T: std::convert::Into<crate::model::EntityFilter>,
336        {
337            self.0.request.entity_filter = std::option::Option::Some(v.into());
338            self
339        }
340
341        /// Sets or clears the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
342        pub fn set_or_clear_entity_filter<T>(mut self, v: std::option::Option<T>) -> Self
343        where
344            T: std::convert::Into<crate::model::EntityFilter>,
345        {
346            self.0.request.entity_filter = v.map(|x| x.into());
347            self
348        }
349    }
350
351    #[doc(hidden)]
352    impl gax::options::internal::RequestBuilder for ImportEntities {
353        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
354            &mut self.0.options
355        }
356    }
357
358    /// The request builder for [DatastoreAdmin::create_index][crate::client::DatastoreAdmin::create_index] calls.
359    ///
360    /// # Example
361    /// ```no_run
362    /// # use google_cloud_datastore_admin_v1::builder;
363    /// use builder::datastore_admin::CreateIndex;
364    /// # tokio_test::block_on(async {
365    /// use lro::Poller;
366    ///
367    /// let builder = prepare_request_builder();
368    /// let response = builder.poller().until_done().await?;
369    /// # gax::Result::<()>::Ok(()) });
370    ///
371    /// fn prepare_request_builder() -> CreateIndex {
372    ///   # panic!();
373    ///   // ... details omitted ...
374    /// }
375    /// ```
376    #[derive(Clone, Debug)]
377    pub struct CreateIndex(RequestBuilder<crate::model::CreateIndexRequest>);
378
379    impl CreateIndex {
380        pub(crate) fn new(
381            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
382        ) -> Self {
383            Self(RequestBuilder::new(stub))
384        }
385
386        /// Sets the full request, replacing any prior values.
387        pub fn with_request<V: Into<crate::model::CreateIndexRequest>>(mut self, v: V) -> Self {
388            self.0.request = v.into();
389            self
390        }
391
392        /// Sets all the options, replacing any prior values.
393        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
394            self.0.options = v.into();
395            self
396        }
397
398        /// Sends the request.
399        ///
400        /// # Long running operations
401        ///
402        /// This starts, but does not poll, a longrunning operation. More information
403        /// on [create_index][crate::client::DatastoreAdmin::create_index].
404        pub async fn send(self) -> Result<longrunning::model::Operation> {
405            (*self.0.stub)
406                .create_index(self.0.request, self.0.options)
407                .await
408                .map(gax::response::Response::into_body)
409        }
410
411        /// Creates a [Poller][lro::Poller] to work with `create_index`.
412        pub fn poller(
413            self,
414        ) -> impl lro::Poller<crate::model::Index, crate::model::IndexOperationMetadata> {
415            type Operation =
416                lro::internal::Operation<crate::model::Index, crate::model::IndexOperationMetadata>;
417            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
418            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
419
420            let stub = self.0.stub.clone();
421            let mut options = self.0.options.clone();
422            options.set_retry_policy(gax::retry_policy::NeverRetry);
423            let query = move |name| {
424                let stub = stub.clone();
425                let options = options.clone();
426                async {
427                    let op = GetOperation::new(stub)
428                        .set_name(name)
429                        .with_options(options)
430                        .send()
431                        .await?;
432                    Ok(Operation::new(op))
433                }
434            };
435
436            let start = move || async {
437                let op = self.send().await?;
438                Ok(Operation::new(op))
439            };
440
441            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
442        }
443
444        /// Sets the value of [project_id][crate::model::CreateIndexRequest::project_id].
445        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
446            self.0.request.project_id = v.into();
447            self
448        }
449
450        /// Sets the value of [index][crate::model::CreateIndexRequest::index].
451        pub fn set_index<T>(mut self, v: T) -> Self
452        where
453            T: std::convert::Into<crate::model::Index>,
454        {
455            self.0.request.index = std::option::Option::Some(v.into());
456            self
457        }
458
459        /// Sets or clears the value of [index][crate::model::CreateIndexRequest::index].
460        pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
461        where
462            T: std::convert::Into<crate::model::Index>,
463        {
464            self.0.request.index = v.map(|x| x.into());
465            self
466        }
467    }
468
469    #[doc(hidden)]
470    impl gax::options::internal::RequestBuilder for CreateIndex {
471        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
472            &mut self.0.options
473        }
474    }
475
476    /// The request builder for [DatastoreAdmin::delete_index][crate::client::DatastoreAdmin::delete_index] calls.
477    ///
478    /// # Example
479    /// ```no_run
480    /// # use google_cloud_datastore_admin_v1::builder;
481    /// use builder::datastore_admin::DeleteIndex;
482    /// # tokio_test::block_on(async {
483    /// use lro::Poller;
484    ///
485    /// let builder = prepare_request_builder();
486    /// let response = builder.poller().until_done().await?;
487    /// # gax::Result::<()>::Ok(()) });
488    ///
489    /// fn prepare_request_builder() -> DeleteIndex {
490    ///   # panic!();
491    ///   // ... details omitted ...
492    /// }
493    /// ```
494    #[derive(Clone, Debug)]
495    pub struct DeleteIndex(RequestBuilder<crate::model::DeleteIndexRequest>);
496
497    impl DeleteIndex {
498        pub(crate) fn new(
499            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
500        ) -> Self {
501            Self(RequestBuilder::new(stub))
502        }
503
504        /// Sets the full request, replacing any prior values.
505        pub fn with_request<V: Into<crate::model::DeleteIndexRequest>>(mut self, v: V) -> Self {
506            self.0.request = v.into();
507            self
508        }
509
510        /// Sets all the options, replacing any prior values.
511        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
512            self.0.options = v.into();
513            self
514        }
515
516        /// Sends the request.
517        ///
518        /// # Long running operations
519        ///
520        /// This starts, but does not poll, a longrunning operation. More information
521        /// on [delete_index][crate::client::DatastoreAdmin::delete_index].
522        pub async fn send(self) -> Result<longrunning::model::Operation> {
523            (*self.0.stub)
524                .delete_index(self.0.request, self.0.options)
525                .await
526                .map(gax::response::Response::into_body)
527        }
528
529        /// Creates a [Poller][lro::Poller] to work with `delete_index`.
530        pub fn poller(
531            self,
532        ) -> impl lro::Poller<crate::model::Index, crate::model::IndexOperationMetadata> {
533            type Operation =
534                lro::internal::Operation<crate::model::Index, crate::model::IndexOperationMetadata>;
535            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
536            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
537
538            let stub = self.0.stub.clone();
539            let mut options = self.0.options.clone();
540            options.set_retry_policy(gax::retry_policy::NeverRetry);
541            let query = move |name| {
542                let stub = stub.clone();
543                let options = options.clone();
544                async {
545                    let op = GetOperation::new(stub)
546                        .set_name(name)
547                        .with_options(options)
548                        .send()
549                        .await?;
550                    Ok(Operation::new(op))
551                }
552            };
553
554            let start = move || async {
555                let op = self.send().await?;
556                Ok(Operation::new(op))
557            };
558
559            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
560        }
561
562        /// Sets the value of [project_id][crate::model::DeleteIndexRequest::project_id].
563        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
564            self.0.request.project_id = v.into();
565            self
566        }
567
568        /// Sets the value of [index_id][crate::model::DeleteIndexRequest::index_id].
569        pub fn set_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
570            self.0.request.index_id = v.into();
571            self
572        }
573    }
574
575    #[doc(hidden)]
576    impl gax::options::internal::RequestBuilder for DeleteIndex {
577        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
578            &mut self.0.options
579        }
580    }
581
582    /// The request builder for [DatastoreAdmin::get_index][crate::client::DatastoreAdmin::get_index] calls.
583    ///
584    /// # Example
585    /// ```no_run
586    /// # use google_cloud_datastore_admin_v1::builder;
587    /// use builder::datastore_admin::GetIndex;
588    /// # tokio_test::block_on(async {
589    ///
590    /// let builder = prepare_request_builder();
591    /// let response = builder.send().await?;
592    /// # gax::Result::<()>::Ok(()) });
593    ///
594    /// fn prepare_request_builder() -> GetIndex {
595    ///   # panic!();
596    ///   // ... details omitted ...
597    /// }
598    /// ```
599    #[derive(Clone, Debug)]
600    pub struct GetIndex(RequestBuilder<crate::model::GetIndexRequest>);
601
602    impl GetIndex {
603        pub(crate) fn new(
604            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
605        ) -> Self {
606            Self(RequestBuilder::new(stub))
607        }
608
609        /// Sets the full request, replacing any prior values.
610        pub fn with_request<V: Into<crate::model::GetIndexRequest>>(mut self, v: V) -> Self {
611            self.0.request = v.into();
612            self
613        }
614
615        /// Sets all the options, replacing any prior values.
616        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
617            self.0.options = v.into();
618            self
619        }
620
621        /// Sends the request.
622        pub async fn send(self) -> Result<crate::model::Index> {
623            (*self.0.stub)
624                .get_index(self.0.request, self.0.options)
625                .await
626                .map(gax::response::Response::into_body)
627        }
628
629        /// Sets the value of [project_id][crate::model::GetIndexRequest::project_id].
630        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
631            self.0.request.project_id = v.into();
632            self
633        }
634
635        /// Sets the value of [index_id][crate::model::GetIndexRequest::index_id].
636        pub fn set_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
637            self.0.request.index_id = v.into();
638            self
639        }
640    }
641
642    #[doc(hidden)]
643    impl gax::options::internal::RequestBuilder for GetIndex {
644        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
645            &mut self.0.options
646        }
647    }
648
649    /// The request builder for [DatastoreAdmin::list_indexes][crate::client::DatastoreAdmin::list_indexes] calls.
650    ///
651    /// # Example
652    /// ```no_run
653    /// # use google_cloud_datastore_admin_v1::builder;
654    /// use builder::datastore_admin::ListIndexes;
655    /// # tokio_test::block_on(async {
656    /// use gax::paginator::ItemPaginator;
657    ///
658    /// let builder = prepare_request_builder();
659    /// let mut items = builder.by_item();
660    /// while let Some(result) = items.next().await {
661    ///   let item = result?;
662    /// }
663    /// # gax::Result::<()>::Ok(()) });
664    ///
665    /// fn prepare_request_builder() -> ListIndexes {
666    ///   # panic!();
667    ///   // ... details omitted ...
668    /// }
669    /// ```
670    #[derive(Clone, Debug)]
671    pub struct ListIndexes(RequestBuilder<crate::model::ListIndexesRequest>);
672
673    impl ListIndexes {
674        pub(crate) fn new(
675            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
676        ) -> Self {
677            Self(RequestBuilder::new(stub))
678        }
679
680        /// Sets the full request, replacing any prior values.
681        pub fn with_request<V: Into<crate::model::ListIndexesRequest>>(mut self, v: V) -> Self {
682            self.0.request = v.into();
683            self
684        }
685
686        /// Sets all the options, replacing any prior values.
687        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
688            self.0.options = v.into();
689            self
690        }
691
692        /// Sends the request.
693        pub async fn send(self) -> Result<crate::model::ListIndexesResponse> {
694            (*self.0.stub)
695                .list_indexes(self.0.request, self.0.options)
696                .await
697                .map(gax::response::Response::into_body)
698        }
699
700        /// Streams each page in the collection.
701        pub fn by_page(
702            self,
703        ) -> impl gax::paginator::Paginator<crate::model::ListIndexesResponse, gax::error::Error>
704        {
705            use std::clone::Clone;
706            let token = self.0.request.page_token.clone();
707            let execute = move |token: String| {
708                let mut builder = self.clone();
709                builder.0.request = builder.0.request.set_page_token(token);
710                builder.send()
711            };
712            gax::paginator::internal::new_paginator(token, execute)
713        }
714
715        /// Streams each item in the collection.
716        pub fn by_item(
717            self,
718        ) -> impl gax::paginator::ItemPaginator<crate::model::ListIndexesResponse, gax::error::Error>
719        {
720            use gax::paginator::Paginator;
721            self.by_page().items()
722        }
723
724        /// Sets the value of [project_id][crate::model::ListIndexesRequest::project_id].
725        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
726            self.0.request.project_id = v.into();
727            self
728        }
729
730        /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
731        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
732            self.0.request.filter = v.into();
733            self
734        }
735
736        /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
737        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
738            self.0.request.page_size = v.into();
739            self
740        }
741
742        /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
743        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
744            self.0.request.page_token = v.into();
745            self
746        }
747    }
748
749    #[doc(hidden)]
750    impl gax::options::internal::RequestBuilder for ListIndexes {
751        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
752            &mut self.0.options
753        }
754    }
755
756    /// The request builder for [DatastoreAdmin::list_operations][crate::client::DatastoreAdmin::list_operations] calls.
757    ///
758    /// # Example
759    /// ```no_run
760    /// # use google_cloud_datastore_admin_v1::builder;
761    /// use builder::datastore_admin::ListOperations;
762    /// # tokio_test::block_on(async {
763    /// use gax::paginator::ItemPaginator;
764    ///
765    /// let builder = prepare_request_builder();
766    /// let mut items = builder.by_item();
767    /// while let Some(result) = items.next().await {
768    ///   let item = result?;
769    /// }
770    /// # gax::Result::<()>::Ok(()) });
771    ///
772    /// fn prepare_request_builder() -> ListOperations {
773    ///   # panic!();
774    ///   // ... details omitted ...
775    /// }
776    /// ```
777    #[derive(Clone, Debug)]
778    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
779
780    impl ListOperations {
781        pub(crate) fn new(
782            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
783        ) -> Self {
784            Self(RequestBuilder::new(stub))
785        }
786
787        /// Sets the full request, replacing any prior values.
788        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
789            mut self,
790            v: V,
791        ) -> Self {
792            self.0.request = v.into();
793            self
794        }
795
796        /// Sets all the options, replacing any prior values.
797        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
798            self.0.options = v.into();
799            self
800        }
801
802        /// Sends the request.
803        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
804            (*self.0.stub)
805                .list_operations(self.0.request, self.0.options)
806                .await
807                .map(gax::response::Response::into_body)
808        }
809
810        /// Streams each page in the collection.
811        pub fn by_page(
812            self,
813        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
814        {
815            use std::clone::Clone;
816            let token = self.0.request.page_token.clone();
817            let execute = move |token: String| {
818                let mut builder = self.clone();
819                builder.0.request = builder.0.request.set_page_token(token);
820                builder.send()
821            };
822            gax::paginator::internal::new_paginator(token, execute)
823        }
824
825        /// Streams each item in the collection.
826        pub fn by_item(
827            self,
828        ) -> impl gax::paginator::ItemPaginator<
829            longrunning::model::ListOperationsResponse,
830            gax::error::Error,
831        > {
832            use gax::paginator::Paginator;
833            self.by_page().items()
834        }
835
836        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
837        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
838            self.0.request.name = v.into();
839            self
840        }
841
842        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
843        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
844            self.0.request.filter = v.into();
845            self
846        }
847
848        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::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][longrunning::model::ListOperationsRequest::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
861    #[doc(hidden)]
862    impl gax::options::internal::RequestBuilder for ListOperations {
863        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
864            &mut self.0.options
865        }
866    }
867
868    /// The request builder for [DatastoreAdmin::get_operation][crate::client::DatastoreAdmin::get_operation] calls.
869    ///
870    /// # Example
871    /// ```no_run
872    /// # use google_cloud_datastore_admin_v1::builder;
873    /// use builder::datastore_admin::GetOperation;
874    /// # tokio_test::block_on(async {
875    ///
876    /// let builder = prepare_request_builder();
877    /// let response = builder.send().await?;
878    /// # gax::Result::<()>::Ok(()) });
879    ///
880    /// fn prepare_request_builder() -> GetOperation {
881    ///   # panic!();
882    ///   // ... details omitted ...
883    /// }
884    /// ```
885    #[derive(Clone, Debug)]
886    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
887
888    impl GetOperation {
889        pub(crate) fn new(
890            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
891        ) -> Self {
892            Self(RequestBuilder::new(stub))
893        }
894
895        /// Sets the full request, replacing any prior values.
896        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
897            mut self,
898            v: V,
899        ) -> Self {
900            self.0.request = v.into();
901            self
902        }
903
904        /// Sets all the options, replacing any prior values.
905        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
906            self.0.options = v.into();
907            self
908        }
909
910        /// Sends the request.
911        pub async fn send(self) -> Result<longrunning::model::Operation> {
912            (*self.0.stub)
913                .get_operation(self.0.request, self.0.options)
914                .await
915                .map(gax::response::Response::into_body)
916        }
917
918        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
919        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
920            self.0.request.name = v.into();
921            self
922        }
923    }
924
925    #[doc(hidden)]
926    impl gax::options::internal::RequestBuilder for GetOperation {
927        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
928            &mut self.0.options
929        }
930    }
931
932    /// The request builder for [DatastoreAdmin::delete_operation][crate::client::DatastoreAdmin::delete_operation] calls.
933    ///
934    /// # Example
935    /// ```no_run
936    /// # use google_cloud_datastore_admin_v1::builder;
937    /// use builder::datastore_admin::DeleteOperation;
938    /// # tokio_test::block_on(async {
939    ///
940    /// let builder = prepare_request_builder();
941    /// let response = builder.send().await?;
942    /// # gax::Result::<()>::Ok(()) });
943    ///
944    /// fn prepare_request_builder() -> DeleteOperation {
945    ///   # panic!();
946    ///   // ... details omitted ...
947    /// }
948    /// ```
949    #[derive(Clone, Debug)]
950    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
951
952    impl DeleteOperation {
953        pub(crate) fn new(
954            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
955        ) -> Self {
956            Self(RequestBuilder::new(stub))
957        }
958
959        /// Sets the full request, replacing any prior values.
960        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
961            mut self,
962            v: V,
963        ) -> Self {
964            self.0.request = v.into();
965            self
966        }
967
968        /// Sets all the options, replacing any prior values.
969        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
970            self.0.options = v.into();
971            self
972        }
973
974        /// Sends the request.
975        pub async fn send(self) -> Result<()> {
976            (*self.0.stub)
977                .delete_operation(self.0.request, self.0.options)
978                .await
979                .map(gax::response::Response::into_body)
980        }
981
982        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
983        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
984            self.0.request.name = v.into();
985            self
986        }
987    }
988
989    #[doc(hidden)]
990    impl gax::options::internal::RequestBuilder for DeleteOperation {
991        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
992            &mut self.0.options
993        }
994    }
995
996    /// The request builder for [DatastoreAdmin::cancel_operation][crate::client::DatastoreAdmin::cancel_operation] calls.
997    ///
998    /// # Example
999    /// ```no_run
1000    /// # use google_cloud_datastore_admin_v1::builder;
1001    /// use builder::datastore_admin::CancelOperation;
1002    /// # tokio_test::block_on(async {
1003    ///
1004    /// let builder = prepare_request_builder();
1005    /// let response = builder.send().await?;
1006    /// # gax::Result::<()>::Ok(()) });
1007    ///
1008    /// fn prepare_request_builder() -> CancelOperation {
1009    ///   # panic!();
1010    ///   // ... details omitted ...
1011    /// }
1012    /// ```
1013    #[derive(Clone, Debug)]
1014    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1015
1016    impl CancelOperation {
1017        pub(crate) fn new(
1018            stub: std::sync::Arc<dyn super::super::stub::dynamic::DatastoreAdmin>,
1019        ) -> Self {
1020            Self(RequestBuilder::new(stub))
1021        }
1022
1023        /// Sets the full request, replacing any prior values.
1024        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1025            mut self,
1026            v: V,
1027        ) -> Self {
1028            self.0.request = v.into();
1029            self
1030        }
1031
1032        /// Sets all the options, replacing any prior values.
1033        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1034            self.0.options = v.into();
1035            self
1036        }
1037
1038        /// Sends the request.
1039        pub async fn send(self) -> Result<()> {
1040            (*self.0.stub)
1041                .cancel_operation(self.0.request, self.0.options)
1042                .await
1043                .map(gax::response::Response::into_body)
1044        }
1045
1046        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
1047        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1048            self.0.request.name = v.into();
1049            self
1050        }
1051    }
1052
1053    #[doc(hidden)]
1054    impl gax::options::internal::RequestBuilder for CancelOperation {
1055        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1056            &mut self.0.options
1057        }
1058    }
1059}