google_cloud_datastore_admin_v1/
builder.rs

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