google_cloud_datastore_admin_v1/
builders.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    use std::sync::Arc;
20
21    /// Common implementation for [crate::client::DatastoreAdmin] request builders.
22    #[derive(Clone, Debug)]
23    pub struct RequestBuilder<R: std::default::Default> {
24        stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>,
25        request: R,
26        options: gax::options::RequestOptions,
27    }
28
29    impl<R> RequestBuilder<R>
30    where
31        R: std::default::Default,
32    {
33        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
34            Self {
35                stub,
36                request: R::default(),
37                options: gax::options::RequestOptions::default(),
38            }
39        }
40    }
41
42    /// The request builder for a DatastoreAdmin::export_entities call.
43    #[derive(Clone, Debug)]
44    pub struct ExportEntities(RequestBuilder<crate::model::ExportEntitiesRequest>);
45
46    impl ExportEntities {
47        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
48            Self(RequestBuilder::new(stub))
49        }
50
51        /// Sets the full request, replacing any prior values.
52        pub fn with_request<V: Into<crate::model::ExportEntitiesRequest>>(mut self, v: V) -> Self {
53            self.0.request = v.into();
54            self
55        }
56
57        /// Sets all the options, replacing any prior values.
58        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
59            self.0.options = v.into();
60            self
61        }
62
63        /// Sends the request.
64        ///
65        /// # Long running operations
66        ///
67        /// This starts, but does not poll, a longrunning operation. More information
68        /// on [export_entities][crate::client::DatastoreAdmin::export_entities].
69        pub async fn send(self) -> Result<longrunning::model::Operation> {
70            (*self.0.stub)
71                .export_entities(self.0.request, self.0.options)
72                .await
73        }
74
75        /// Creates a [Poller][lro::Poller] to work with `export_entities`.
76        pub fn poller(
77            self,
78        ) -> impl lro::Poller<crate::model::ExportEntitiesResponse, crate::model::ExportEntitiesMetadata>
79        {
80            type Operation = lro::Operation<
81                crate::model::ExportEntitiesResponse,
82                crate::model::ExportEntitiesMetadata,
83            >;
84            let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
85            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
86
87            let stub = self.0.stub.clone();
88            let mut options = self.0.options.clone();
89            options.set_retry_policy(gax::retry_policy::NeverRetry);
90            let query = move |name| {
91                let stub = stub.clone();
92                let options = options.clone();
93                async {
94                    let op = GetOperation::new(stub)
95                        .set_name(name)
96                        .with_options(options)
97                        .send()
98                        .await?;
99                    Ok(Operation::new(op))
100                }
101            };
102
103            let start = move || async {
104                let op = self.send().await?;
105                Ok(Operation::new(op))
106            };
107
108            lro::new_poller(polling_policy, polling_backoff_policy, start, query)
109        }
110
111        /// Sets the value of [project_id][crate::model::ExportEntitiesRequest::project_id].
112        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
113            self.0.request.project_id = v.into();
114            self
115        }
116
117        /// Sets the value of [entity_filter][crate::model::ExportEntitiesRequest::entity_filter].
118        pub fn set_entity_filter<T: Into<std::option::Option<crate::model::EntityFilter>>>(
119            mut self,
120            v: T,
121        ) -> Self {
122            self.0.request.entity_filter = v.into();
123            self
124        }
125
126        /// Sets the value of [output_url_prefix][crate::model::ExportEntitiesRequest::output_url_prefix].
127        pub fn set_output_url_prefix<T: Into<std::string::String>>(mut self, v: T) -> Self {
128            self.0.request.output_url_prefix = v.into();
129            self
130        }
131
132        /// Sets the value of [labels][crate::model::ExportEntitiesRequest::labels].
133        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
134        where
135            T: std::iter::IntoIterator<Item = (K, V)>,
136            K: std::convert::Into<std::string::String>,
137            V: std::convert::Into<std::string::String>,
138        {
139            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
140            self
141        }
142    }
143
144    impl gax::options::RequestBuilder for ExportEntities {
145        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
146            &mut self.0.options
147        }
148    }
149
150    /// The request builder for a DatastoreAdmin::import_entities call.
151    #[derive(Clone, Debug)]
152    pub struct ImportEntities(RequestBuilder<crate::model::ImportEntitiesRequest>);
153
154    impl ImportEntities {
155        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
156            Self(RequestBuilder::new(stub))
157        }
158
159        /// Sets the full request, replacing any prior values.
160        pub fn with_request<V: Into<crate::model::ImportEntitiesRequest>>(mut self, v: V) -> Self {
161            self.0.request = v.into();
162            self
163        }
164
165        /// Sets all the options, replacing any prior values.
166        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
167            self.0.options = v.into();
168            self
169        }
170
171        /// Sends the request.
172        ///
173        /// # Long running operations
174        ///
175        /// This starts, but does not poll, a longrunning operation. More information
176        /// on [import_entities][crate::client::DatastoreAdmin::import_entities].
177        pub async fn send(self) -> Result<longrunning::model::Operation> {
178            (*self.0.stub)
179                .import_entities(self.0.request, self.0.options)
180                .await
181        }
182
183        /// Creates a [Poller][lro::Poller] to work with `import_entities`.
184        pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::ImportEntitiesMetadata> {
185            type Operation = lro::Operation<wkt::Empty, crate::model::ImportEntitiesMetadata>;
186            let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
187            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
188
189            let stub = self.0.stub.clone();
190            let mut options = self.0.options.clone();
191            options.set_retry_policy(gax::retry_policy::NeverRetry);
192            let query = move |name| {
193                let stub = stub.clone();
194                let options = options.clone();
195                async {
196                    let op = GetOperation::new(stub)
197                        .set_name(name)
198                        .with_options(options)
199                        .send()
200                        .await?;
201                    Ok(Operation::new(op))
202                }
203            };
204
205            let start = move || async {
206                let op = self.send().await?;
207                Ok(Operation::new(op))
208            };
209
210            lro::new_poller(polling_policy, polling_backoff_policy, start, query)
211        }
212
213        /// Sets the value of [project_id][crate::model::ImportEntitiesRequest::project_id].
214        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
215            self.0.request.project_id = v.into();
216            self
217        }
218
219        /// Sets the value of [input_url][crate::model::ImportEntitiesRequest::input_url].
220        pub fn set_input_url<T: Into<std::string::String>>(mut self, v: T) -> Self {
221            self.0.request.input_url = v.into();
222            self
223        }
224
225        /// Sets the value of [entity_filter][crate::model::ImportEntitiesRequest::entity_filter].
226        pub fn set_entity_filter<T: Into<std::option::Option<crate::model::EntityFilter>>>(
227            mut self,
228            v: T,
229        ) -> Self {
230            self.0.request.entity_filter = v.into();
231            self
232        }
233
234        /// Sets the value of [labels][crate::model::ImportEntitiesRequest::labels].
235        pub fn set_labels<T, K, V>(mut self, v: T) -> Self
236        where
237            T: std::iter::IntoIterator<Item = (K, V)>,
238            K: std::convert::Into<std::string::String>,
239            V: std::convert::Into<std::string::String>,
240        {
241            self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
242            self
243        }
244    }
245
246    impl gax::options::RequestBuilder for ImportEntities {
247        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248            &mut self.0.options
249        }
250    }
251
252    /// The request builder for a DatastoreAdmin::create_index call.
253    #[derive(Clone, Debug)]
254    pub struct CreateIndex(RequestBuilder<crate::model::CreateIndexRequest>);
255
256    impl CreateIndex {
257        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
258            Self(RequestBuilder::new(stub))
259        }
260
261        /// Sets the full request, replacing any prior values.
262        pub fn with_request<V: Into<crate::model::CreateIndexRequest>>(mut self, v: V) -> Self {
263            self.0.request = v.into();
264            self
265        }
266
267        /// Sets all the options, replacing any prior values.
268        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
269            self.0.options = v.into();
270            self
271        }
272
273        /// Sends the request.
274        ///
275        /// # Long running operations
276        ///
277        /// This starts, but does not poll, a longrunning operation. More information
278        /// on [create_index][crate::client::DatastoreAdmin::create_index].
279        pub async fn send(self) -> Result<longrunning::model::Operation> {
280            (*self.0.stub)
281                .create_index(self.0.request, self.0.options)
282                .await
283        }
284
285        /// Creates a [Poller][lro::Poller] to work with `create_index`.
286        pub fn poller(
287            self,
288        ) -> impl lro::Poller<crate::model::Index, crate::model::IndexOperationMetadata> {
289            type Operation =
290                lro::Operation<crate::model::Index, crate::model::IndexOperationMetadata>;
291            let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
292            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
293
294            let stub = self.0.stub.clone();
295            let mut options = self.0.options.clone();
296            options.set_retry_policy(gax::retry_policy::NeverRetry);
297            let query = move |name| {
298                let stub = stub.clone();
299                let options = options.clone();
300                async {
301                    let op = GetOperation::new(stub)
302                        .set_name(name)
303                        .with_options(options)
304                        .send()
305                        .await?;
306                    Ok(Operation::new(op))
307                }
308            };
309
310            let start = move || async {
311                let op = self.send().await?;
312                Ok(Operation::new(op))
313            };
314
315            lro::new_poller(polling_policy, polling_backoff_policy, start, query)
316        }
317
318        /// Sets the value of [project_id][crate::model::CreateIndexRequest::project_id].
319        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
320            self.0.request.project_id = v.into();
321            self
322        }
323
324        /// Sets the value of [index][crate::model::CreateIndexRequest::index].
325        pub fn set_index<T: Into<std::option::Option<crate::model::Index>>>(
326            mut self,
327            v: T,
328        ) -> Self {
329            self.0.request.index = v.into();
330            self
331        }
332    }
333
334    impl gax::options::RequestBuilder for CreateIndex {
335        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
336            &mut self.0.options
337        }
338    }
339
340    /// The request builder for a DatastoreAdmin::delete_index call.
341    #[derive(Clone, Debug)]
342    pub struct DeleteIndex(RequestBuilder<crate::model::DeleteIndexRequest>);
343
344    impl DeleteIndex {
345        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
346            Self(RequestBuilder::new(stub))
347        }
348
349        /// Sets the full request, replacing any prior values.
350        pub fn with_request<V: Into<crate::model::DeleteIndexRequest>>(mut self, v: V) -> Self {
351            self.0.request = v.into();
352            self
353        }
354
355        /// Sets all the options, replacing any prior values.
356        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
357            self.0.options = v.into();
358            self
359        }
360
361        /// Sends the request.
362        ///
363        /// # Long running operations
364        ///
365        /// This starts, but does not poll, a longrunning operation. More information
366        /// on [delete_index][crate::client::DatastoreAdmin::delete_index].
367        pub async fn send(self) -> Result<longrunning::model::Operation> {
368            (*self.0.stub)
369                .delete_index(self.0.request, self.0.options)
370                .await
371        }
372
373        /// Creates a [Poller][lro::Poller] to work with `delete_index`.
374        pub fn poller(
375            self,
376        ) -> impl lro::Poller<crate::model::Index, crate::model::IndexOperationMetadata> {
377            type Operation =
378                lro::Operation<crate::model::Index, crate::model::IndexOperationMetadata>;
379            let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
380            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
381
382            let stub = self.0.stub.clone();
383            let mut options = self.0.options.clone();
384            options.set_retry_policy(gax::retry_policy::NeverRetry);
385            let query = move |name| {
386                let stub = stub.clone();
387                let options = options.clone();
388                async {
389                    let op = GetOperation::new(stub)
390                        .set_name(name)
391                        .with_options(options)
392                        .send()
393                        .await?;
394                    Ok(Operation::new(op))
395                }
396            };
397
398            let start = move || async {
399                let op = self.send().await?;
400                Ok(Operation::new(op))
401            };
402
403            lro::new_poller(polling_policy, polling_backoff_policy, start, query)
404        }
405
406        /// Sets the value of [project_id][crate::model::DeleteIndexRequest::project_id].
407        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
408            self.0.request.project_id = v.into();
409            self
410        }
411
412        /// Sets the value of [index_id][crate::model::DeleteIndexRequest::index_id].
413        pub fn set_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
414            self.0.request.index_id = v.into();
415            self
416        }
417    }
418
419    impl gax::options::RequestBuilder for DeleteIndex {
420        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
421            &mut self.0.options
422        }
423    }
424
425    /// The request builder for a DatastoreAdmin::get_index call.
426    #[derive(Clone, Debug)]
427    pub struct GetIndex(RequestBuilder<crate::model::GetIndexRequest>);
428
429    impl GetIndex {
430        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
431            Self(RequestBuilder::new(stub))
432        }
433
434        /// Sets the full request, replacing any prior values.
435        pub fn with_request<V: Into<crate::model::GetIndexRequest>>(mut self, v: V) -> Self {
436            self.0.request = v.into();
437            self
438        }
439
440        /// Sets all the options, replacing any prior values.
441        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
442            self.0.options = v.into();
443            self
444        }
445
446        /// Sends the request.
447        pub async fn send(self) -> Result<crate::model::Index> {
448            (*self.0.stub)
449                .get_index(self.0.request, self.0.options)
450                .await
451        }
452
453        /// Sets the value of [project_id][crate::model::GetIndexRequest::project_id].
454        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
455            self.0.request.project_id = v.into();
456            self
457        }
458
459        /// Sets the value of [index_id][crate::model::GetIndexRequest::index_id].
460        pub fn set_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
461            self.0.request.index_id = v.into();
462            self
463        }
464    }
465
466    impl gax::options::RequestBuilder for GetIndex {
467        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
468            &mut self.0.options
469        }
470    }
471
472    /// The request builder for a DatastoreAdmin::list_indexes call.
473    #[derive(Clone, Debug)]
474    pub struct ListIndexes(RequestBuilder<crate::model::ListIndexesRequest>);
475
476    impl ListIndexes {
477        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
478            Self(RequestBuilder::new(stub))
479        }
480
481        /// Sets the full request, replacing any prior values.
482        pub fn with_request<V: Into<crate::model::ListIndexesRequest>>(mut self, v: V) -> Self {
483            self.0.request = v.into();
484            self
485        }
486
487        /// Sets all the options, replacing any prior values.
488        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
489            self.0.options = v.into();
490            self
491        }
492
493        /// Sends the request.
494        pub async fn send(self) -> Result<crate::model::ListIndexesResponse> {
495            (*self.0.stub)
496                .list_indexes(self.0.request, self.0.options)
497                .await
498        }
499
500        /// Streams the responses back.
501        #[cfg(feature = "unstable-stream")]
502        pub async fn stream(
503            self,
504        ) -> gax::paginator::Paginator<crate::model::ListIndexesResponse, gax::error::Error>
505        {
506            let token = gax::paginator::extract_token(&self.0.request.page_token);
507            let execute = move |token: String| {
508                let mut builder = self.clone();
509                builder.0.request = builder.0.request.set_page_token(token);
510                builder.send()
511            };
512            gax::paginator::Paginator::new(token, execute)
513        }
514
515        /// Sets the value of [project_id][crate::model::ListIndexesRequest::project_id].
516        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
517            self.0.request.project_id = v.into();
518            self
519        }
520
521        /// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
522        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
523            self.0.request.filter = v.into();
524            self
525        }
526
527        /// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
528        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
529            self.0.request.page_size = v.into();
530            self
531        }
532
533        /// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
534        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
535            self.0.request.page_token = v.into();
536            self
537        }
538    }
539
540    impl gax::options::RequestBuilder for ListIndexes {
541        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
542            &mut self.0.options
543        }
544    }
545
546    /// The request builder for a DatastoreAdmin::list_operations call.
547    #[derive(Clone, Debug)]
548    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
549
550    impl ListOperations {
551        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
552            Self(RequestBuilder::new(stub))
553        }
554
555        /// Sets the full request, replacing any prior values.
556        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
557            mut self,
558            v: V,
559        ) -> Self {
560            self.0.request = v.into();
561            self
562        }
563
564        /// Sets all the options, replacing any prior values.
565        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
566            self.0.options = v.into();
567            self
568        }
569
570        /// Sends the request.
571        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
572            (*self.0.stub)
573                .list_operations(self.0.request, self.0.options)
574                .await
575        }
576
577        /// Streams the responses back.
578        #[cfg(feature = "unstable-stream")]
579        pub async fn stream(
580            self,
581        ) -> gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
582        {
583            let token = gax::paginator::extract_token(&self.0.request.page_token);
584            let execute = move |token: String| {
585                let mut builder = self.clone();
586                builder.0.request = builder.0.request.set_page_token(token);
587                builder.send()
588            };
589            gax::paginator::Paginator::new(token, execute)
590        }
591
592        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
593        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
594            self.0.request.name = v.into();
595            self
596        }
597
598        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
599        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
600            self.0.request.filter = v.into();
601            self
602        }
603
604        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
605        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
606            self.0.request.page_size = v.into();
607            self
608        }
609
610        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
611        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
612            self.0.request.page_token = v.into();
613            self
614        }
615    }
616
617    impl gax::options::RequestBuilder for ListOperations {
618        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
619            &mut self.0.options
620        }
621    }
622
623    /// The request builder for a DatastoreAdmin::get_operation call.
624    #[derive(Clone, Debug)]
625    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
626
627    impl GetOperation {
628        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
629            Self(RequestBuilder::new(stub))
630        }
631
632        /// Sets the full request, replacing any prior values.
633        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
634            mut self,
635            v: V,
636        ) -> Self {
637            self.0.request = v.into();
638            self
639        }
640
641        /// Sets all the options, replacing any prior values.
642        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
643            self.0.options = v.into();
644            self
645        }
646
647        /// Sends the request.
648        pub async fn send(self) -> Result<longrunning::model::Operation> {
649            (*self.0.stub)
650                .get_operation(self.0.request, self.0.options)
651                .await
652        }
653
654        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
655        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
656            self.0.request.name = v.into();
657            self
658        }
659    }
660
661    impl gax::options::RequestBuilder for GetOperation {
662        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
663            &mut self.0.options
664        }
665    }
666
667    /// The request builder for a DatastoreAdmin::delete_operation call.
668    #[derive(Clone, Debug)]
669    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
670
671    impl DeleteOperation {
672        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
673            Self(RequestBuilder::new(stub))
674        }
675
676        /// Sets the full request, replacing any prior values.
677        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
678            mut self,
679            v: V,
680        ) -> Self {
681            self.0.request = v.into();
682            self
683        }
684
685        /// Sets all the options, replacing any prior values.
686        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
687            self.0.options = v.into();
688            self
689        }
690
691        /// Sends the request.
692        pub async fn send(self) -> Result<wkt::Empty> {
693            (*self.0.stub)
694                .delete_operation(self.0.request, self.0.options)
695                .await
696        }
697
698        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
699        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
700            self.0.request.name = v.into();
701            self
702        }
703    }
704
705    impl gax::options::RequestBuilder for DeleteOperation {
706        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
707            &mut self.0.options
708        }
709    }
710
711    /// The request builder for a DatastoreAdmin::cancel_operation call.
712    #[derive(Clone, Debug)]
713    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
714
715    impl CancelOperation {
716        pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::DatastoreAdmin>) -> Self {
717            Self(RequestBuilder::new(stub))
718        }
719
720        /// Sets the full request, replacing any prior values.
721        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
722            mut self,
723            v: V,
724        ) -> Self {
725            self.0.request = v.into();
726            self
727        }
728
729        /// Sets all the options, replacing any prior values.
730        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
731            self.0.options = v.into();
732            self
733        }
734
735        /// Sends the request.
736        pub async fn send(self) -> Result<wkt::Empty> {
737            (*self.0.stub)
738                .cancel_operation(self.0.request, self.0.options)
739                .await
740        }
741
742        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
743        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
744            self.0.request.name = v.into();
745            self
746        }
747    }
748
749    impl gax::options::RequestBuilder for CancelOperation {
750        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
751            &mut self.0.options
752        }
753    }
754}