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