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
17pub mod storage_batch_operations {
18    use crate::Result;
19
20    /// A builder for [StorageBatchOperations][crate::client::StorageBatchOperations].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_storagebatchoperations_v1::*;
25    /// # use builder::storage_batch_operations::ClientBuilder;
26    /// # use client::StorageBatchOperations;
27    /// let builder : ClientBuilder = StorageBatchOperations::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://storagebatchoperations.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::StorageBatchOperations;
38        pub struct Factory;
39        impl gax::client_builder::internal::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            ) -> gax::client_builder::Result<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: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [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() -> gax::Result<()> {
80    /// use 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<gax::options::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(gax::response::Response::into_body)
122        }
123
124        /// Streams each page in the collection.
125        pub fn by_page(
126            self,
127        ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::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            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 gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
143        {
144            use 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 gax::options::internal::RequestBuilder for ListJobs {
183        fn request_options(&mut self) -> &mut gax::options::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() -> gax::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<gax::options::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(gax::response::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 gax::options::internal::RequestBuilder for GetJob {
245        fn request_options(&mut self) -> &mut gax::options::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() -> gax::Result<()> {
256    /// use 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<gax::options::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<longrunning::model::Operation> {
296            (*self.0.stub)
297                .create_job(self.0.request, self.0.options)
298                .await
299                .map(gax::response::Response::into_body)
300        }
301
302        /// Creates a [Poller][lro::Poller] to work with `create_job`.
303        pub fn poller(
304            self,
305        ) -> impl lro::Poller<crate::model::Job, crate::model::OperationMetadata> {
306            type Operation =
307                lro::internal::Operation<crate::model::Job, crate::model::OperationMetadata>;
308            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
309            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
310
311            let stub = self.0.stub.clone();
312            let mut options = self.0.options.clone();
313            options.set_retry_policy(gax::retry_policy::NeverRetry);
314            let query = move |name| {
315                let stub = stub.clone();
316                let options = options.clone();
317                async {
318                    let op = GetOperation::new(stub)
319                        .set_name(name)
320                        .with_options(options)
321                        .send()
322                        .await?;
323                    Ok(Operation::new(op))
324                }
325            };
326
327            let start = move || async {
328                let op = self.send().await?;
329                Ok(Operation::new(op))
330            };
331
332            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
333        }
334
335        /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
336        ///
337        /// This is a **required** field for requests.
338        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
339            self.0.request.parent = v.into();
340            self
341        }
342
343        /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
344        ///
345        /// This is a **required** field for requests.
346        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
347            self.0.request.job_id = v.into();
348            self
349        }
350
351        /// Sets the value of [job][crate::model::CreateJobRequest::job].
352        ///
353        /// This is a **required** field for requests.
354        pub fn set_job<T>(mut self, v: T) -> Self
355        where
356            T: std::convert::Into<crate::model::Job>,
357        {
358            self.0.request.job = std::option::Option::Some(v.into());
359            self
360        }
361
362        /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
363        ///
364        /// This is a **required** field for requests.
365        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
366        where
367            T: std::convert::Into<crate::model::Job>,
368        {
369            self.0.request.job = v.map(|x| x.into());
370            self
371        }
372
373        /// Sets the value of [request_id][crate::model::CreateJobRequest::request_id].
374        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
375            self.0.request.request_id = v.into();
376            self
377        }
378    }
379
380    #[doc(hidden)]
381    impl gax::options::internal::RequestBuilder for CreateJob {
382        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
383            &mut self.0.options
384        }
385    }
386
387    /// The request builder for [StorageBatchOperations::delete_job][crate::client::StorageBatchOperations::delete_job] calls.
388    ///
389    /// # Example
390    /// ```
391    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::DeleteJob;
392    /// # async fn sample() -> gax::Result<()> {
393    ///
394    /// let builder = prepare_request_builder();
395    /// let response = builder.send().await?;
396    /// # Ok(()) }
397    ///
398    /// fn prepare_request_builder() -> DeleteJob {
399    ///   # panic!();
400    ///   // ... details omitted ...
401    /// }
402    /// ```
403    #[derive(Clone, Debug)]
404    pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
405
406    impl DeleteJob {
407        pub(crate) fn new(
408            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
409        ) -> Self {
410            Self(RequestBuilder::new(stub))
411        }
412
413        /// Sets the full request, replacing any prior values.
414        pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
415            self.0.request = v.into();
416            self
417        }
418
419        /// Sets all the options, replacing any prior values.
420        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
421            self.0.options = v.into();
422            self
423        }
424
425        /// Sends the request.
426        pub async fn send(self) -> Result<()> {
427            (*self.0.stub)
428                .delete_job(self.0.request, self.0.options)
429                .await
430                .map(gax::response::Response::into_body)
431        }
432
433        /// Sets the value of [name][crate::model::DeleteJobRequest::name].
434        ///
435        /// This is a **required** field for requests.
436        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
437            self.0.request.name = v.into();
438            self
439        }
440
441        /// Sets the value of [request_id][crate::model::DeleteJobRequest::request_id].
442        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
443            self.0.request.request_id = v.into();
444            self
445        }
446    }
447
448    #[doc(hidden)]
449    impl gax::options::internal::RequestBuilder for DeleteJob {
450        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
451            &mut self.0.options
452        }
453    }
454
455    /// The request builder for [StorageBatchOperations::cancel_job][crate::client::StorageBatchOperations::cancel_job] calls.
456    ///
457    /// # Example
458    /// ```
459    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CancelJob;
460    /// # async fn sample() -> gax::Result<()> {
461    ///
462    /// let builder = prepare_request_builder();
463    /// let response = builder.send().await?;
464    /// # Ok(()) }
465    ///
466    /// fn prepare_request_builder() -> CancelJob {
467    ///   # panic!();
468    ///   // ... details omitted ...
469    /// }
470    /// ```
471    #[derive(Clone, Debug)]
472    pub struct CancelJob(RequestBuilder<crate::model::CancelJobRequest>);
473
474    impl CancelJob {
475        pub(crate) fn new(
476            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
477        ) -> 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::CancelJobRequest>>(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::CancelJobResponse> {
495            (*self.0.stub)
496                .cancel_job(self.0.request, self.0.options)
497                .await
498                .map(gax::response::Response::into_body)
499        }
500
501        /// Sets the value of [name][crate::model::CancelJobRequest::name].
502        ///
503        /// This is a **required** field for requests.
504        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
505            self.0.request.name = v.into();
506            self
507        }
508
509        /// Sets the value of [request_id][crate::model::CancelJobRequest::request_id].
510        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
511            self.0.request.request_id = v.into();
512            self
513        }
514    }
515
516    #[doc(hidden)]
517    impl gax::options::internal::RequestBuilder for CancelJob {
518        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
519            &mut self.0.options
520        }
521    }
522
523    /// The request builder for [StorageBatchOperations::list_locations][crate::client::StorageBatchOperations::list_locations] calls.
524    ///
525    /// # Example
526    /// ```
527    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListLocations;
528    /// # async fn sample() -> gax::Result<()> {
529    /// use gax::paginator::ItemPaginator;
530    ///
531    /// let builder = prepare_request_builder();
532    /// let mut items = builder.by_item();
533    /// while let Some(result) = items.next().await {
534    ///   let item = result?;
535    /// }
536    /// # Ok(()) }
537    ///
538    /// fn prepare_request_builder() -> ListLocations {
539    ///   # panic!();
540    ///   // ... details omitted ...
541    /// }
542    /// ```
543    #[derive(Clone, Debug)]
544    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
545
546    impl ListLocations {
547        pub(crate) fn new(
548            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
549        ) -> Self {
550            Self(RequestBuilder::new(stub))
551        }
552
553        /// Sets the full request, replacing any prior values.
554        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
555            mut self,
556            v: V,
557        ) -> Self {
558            self.0.request = v.into();
559            self
560        }
561
562        /// Sets all the options, replacing any prior values.
563        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
564            self.0.options = v.into();
565            self
566        }
567
568        /// Sends the request.
569        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
570            (*self.0.stub)
571                .list_locations(self.0.request, self.0.options)
572                .await
573                .map(gax::response::Response::into_body)
574        }
575
576        /// Streams each page in the collection.
577        pub fn by_page(
578            self,
579        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
580        {
581            use std::clone::Clone;
582            let token = self.0.request.page_token.clone();
583            let execute = move |token: String| {
584                let mut builder = self.clone();
585                builder.0.request = builder.0.request.set_page_token(token);
586                builder.send()
587            };
588            gax::paginator::internal::new_paginator(token, execute)
589        }
590
591        /// Streams each item in the collection.
592        pub fn by_item(
593            self,
594        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
595        {
596            use gax::paginator::Paginator;
597            self.by_page().items()
598        }
599
600        /// Sets the value of [name][location::model::ListLocationsRequest::name].
601        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
602            self.0.request.name = v.into();
603            self
604        }
605
606        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
607        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
608            self.0.request.filter = v.into();
609            self
610        }
611
612        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
613        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
614            self.0.request.page_size = v.into();
615            self
616        }
617
618        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
619        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
620            self.0.request.page_token = v.into();
621            self
622        }
623    }
624
625    #[doc(hidden)]
626    impl gax::options::internal::RequestBuilder for ListLocations {
627        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
628            &mut self.0.options
629        }
630    }
631
632    /// The request builder for [StorageBatchOperations::get_location][crate::client::StorageBatchOperations::get_location] calls.
633    ///
634    /// # Example
635    /// ```
636    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetLocation;
637    /// # async fn sample() -> gax::Result<()> {
638    ///
639    /// let builder = prepare_request_builder();
640    /// let response = builder.send().await?;
641    /// # Ok(()) }
642    ///
643    /// fn prepare_request_builder() -> GetLocation {
644    ///   # panic!();
645    ///   // ... details omitted ...
646    /// }
647    /// ```
648    #[derive(Clone, Debug)]
649    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
650
651    impl GetLocation {
652        pub(crate) fn new(
653            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
654        ) -> Self {
655            Self(RequestBuilder::new(stub))
656        }
657
658        /// Sets the full request, replacing any prior values.
659        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
660            self.0.request = v.into();
661            self
662        }
663
664        /// Sets all the options, replacing any prior values.
665        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
666            self.0.options = v.into();
667            self
668        }
669
670        /// Sends the request.
671        pub async fn send(self) -> Result<location::model::Location> {
672            (*self.0.stub)
673                .get_location(self.0.request, self.0.options)
674                .await
675                .map(gax::response::Response::into_body)
676        }
677
678        /// Sets the value of [name][location::model::GetLocationRequest::name].
679        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
680            self.0.request.name = v.into();
681            self
682        }
683    }
684
685    #[doc(hidden)]
686    impl gax::options::internal::RequestBuilder for GetLocation {
687        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
688            &mut self.0.options
689        }
690    }
691
692    /// The request builder for [StorageBatchOperations::list_operations][crate::client::StorageBatchOperations::list_operations] calls.
693    ///
694    /// # Example
695    /// ```
696    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::ListOperations;
697    /// # async fn sample() -> gax::Result<()> {
698    /// use gax::paginator::ItemPaginator;
699    ///
700    /// let builder = prepare_request_builder();
701    /// let mut items = builder.by_item();
702    /// while let Some(result) = items.next().await {
703    ///   let item = result?;
704    /// }
705    /// # Ok(()) }
706    ///
707    /// fn prepare_request_builder() -> ListOperations {
708    ///   # panic!();
709    ///   // ... details omitted ...
710    /// }
711    /// ```
712    #[derive(Clone, Debug)]
713    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
714
715    impl ListOperations {
716        pub(crate) fn new(
717            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
718        ) -> Self {
719            Self(RequestBuilder::new(stub))
720        }
721
722        /// Sets the full request, replacing any prior values.
723        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
724            mut self,
725            v: V,
726        ) -> Self {
727            self.0.request = v.into();
728            self
729        }
730
731        /// Sets all the options, replacing any prior values.
732        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
733            self.0.options = v.into();
734            self
735        }
736
737        /// Sends the request.
738        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
739            (*self.0.stub)
740                .list_operations(self.0.request, self.0.options)
741                .await
742                .map(gax::response::Response::into_body)
743        }
744
745        /// Streams each page in the collection.
746        pub fn by_page(
747            self,
748        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
749        {
750            use std::clone::Clone;
751            let token = self.0.request.page_token.clone();
752            let execute = move |token: String| {
753                let mut builder = self.clone();
754                builder.0.request = builder.0.request.set_page_token(token);
755                builder.send()
756            };
757            gax::paginator::internal::new_paginator(token, execute)
758        }
759
760        /// Streams each item in the collection.
761        pub fn by_item(
762            self,
763        ) -> impl gax::paginator::ItemPaginator<
764            longrunning::model::ListOperationsResponse,
765            gax::error::Error,
766        > {
767            use gax::paginator::Paginator;
768            self.by_page().items()
769        }
770
771        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
772        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
773            self.0.request.name = v.into();
774            self
775        }
776
777        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
778        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
779            self.0.request.filter = v.into();
780            self
781        }
782
783        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
784        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
785            self.0.request.page_size = v.into();
786            self
787        }
788
789        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
790        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
791            self.0.request.page_token = v.into();
792            self
793        }
794
795        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
796        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
797            self.0.request.return_partial_success = v.into();
798            self
799        }
800    }
801
802    #[doc(hidden)]
803    impl gax::options::internal::RequestBuilder for ListOperations {
804        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
805            &mut self.0.options
806        }
807    }
808
809    /// The request builder for [StorageBatchOperations::get_operation][crate::client::StorageBatchOperations::get_operation] calls.
810    ///
811    /// # Example
812    /// ```
813    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::GetOperation;
814    /// # async fn sample() -> gax::Result<()> {
815    ///
816    /// let builder = prepare_request_builder();
817    /// let response = builder.send().await?;
818    /// # Ok(()) }
819    ///
820    /// fn prepare_request_builder() -> GetOperation {
821    ///   # panic!();
822    ///   // ... details omitted ...
823    /// }
824    /// ```
825    #[derive(Clone, Debug)]
826    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
827
828    impl GetOperation {
829        pub(crate) fn new(
830            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
831        ) -> Self {
832            Self(RequestBuilder::new(stub))
833        }
834
835        /// Sets the full request, replacing any prior values.
836        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
837            mut self,
838            v: V,
839        ) -> Self {
840            self.0.request = v.into();
841            self
842        }
843
844        /// Sets all the options, replacing any prior values.
845        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
846            self.0.options = v.into();
847            self
848        }
849
850        /// Sends the request.
851        pub async fn send(self) -> Result<longrunning::model::Operation> {
852            (*self.0.stub)
853                .get_operation(self.0.request, self.0.options)
854                .await
855                .map(gax::response::Response::into_body)
856        }
857
858        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
859        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
860            self.0.request.name = v.into();
861            self
862        }
863    }
864
865    #[doc(hidden)]
866    impl gax::options::internal::RequestBuilder for GetOperation {
867        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
868            &mut self.0.options
869        }
870    }
871
872    /// The request builder for [StorageBatchOperations::delete_operation][crate::client::StorageBatchOperations::delete_operation] calls.
873    ///
874    /// # Example
875    /// ```
876    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::DeleteOperation;
877    /// # async fn sample() -> gax::Result<()> {
878    ///
879    /// let builder = prepare_request_builder();
880    /// let response = builder.send().await?;
881    /// # Ok(()) }
882    ///
883    /// fn prepare_request_builder() -> DeleteOperation {
884    ///   # panic!();
885    ///   // ... details omitted ...
886    /// }
887    /// ```
888    #[derive(Clone, Debug)]
889    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
890
891    impl DeleteOperation {
892        pub(crate) fn new(
893            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
894        ) -> Self {
895            Self(RequestBuilder::new(stub))
896        }
897
898        /// Sets the full request, replacing any prior values.
899        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
900            mut self,
901            v: V,
902        ) -> Self {
903            self.0.request = v.into();
904            self
905        }
906
907        /// Sets all the options, replacing any prior values.
908        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
909            self.0.options = v.into();
910            self
911        }
912
913        /// Sends the request.
914        pub async fn send(self) -> Result<()> {
915            (*self.0.stub)
916                .delete_operation(self.0.request, self.0.options)
917                .await
918                .map(gax::response::Response::into_body)
919        }
920
921        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
922        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
923            self.0.request.name = v.into();
924            self
925        }
926    }
927
928    #[doc(hidden)]
929    impl gax::options::internal::RequestBuilder for DeleteOperation {
930        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
931            &mut self.0.options
932        }
933    }
934
935    /// The request builder for [StorageBatchOperations::cancel_operation][crate::client::StorageBatchOperations::cancel_operation] calls.
936    ///
937    /// # Example
938    /// ```
939    /// # use google_cloud_storagebatchoperations_v1::builder::storage_batch_operations::CancelOperation;
940    /// # async fn sample() -> gax::Result<()> {
941    ///
942    /// let builder = prepare_request_builder();
943    /// let response = builder.send().await?;
944    /// # Ok(()) }
945    ///
946    /// fn prepare_request_builder() -> CancelOperation {
947    ///   # panic!();
948    ///   // ... details omitted ...
949    /// }
950    /// ```
951    #[derive(Clone, Debug)]
952    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
953
954    impl CancelOperation {
955        pub(crate) fn new(
956            stub: std::sync::Arc<dyn super::super::stub::dynamic::StorageBatchOperations>,
957        ) -> Self {
958            Self(RequestBuilder::new(stub))
959        }
960
961        /// Sets the full request, replacing any prior values.
962        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
963            mut self,
964            v: V,
965        ) -> Self {
966            self.0.request = v.into();
967            self
968        }
969
970        /// Sets all the options, replacing any prior values.
971        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
972            self.0.options = v.into();
973            self
974        }
975
976        /// Sends the request.
977        pub async fn send(self) -> Result<()> {
978            (*self.0.stub)
979                .cancel_operation(self.0.request, self.0.options)
980                .await
981                .map(gax::response::Response::into_body)
982        }
983
984        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
985        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
986            self.0.request.name = v.into();
987            self
988        }
989    }
990
991    #[doc(hidden)]
992    impl gax::options::internal::RequestBuilder for CancelOperation {
993        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
994            &mut self.0.options
995        }
996    }
997}