Skip to main content

google_cloud_storagebatchoperations_v1/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17/// Request and client builders for [StorageBatchOperations][crate::client::StorageBatchOperations].
18pub mod storage_batch_operations {
19    use crate::Result;
20
21    /// A builder for [StorageBatchOperations][crate::client::StorageBatchOperations].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_storagebatchoperations_v1::*;
26    /// # use builder::storage_batch_operations::ClientBuilder;
27    /// # use client::StorageBatchOperations;
28    /// let builder : ClientBuilder = StorageBatchOperations::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://storagebatchoperations.googleapis.com")
31    ///     .build().await?;
32    /// # Ok(()) }
33    /// ```
34    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::StorageBatchOperations;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = StorageBatchOperations;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> crate::ClientBuilderResult<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::StorageBatchOperations] 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::StorageBatchOperations>,
55        request: R,
56        options: crate::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: crate::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [StorageBatchOperations::list_jobs][crate::client::StorageBatchOperations::list_jobs] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListJobs;
79    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
80    /// use google_cloud_gax::paginator::ItemPaginator;
81    ///
82    /// let builder = prepare_request_builder();
83    /// let mut items = builder.by_item();
84    /// while let Some(result) = items.next().await {
85    ///   let item = result?;
86    /// }
87    /// # Ok(()) }
88    ///
89    /// fn prepare_request_builder() -> ListJobs {
90    ///   # panic!();
91    ///   // ... details omitted ...
92    /// }
93    /// ```
94    #[derive(Clone, Debug)]
95    pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
96
97    impl ListJobs {
98        pub(crate) fn new(
99            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
100        ) -> Self {
101            Self(RequestBuilder::new(stub))
102        }
103
104        /// Sets the full request, replacing any prior values.
105        pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
106            self.0.request = v.into();
107            self
108        }
109
110        /// Sets all the options, replacing any prior values.
111        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112            self.0.options = v.into();
113            self
114        }
115
116        /// Sends the request.
117        pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
118            (*self.0.stub)
119                .list_jobs(self.0.request, self.0.options)
120                .await
121                .map(crate::Response::into_body)
122        }
123
124        /// Streams each page in the collection.
125        pub fn by_page(
126            self,
127        ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListJobsResponse, crate::Error>
128        {
129            use std::clone::Clone;
130            let token = self.0.request.page_token.clone();
131            let execute = move |token: String| {
132                let mut builder = self.clone();
133                builder.0.request = builder.0.request.set_page_token(token);
134                builder.send()
135            };
136            google_cloud_gax::paginator::internal::new_paginator(token, execute)
137        }
138
139        /// Streams each item in the collection.
140        pub fn by_item(
141            self,
142        ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListJobsResponse, crate::Error>
143        {
144            use google_cloud_gax::paginator::Paginator;
145            self.by_page().items()
146        }
147
148        /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
149        ///
150        /// This is a **required** field for requests.
151        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
152            self.0.request.parent = v.into();
153            self
154        }
155
156        /// Sets the value of [filter][crate::model::ListJobsRequest::filter].
157        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
158            self.0.request.filter = v.into();
159            self
160        }
161
162        /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
163        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
164            self.0.request.page_size = v.into();
165            self
166        }
167
168        /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
169        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
170            self.0.request.page_token = v.into();
171            self
172        }
173
174        /// Sets the value of [order_by][crate::model::ListJobsRequest::order_by].
175        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
176            self.0.request.order_by = v.into();
177            self
178        }
179    }
180
181    #[doc(hidden)]
182    impl crate::RequestBuilder for ListJobs {
183        fn request_options(&mut self) -> &mut crate::RequestOptions {
184            &mut self.0.options
185        }
186    }
187
188    /// The request builder for [StorageBatchOperations::get_job][crate::client::StorageBatchOperations::get_job] calls.
189    ///
190    /// # Example
191    /// ```
192    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetJob;
193    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
194    ///
195    /// let builder = prepare_request_builder();
196    /// let response = builder.send().await?;
197    /// # Ok(()) }
198    ///
199    /// fn prepare_request_builder() -> GetJob {
200    ///   # panic!();
201    ///   // ... details omitted ...
202    /// }
203    /// ```
204    #[derive(Clone, Debug)]
205    pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
206
207    impl GetJob {
208        pub(crate) fn new(
209            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
210        ) -> Self {
211            Self(RequestBuilder::new(stub))
212        }
213
214        /// Sets the full request, replacing any prior values.
215        pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
216            self.0.request = v.into();
217            self
218        }
219
220        /// Sets all the options, replacing any prior values.
221        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
222            self.0.options = v.into();
223            self
224        }
225
226        /// Sends the request.
227        pub async fn send(self) -> Result<crate::model::Job> {
228            (*self.0.stub)
229                .get_job(self.0.request, self.0.options)
230                .await
231                .map(crate::Response::into_body)
232        }
233
234        /// Sets the value of [name][crate::model::GetJobRequest::name].
235        ///
236        /// This is a **required** field for requests.
237        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
238            self.0.request.name = v.into();
239            self
240        }
241    }
242
243    #[doc(hidden)]
244    impl crate::RequestBuilder for GetJob {
245        fn request_options(&mut self) -> &mut crate::RequestOptions {
246            &mut self.0.options
247        }
248    }
249
250    /// The request builder for [StorageBatchOperations::create_job][crate::client::StorageBatchOperations::create_job] calls.
251    ///
252    /// # Example
253    /// ```
254    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CreateJob;
255    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
256    /// use google_cloud_lro::Poller;
257    ///
258    /// let builder = prepare_request_builder();
259    /// let response = builder.poller().until_done().await?;
260    /// # Ok(()) }
261    ///
262    /// fn prepare_request_builder() -> CreateJob {
263    ///   # panic!();
264    ///   // ... details omitted ...
265    /// }
266    /// ```
267    #[derive(Clone, Debug)]
268    pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
269
270    impl CreateJob {
271        pub(crate) fn new(
272            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
273        ) -> Self {
274            Self(RequestBuilder::new(stub))
275        }
276
277        /// Sets the full request, replacing any prior values.
278        pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
279            self.0.request = v.into();
280            self
281        }
282
283        /// Sets all the options, replacing any prior values.
284        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
285            self.0.options = v.into();
286            self
287        }
288
289        /// Sends the request.
290        ///
291        /// # Long running operations
292        ///
293        /// This starts, but does not poll, a longrunning operation. More information
294        /// on [create_job][crate::client::StorageBatchOperations::create_job].
295        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
296            (*self.0.stub)
297                .create_job(self.0.request, self.0.options)
298                .await
299                .map(crate::Response::into_body)
300        }
301
302        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_job`.
303        pub fn poller(
304            self,
305        ) -> impl google_cloud_lro::Poller<crate::model::Job, crate::model::OperationMetadata>
306        {
307            type Operation = google_cloud_lro::internal::Operation<
308                crate::model::Job,
309                crate::model::OperationMetadata,
310            >;
311            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
312            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
313            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
314            if let Some(ref mut details) = poller_options.tracing {
315                details.method_name = "google_cloud_storagebatchoperations_v1::client::StorageBatchOperations::create_job::until_done";
316            }
317
318            let stub = self.0.stub.clone();
319            let mut options = self.0.options.clone();
320            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
321            let query = move |name| {
322                let stub = stub.clone();
323                let options = options.clone();
324                async {
325                    let op = GetOperation::new(stub)
326                        .set_name(name)
327                        .with_options(options)
328                        .send()
329                        .await?;
330                    Ok(Operation::new(op))
331                }
332            };
333
334            let start = move || async {
335                let op = self.send().await?;
336                Ok(Operation::new(op))
337            };
338
339            use google_cloud_lro::internal::PollerExt;
340            {
341                google_cloud_lro::internal::new_poller(
342                    polling_error_policy,
343                    polling_backoff_policy,
344                    start,
345                    query,
346                )
347            }
348            .with_options(poller_options)
349        }
350
351        /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
352        ///
353        /// This is a **required** field for requests.
354        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
355            self.0.request.parent = v.into();
356            self
357        }
358
359        /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
360        ///
361        /// This is a **required** field for requests.
362        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
363            self.0.request.job_id = v.into();
364            self
365        }
366
367        /// Sets the value of [job][crate::model::CreateJobRequest::job].
368        ///
369        /// This is a **required** field for requests.
370        pub fn set_job<T>(mut self, v: T) -> Self
371        where
372            T: std::convert::Into<crate::model::Job>,
373        {
374            self.0.request.job = std::option::Option::Some(v.into());
375            self
376        }
377
378        /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
379        ///
380        /// This is a **required** field for requests.
381        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
382        where
383            T: std::convert::Into<crate::model::Job>,
384        {
385            self.0.request.job = v.map(|x| x.into());
386            self
387        }
388
389        /// Sets the value of [request_id][crate::model::CreateJobRequest::request_id].
390        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
391            self.0.request.request_id = v.into();
392            self
393        }
394    }
395
396    #[doc(hidden)]
397    impl crate::RequestBuilder for CreateJob {
398        fn request_options(&mut self) -> &mut crate::RequestOptions {
399            &mut self.0.options
400        }
401    }
402
403    /// The request builder for [StorageBatchOperations::delete_job][crate::client::StorageBatchOperations::delete_job] calls.
404    ///
405    /// # Example
406    /// ```
407    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::DeleteJob;
408    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
409    ///
410    /// let builder = prepare_request_builder();
411    /// let response = builder.send().await?;
412    /// # Ok(()) }
413    ///
414    /// fn prepare_request_builder() -> DeleteJob {
415    ///   # panic!();
416    ///   // ... details omitted ...
417    /// }
418    /// ```
419    #[derive(Clone, Debug)]
420    pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
421
422    impl DeleteJob {
423        pub(crate) fn new(
424            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
425        ) -> Self {
426            Self(RequestBuilder::new(stub))
427        }
428
429        /// Sets the full request, replacing any prior values.
430        pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
431            self.0.request = v.into();
432            self
433        }
434
435        /// Sets all the options, replacing any prior values.
436        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
437            self.0.options = v.into();
438            self
439        }
440
441        /// Sends the request.
442        pub async fn send(self) -> Result<()> {
443            (*self.0.stub)
444                .delete_job(self.0.request, self.0.options)
445                .await
446                .map(crate::Response::into_body)
447        }
448
449        /// Sets the value of [name][crate::model::DeleteJobRequest::name].
450        ///
451        /// This is a **required** field for requests.
452        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
453            self.0.request.name = v.into();
454            self
455        }
456
457        /// Sets the value of [request_id][crate::model::DeleteJobRequest::request_id].
458        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
459            self.0.request.request_id = v.into();
460            self
461        }
462
463        /// Sets the value of [force][crate::model::DeleteJobRequest::force].
464        pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
465            self.0.request.force = v.into();
466            self
467        }
468    }
469
470    #[doc(hidden)]
471    impl crate::RequestBuilder for DeleteJob {
472        fn request_options(&mut self) -> &mut crate::RequestOptions {
473            &mut self.0.options
474        }
475    }
476
477    /// The request builder for [StorageBatchOperations::cancel_job][crate::client::StorageBatchOperations::cancel_job] calls.
478    ///
479    /// # Example
480    /// ```
481    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CancelJob;
482    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
483    ///
484    /// let builder = prepare_request_builder();
485    /// let response = builder.send().await?;
486    /// # Ok(()) }
487    ///
488    /// fn prepare_request_builder() -> CancelJob {
489    ///   # panic!();
490    ///   // ... details omitted ...
491    /// }
492    /// ```
493    #[derive(Clone, Debug)]
494    pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
495
496    impl CancelJob {
497        pub(crate) fn new(
498            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
499        ) -> Self {
500            Self(RequestBuilder::new(stub))
501        }
502
503        /// Sets the full request, replacing any prior values.
504        pub fn with_request<V: Into<crate::model::CancelJobRequest>>(mut self, v: V) -> Self {
505            self.0.request = v.into();
506            self
507        }
508
509        /// Sets all the options, replacing any prior values.
510        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
511            self.0.options = v.into();
512            self
513        }
514
515        /// Sends the request.
516        pub async fn send(self) -> Result<crate::model::CancelJobResponse> {
517            (*self.0.stub)
518                .cancel_job(self.0.request, self.0.options)
519                .await
520                .map(crate::Response::into_body)
521        }
522
523        /// Sets the value of [name][crate::model::CancelJobRequest::name].
524        ///
525        /// This is a **required** field for requests.
526        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
527            self.0.request.name = v.into();
528            self
529        }
530
531        /// Sets the value of [request_id][crate::model::CancelJobRequest::request_id].
532        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
533            self.0.request.request_id = v.into();
534            self
535        }
536    }
537
538    #[doc(hidden)]
539    impl crate::RequestBuilder for CancelJob {
540        fn request_options(&mut self) -> &mut crate::RequestOptions {
541            &mut self.0.options
542        }
543    }
544
545    /// The request builder for [StorageBatchOperations::list_bucket_operations][crate::client::StorageBatchOperations::list_bucket_operations] calls.
546    ///
547    /// # Example
548    /// ```
549    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListBucketOperations;
550    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
551    /// use google_cloud_gax::paginator::ItemPaginator;
552    ///
553    /// let builder = prepare_request_builder();
554    /// let mut items = builder.by_item();
555    /// while let Some(result) = items.next().await {
556    ///   let item = result?;
557    /// }
558    /// # Ok(()) }
559    ///
560    /// fn prepare_request_builder() -> ListBucketOperations {
561    ///   # panic!();
562    ///   // ... details omitted ...
563    /// }
564    /// ```
565    #[derive(Clone, Debug)]
566    pub struct ListBucketOperations(RequestBuilder<crate::model::ListBucketOperationsRequest>);
567
568    impl ListBucketOperations {
569        pub(crate) fn new(
570            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
571        ) -> Self {
572            Self(RequestBuilder::new(stub))
573        }
574
575        /// Sets the full request, replacing any prior values.
576        pub fn with_request<V: Into<crate::model::ListBucketOperationsRequest>>(
577            mut self,
578            v: V,
579        ) -> Self {
580            self.0.request = v.into();
581            self
582        }
583
584        /// Sets all the options, replacing any prior values.
585        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
586            self.0.options = v.into();
587            self
588        }
589
590        /// Sends the request.
591        pub async fn send(self) -> Result<crate::model::ListBucketOperationsResponse> {
592            (*self.0.stub)
593                .list_bucket_operations(self.0.request, self.0.options)
594                .await
595                .map(crate::Response::into_body)
596        }
597
598        /// Streams each page in the collection.
599        pub fn by_page(
600            self,
601        ) -> impl google_cloud_gax::paginator::Paginator<
602            crate::model::ListBucketOperationsResponse,
603            crate::Error,
604        > {
605            use std::clone::Clone;
606            let token = self.0.request.page_token.clone();
607            let execute = move |token: String| {
608                let mut builder = self.clone();
609                builder.0.request = builder.0.request.set_page_token(token);
610                builder.send()
611            };
612            google_cloud_gax::paginator::internal::new_paginator(token, execute)
613        }
614
615        /// Streams each item in the collection.
616        pub fn by_item(
617            self,
618        ) -> impl google_cloud_gax::paginator::ItemPaginator<
619            crate::model::ListBucketOperationsResponse,
620            crate::Error,
621        > {
622            use google_cloud_gax::paginator::Paginator;
623            self.by_page().items()
624        }
625
626        /// Sets the value of [parent][crate::model::ListBucketOperationsRequest::parent].
627        ///
628        /// This is a **required** field for requests.
629        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
630            self.0.request.parent = v.into();
631            self
632        }
633
634        /// Sets the value of [filter][crate::model::ListBucketOperationsRequest::filter].
635        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
636            self.0.request.filter = v.into();
637            self
638        }
639
640        /// Sets the value of [page_size][crate::model::ListBucketOperationsRequest::page_size].
641        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
642            self.0.request.page_size = v.into();
643            self
644        }
645
646        /// Sets the value of [page_token][crate::model::ListBucketOperationsRequest::page_token].
647        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
648            self.0.request.page_token = v.into();
649            self
650        }
651
652        /// Sets the value of [order_by][crate::model::ListBucketOperationsRequest::order_by].
653        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
654            self.0.request.order_by = v.into();
655            self
656        }
657    }
658
659    #[doc(hidden)]
660    impl crate::RequestBuilder for ListBucketOperations {
661        fn request_options(&mut self) -> &mut crate::RequestOptions {
662            &mut self.0.options
663        }
664    }
665
666    /// The request builder for [StorageBatchOperations::get_bucket_operation][crate::client::StorageBatchOperations::get_bucket_operation] calls.
667    ///
668    /// # Example
669    /// ```
670    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetBucketOperation;
671    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
672    ///
673    /// let builder = prepare_request_builder();
674    /// let response = builder.send().await?;
675    /// # Ok(()) }
676    ///
677    /// fn prepare_request_builder() -> GetBucketOperation {
678    ///   # panic!();
679    ///   // ... details omitted ...
680    /// }
681    /// ```
682    #[derive(Clone, Debug)]
683    pub struct GetBucketOperation(RequestBuilder<crate::model::GetBucketOperationRequest>);
684
685    impl GetBucketOperation {
686        pub(crate) fn new(
687            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
688        ) -> Self {
689            Self(RequestBuilder::new(stub))
690        }
691
692        /// Sets the full request, replacing any prior values.
693        pub fn with_request<V: Into<crate::model::GetBucketOperationRequest>>(
694            mut self,
695            v: V,
696        ) -> Self {
697            self.0.request = v.into();
698            self
699        }
700
701        /// Sets all the options, replacing any prior values.
702        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
703            self.0.options = v.into();
704            self
705        }
706
707        /// Sends the request.
708        pub async fn send(self) -> Result<crate::model::BucketOperation> {
709            (*self.0.stub)
710                .get_bucket_operation(self.0.request, self.0.options)
711                .await
712                .map(crate::Response::into_body)
713        }
714
715        /// Sets the value of [name][crate::model::GetBucketOperationRequest::name].
716        ///
717        /// This is a **required** field for requests.
718        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
719            self.0.request.name = v.into();
720            self
721        }
722    }
723
724    #[doc(hidden)]
725    impl crate::RequestBuilder for GetBucketOperation {
726        fn request_options(&mut self) -> &mut crate::RequestOptions {
727            &mut self.0.options
728        }
729    }
730
731    /// The request builder for [StorageBatchOperations::list_locations][crate::client::StorageBatchOperations::list_locations] calls.
732    ///
733    /// # Example
734    /// ```
735    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListLocations;
736    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
737    /// use google_cloud_gax::paginator::ItemPaginator;
738    ///
739    /// let builder = prepare_request_builder();
740    /// let mut items = builder.by_item();
741    /// while let Some(result) = items.next().await {
742    ///   let item = result?;
743    /// }
744    /// # Ok(()) }
745    ///
746    /// fn prepare_request_builder() -> ListLocations {
747    ///   # panic!();
748    ///   // ... details omitted ...
749    /// }
750    /// ```
751    #[derive(Clone, Debug)]
752    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
753
754    impl ListLocations {
755        pub(crate) fn new(
756            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
757        ) -> Self {
758            Self(RequestBuilder::new(stub))
759        }
760
761        /// Sets the full request, replacing any prior values.
762        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
763            mut self,
764            v: V,
765        ) -> Self {
766            self.0.request = v.into();
767            self
768        }
769
770        /// Sets all the options, replacing any prior values.
771        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
772            self.0.options = v.into();
773            self
774        }
775
776        /// Sends the request.
777        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
778            (*self.0.stub)
779                .list_locations(self.0.request, self.0.options)
780                .await
781                .map(crate::Response::into_body)
782        }
783
784        /// Streams each page in the collection.
785        pub fn by_page(
786            self,
787        ) -> impl google_cloud_gax::paginator::Paginator<
788            google_cloud_location::model::ListLocationsResponse,
789            crate::Error,
790        > {
791            use std::clone::Clone;
792            let token = self.0.request.page_token.clone();
793            let execute = move |token: String| {
794                let mut builder = self.clone();
795                builder.0.request = builder.0.request.set_page_token(token);
796                builder.send()
797            };
798            google_cloud_gax::paginator::internal::new_paginator(token, execute)
799        }
800
801        /// Streams each item in the collection.
802        pub fn by_item(
803            self,
804        ) -> impl google_cloud_gax::paginator::ItemPaginator<
805            google_cloud_location::model::ListLocationsResponse,
806            crate::Error,
807        > {
808            use google_cloud_gax::paginator::Paginator;
809            self.by_page().items()
810        }
811
812        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
813        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
814            self.0.request.name = v.into();
815            self
816        }
817
818        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
819        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
820            self.0.request.filter = v.into();
821            self
822        }
823
824        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
825        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
826            self.0.request.page_size = v.into();
827            self
828        }
829
830        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
831        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
832            self.0.request.page_token = v.into();
833            self
834        }
835    }
836
837    #[doc(hidden)]
838    impl crate::RequestBuilder for ListLocations {
839        fn request_options(&mut self) -> &mut crate::RequestOptions {
840            &mut self.0.options
841        }
842    }
843
844    /// The request builder for [StorageBatchOperations::get_location][crate::client::StorageBatchOperations::get_location] calls.
845    ///
846    /// # Example
847    /// ```
848    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetLocation;
849    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
850    ///
851    /// let builder = prepare_request_builder();
852    /// let response = builder.send().await?;
853    /// # Ok(()) }
854    ///
855    /// fn prepare_request_builder() -> GetLocation {
856    ///   # panic!();
857    ///   // ... details omitted ...
858    /// }
859    /// ```
860    #[derive(Clone, Debug)]
861    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
862
863    impl GetLocation {
864        pub(crate) fn new(
865            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
866        ) -> Self {
867            Self(RequestBuilder::new(stub))
868        }
869
870        /// Sets the full request, replacing any prior values.
871        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
872            mut self,
873            v: V,
874        ) -> Self {
875            self.0.request = v.into();
876            self
877        }
878
879        /// Sets all the options, replacing any prior values.
880        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
881            self.0.options = v.into();
882            self
883        }
884
885        /// Sends the request.
886        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
887            (*self.0.stub)
888                .get_location(self.0.request, self.0.options)
889                .await
890                .map(crate::Response::into_body)
891        }
892
893        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
894        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
895            self.0.request.name = v.into();
896            self
897        }
898    }
899
900    #[doc(hidden)]
901    impl crate::RequestBuilder for GetLocation {
902        fn request_options(&mut self) -> &mut crate::RequestOptions {
903            &mut self.0.options
904        }
905    }
906
907    /// The request builder for [StorageBatchOperations::list_operations][crate::client::StorageBatchOperations::list_operations] calls.
908    ///
909    /// # Example
910    /// ```
911    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListOperations;
912    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
913    /// use google_cloud_gax::paginator::ItemPaginator;
914    ///
915    /// let builder = prepare_request_builder();
916    /// let mut items = builder.by_item();
917    /// while let Some(result) = items.next().await {
918    ///   let item = result?;
919    /// }
920    /// # Ok(()) }
921    ///
922    /// fn prepare_request_builder() -> ListOperations {
923    ///   # panic!();
924    ///   // ... details omitted ...
925    /// }
926    /// ```
927    #[derive(Clone, Debug)]
928    pub struct ListOperations(
929        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
930    );
931
932    impl ListOperations {
933        pub(crate) fn new(
934            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
935        ) -> Self {
936            Self(RequestBuilder::new(stub))
937        }
938
939        /// Sets the full request, replacing any prior values.
940        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
941            mut self,
942            v: V,
943        ) -> Self {
944            self.0.request = v.into();
945            self
946        }
947
948        /// Sets all the options, replacing any prior values.
949        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
950            self.0.options = v.into();
951            self
952        }
953
954        /// Sends the request.
955        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
956            (*self.0.stub)
957                .list_operations(self.0.request, self.0.options)
958                .await
959                .map(crate::Response::into_body)
960        }
961
962        /// Streams each page in the collection.
963        pub fn by_page(
964            self,
965        ) -> impl google_cloud_gax::paginator::Paginator<
966            google_cloud_longrunning::model::ListOperationsResponse,
967            crate::Error,
968        > {
969            use std::clone::Clone;
970            let token = self.0.request.page_token.clone();
971            let execute = move |token: String| {
972                let mut builder = self.clone();
973                builder.0.request = builder.0.request.set_page_token(token);
974                builder.send()
975            };
976            google_cloud_gax::paginator::internal::new_paginator(token, execute)
977        }
978
979        /// Streams each item in the collection.
980        pub fn by_item(
981            self,
982        ) -> impl google_cloud_gax::paginator::ItemPaginator<
983            google_cloud_longrunning::model::ListOperationsResponse,
984            crate::Error,
985        > {
986            use google_cloud_gax::paginator::Paginator;
987            self.by_page().items()
988        }
989
990        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
991        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
992            self.0.request.name = v.into();
993            self
994        }
995
996        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
997        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
998            self.0.request.filter = v.into();
999            self
1000        }
1001
1002        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
1003        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1004            self.0.request.page_size = v.into();
1005            self
1006        }
1007
1008        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
1009        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1010            self.0.request.page_token = v.into();
1011            self
1012        }
1013
1014        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
1015        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1016            self.0.request.return_partial_success = v.into();
1017            self
1018        }
1019    }
1020
1021    #[doc(hidden)]
1022    impl crate::RequestBuilder for ListOperations {
1023        fn request_options(&mut self) -> &mut crate::RequestOptions {
1024            &mut self.0.options
1025        }
1026    }
1027
1028    /// The request builder for [StorageBatchOperations::get_operation][crate::client::StorageBatchOperations::get_operation] calls.
1029    ///
1030    /// # Example
1031    /// ```
1032    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetOperation;
1033    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
1034    ///
1035    /// let builder = prepare_request_builder();
1036    /// let response = builder.send().await?;
1037    /// # Ok(()) }
1038    ///
1039    /// fn prepare_request_builder() -> GetOperation {
1040    ///   # panic!();
1041    ///   // ... details omitted ...
1042    /// }
1043    /// ```
1044    #[derive(Clone, Debug)]
1045    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1046
1047    impl GetOperation {
1048        pub(crate) fn new(
1049            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
1050        ) -> Self {
1051            Self(RequestBuilder::new(stub))
1052        }
1053
1054        /// Sets the full request, replacing any prior values.
1055        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1056            mut self,
1057            v: V,
1058        ) -> Self {
1059            self.0.request = v.into();
1060            self
1061        }
1062
1063        /// Sets all the options, replacing any prior values.
1064        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1065            self.0.options = v.into();
1066            self
1067        }
1068
1069        /// Sends the request.
1070        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1071            (*self.0.stub)
1072                .get_operation(self.0.request, self.0.options)
1073                .await
1074                .map(crate::Response::into_body)
1075        }
1076
1077        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
1078        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1079            self.0.request.name = v.into();
1080            self
1081        }
1082    }
1083
1084    #[doc(hidden)]
1085    impl crate::RequestBuilder for GetOperation {
1086        fn request_options(&mut self) -> &mut crate::RequestOptions {
1087            &mut self.0.options
1088        }
1089    }
1090
1091    /// The request builder for [StorageBatchOperations::delete_operation][crate::client::StorageBatchOperations::delete_operation] calls.
1092    ///
1093    /// # Example
1094    /// ```
1095    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::DeleteOperation;
1096    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
1097    ///
1098    /// let builder = prepare_request_builder();
1099    /// let response = builder.send().await?;
1100    /// # Ok(()) }
1101    ///
1102    /// fn prepare_request_builder() -> DeleteOperation {
1103    ///   # panic!();
1104    ///   // ... details omitted ...
1105    /// }
1106    /// ```
1107    #[derive(Clone, Debug)]
1108    pub struct DeleteOperation(
1109        RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1110    );
1111
1112    impl DeleteOperation {
1113        pub(crate) fn new(
1114            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
1115        ) -> Self {
1116            Self(RequestBuilder::new(stub))
1117        }
1118
1119        /// Sets the full request, replacing any prior values.
1120        pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1121            mut self,
1122            v: V,
1123        ) -> Self {
1124            self.0.request = v.into();
1125            self
1126        }
1127
1128        /// Sets all the options, replacing any prior values.
1129        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1130            self.0.options = v.into();
1131            self
1132        }
1133
1134        /// Sends the request.
1135        pub async fn send(self) -> Result<()> {
1136            (*self.0.stub)
1137                .delete_operation(self.0.request, self.0.options)
1138                .await
1139                .map(crate::Response::into_body)
1140        }
1141
1142        /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
1143        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1144            self.0.request.name = v.into();
1145            self
1146        }
1147    }
1148
1149    #[doc(hidden)]
1150    impl crate::RequestBuilder for DeleteOperation {
1151        fn request_options(&mut self) -> &mut crate::RequestOptions {
1152            &mut self.0.options
1153        }
1154    }
1155
1156    /// The request builder for [StorageBatchOperations::cancel_operation][crate::client::StorageBatchOperations::cancel_operation] calls.
1157    ///
1158    /// # Example
1159    /// ```
1160    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CancelOperation;
1161    /// # async fn sample() -> google_cloud_storagebatchoperations_v1::Result<()> {
1162    ///
1163    /// let builder = prepare_request_builder();
1164    /// let response = builder.send().await?;
1165    /// # Ok(()) }
1166    ///
1167    /// fn prepare_request_builder() -> CancelOperation {
1168    ///   # panic!();
1169    ///   // ... details omitted ...
1170    /// }
1171    /// ```
1172    #[derive(Clone, Debug)]
1173    pub struct CancelOperation(
1174        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1175    );
1176
1177    impl CancelOperation {
1178        pub(crate) fn new(
1179            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
1180        ) -> Self {
1181            Self(RequestBuilder::new(stub))
1182        }
1183
1184        /// Sets the full request, replacing any prior values.
1185        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1186            mut self,
1187            v: V,
1188        ) -> Self {
1189            self.0.request = v.into();
1190            self
1191        }
1192
1193        /// Sets all the options, replacing any prior values.
1194        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1195            self.0.options = v.into();
1196            self
1197        }
1198
1199        /// Sends the request.
1200        pub async fn send(self) -> Result<()> {
1201            (*self.0.stub)
1202                .cancel_operation(self.0.request, self.0.options)
1203                .await
1204                .map(crate::Response::into_body)
1205        }
1206
1207        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
1208        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1209            self.0.request.name = v.into();
1210            self
1211        }
1212    }
1213
1214    #[doc(hidden)]
1215    impl crate::RequestBuilder for CancelOperation {
1216        fn request_options(&mut self) -> &mut crate::RequestOptions {
1217            &mut self.0.options
1218        }
1219    }
1220}