Skip to main content

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