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