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