google_cloud_run_v2/
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 builds {
18    use crate::Result;
19
20    /// A builder for [Builds][crate::client::Builds].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_run_v2::*;
25    /// # use builder::builds::ClientBuilder;
26    /// # use client::Builds;
27    /// let builder : ClientBuilder = Builds::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://run.googleapis.com")
30    ///     .build().await?;
31    /// # gax::client_builder::Result::<()>::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::Builds;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = Builds;
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::Builds] 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::Builds>,
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(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
64            Self {
65                stub,
66                request: R::default(),
67                options: gax::options::RequestOptions::default(),
68            }
69        }
70    }
71
72    /// The request builder for [Builds::submit_build][crate::client::Builds::submit_build] calls.
73    ///
74    /// # Example
75    /// ```no_run
76    /// # use google_cloud_run_v2::builder;
77    /// use builder::builds::SubmitBuild;
78    /// # tokio_test::block_on(async {
79    ///
80    /// let builder = prepare_request_builder();
81    /// let response = builder.send().await?;
82    /// # gax::Result::<()>::Ok(()) });
83    ///
84    /// fn prepare_request_builder() -> SubmitBuild {
85    ///   # panic!();
86    ///   // ... details omitted ...
87    /// }
88    /// ```
89    #[derive(Clone, Debug)]
90    pub struct SubmitBuild(RequestBuilder<crate::model::SubmitBuildRequest>);
91
92    impl SubmitBuild {
93        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
94            Self(RequestBuilder::new(stub))
95        }
96
97        /// Sets the full request, replacing any prior values.
98        pub fn with_request<V: Into<crate::model::SubmitBuildRequest>>(mut self, v: V) -> Self {
99            self.0.request = v.into();
100            self
101        }
102
103        /// Sets all the options, replacing any prior values.
104        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
105            self.0.options = v.into();
106            self
107        }
108
109        /// Sends the request.
110        pub async fn send(self) -> Result<crate::model::SubmitBuildResponse> {
111            (*self.0.stub)
112                .submit_build(self.0.request, self.0.options)
113                .await
114                .map(gax::response::Response::into_body)
115        }
116
117        /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
118        ///
119        /// This is a **required** field for requests.
120        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
121            self.0.request.parent = v.into();
122            self
123        }
124
125        /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
126        ///
127        /// This is a **required** field for requests.
128        pub fn set_image_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
129            self.0.request.image_uri = v.into();
130            self
131        }
132
133        /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
134        pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
135            self.0.request.service_account = v.into();
136            self
137        }
138
139        /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
140        pub fn set_worker_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
141            self.0.request.worker_pool = v.into();
142            self
143        }
144
145        /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
146        pub fn set_tags<T, V>(mut self, v: T) -> Self
147        where
148            T: std::iter::IntoIterator<Item = V>,
149            V: std::convert::Into<std::string::String>,
150        {
151            use std::iter::Iterator;
152            self.0.request.tags = v.into_iter().map(|i| i.into()).collect();
153            self
154        }
155
156        /// Sets the value of [machine_type][crate::model::SubmitBuildRequest::machine_type].
157        pub fn set_machine_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
158            self.0.request.machine_type = v.into();
159            self
160        }
161
162        /// Sets the value of [release_track][crate::model::SubmitBuildRequest::release_track].
163        pub fn set_release_track<T: Into<api::model::LaunchStage>>(mut self, v: T) -> Self {
164            self.0.request.release_track = v.into();
165            self
166        }
167
168        /// Sets the value of [client][crate::model::SubmitBuildRequest::client].
169        pub fn set_client<T: Into<std::string::String>>(mut self, v: T) -> Self {
170            self.0.request.client = v.into();
171            self
172        }
173
174        /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
175        ///
176        /// Note that all the setters affecting `source` are
177        /// mutually exclusive.
178        pub fn set_source<T: Into<Option<crate::model::submit_build_request::Source>>>(
179            mut self,
180            v: T,
181        ) -> Self {
182            self.0.request.source = v.into();
183            self
184        }
185
186        /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
187        /// to hold a `StorageSource`.
188        ///
189        /// Note that all the setters affecting `source` are
190        /// mutually exclusive.
191        pub fn set_storage_source<
192            T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
193        >(
194            mut self,
195            v: T,
196        ) -> Self {
197            self.0.request = self.0.request.set_storage_source(v);
198            self
199        }
200
201        /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
202        ///
203        /// Note that all the setters affecting `build_type` are
204        /// mutually exclusive.
205        pub fn set_build_type<T: Into<Option<crate::model::submit_build_request::BuildType>>>(
206            mut self,
207            v: T,
208        ) -> Self {
209            self.0.request.build_type = v.into();
210            self
211        }
212
213        /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
214        /// to hold a `BuildpackBuild`.
215        ///
216        /// Note that all the setters affecting `build_type` are
217        /// mutually exclusive.
218        pub fn set_buildpack_build<
219            T: std::convert::Into<
220                    std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>,
221                >,
222        >(
223            mut self,
224            v: T,
225        ) -> Self {
226            self.0.request = self.0.request.set_buildpack_build(v);
227            self
228        }
229
230        /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
231        /// to hold a `DockerBuild`.
232        ///
233        /// Note that all the setters affecting `build_type` are
234        /// mutually exclusive.
235        pub fn set_docker_build<
236            T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
237        >(
238            mut self,
239            v: T,
240        ) -> Self {
241            self.0.request = self.0.request.set_docker_build(v);
242            self
243        }
244    }
245
246    #[doc(hidden)]
247    impl gax::options::internal::RequestBuilder for SubmitBuild {
248        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
249            &mut self.0.options
250        }
251    }
252
253    /// The request builder for [Builds::list_operations][crate::client::Builds::list_operations] calls.
254    ///
255    /// # Example
256    /// ```no_run
257    /// # use google_cloud_run_v2::builder;
258    /// use builder::builds::ListOperations;
259    /// # tokio_test::block_on(async {
260    /// use gax::paginator::ItemPaginator;
261    ///
262    /// let builder = prepare_request_builder();
263    /// let mut items = builder.by_item();
264    /// while let Some(result) = items.next().await {
265    ///   let item = result?;
266    /// }
267    /// # gax::Result::<()>::Ok(()) });
268    ///
269    /// fn prepare_request_builder() -> ListOperations {
270    ///   # panic!();
271    ///   // ... details omitted ...
272    /// }
273    /// ```
274    #[derive(Clone, Debug)]
275    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
276
277    impl ListOperations {
278        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
279            Self(RequestBuilder::new(stub))
280        }
281
282        /// Sets the full request, replacing any prior values.
283        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
284            mut self,
285            v: V,
286        ) -> Self {
287            self.0.request = v.into();
288            self
289        }
290
291        /// Sets all the options, replacing any prior values.
292        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
293            self.0.options = v.into();
294            self
295        }
296
297        /// Sends the request.
298        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
299            (*self.0.stub)
300                .list_operations(self.0.request, self.0.options)
301                .await
302                .map(gax::response::Response::into_body)
303        }
304
305        /// Streams each page in the collection.
306        pub fn by_page(
307            self,
308        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
309        {
310            use std::clone::Clone;
311            let token = self.0.request.page_token.clone();
312            let execute = move |token: String| {
313                let mut builder = self.clone();
314                builder.0.request = builder.0.request.set_page_token(token);
315                builder.send()
316            };
317            gax::paginator::internal::new_paginator(token, execute)
318        }
319
320        /// Streams each item in the collection.
321        pub fn by_item(
322            self,
323        ) -> impl gax::paginator::ItemPaginator<
324            longrunning::model::ListOperationsResponse,
325            gax::error::Error,
326        > {
327            use gax::paginator::Paginator;
328            self.by_page().items()
329        }
330
331        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
332        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
333            self.0.request.name = v.into();
334            self
335        }
336
337        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
338        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
339            self.0.request.filter = v.into();
340            self
341        }
342
343        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
344        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
345            self.0.request.page_size = v.into();
346            self
347        }
348
349        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
350        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
351            self.0.request.page_token = v.into();
352            self
353        }
354
355        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
356        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
357            self.0.request.return_partial_success = v.into();
358            self
359        }
360    }
361
362    #[doc(hidden)]
363    impl gax::options::internal::RequestBuilder for ListOperations {
364        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
365            &mut self.0.options
366        }
367    }
368
369    /// The request builder for [Builds::get_operation][crate::client::Builds::get_operation] calls.
370    ///
371    /// # Example
372    /// ```no_run
373    /// # use google_cloud_run_v2::builder;
374    /// use builder::builds::GetOperation;
375    /// # tokio_test::block_on(async {
376    ///
377    /// let builder = prepare_request_builder();
378    /// let response = builder.send().await?;
379    /// # gax::Result::<()>::Ok(()) });
380    ///
381    /// fn prepare_request_builder() -> GetOperation {
382    ///   # panic!();
383    ///   // ... details omitted ...
384    /// }
385    /// ```
386    #[derive(Clone, Debug)]
387    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
388
389    impl GetOperation {
390        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
391            Self(RequestBuilder::new(stub))
392        }
393
394        /// Sets the full request, replacing any prior values.
395        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
396            mut self,
397            v: V,
398        ) -> Self {
399            self.0.request = v.into();
400            self
401        }
402
403        /// Sets all the options, replacing any prior values.
404        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
405            self.0.options = v.into();
406            self
407        }
408
409        /// Sends the request.
410        pub async fn send(self) -> Result<longrunning::model::Operation> {
411            (*self.0.stub)
412                .get_operation(self.0.request, self.0.options)
413                .await
414                .map(gax::response::Response::into_body)
415        }
416
417        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
418        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
419            self.0.request.name = v.into();
420            self
421        }
422    }
423
424    #[doc(hidden)]
425    impl gax::options::internal::RequestBuilder for GetOperation {
426        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
427            &mut self.0.options
428        }
429    }
430
431    /// The request builder for [Builds::delete_operation][crate::client::Builds::delete_operation] calls.
432    ///
433    /// # Example
434    /// ```no_run
435    /// # use google_cloud_run_v2::builder;
436    /// use builder::builds::DeleteOperation;
437    /// # tokio_test::block_on(async {
438    ///
439    /// let builder = prepare_request_builder();
440    /// let response = builder.send().await?;
441    /// # gax::Result::<()>::Ok(()) });
442    ///
443    /// fn prepare_request_builder() -> DeleteOperation {
444    ///   # panic!();
445    ///   // ... details omitted ...
446    /// }
447    /// ```
448    #[derive(Clone, Debug)]
449    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
450
451    impl DeleteOperation {
452        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
453            Self(RequestBuilder::new(stub))
454        }
455
456        /// Sets the full request, replacing any prior values.
457        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
458            mut self,
459            v: V,
460        ) -> Self {
461            self.0.request = v.into();
462            self
463        }
464
465        /// Sets all the options, replacing any prior values.
466        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
467            self.0.options = v.into();
468            self
469        }
470
471        /// Sends the request.
472        pub async fn send(self) -> Result<()> {
473            (*self.0.stub)
474                .delete_operation(self.0.request, self.0.options)
475                .await
476                .map(gax::response::Response::into_body)
477        }
478
479        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
480        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
481            self.0.request.name = v.into();
482            self
483        }
484    }
485
486    #[doc(hidden)]
487    impl gax::options::internal::RequestBuilder for DeleteOperation {
488        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
489            &mut self.0.options
490        }
491    }
492
493    /// The request builder for [Builds::wait_operation][crate::client::Builds::wait_operation] calls.
494    ///
495    /// # Example
496    /// ```no_run
497    /// # use google_cloud_run_v2::builder;
498    /// use builder::builds::WaitOperation;
499    /// # tokio_test::block_on(async {
500    ///
501    /// let builder = prepare_request_builder();
502    /// let response = builder.send().await?;
503    /// # gax::Result::<()>::Ok(()) });
504    ///
505    /// fn prepare_request_builder() -> WaitOperation {
506    ///   # panic!();
507    ///   // ... details omitted ...
508    /// }
509    /// ```
510    #[derive(Clone, Debug)]
511    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
512
513    impl WaitOperation {
514        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
515            Self(RequestBuilder::new(stub))
516        }
517
518        /// Sets the full request, replacing any prior values.
519        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
520            mut self,
521            v: V,
522        ) -> Self {
523            self.0.request = v.into();
524            self
525        }
526
527        /// Sets all the options, replacing any prior values.
528        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
529            self.0.options = v.into();
530            self
531        }
532
533        /// Sends the request.
534        pub async fn send(self) -> Result<longrunning::model::Operation> {
535            (*self.0.stub)
536                .wait_operation(self.0.request, self.0.options)
537                .await
538                .map(gax::response::Response::into_body)
539        }
540
541        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
542        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
543            self.0.request.name = v.into();
544            self
545        }
546
547        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
548        pub fn set_timeout<T>(mut self, v: T) -> Self
549        where
550            T: std::convert::Into<wkt::Duration>,
551        {
552            self.0.request.timeout = std::option::Option::Some(v.into());
553            self
554        }
555
556        /// Sets or clears the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
557        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
558        where
559            T: std::convert::Into<wkt::Duration>,
560        {
561            self.0.request.timeout = v.map(|x| x.into());
562            self
563        }
564    }
565
566    #[doc(hidden)]
567    impl gax::options::internal::RequestBuilder for WaitOperation {
568        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
569            &mut self.0.options
570        }
571    }
572}
573
574pub mod executions {
575    use crate::Result;
576
577    /// A builder for [Executions][crate::client::Executions].
578    ///
579    /// ```
580    /// # tokio_test::block_on(async {
581    /// # use google_cloud_run_v2::*;
582    /// # use builder::executions::ClientBuilder;
583    /// # use client::Executions;
584    /// let builder : ClientBuilder = Executions::builder();
585    /// let client = builder
586    ///     .with_endpoint("https://run.googleapis.com")
587    ///     .build().await?;
588    /// # gax::client_builder::Result::<()>::Ok(()) });
589    /// ```
590    pub type ClientBuilder =
591        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
592
593    pub(crate) mod client {
594        use super::super::super::client::Executions;
595        pub struct Factory;
596        impl gax::client_builder::internal::ClientFactory for Factory {
597            type Client = Executions;
598            type Credentials = gaxi::options::Credentials;
599            async fn build(
600                self,
601                config: gaxi::options::ClientConfig,
602            ) -> gax::client_builder::Result<Self::Client> {
603                Self::Client::new(config).await
604            }
605        }
606    }
607
608    /// Common implementation for [crate::client::Executions] request builders.
609    #[derive(Clone, Debug)]
610    pub(crate) struct RequestBuilder<R: std::default::Default> {
611        stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
612        request: R,
613        options: gax::options::RequestOptions,
614    }
615
616    impl<R> RequestBuilder<R>
617    where
618        R: std::default::Default,
619    {
620        pub(crate) fn new(
621            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
622        ) -> Self {
623            Self {
624                stub,
625                request: R::default(),
626                options: gax::options::RequestOptions::default(),
627            }
628        }
629    }
630
631    /// The request builder for [Executions::get_execution][crate::client::Executions::get_execution] calls.
632    ///
633    /// # Example
634    /// ```no_run
635    /// # use google_cloud_run_v2::builder;
636    /// use builder::executions::GetExecution;
637    /// # tokio_test::block_on(async {
638    ///
639    /// let builder = prepare_request_builder();
640    /// let response = builder.send().await?;
641    /// # gax::Result::<()>::Ok(()) });
642    ///
643    /// fn prepare_request_builder() -> GetExecution {
644    ///   # panic!();
645    ///   // ... details omitted ...
646    /// }
647    /// ```
648    #[derive(Clone, Debug)]
649    pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
650
651    impl GetExecution {
652        pub(crate) fn new(
653            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
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<crate::model::GetExecutionRequest>>(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<crate::model::Execution> {
672            (*self.0.stub)
673                .get_execution(self.0.request, self.0.options)
674                .await
675                .map(gax::response::Response::into_body)
676        }
677
678        /// Sets the value of [name][crate::model::GetExecutionRequest::name].
679        ///
680        /// This is a **required** field for requests.
681        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
682            self.0.request.name = v.into();
683            self
684        }
685    }
686
687    #[doc(hidden)]
688    impl gax::options::internal::RequestBuilder for GetExecution {
689        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
690            &mut self.0.options
691        }
692    }
693
694    /// The request builder for [Executions::list_executions][crate::client::Executions::list_executions] calls.
695    ///
696    /// # Example
697    /// ```no_run
698    /// # use google_cloud_run_v2::builder;
699    /// use builder::executions::ListExecutions;
700    /// # tokio_test::block_on(async {
701    /// use gax::paginator::ItemPaginator;
702    ///
703    /// let builder = prepare_request_builder();
704    /// let mut items = builder.by_item();
705    /// while let Some(result) = items.next().await {
706    ///   let item = result?;
707    /// }
708    /// # gax::Result::<()>::Ok(()) });
709    ///
710    /// fn prepare_request_builder() -> ListExecutions {
711    ///   # panic!();
712    ///   // ... details omitted ...
713    /// }
714    /// ```
715    #[derive(Clone, Debug)]
716    pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
717
718    impl ListExecutions {
719        pub(crate) fn new(
720            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
721        ) -> Self {
722            Self(RequestBuilder::new(stub))
723        }
724
725        /// Sets the full request, replacing any prior values.
726        pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> 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<crate::model::ListExecutionsResponse> {
739            (*self.0.stub)
740                .list_executions(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<crate::model::ListExecutionsResponse, 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<crate::model::ListExecutionsResponse, gax::error::Error>
764        {
765            use gax::paginator::Paginator;
766            self.by_page().items()
767        }
768
769        /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
770        ///
771        /// This is a **required** field for requests.
772        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
773            self.0.request.parent = v.into();
774            self
775        }
776
777        /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
778        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
779            self.0.request.page_size = v.into();
780            self
781        }
782
783        /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
784        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
785            self.0.request.page_token = v.into();
786            self
787        }
788
789        /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
790        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
791            self.0.request.show_deleted = v.into();
792            self
793        }
794    }
795
796    #[doc(hidden)]
797    impl gax::options::internal::RequestBuilder for ListExecutions {
798        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
799            &mut self.0.options
800        }
801    }
802
803    /// The request builder for [Executions::delete_execution][crate::client::Executions::delete_execution] calls.
804    ///
805    /// # Example
806    /// ```no_run
807    /// # use google_cloud_run_v2::builder;
808    /// use builder::executions::DeleteExecution;
809    /// # tokio_test::block_on(async {
810    /// use lro::Poller;
811    ///
812    /// let builder = prepare_request_builder();
813    /// let response = builder.poller().until_done().await?;
814    /// # gax::Result::<()>::Ok(()) });
815    ///
816    /// fn prepare_request_builder() -> DeleteExecution {
817    ///   # panic!();
818    ///   // ... details omitted ...
819    /// }
820    /// ```
821    #[derive(Clone, Debug)]
822    pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
823
824    impl DeleteExecution {
825        pub(crate) fn new(
826            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
827        ) -> Self {
828            Self(RequestBuilder::new(stub))
829        }
830
831        /// Sets the full request, replacing any prior values.
832        pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
833            self.0.request = v.into();
834            self
835        }
836
837        /// Sets all the options, replacing any prior values.
838        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
839            self.0.options = v.into();
840            self
841        }
842
843        /// Sends the request.
844        ///
845        /// # Long running operations
846        ///
847        /// This starts, but does not poll, a longrunning operation. More information
848        /// on [delete_execution][crate::client::Executions::delete_execution].
849        pub async fn send(self) -> Result<longrunning::model::Operation> {
850            (*self.0.stub)
851                .delete_execution(self.0.request, self.0.options)
852                .await
853                .map(gax::response::Response::into_body)
854        }
855
856        /// Creates a [Poller][lro::Poller] to work with `delete_execution`.
857        pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
858            type Operation =
859                lro::internal::Operation<crate::model::Execution, crate::model::Execution>;
860            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
861            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
862
863            let stub = self.0.stub.clone();
864            let mut options = self.0.options.clone();
865            options.set_retry_policy(gax::retry_policy::NeverRetry);
866            let query = move |name| {
867                let stub = stub.clone();
868                let options = options.clone();
869                async {
870                    let op = GetOperation::new(stub)
871                        .set_name(name)
872                        .with_options(options)
873                        .send()
874                        .await?;
875                    Ok(Operation::new(op))
876                }
877            };
878
879            let start = move || async {
880                let op = self.send().await?;
881                Ok(Operation::new(op))
882            };
883
884            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
885        }
886
887        /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
888        ///
889        /// This is a **required** field for requests.
890        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
891            self.0.request.name = v.into();
892            self
893        }
894
895        /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
896        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
897            self.0.request.validate_only = v.into();
898            self
899        }
900
901        /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
902        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
903            self.0.request.etag = v.into();
904            self
905        }
906    }
907
908    #[doc(hidden)]
909    impl gax::options::internal::RequestBuilder for DeleteExecution {
910        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
911            &mut self.0.options
912        }
913    }
914
915    /// The request builder for [Executions::cancel_execution][crate::client::Executions::cancel_execution] calls.
916    ///
917    /// # Example
918    /// ```no_run
919    /// # use google_cloud_run_v2::builder;
920    /// use builder::executions::CancelExecution;
921    /// # tokio_test::block_on(async {
922    /// use lro::Poller;
923    ///
924    /// let builder = prepare_request_builder();
925    /// let response = builder.poller().until_done().await?;
926    /// # gax::Result::<()>::Ok(()) });
927    ///
928    /// fn prepare_request_builder() -> CancelExecution {
929    ///   # panic!();
930    ///   // ... details omitted ...
931    /// }
932    /// ```
933    #[derive(Clone, Debug)]
934    pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
935
936    impl CancelExecution {
937        pub(crate) fn new(
938            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
939        ) -> Self {
940            Self(RequestBuilder::new(stub))
941        }
942
943        /// Sets the full request, replacing any prior values.
944        pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(mut self, v: V) -> Self {
945            self.0.request = v.into();
946            self
947        }
948
949        /// Sets all the options, replacing any prior values.
950        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
951            self.0.options = v.into();
952            self
953        }
954
955        /// Sends the request.
956        ///
957        /// # Long running operations
958        ///
959        /// This starts, but does not poll, a longrunning operation. More information
960        /// on [cancel_execution][crate::client::Executions::cancel_execution].
961        pub async fn send(self) -> Result<longrunning::model::Operation> {
962            (*self.0.stub)
963                .cancel_execution(self.0.request, self.0.options)
964                .await
965                .map(gax::response::Response::into_body)
966        }
967
968        /// Creates a [Poller][lro::Poller] to work with `cancel_execution`.
969        pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
970            type Operation =
971                lro::internal::Operation<crate::model::Execution, crate::model::Execution>;
972            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
973            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
974
975            let stub = self.0.stub.clone();
976            let mut options = self.0.options.clone();
977            options.set_retry_policy(gax::retry_policy::NeverRetry);
978            let query = move |name| {
979                let stub = stub.clone();
980                let options = options.clone();
981                async {
982                    let op = GetOperation::new(stub)
983                        .set_name(name)
984                        .with_options(options)
985                        .send()
986                        .await?;
987                    Ok(Operation::new(op))
988                }
989            };
990
991            let start = move || async {
992                let op = self.send().await?;
993                Ok(Operation::new(op))
994            };
995
996            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
997        }
998
999        /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
1000        ///
1001        /// This is a **required** field for requests.
1002        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1003            self.0.request.name = v.into();
1004            self
1005        }
1006
1007        /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
1008        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1009            self.0.request.validate_only = v.into();
1010            self
1011        }
1012
1013        /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
1014        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1015            self.0.request.etag = v.into();
1016            self
1017        }
1018    }
1019
1020    #[doc(hidden)]
1021    impl gax::options::internal::RequestBuilder for CancelExecution {
1022        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1023            &mut self.0.options
1024        }
1025    }
1026
1027    /// The request builder for [Executions::list_operations][crate::client::Executions::list_operations] calls.
1028    ///
1029    /// # Example
1030    /// ```no_run
1031    /// # use google_cloud_run_v2::builder;
1032    /// use builder::executions::ListOperations;
1033    /// # tokio_test::block_on(async {
1034    /// use gax::paginator::ItemPaginator;
1035    ///
1036    /// let builder = prepare_request_builder();
1037    /// let mut items = builder.by_item();
1038    /// while let Some(result) = items.next().await {
1039    ///   let item = result?;
1040    /// }
1041    /// # gax::Result::<()>::Ok(()) });
1042    ///
1043    /// fn prepare_request_builder() -> ListOperations {
1044    ///   # panic!();
1045    ///   // ... details omitted ...
1046    /// }
1047    /// ```
1048    #[derive(Clone, Debug)]
1049    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1050
1051    impl ListOperations {
1052        pub(crate) fn new(
1053            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1054        ) -> Self {
1055            Self(RequestBuilder::new(stub))
1056        }
1057
1058        /// Sets the full request, replacing any prior values.
1059        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1060            mut self,
1061            v: V,
1062        ) -> Self {
1063            self.0.request = v.into();
1064            self
1065        }
1066
1067        /// Sets all the options, replacing any prior values.
1068        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1069            self.0.options = v.into();
1070            self
1071        }
1072
1073        /// Sends the request.
1074        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1075            (*self.0.stub)
1076                .list_operations(self.0.request, self.0.options)
1077                .await
1078                .map(gax::response::Response::into_body)
1079        }
1080
1081        /// Streams each page in the collection.
1082        pub fn by_page(
1083            self,
1084        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1085        {
1086            use std::clone::Clone;
1087            let token = self.0.request.page_token.clone();
1088            let execute = move |token: String| {
1089                let mut builder = self.clone();
1090                builder.0.request = builder.0.request.set_page_token(token);
1091                builder.send()
1092            };
1093            gax::paginator::internal::new_paginator(token, execute)
1094        }
1095
1096        /// Streams each item in the collection.
1097        pub fn by_item(
1098            self,
1099        ) -> impl gax::paginator::ItemPaginator<
1100            longrunning::model::ListOperationsResponse,
1101            gax::error::Error,
1102        > {
1103            use gax::paginator::Paginator;
1104            self.by_page().items()
1105        }
1106
1107        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1108        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109            self.0.request.name = v.into();
1110            self
1111        }
1112
1113        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1114        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1115            self.0.request.filter = v.into();
1116            self
1117        }
1118
1119        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1120        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1121            self.0.request.page_size = v.into();
1122            self
1123        }
1124
1125        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1126        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1127            self.0.request.page_token = v.into();
1128            self
1129        }
1130
1131        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1132        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1133            self.0.request.return_partial_success = v.into();
1134            self
1135        }
1136    }
1137
1138    #[doc(hidden)]
1139    impl gax::options::internal::RequestBuilder for ListOperations {
1140        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1141            &mut self.0.options
1142        }
1143    }
1144
1145    /// The request builder for [Executions::get_operation][crate::client::Executions::get_operation] calls.
1146    ///
1147    /// # Example
1148    /// ```no_run
1149    /// # use google_cloud_run_v2::builder;
1150    /// use builder::executions::GetOperation;
1151    /// # tokio_test::block_on(async {
1152    ///
1153    /// let builder = prepare_request_builder();
1154    /// let response = builder.send().await?;
1155    /// # gax::Result::<()>::Ok(()) });
1156    ///
1157    /// fn prepare_request_builder() -> GetOperation {
1158    ///   # panic!();
1159    ///   // ... details omitted ...
1160    /// }
1161    /// ```
1162    #[derive(Clone, Debug)]
1163    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1164
1165    impl GetOperation {
1166        pub(crate) fn new(
1167            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1168        ) -> Self {
1169            Self(RequestBuilder::new(stub))
1170        }
1171
1172        /// Sets the full request, replacing any prior values.
1173        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1174            mut self,
1175            v: V,
1176        ) -> Self {
1177            self.0.request = v.into();
1178            self
1179        }
1180
1181        /// Sets all the options, replacing any prior values.
1182        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1183            self.0.options = v.into();
1184            self
1185        }
1186
1187        /// Sends the request.
1188        pub async fn send(self) -> Result<longrunning::model::Operation> {
1189            (*self.0.stub)
1190                .get_operation(self.0.request, self.0.options)
1191                .await
1192                .map(gax::response::Response::into_body)
1193        }
1194
1195        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1196        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1197            self.0.request.name = v.into();
1198            self
1199        }
1200    }
1201
1202    #[doc(hidden)]
1203    impl gax::options::internal::RequestBuilder for GetOperation {
1204        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1205            &mut self.0.options
1206        }
1207    }
1208
1209    /// The request builder for [Executions::delete_operation][crate::client::Executions::delete_operation] calls.
1210    ///
1211    /// # Example
1212    /// ```no_run
1213    /// # use google_cloud_run_v2::builder;
1214    /// use builder::executions::DeleteOperation;
1215    /// # tokio_test::block_on(async {
1216    ///
1217    /// let builder = prepare_request_builder();
1218    /// let response = builder.send().await?;
1219    /// # gax::Result::<()>::Ok(()) });
1220    ///
1221    /// fn prepare_request_builder() -> DeleteOperation {
1222    ///   # panic!();
1223    ///   // ... details omitted ...
1224    /// }
1225    /// ```
1226    #[derive(Clone, Debug)]
1227    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1228
1229    impl DeleteOperation {
1230        pub(crate) fn new(
1231            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1232        ) -> Self {
1233            Self(RequestBuilder::new(stub))
1234        }
1235
1236        /// Sets the full request, replacing any prior values.
1237        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1238            mut self,
1239            v: V,
1240        ) -> Self {
1241            self.0.request = v.into();
1242            self
1243        }
1244
1245        /// Sets all the options, replacing any prior values.
1246        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1247            self.0.options = v.into();
1248            self
1249        }
1250
1251        /// Sends the request.
1252        pub async fn send(self) -> Result<()> {
1253            (*self.0.stub)
1254                .delete_operation(self.0.request, self.0.options)
1255                .await
1256                .map(gax::response::Response::into_body)
1257        }
1258
1259        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1260        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1261            self.0.request.name = v.into();
1262            self
1263        }
1264    }
1265
1266    #[doc(hidden)]
1267    impl gax::options::internal::RequestBuilder for DeleteOperation {
1268        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1269            &mut self.0.options
1270        }
1271    }
1272
1273    /// The request builder for [Executions::wait_operation][crate::client::Executions::wait_operation] calls.
1274    ///
1275    /// # Example
1276    /// ```no_run
1277    /// # use google_cloud_run_v2::builder;
1278    /// use builder::executions::WaitOperation;
1279    /// # tokio_test::block_on(async {
1280    ///
1281    /// let builder = prepare_request_builder();
1282    /// let response = builder.send().await?;
1283    /// # gax::Result::<()>::Ok(()) });
1284    ///
1285    /// fn prepare_request_builder() -> WaitOperation {
1286    ///   # panic!();
1287    ///   // ... details omitted ...
1288    /// }
1289    /// ```
1290    #[derive(Clone, Debug)]
1291    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
1292
1293    impl WaitOperation {
1294        pub(crate) fn new(
1295            stub: std::sync::Arc<dyn super::super::stub::dynamic::Executions>,
1296        ) -> Self {
1297            Self(RequestBuilder::new(stub))
1298        }
1299
1300        /// Sets the full request, replacing any prior values.
1301        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
1302            mut self,
1303            v: V,
1304        ) -> Self {
1305            self.0.request = v.into();
1306            self
1307        }
1308
1309        /// Sets all the options, replacing any prior values.
1310        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1311            self.0.options = v.into();
1312            self
1313        }
1314
1315        /// Sends the request.
1316        pub async fn send(self) -> Result<longrunning::model::Operation> {
1317            (*self.0.stub)
1318                .wait_operation(self.0.request, self.0.options)
1319                .await
1320                .map(gax::response::Response::into_body)
1321        }
1322
1323        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
1324        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1325            self.0.request.name = v.into();
1326            self
1327        }
1328
1329        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
1330        pub fn set_timeout<T>(mut self, v: T) -> Self
1331        where
1332            T: std::convert::Into<wkt::Duration>,
1333        {
1334            self.0.request.timeout = std::option::Option::Some(v.into());
1335            self
1336        }
1337
1338        /// Sets or clears the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
1339        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
1340        where
1341            T: std::convert::Into<wkt::Duration>,
1342        {
1343            self.0.request.timeout = v.map(|x| x.into());
1344            self
1345        }
1346    }
1347
1348    #[doc(hidden)]
1349    impl gax::options::internal::RequestBuilder for WaitOperation {
1350        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1351            &mut self.0.options
1352        }
1353    }
1354}
1355
1356pub mod jobs {
1357    use crate::Result;
1358
1359    /// A builder for [Jobs][crate::client::Jobs].
1360    ///
1361    /// ```
1362    /// # tokio_test::block_on(async {
1363    /// # use google_cloud_run_v2::*;
1364    /// # use builder::jobs::ClientBuilder;
1365    /// # use client::Jobs;
1366    /// let builder : ClientBuilder = Jobs::builder();
1367    /// let client = builder
1368    ///     .with_endpoint("https://run.googleapis.com")
1369    ///     .build().await?;
1370    /// # gax::client_builder::Result::<()>::Ok(()) });
1371    /// ```
1372    pub type ClientBuilder =
1373        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1374
1375    pub(crate) mod client {
1376        use super::super::super::client::Jobs;
1377        pub struct Factory;
1378        impl gax::client_builder::internal::ClientFactory for Factory {
1379            type Client = Jobs;
1380            type Credentials = gaxi::options::Credentials;
1381            async fn build(
1382                self,
1383                config: gaxi::options::ClientConfig,
1384            ) -> gax::client_builder::Result<Self::Client> {
1385                Self::Client::new(config).await
1386            }
1387        }
1388    }
1389
1390    /// Common implementation for [crate::client::Jobs] request builders.
1391    #[derive(Clone, Debug)]
1392    pub(crate) struct RequestBuilder<R: std::default::Default> {
1393        stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>,
1394        request: R,
1395        options: gax::options::RequestOptions,
1396    }
1397
1398    impl<R> RequestBuilder<R>
1399    where
1400        R: std::default::Default,
1401    {
1402        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1403            Self {
1404                stub,
1405                request: R::default(),
1406                options: gax::options::RequestOptions::default(),
1407            }
1408        }
1409    }
1410
1411    /// The request builder for [Jobs::create_job][crate::client::Jobs::create_job] calls.
1412    ///
1413    /// # Example
1414    /// ```no_run
1415    /// # use google_cloud_run_v2::builder;
1416    /// use builder::jobs::CreateJob;
1417    /// # tokio_test::block_on(async {
1418    /// use lro::Poller;
1419    ///
1420    /// let builder = prepare_request_builder();
1421    /// let response = builder.poller().until_done().await?;
1422    /// # gax::Result::<()>::Ok(()) });
1423    ///
1424    /// fn prepare_request_builder() -> CreateJob {
1425    ///   # panic!();
1426    ///   // ... details omitted ...
1427    /// }
1428    /// ```
1429    #[derive(Clone, Debug)]
1430    pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
1431
1432    impl CreateJob {
1433        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1434            Self(RequestBuilder::new(stub))
1435        }
1436
1437        /// Sets the full request, replacing any prior values.
1438        pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
1439            self.0.request = v.into();
1440            self
1441        }
1442
1443        /// Sets all the options, replacing any prior values.
1444        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1445            self.0.options = v.into();
1446            self
1447        }
1448
1449        /// Sends the request.
1450        ///
1451        /// # Long running operations
1452        ///
1453        /// This starts, but does not poll, a longrunning operation. More information
1454        /// on [create_job][crate::client::Jobs::create_job].
1455        pub async fn send(self) -> Result<longrunning::model::Operation> {
1456            (*self.0.stub)
1457                .create_job(self.0.request, self.0.options)
1458                .await
1459                .map(gax::response::Response::into_body)
1460        }
1461
1462        /// Creates a [Poller][lro::Poller] to work with `create_job`.
1463        pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1464            type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
1465            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1466            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1467
1468            let stub = self.0.stub.clone();
1469            let mut options = self.0.options.clone();
1470            options.set_retry_policy(gax::retry_policy::NeverRetry);
1471            let query = move |name| {
1472                let stub = stub.clone();
1473                let options = options.clone();
1474                async {
1475                    let op = GetOperation::new(stub)
1476                        .set_name(name)
1477                        .with_options(options)
1478                        .send()
1479                        .await?;
1480                    Ok(Operation::new(op))
1481                }
1482            };
1483
1484            let start = move || async {
1485                let op = self.send().await?;
1486                Ok(Operation::new(op))
1487            };
1488
1489            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1490        }
1491
1492        /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
1493        ///
1494        /// This is a **required** field for requests.
1495        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1496            self.0.request.parent = v.into();
1497            self
1498        }
1499
1500        /// Sets the value of [job][crate::model::CreateJobRequest::job].
1501        ///
1502        /// This is a **required** field for requests.
1503        pub fn set_job<T>(mut self, v: T) -> Self
1504        where
1505            T: std::convert::Into<crate::model::Job>,
1506        {
1507            self.0.request.job = std::option::Option::Some(v.into());
1508            self
1509        }
1510
1511        /// Sets or clears the value of [job][crate::model::CreateJobRequest::job].
1512        ///
1513        /// This is a **required** field for requests.
1514        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
1515        where
1516            T: std::convert::Into<crate::model::Job>,
1517        {
1518            self.0.request.job = v.map(|x| x.into());
1519            self
1520        }
1521
1522        /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
1523        ///
1524        /// This is a **required** field for requests.
1525        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1526            self.0.request.job_id = v.into();
1527            self
1528        }
1529
1530        /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
1531        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1532            self.0.request.validate_only = v.into();
1533            self
1534        }
1535    }
1536
1537    #[doc(hidden)]
1538    impl gax::options::internal::RequestBuilder for CreateJob {
1539        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1540            &mut self.0.options
1541        }
1542    }
1543
1544    /// The request builder for [Jobs::get_job][crate::client::Jobs::get_job] calls.
1545    ///
1546    /// # Example
1547    /// ```no_run
1548    /// # use google_cloud_run_v2::builder;
1549    /// use builder::jobs::GetJob;
1550    /// # tokio_test::block_on(async {
1551    ///
1552    /// let builder = prepare_request_builder();
1553    /// let response = builder.send().await?;
1554    /// # gax::Result::<()>::Ok(()) });
1555    ///
1556    /// fn prepare_request_builder() -> GetJob {
1557    ///   # panic!();
1558    ///   // ... details omitted ...
1559    /// }
1560    /// ```
1561    #[derive(Clone, Debug)]
1562    pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
1563
1564    impl GetJob {
1565        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1566            Self(RequestBuilder::new(stub))
1567        }
1568
1569        /// Sets the full request, replacing any prior values.
1570        pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
1571            self.0.request = v.into();
1572            self
1573        }
1574
1575        /// Sets all the options, replacing any prior values.
1576        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1577            self.0.options = v.into();
1578            self
1579        }
1580
1581        /// Sends the request.
1582        pub async fn send(self) -> Result<crate::model::Job> {
1583            (*self.0.stub)
1584                .get_job(self.0.request, self.0.options)
1585                .await
1586                .map(gax::response::Response::into_body)
1587        }
1588
1589        /// Sets the value of [name][crate::model::GetJobRequest::name].
1590        ///
1591        /// This is a **required** field for requests.
1592        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1593            self.0.request.name = v.into();
1594            self
1595        }
1596    }
1597
1598    #[doc(hidden)]
1599    impl gax::options::internal::RequestBuilder for GetJob {
1600        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1601            &mut self.0.options
1602        }
1603    }
1604
1605    /// The request builder for [Jobs::list_jobs][crate::client::Jobs::list_jobs] calls.
1606    ///
1607    /// # Example
1608    /// ```no_run
1609    /// # use google_cloud_run_v2::builder;
1610    /// use builder::jobs::ListJobs;
1611    /// # tokio_test::block_on(async {
1612    /// use gax::paginator::ItemPaginator;
1613    ///
1614    /// let builder = prepare_request_builder();
1615    /// let mut items = builder.by_item();
1616    /// while let Some(result) = items.next().await {
1617    ///   let item = result?;
1618    /// }
1619    /// # gax::Result::<()>::Ok(()) });
1620    ///
1621    /// fn prepare_request_builder() -> ListJobs {
1622    ///   # panic!();
1623    ///   // ... details omitted ...
1624    /// }
1625    /// ```
1626    #[derive(Clone, Debug)]
1627    pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
1628
1629    impl ListJobs {
1630        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1631            Self(RequestBuilder::new(stub))
1632        }
1633
1634        /// Sets the full request, replacing any prior values.
1635        pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
1636            self.0.request = v.into();
1637            self
1638        }
1639
1640        /// Sets all the options, replacing any prior values.
1641        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1642            self.0.options = v.into();
1643            self
1644        }
1645
1646        /// Sends the request.
1647        pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
1648            (*self.0.stub)
1649                .list_jobs(self.0.request, self.0.options)
1650                .await
1651                .map(gax::response::Response::into_body)
1652        }
1653
1654        /// Streams each page in the collection.
1655        pub fn by_page(
1656            self,
1657        ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
1658        {
1659            use std::clone::Clone;
1660            let token = self.0.request.page_token.clone();
1661            let execute = move |token: String| {
1662                let mut builder = self.clone();
1663                builder.0.request = builder.0.request.set_page_token(token);
1664                builder.send()
1665            };
1666            gax::paginator::internal::new_paginator(token, execute)
1667        }
1668
1669        /// Streams each item in the collection.
1670        pub fn by_item(
1671            self,
1672        ) -> impl gax::paginator::ItemPaginator<crate::model::ListJobsResponse, gax::error::Error>
1673        {
1674            use gax::paginator::Paginator;
1675            self.by_page().items()
1676        }
1677
1678        /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
1679        ///
1680        /// This is a **required** field for requests.
1681        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1682            self.0.request.parent = v.into();
1683            self
1684        }
1685
1686        /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
1687        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1688            self.0.request.page_size = v.into();
1689            self
1690        }
1691
1692        /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
1693        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1694            self.0.request.page_token = v.into();
1695            self
1696        }
1697
1698        /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
1699        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1700            self.0.request.show_deleted = v.into();
1701            self
1702        }
1703    }
1704
1705    #[doc(hidden)]
1706    impl gax::options::internal::RequestBuilder for ListJobs {
1707        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1708            &mut self.0.options
1709        }
1710    }
1711
1712    /// The request builder for [Jobs::update_job][crate::client::Jobs::update_job] calls.
1713    ///
1714    /// # Example
1715    /// ```no_run
1716    /// # use google_cloud_run_v2::builder;
1717    /// use builder::jobs::UpdateJob;
1718    /// # tokio_test::block_on(async {
1719    /// use lro::Poller;
1720    ///
1721    /// let builder = prepare_request_builder();
1722    /// let response = builder.poller().until_done().await?;
1723    /// # gax::Result::<()>::Ok(()) });
1724    ///
1725    /// fn prepare_request_builder() -> UpdateJob {
1726    ///   # panic!();
1727    ///   // ... details omitted ...
1728    /// }
1729    /// ```
1730    #[derive(Clone, Debug)]
1731    pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
1732
1733    impl UpdateJob {
1734        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1735            Self(RequestBuilder::new(stub))
1736        }
1737
1738        /// Sets the full request, replacing any prior values.
1739        pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> Self {
1740            self.0.request = v.into();
1741            self
1742        }
1743
1744        /// Sets all the options, replacing any prior values.
1745        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1746            self.0.options = v.into();
1747            self
1748        }
1749
1750        /// Sends the request.
1751        ///
1752        /// # Long running operations
1753        ///
1754        /// This starts, but does not poll, a longrunning operation. More information
1755        /// on [update_job][crate::client::Jobs::update_job].
1756        pub async fn send(self) -> Result<longrunning::model::Operation> {
1757            (*self.0.stub)
1758                .update_job(self.0.request, self.0.options)
1759                .await
1760                .map(gax::response::Response::into_body)
1761        }
1762
1763        /// Creates a [Poller][lro::Poller] to work with `update_job`.
1764        pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1765            type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
1766            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1767            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1768
1769            let stub = self.0.stub.clone();
1770            let mut options = self.0.options.clone();
1771            options.set_retry_policy(gax::retry_policy::NeverRetry);
1772            let query = move |name| {
1773                let stub = stub.clone();
1774                let options = options.clone();
1775                async {
1776                    let op = GetOperation::new(stub)
1777                        .set_name(name)
1778                        .with_options(options)
1779                        .send()
1780                        .await?;
1781                    Ok(Operation::new(op))
1782                }
1783            };
1784
1785            let start = move || async {
1786                let op = self.send().await?;
1787                Ok(Operation::new(op))
1788            };
1789
1790            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1791        }
1792
1793        /// Sets the value of [job][crate::model::UpdateJobRequest::job].
1794        ///
1795        /// This is a **required** field for requests.
1796        pub fn set_job<T>(mut self, v: T) -> Self
1797        where
1798            T: std::convert::Into<crate::model::Job>,
1799        {
1800            self.0.request.job = std::option::Option::Some(v.into());
1801            self
1802        }
1803
1804        /// Sets or clears the value of [job][crate::model::UpdateJobRequest::job].
1805        ///
1806        /// This is a **required** field for requests.
1807        pub fn set_or_clear_job<T>(mut self, v: std::option::Option<T>) -> Self
1808        where
1809            T: std::convert::Into<crate::model::Job>,
1810        {
1811            self.0.request.job = v.map(|x| x.into());
1812            self
1813        }
1814
1815        /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
1816        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1817            self.0.request.validate_only = v.into();
1818            self
1819        }
1820
1821        /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
1822        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1823            self.0.request.allow_missing = v.into();
1824            self
1825        }
1826    }
1827
1828    #[doc(hidden)]
1829    impl gax::options::internal::RequestBuilder for UpdateJob {
1830        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1831            &mut self.0.options
1832        }
1833    }
1834
1835    /// The request builder for [Jobs::delete_job][crate::client::Jobs::delete_job] calls.
1836    ///
1837    /// # Example
1838    /// ```no_run
1839    /// # use google_cloud_run_v2::builder;
1840    /// use builder::jobs::DeleteJob;
1841    /// # tokio_test::block_on(async {
1842    /// use lro::Poller;
1843    ///
1844    /// let builder = prepare_request_builder();
1845    /// let response = builder.poller().until_done().await?;
1846    /// # gax::Result::<()>::Ok(()) });
1847    ///
1848    /// fn prepare_request_builder() -> DeleteJob {
1849    ///   # panic!();
1850    ///   // ... details omitted ...
1851    /// }
1852    /// ```
1853    #[derive(Clone, Debug)]
1854    pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
1855
1856    impl DeleteJob {
1857        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1858            Self(RequestBuilder::new(stub))
1859        }
1860
1861        /// Sets the full request, replacing any prior values.
1862        pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
1863            self.0.request = v.into();
1864            self
1865        }
1866
1867        /// Sets all the options, replacing any prior values.
1868        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1869            self.0.options = v.into();
1870            self
1871        }
1872
1873        /// Sends the request.
1874        ///
1875        /// # Long running operations
1876        ///
1877        /// This starts, but does not poll, a longrunning operation. More information
1878        /// on [delete_job][crate::client::Jobs::delete_job].
1879        pub async fn send(self) -> Result<longrunning::model::Operation> {
1880            (*self.0.stub)
1881                .delete_job(self.0.request, self.0.options)
1882                .await
1883                .map(gax::response::Response::into_body)
1884        }
1885
1886        /// Creates a [Poller][lro::Poller] to work with `delete_job`.
1887        pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1888            type Operation = lro::internal::Operation<crate::model::Job, crate::model::Job>;
1889            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1890            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1891
1892            let stub = self.0.stub.clone();
1893            let mut options = self.0.options.clone();
1894            options.set_retry_policy(gax::retry_policy::NeverRetry);
1895            let query = move |name| {
1896                let stub = stub.clone();
1897                let options = options.clone();
1898                async {
1899                    let op = GetOperation::new(stub)
1900                        .set_name(name)
1901                        .with_options(options)
1902                        .send()
1903                        .await?;
1904                    Ok(Operation::new(op))
1905                }
1906            };
1907
1908            let start = move || async {
1909                let op = self.send().await?;
1910                Ok(Operation::new(op))
1911            };
1912
1913            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1914        }
1915
1916        /// Sets the value of [name][crate::model::DeleteJobRequest::name].
1917        ///
1918        /// This is a **required** field for requests.
1919        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1920            self.0.request.name = v.into();
1921            self
1922        }
1923
1924        /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
1925        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1926            self.0.request.validate_only = v.into();
1927            self
1928        }
1929
1930        /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
1931        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1932            self.0.request.etag = v.into();
1933            self
1934        }
1935    }
1936
1937    #[doc(hidden)]
1938    impl gax::options::internal::RequestBuilder for DeleteJob {
1939        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1940            &mut self.0.options
1941        }
1942    }
1943
1944    /// The request builder for [Jobs::run_job][crate::client::Jobs::run_job] calls.
1945    ///
1946    /// # Example
1947    /// ```no_run
1948    /// # use google_cloud_run_v2::builder;
1949    /// use builder::jobs::RunJob;
1950    /// # tokio_test::block_on(async {
1951    /// use lro::Poller;
1952    ///
1953    /// let builder = prepare_request_builder();
1954    /// let response = builder.poller().until_done().await?;
1955    /// # gax::Result::<()>::Ok(()) });
1956    ///
1957    /// fn prepare_request_builder() -> RunJob {
1958    ///   # panic!();
1959    ///   // ... details omitted ...
1960    /// }
1961    /// ```
1962    #[derive(Clone, Debug)]
1963    pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
1964
1965    impl RunJob {
1966        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1967            Self(RequestBuilder::new(stub))
1968        }
1969
1970        /// Sets the full request, replacing any prior values.
1971        pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
1972            self.0.request = v.into();
1973            self
1974        }
1975
1976        /// Sets all the options, replacing any prior values.
1977        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1978            self.0.options = v.into();
1979            self
1980        }
1981
1982        /// Sends the request.
1983        ///
1984        /// # Long running operations
1985        ///
1986        /// This starts, but does not poll, a longrunning operation. More information
1987        /// on [run_job][crate::client::Jobs::run_job].
1988        pub async fn send(self) -> Result<longrunning::model::Operation> {
1989            (*self.0.stub)
1990                .run_job(self.0.request, self.0.options)
1991                .await
1992                .map(gax::response::Response::into_body)
1993        }
1994
1995        /// Creates a [Poller][lro::Poller] to work with `run_job`.
1996        pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
1997            type Operation =
1998                lro::internal::Operation<crate::model::Execution, crate::model::Execution>;
1999            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2000            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2001
2002            let stub = self.0.stub.clone();
2003            let mut options = self.0.options.clone();
2004            options.set_retry_policy(gax::retry_policy::NeverRetry);
2005            let query = move |name| {
2006                let stub = stub.clone();
2007                let options = options.clone();
2008                async {
2009                    let op = GetOperation::new(stub)
2010                        .set_name(name)
2011                        .with_options(options)
2012                        .send()
2013                        .await?;
2014                    Ok(Operation::new(op))
2015                }
2016            };
2017
2018            let start = move || async {
2019                let op = self.send().await?;
2020                Ok(Operation::new(op))
2021            };
2022
2023            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2024        }
2025
2026        /// Sets the value of [name][crate::model::RunJobRequest::name].
2027        ///
2028        /// This is a **required** field for requests.
2029        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2030            self.0.request.name = v.into();
2031            self
2032        }
2033
2034        /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
2035        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2036            self.0.request.validate_only = v.into();
2037            self
2038        }
2039
2040        /// Sets the value of [etag][crate::model::RunJobRequest::etag].
2041        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2042            self.0.request.etag = v.into();
2043            self
2044        }
2045
2046        /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
2047        pub fn set_overrides<T>(mut self, v: T) -> Self
2048        where
2049            T: std::convert::Into<crate::model::run_job_request::Overrides>,
2050        {
2051            self.0.request.overrides = std::option::Option::Some(v.into());
2052            self
2053        }
2054
2055        /// Sets or clears the value of [overrides][crate::model::RunJobRequest::overrides].
2056        pub fn set_or_clear_overrides<T>(mut self, v: std::option::Option<T>) -> Self
2057        where
2058            T: std::convert::Into<crate::model::run_job_request::Overrides>,
2059        {
2060            self.0.request.overrides = v.map(|x| x.into());
2061            self
2062        }
2063    }
2064
2065    #[doc(hidden)]
2066    impl gax::options::internal::RequestBuilder for RunJob {
2067        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2068            &mut self.0.options
2069        }
2070    }
2071
2072    /// The request builder for [Jobs::get_iam_policy][crate::client::Jobs::get_iam_policy] calls.
2073    ///
2074    /// # Example
2075    /// ```no_run
2076    /// # use google_cloud_run_v2::builder;
2077    /// use builder::jobs::GetIamPolicy;
2078    /// # tokio_test::block_on(async {
2079    ///
2080    /// let builder = prepare_request_builder();
2081    /// let response = builder.send().await?;
2082    /// # gax::Result::<()>::Ok(()) });
2083    ///
2084    /// fn prepare_request_builder() -> GetIamPolicy {
2085    ///   # panic!();
2086    ///   // ... details omitted ...
2087    /// }
2088    /// ```
2089    #[derive(Clone, Debug)]
2090    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2091
2092    impl GetIamPolicy {
2093        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2094            Self(RequestBuilder::new(stub))
2095        }
2096
2097        /// Sets the full request, replacing any prior values.
2098        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2099            self.0.request = v.into();
2100            self
2101        }
2102
2103        /// Sets all the options, replacing any prior values.
2104        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2105            self.0.options = v.into();
2106            self
2107        }
2108
2109        /// Sends the request.
2110        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2111            (*self.0.stub)
2112                .get_iam_policy(self.0.request, self.0.options)
2113                .await
2114                .map(gax::response::Response::into_body)
2115        }
2116
2117        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
2118        ///
2119        /// This is a **required** field for requests.
2120        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2121            self.0.request.resource = v.into();
2122            self
2123        }
2124
2125        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
2126        pub fn set_options<T>(mut self, v: T) -> Self
2127        where
2128            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2129        {
2130            self.0.request.options = std::option::Option::Some(v.into());
2131            self
2132        }
2133
2134        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
2135        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2136        where
2137            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2138        {
2139            self.0.request.options = v.map(|x| x.into());
2140            self
2141        }
2142    }
2143
2144    #[doc(hidden)]
2145    impl gax::options::internal::RequestBuilder for GetIamPolicy {
2146        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2147            &mut self.0.options
2148        }
2149    }
2150
2151    /// The request builder for [Jobs::set_iam_policy][crate::client::Jobs::set_iam_policy] calls.
2152    ///
2153    /// # Example
2154    /// ```no_run
2155    /// # use google_cloud_run_v2::builder;
2156    /// use builder::jobs::SetIamPolicy;
2157    /// # tokio_test::block_on(async {
2158    ///
2159    /// let builder = prepare_request_builder();
2160    /// let response = builder.send().await?;
2161    /// # gax::Result::<()>::Ok(()) });
2162    ///
2163    /// fn prepare_request_builder() -> SetIamPolicy {
2164    ///   # panic!();
2165    ///   // ... details omitted ...
2166    /// }
2167    /// ```
2168    #[derive(Clone, Debug)]
2169    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2170
2171    impl SetIamPolicy {
2172        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2173            Self(RequestBuilder::new(stub))
2174        }
2175
2176        /// Sets the full request, replacing any prior values.
2177        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2178            self.0.request = v.into();
2179            self
2180        }
2181
2182        /// Sets all the options, replacing any prior values.
2183        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2184            self.0.options = v.into();
2185            self
2186        }
2187
2188        /// Sends the request.
2189        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2190            (*self.0.stub)
2191                .set_iam_policy(self.0.request, self.0.options)
2192                .await
2193                .map(gax::response::Response::into_body)
2194        }
2195
2196        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
2197        ///
2198        /// This is a **required** field for requests.
2199        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2200            self.0.request.resource = v.into();
2201            self
2202        }
2203
2204        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2205        ///
2206        /// This is a **required** field for requests.
2207        pub fn set_policy<T>(mut self, v: T) -> Self
2208        where
2209            T: std::convert::Into<iam_v1::model::Policy>,
2210        {
2211            self.0.request.policy = std::option::Option::Some(v.into());
2212            self
2213        }
2214
2215        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2216        ///
2217        /// This is a **required** field for requests.
2218        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2219        where
2220            T: std::convert::Into<iam_v1::model::Policy>,
2221        {
2222            self.0.request.policy = v.map(|x| x.into());
2223            self
2224        }
2225
2226        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2227        pub fn set_update_mask<T>(mut self, v: T) -> Self
2228        where
2229            T: std::convert::Into<wkt::FieldMask>,
2230        {
2231            self.0.request.update_mask = std::option::Option::Some(v.into());
2232            self
2233        }
2234
2235        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
2236        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2237        where
2238            T: std::convert::Into<wkt::FieldMask>,
2239        {
2240            self.0.request.update_mask = v.map(|x| x.into());
2241            self
2242        }
2243    }
2244
2245    #[doc(hidden)]
2246    impl gax::options::internal::RequestBuilder for SetIamPolicy {
2247        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2248            &mut self.0.options
2249        }
2250    }
2251
2252    /// The request builder for [Jobs::test_iam_permissions][crate::client::Jobs::test_iam_permissions] calls.
2253    ///
2254    /// # Example
2255    /// ```no_run
2256    /// # use google_cloud_run_v2::builder;
2257    /// use builder::jobs::TestIamPermissions;
2258    /// # tokio_test::block_on(async {
2259    ///
2260    /// let builder = prepare_request_builder();
2261    /// let response = builder.send().await?;
2262    /// # gax::Result::<()>::Ok(()) });
2263    ///
2264    /// fn prepare_request_builder() -> TestIamPermissions {
2265    ///   # panic!();
2266    ///   // ... details omitted ...
2267    /// }
2268    /// ```
2269    #[derive(Clone, Debug)]
2270    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2271
2272    impl TestIamPermissions {
2273        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2274            Self(RequestBuilder::new(stub))
2275        }
2276
2277        /// Sets the full request, replacing any prior values.
2278        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2279            mut self,
2280            v: V,
2281        ) -> Self {
2282            self.0.request = v.into();
2283            self
2284        }
2285
2286        /// Sets all the options, replacing any prior values.
2287        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2288            self.0.options = v.into();
2289            self
2290        }
2291
2292        /// Sends the request.
2293        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2294            (*self.0.stub)
2295                .test_iam_permissions(self.0.request, self.0.options)
2296                .await
2297                .map(gax::response::Response::into_body)
2298        }
2299
2300        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
2301        ///
2302        /// This is a **required** field for requests.
2303        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2304            self.0.request.resource = v.into();
2305            self
2306        }
2307
2308        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
2309        ///
2310        /// This is a **required** field for requests.
2311        pub fn set_permissions<T, V>(mut self, v: T) -> Self
2312        where
2313            T: std::iter::IntoIterator<Item = V>,
2314            V: std::convert::Into<std::string::String>,
2315        {
2316            use std::iter::Iterator;
2317            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2318            self
2319        }
2320    }
2321
2322    #[doc(hidden)]
2323    impl gax::options::internal::RequestBuilder for TestIamPermissions {
2324        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2325            &mut self.0.options
2326        }
2327    }
2328
2329    /// The request builder for [Jobs::list_operations][crate::client::Jobs::list_operations] calls.
2330    ///
2331    /// # Example
2332    /// ```no_run
2333    /// # use google_cloud_run_v2::builder;
2334    /// use builder::jobs::ListOperations;
2335    /// # tokio_test::block_on(async {
2336    /// use gax::paginator::ItemPaginator;
2337    ///
2338    /// let builder = prepare_request_builder();
2339    /// let mut items = builder.by_item();
2340    /// while let Some(result) = items.next().await {
2341    ///   let item = result?;
2342    /// }
2343    /// # gax::Result::<()>::Ok(()) });
2344    ///
2345    /// fn prepare_request_builder() -> ListOperations {
2346    ///   # panic!();
2347    ///   // ... details omitted ...
2348    /// }
2349    /// ```
2350    #[derive(Clone, Debug)]
2351    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2352
2353    impl ListOperations {
2354        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2355            Self(RequestBuilder::new(stub))
2356        }
2357
2358        /// Sets the full request, replacing any prior values.
2359        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2360            mut self,
2361            v: V,
2362        ) -> Self {
2363            self.0.request = v.into();
2364            self
2365        }
2366
2367        /// Sets all the options, replacing any prior values.
2368        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2369            self.0.options = v.into();
2370            self
2371        }
2372
2373        /// Sends the request.
2374        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2375            (*self.0.stub)
2376                .list_operations(self.0.request, self.0.options)
2377                .await
2378                .map(gax::response::Response::into_body)
2379        }
2380
2381        /// Streams each page in the collection.
2382        pub fn by_page(
2383            self,
2384        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2385        {
2386            use std::clone::Clone;
2387            let token = self.0.request.page_token.clone();
2388            let execute = move |token: String| {
2389                let mut builder = self.clone();
2390                builder.0.request = builder.0.request.set_page_token(token);
2391                builder.send()
2392            };
2393            gax::paginator::internal::new_paginator(token, execute)
2394        }
2395
2396        /// Streams each item in the collection.
2397        pub fn by_item(
2398            self,
2399        ) -> impl gax::paginator::ItemPaginator<
2400            longrunning::model::ListOperationsResponse,
2401            gax::error::Error,
2402        > {
2403            use gax::paginator::Paginator;
2404            self.by_page().items()
2405        }
2406
2407        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2408        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2409            self.0.request.name = v.into();
2410            self
2411        }
2412
2413        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2414        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2415            self.0.request.filter = v.into();
2416            self
2417        }
2418
2419        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2420        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2421            self.0.request.page_size = v.into();
2422            self
2423        }
2424
2425        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2426        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2427            self.0.request.page_token = v.into();
2428            self
2429        }
2430
2431        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
2432        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2433            self.0.request.return_partial_success = v.into();
2434            self
2435        }
2436    }
2437
2438    #[doc(hidden)]
2439    impl gax::options::internal::RequestBuilder for ListOperations {
2440        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2441            &mut self.0.options
2442        }
2443    }
2444
2445    /// The request builder for [Jobs::get_operation][crate::client::Jobs::get_operation] calls.
2446    ///
2447    /// # Example
2448    /// ```no_run
2449    /// # use google_cloud_run_v2::builder;
2450    /// use builder::jobs::GetOperation;
2451    /// # tokio_test::block_on(async {
2452    ///
2453    /// let builder = prepare_request_builder();
2454    /// let response = builder.send().await?;
2455    /// # gax::Result::<()>::Ok(()) });
2456    ///
2457    /// fn prepare_request_builder() -> GetOperation {
2458    ///   # panic!();
2459    ///   // ... details omitted ...
2460    /// }
2461    /// ```
2462    #[derive(Clone, Debug)]
2463    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2464
2465    impl GetOperation {
2466        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2467            Self(RequestBuilder::new(stub))
2468        }
2469
2470        /// Sets the full request, replacing any prior values.
2471        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2472            mut self,
2473            v: V,
2474        ) -> Self {
2475            self.0.request = v.into();
2476            self
2477        }
2478
2479        /// Sets all the options, replacing any prior values.
2480        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2481            self.0.options = v.into();
2482            self
2483        }
2484
2485        /// Sends the request.
2486        pub async fn send(self) -> Result<longrunning::model::Operation> {
2487            (*self.0.stub)
2488                .get_operation(self.0.request, self.0.options)
2489                .await
2490                .map(gax::response::Response::into_body)
2491        }
2492
2493        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2494        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2495            self.0.request.name = v.into();
2496            self
2497        }
2498    }
2499
2500    #[doc(hidden)]
2501    impl gax::options::internal::RequestBuilder for GetOperation {
2502        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2503            &mut self.0.options
2504        }
2505    }
2506
2507    /// The request builder for [Jobs::delete_operation][crate::client::Jobs::delete_operation] calls.
2508    ///
2509    /// # Example
2510    /// ```no_run
2511    /// # use google_cloud_run_v2::builder;
2512    /// use builder::jobs::DeleteOperation;
2513    /// # tokio_test::block_on(async {
2514    ///
2515    /// let builder = prepare_request_builder();
2516    /// let response = builder.send().await?;
2517    /// # gax::Result::<()>::Ok(()) });
2518    ///
2519    /// fn prepare_request_builder() -> DeleteOperation {
2520    ///   # panic!();
2521    ///   // ... details omitted ...
2522    /// }
2523    /// ```
2524    #[derive(Clone, Debug)]
2525    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2526
2527    impl DeleteOperation {
2528        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2529            Self(RequestBuilder::new(stub))
2530        }
2531
2532        /// Sets the full request, replacing any prior values.
2533        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2534            mut self,
2535            v: V,
2536        ) -> Self {
2537            self.0.request = v.into();
2538            self
2539        }
2540
2541        /// Sets all the options, replacing any prior values.
2542        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2543            self.0.options = v.into();
2544            self
2545        }
2546
2547        /// Sends the request.
2548        pub async fn send(self) -> Result<()> {
2549            (*self.0.stub)
2550                .delete_operation(self.0.request, self.0.options)
2551                .await
2552                .map(gax::response::Response::into_body)
2553        }
2554
2555        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
2556        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2557            self.0.request.name = v.into();
2558            self
2559        }
2560    }
2561
2562    #[doc(hidden)]
2563    impl gax::options::internal::RequestBuilder for DeleteOperation {
2564        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2565            &mut self.0.options
2566        }
2567    }
2568
2569    /// The request builder for [Jobs::wait_operation][crate::client::Jobs::wait_operation] calls.
2570    ///
2571    /// # Example
2572    /// ```no_run
2573    /// # use google_cloud_run_v2::builder;
2574    /// use builder::jobs::WaitOperation;
2575    /// # tokio_test::block_on(async {
2576    ///
2577    /// let builder = prepare_request_builder();
2578    /// let response = builder.send().await?;
2579    /// # gax::Result::<()>::Ok(()) });
2580    ///
2581    /// fn prepare_request_builder() -> WaitOperation {
2582    ///   # panic!();
2583    ///   // ... details omitted ...
2584    /// }
2585    /// ```
2586    #[derive(Clone, Debug)]
2587    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
2588
2589    impl WaitOperation {
2590        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
2591            Self(RequestBuilder::new(stub))
2592        }
2593
2594        /// Sets the full request, replacing any prior values.
2595        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
2596            mut self,
2597            v: V,
2598        ) -> Self {
2599            self.0.request = v.into();
2600            self
2601        }
2602
2603        /// Sets all the options, replacing any prior values.
2604        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2605            self.0.options = v.into();
2606            self
2607        }
2608
2609        /// Sends the request.
2610        pub async fn send(self) -> Result<longrunning::model::Operation> {
2611            (*self.0.stub)
2612                .wait_operation(self.0.request, self.0.options)
2613                .await
2614                .map(gax::response::Response::into_body)
2615        }
2616
2617        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
2618        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2619            self.0.request.name = v.into();
2620            self
2621        }
2622
2623        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
2624        pub fn set_timeout<T>(mut self, v: T) -> Self
2625        where
2626            T: std::convert::Into<wkt::Duration>,
2627        {
2628            self.0.request.timeout = std::option::Option::Some(v.into());
2629            self
2630        }
2631
2632        /// Sets or clears the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
2633        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
2634        where
2635            T: std::convert::Into<wkt::Duration>,
2636        {
2637            self.0.request.timeout = v.map(|x| x.into());
2638            self
2639        }
2640    }
2641
2642    #[doc(hidden)]
2643    impl gax::options::internal::RequestBuilder for WaitOperation {
2644        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2645            &mut self.0.options
2646        }
2647    }
2648}
2649
2650pub mod revisions {
2651    use crate::Result;
2652
2653    /// A builder for [Revisions][crate::client::Revisions].
2654    ///
2655    /// ```
2656    /// # tokio_test::block_on(async {
2657    /// # use google_cloud_run_v2::*;
2658    /// # use builder::revisions::ClientBuilder;
2659    /// # use client::Revisions;
2660    /// let builder : ClientBuilder = Revisions::builder();
2661    /// let client = builder
2662    ///     .with_endpoint("https://run.googleapis.com")
2663    ///     .build().await?;
2664    /// # gax::client_builder::Result::<()>::Ok(()) });
2665    /// ```
2666    pub type ClientBuilder =
2667        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2668
2669    pub(crate) mod client {
2670        use super::super::super::client::Revisions;
2671        pub struct Factory;
2672        impl gax::client_builder::internal::ClientFactory for Factory {
2673            type Client = Revisions;
2674            type Credentials = gaxi::options::Credentials;
2675            async fn build(
2676                self,
2677                config: gaxi::options::ClientConfig,
2678            ) -> gax::client_builder::Result<Self::Client> {
2679                Self::Client::new(config).await
2680            }
2681        }
2682    }
2683
2684    /// Common implementation for [crate::client::Revisions] request builders.
2685    #[derive(Clone, Debug)]
2686    pub(crate) struct RequestBuilder<R: std::default::Default> {
2687        stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2688        request: R,
2689        options: gax::options::RequestOptions,
2690    }
2691
2692    impl<R> RequestBuilder<R>
2693    where
2694        R: std::default::Default,
2695    {
2696        pub(crate) fn new(
2697            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2698        ) -> Self {
2699            Self {
2700                stub,
2701                request: R::default(),
2702                options: gax::options::RequestOptions::default(),
2703            }
2704        }
2705    }
2706
2707    /// The request builder for [Revisions::get_revision][crate::client::Revisions::get_revision] calls.
2708    ///
2709    /// # Example
2710    /// ```no_run
2711    /// # use google_cloud_run_v2::builder;
2712    /// use builder::revisions::GetRevision;
2713    /// # tokio_test::block_on(async {
2714    ///
2715    /// let builder = prepare_request_builder();
2716    /// let response = builder.send().await?;
2717    /// # gax::Result::<()>::Ok(()) });
2718    ///
2719    /// fn prepare_request_builder() -> GetRevision {
2720    ///   # panic!();
2721    ///   // ... details omitted ...
2722    /// }
2723    /// ```
2724    #[derive(Clone, Debug)]
2725    pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
2726
2727    impl GetRevision {
2728        pub(crate) fn new(
2729            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2730        ) -> Self {
2731            Self(RequestBuilder::new(stub))
2732        }
2733
2734        /// Sets the full request, replacing any prior values.
2735        pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
2736            self.0.request = v.into();
2737            self
2738        }
2739
2740        /// Sets all the options, replacing any prior values.
2741        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2742            self.0.options = v.into();
2743            self
2744        }
2745
2746        /// Sends the request.
2747        pub async fn send(self) -> Result<crate::model::Revision> {
2748            (*self.0.stub)
2749                .get_revision(self.0.request, self.0.options)
2750                .await
2751                .map(gax::response::Response::into_body)
2752        }
2753
2754        /// Sets the value of [name][crate::model::GetRevisionRequest::name].
2755        ///
2756        /// This is a **required** field for requests.
2757        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2758            self.0.request.name = v.into();
2759            self
2760        }
2761    }
2762
2763    #[doc(hidden)]
2764    impl gax::options::internal::RequestBuilder for GetRevision {
2765        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2766            &mut self.0.options
2767        }
2768    }
2769
2770    /// The request builder for [Revisions::list_revisions][crate::client::Revisions::list_revisions] calls.
2771    ///
2772    /// # Example
2773    /// ```no_run
2774    /// # use google_cloud_run_v2::builder;
2775    /// use builder::revisions::ListRevisions;
2776    /// # tokio_test::block_on(async {
2777    /// use gax::paginator::ItemPaginator;
2778    ///
2779    /// let builder = prepare_request_builder();
2780    /// let mut items = builder.by_item();
2781    /// while let Some(result) = items.next().await {
2782    ///   let item = result?;
2783    /// }
2784    /// # gax::Result::<()>::Ok(()) });
2785    ///
2786    /// fn prepare_request_builder() -> ListRevisions {
2787    ///   # panic!();
2788    ///   // ... details omitted ...
2789    /// }
2790    /// ```
2791    #[derive(Clone, Debug)]
2792    pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
2793
2794    impl ListRevisions {
2795        pub(crate) fn new(
2796            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2797        ) -> Self {
2798            Self(RequestBuilder::new(stub))
2799        }
2800
2801        /// Sets the full request, replacing any prior values.
2802        pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
2803            self.0.request = v.into();
2804            self
2805        }
2806
2807        /// Sets all the options, replacing any prior values.
2808        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2809            self.0.options = v.into();
2810            self
2811        }
2812
2813        /// Sends the request.
2814        pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
2815            (*self.0.stub)
2816                .list_revisions(self.0.request, self.0.options)
2817                .await
2818                .map(gax::response::Response::into_body)
2819        }
2820
2821        /// Streams each page in the collection.
2822        pub fn by_page(
2823            self,
2824        ) -> impl gax::paginator::Paginator<crate::model::ListRevisionsResponse, gax::error::Error>
2825        {
2826            use std::clone::Clone;
2827            let token = self.0.request.page_token.clone();
2828            let execute = move |token: String| {
2829                let mut builder = self.clone();
2830                builder.0.request = builder.0.request.set_page_token(token);
2831                builder.send()
2832            };
2833            gax::paginator::internal::new_paginator(token, execute)
2834        }
2835
2836        /// Streams each item in the collection.
2837        pub fn by_item(
2838            self,
2839        ) -> impl gax::paginator::ItemPaginator<crate::model::ListRevisionsResponse, gax::error::Error>
2840        {
2841            use gax::paginator::Paginator;
2842            self.by_page().items()
2843        }
2844
2845        /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
2846        ///
2847        /// This is a **required** field for requests.
2848        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2849            self.0.request.parent = v.into();
2850            self
2851        }
2852
2853        /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
2854        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2855            self.0.request.page_size = v.into();
2856            self
2857        }
2858
2859        /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
2860        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2861            self.0.request.page_token = v.into();
2862            self
2863        }
2864
2865        /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
2866        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2867            self.0.request.show_deleted = v.into();
2868            self
2869        }
2870    }
2871
2872    #[doc(hidden)]
2873    impl gax::options::internal::RequestBuilder for ListRevisions {
2874        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2875            &mut self.0.options
2876        }
2877    }
2878
2879    /// The request builder for [Revisions::delete_revision][crate::client::Revisions::delete_revision] calls.
2880    ///
2881    /// # Example
2882    /// ```no_run
2883    /// # use google_cloud_run_v2::builder;
2884    /// use builder::revisions::DeleteRevision;
2885    /// # tokio_test::block_on(async {
2886    /// use lro::Poller;
2887    ///
2888    /// let builder = prepare_request_builder();
2889    /// let response = builder.poller().until_done().await?;
2890    /// # gax::Result::<()>::Ok(()) });
2891    ///
2892    /// fn prepare_request_builder() -> DeleteRevision {
2893    ///   # panic!();
2894    ///   // ... details omitted ...
2895    /// }
2896    /// ```
2897    #[derive(Clone, Debug)]
2898    pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
2899
2900    impl DeleteRevision {
2901        pub(crate) fn new(
2902            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
2903        ) -> Self {
2904            Self(RequestBuilder::new(stub))
2905        }
2906
2907        /// Sets the full request, replacing any prior values.
2908        pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
2909            self.0.request = v.into();
2910            self
2911        }
2912
2913        /// Sets all the options, replacing any prior values.
2914        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2915            self.0.options = v.into();
2916            self
2917        }
2918
2919        /// Sends the request.
2920        ///
2921        /// # Long running operations
2922        ///
2923        /// This starts, but does not poll, a longrunning operation. More information
2924        /// on [delete_revision][crate::client::Revisions::delete_revision].
2925        pub async fn send(self) -> Result<longrunning::model::Operation> {
2926            (*self.0.stub)
2927                .delete_revision(self.0.request, self.0.options)
2928                .await
2929                .map(gax::response::Response::into_body)
2930        }
2931
2932        /// Creates a [Poller][lro::Poller] to work with `delete_revision`.
2933        pub fn poller(self) -> impl lro::Poller<crate::model::Revision, crate::model::Revision> {
2934            type Operation =
2935                lro::internal::Operation<crate::model::Revision, crate::model::Revision>;
2936            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2937            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2938
2939            let stub = self.0.stub.clone();
2940            let mut options = self.0.options.clone();
2941            options.set_retry_policy(gax::retry_policy::NeverRetry);
2942            let query = move |name| {
2943                let stub = stub.clone();
2944                let options = options.clone();
2945                async {
2946                    let op = GetOperation::new(stub)
2947                        .set_name(name)
2948                        .with_options(options)
2949                        .send()
2950                        .await?;
2951                    Ok(Operation::new(op))
2952                }
2953            };
2954
2955            let start = move || async {
2956                let op = self.send().await?;
2957                Ok(Operation::new(op))
2958            };
2959
2960            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2961        }
2962
2963        /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
2964        ///
2965        /// This is a **required** field for requests.
2966        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2967            self.0.request.name = v.into();
2968            self
2969        }
2970
2971        /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
2972        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2973            self.0.request.validate_only = v.into();
2974            self
2975        }
2976
2977        /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
2978        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2979            self.0.request.etag = v.into();
2980            self
2981        }
2982    }
2983
2984    #[doc(hidden)]
2985    impl gax::options::internal::RequestBuilder for DeleteRevision {
2986        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2987            &mut self.0.options
2988        }
2989    }
2990
2991    /// The request builder for [Revisions::list_operations][crate::client::Revisions::list_operations] calls.
2992    ///
2993    /// # Example
2994    /// ```no_run
2995    /// # use google_cloud_run_v2::builder;
2996    /// use builder::revisions::ListOperations;
2997    /// # tokio_test::block_on(async {
2998    /// use gax::paginator::ItemPaginator;
2999    ///
3000    /// let builder = prepare_request_builder();
3001    /// let mut items = builder.by_item();
3002    /// while let Some(result) = items.next().await {
3003    ///   let item = result?;
3004    /// }
3005    /// # gax::Result::<()>::Ok(()) });
3006    ///
3007    /// fn prepare_request_builder() -> ListOperations {
3008    ///   # panic!();
3009    ///   // ... details omitted ...
3010    /// }
3011    /// ```
3012    #[derive(Clone, Debug)]
3013    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3014
3015    impl ListOperations {
3016        pub(crate) fn new(
3017            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3018        ) -> Self {
3019            Self(RequestBuilder::new(stub))
3020        }
3021
3022        /// Sets the full request, replacing any prior values.
3023        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3024            mut self,
3025            v: V,
3026        ) -> Self {
3027            self.0.request = v.into();
3028            self
3029        }
3030
3031        /// Sets all the options, replacing any prior values.
3032        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3033            self.0.options = v.into();
3034            self
3035        }
3036
3037        /// Sends the request.
3038        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3039            (*self.0.stub)
3040                .list_operations(self.0.request, self.0.options)
3041                .await
3042                .map(gax::response::Response::into_body)
3043        }
3044
3045        /// Streams each page in the collection.
3046        pub fn by_page(
3047            self,
3048        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3049        {
3050            use std::clone::Clone;
3051            let token = self.0.request.page_token.clone();
3052            let execute = move |token: String| {
3053                let mut builder = self.clone();
3054                builder.0.request = builder.0.request.set_page_token(token);
3055                builder.send()
3056            };
3057            gax::paginator::internal::new_paginator(token, execute)
3058        }
3059
3060        /// Streams each item in the collection.
3061        pub fn by_item(
3062            self,
3063        ) -> impl gax::paginator::ItemPaginator<
3064            longrunning::model::ListOperationsResponse,
3065            gax::error::Error,
3066        > {
3067            use gax::paginator::Paginator;
3068            self.by_page().items()
3069        }
3070
3071        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3072        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3073            self.0.request.name = v.into();
3074            self
3075        }
3076
3077        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3078        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3079            self.0.request.filter = v.into();
3080            self
3081        }
3082
3083        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3084        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3085            self.0.request.page_size = v.into();
3086            self
3087        }
3088
3089        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3090        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3091            self.0.request.page_token = v.into();
3092            self
3093        }
3094
3095        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
3096        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3097            self.0.request.return_partial_success = v.into();
3098            self
3099        }
3100    }
3101
3102    #[doc(hidden)]
3103    impl gax::options::internal::RequestBuilder for ListOperations {
3104        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3105            &mut self.0.options
3106        }
3107    }
3108
3109    /// The request builder for [Revisions::get_operation][crate::client::Revisions::get_operation] calls.
3110    ///
3111    /// # Example
3112    /// ```no_run
3113    /// # use google_cloud_run_v2::builder;
3114    /// use builder::revisions::GetOperation;
3115    /// # tokio_test::block_on(async {
3116    ///
3117    /// let builder = prepare_request_builder();
3118    /// let response = builder.send().await?;
3119    /// # gax::Result::<()>::Ok(()) });
3120    ///
3121    /// fn prepare_request_builder() -> GetOperation {
3122    ///   # panic!();
3123    ///   // ... details omitted ...
3124    /// }
3125    /// ```
3126    #[derive(Clone, Debug)]
3127    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3128
3129    impl GetOperation {
3130        pub(crate) fn new(
3131            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3132        ) -> Self {
3133            Self(RequestBuilder::new(stub))
3134        }
3135
3136        /// Sets the full request, replacing any prior values.
3137        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3138            mut self,
3139            v: V,
3140        ) -> Self {
3141            self.0.request = v.into();
3142            self
3143        }
3144
3145        /// Sets all the options, replacing any prior values.
3146        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3147            self.0.options = v.into();
3148            self
3149        }
3150
3151        /// Sends the request.
3152        pub async fn send(self) -> Result<longrunning::model::Operation> {
3153            (*self.0.stub)
3154                .get_operation(self.0.request, self.0.options)
3155                .await
3156                .map(gax::response::Response::into_body)
3157        }
3158
3159        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3160        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3161            self.0.request.name = v.into();
3162            self
3163        }
3164    }
3165
3166    #[doc(hidden)]
3167    impl gax::options::internal::RequestBuilder for GetOperation {
3168        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3169            &mut self.0.options
3170        }
3171    }
3172
3173    /// The request builder for [Revisions::delete_operation][crate::client::Revisions::delete_operation] calls.
3174    ///
3175    /// # Example
3176    /// ```no_run
3177    /// # use google_cloud_run_v2::builder;
3178    /// use builder::revisions::DeleteOperation;
3179    /// # tokio_test::block_on(async {
3180    ///
3181    /// let builder = prepare_request_builder();
3182    /// let response = builder.send().await?;
3183    /// # gax::Result::<()>::Ok(()) });
3184    ///
3185    /// fn prepare_request_builder() -> DeleteOperation {
3186    ///   # panic!();
3187    ///   // ... details omitted ...
3188    /// }
3189    /// ```
3190    #[derive(Clone, Debug)]
3191    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3192
3193    impl DeleteOperation {
3194        pub(crate) fn new(
3195            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3196        ) -> Self {
3197            Self(RequestBuilder::new(stub))
3198        }
3199
3200        /// Sets the full request, replacing any prior values.
3201        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3202            mut self,
3203            v: V,
3204        ) -> Self {
3205            self.0.request = v.into();
3206            self
3207        }
3208
3209        /// Sets all the options, replacing any prior values.
3210        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3211            self.0.options = v.into();
3212            self
3213        }
3214
3215        /// Sends the request.
3216        pub async fn send(self) -> Result<()> {
3217            (*self.0.stub)
3218                .delete_operation(self.0.request, self.0.options)
3219                .await
3220                .map(gax::response::Response::into_body)
3221        }
3222
3223        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
3224        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3225            self.0.request.name = v.into();
3226            self
3227        }
3228    }
3229
3230    #[doc(hidden)]
3231    impl gax::options::internal::RequestBuilder for DeleteOperation {
3232        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3233            &mut self.0.options
3234        }
3235    }
3236
3237    /// The request builder for [Revisions::wait_operation][crate::client::Revisions::wait_operation] calls.
3238    ///
3239    /// # Example
3240    /// ```no_run
3241    /// # use google_cloud_run_v2::builder;
3242    /// use builder::revisions::WaitOperation;
3243    /// # tokio_test::block_on(async {
3244    ///
3245    /// let builder = prepare_request_builder();
3246    /// let response = builder.send().await?;
3247    /// # gax::Result::<()>::Ok(()) });
3248    ///
3249    /// fn prepare_request_builder() -> WaitOperation {
3250    ///   # panic!();
3251    ///   // ... details omitted ...
3252    /// }
3253    /// ```
3254    #[derive(Clone, Debug)]
3255    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
3256
3257    impl WaitOperation {
3258        pub(crate) fn new(
3259            stub: std::sync::Arc<dyn super::super::stub::dynamic::Revisions>,
3260        ) -> Self {
3261            Self(RequestBuilder::new(stub))
3262        }
3263
3264        /// Sets the full request, replacing any prior values.
3265        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
3266            mut self,
3267            v: V,
3268        ) -> Self {
3269            self.0.request = v.into();
3270            self
3271        }
3272
3273        /// Sets all the options, replacing any prior values.
3274        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3275            self.0.options = v.into();
3276            self
3277        }
3278
3279        /// Sends the request.
3280        pub async fn send(self) -> Result<longrunning::model::Operation> {
3281            (*self.0.stub)
3282                .wait_operation(self.0.request, self.0.options)
3283                .await
3284                .map(gax::response::Response::into_body)
3285        }
3286
3287        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
3288        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3289            self.0.request.name = v.into();
3290            self
3291        }
3292
3293        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
3294        pub fn set_timeout<T>(mut self, v: T) -> Self
3295        where
3296            T: std::convert::Into<wkt::Duration>,
3297        {
3298            self.0.request.timeout = std::option::Option::Some(v.into());
3299            self
3300        }
3301
3302        /// Sets or clears the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
3303        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
3304        where
3305            T: std::convert::Into<wkt::Duration>,
3306        {
3307            self.0.request.timeout = v.map(|x| x.into());
3308            self
3309        }
3310    }
3311
3312    #[doc(hidden)]
3313    impl gax::options::internal::RequestBuilder for WaitOperation {
3314        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3315            &mut self.0.options
3316        }
3317    }
3318}
3319
3320pub mod services {
3321    use crate::Result;
3322
3323    /// A builder for [Services][crate::client::Services].
3324    ///
3325    /// ```
3326    /// # tokio_test::block_on(async {
3327    /// # use google_cloud_run_v2::*;
3328    /// # use builder::services::ClientBuilder;
3329    /// # use client::Services;
3330    /// let builder : ClientBuilder = Services::builder();
3331    /// let client = builder
3332    ///     .with_endpoint("https://run.googleapis.com")
3333    ///     .build().await?;
3334    /// # gax::client_builder::Result::<()>::Ok(()) });
3335    /// ```
3336    pub type ClientBuilder =
3337        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3338
3339    pub(crate) mod client {
3340        use super::super::super::client::Services;
3341        pub struct Factory;
3342        impl gax::client_builder::internal::ClientFactory for Factory {
3343            type Client = Services;
3344            type Credentials = gaxi::options::Credentials;
3345            async fn build(
3346                self,
3347                config: gaxi::options::ClientConfig,
3348            ) -> gax::client_builder::Result<Self::Client> {
3349                Self::Client::new(config).await
3350            }
3351        }
3352    }
3353
3354    /// Common implementation for [crate::client::Services] request builders.
3355    #[derive(Clone, Debug)]
3356    pub(crate) struct RequestBuilder<R: std::default::Default> {
3357        stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>,
3358        request: R,
3359        options: gax::options::RequestOptions,
3360    }
3361
3362    impl<R> RequestBuilder<R>
3363    where
3364        R: std::default::Default,
3365    {
3366        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3367            Self {
3368                stub,
3369                request: R::default(),
3370                options: gax::options::RequestOptions::default(),
3371            }
3372        }
3373    }
3374
3375    /// The request builder for [Services::create_service][crate::client::Services::create_service] calls.
3376    ///
3377    /// # Example
3378    /// ```no_run
3379    /// # use google_cloud_run_v2::builder;
3380    /// use builder::services::CreateService;
3381    /// # tokio_test::block_on(async {
3382    /// use lro::Poller;
3383    ///
3384    /// let builder = prepare_request_builder();
3385    /// let response = builder.poller().until_done().await?;
3386    /// # gax::Result::<()>::Ok(()) });
3387    ///
3388    /// fn prepare_request_builder() -> CreateService {
3389    ///   # panic!();
3390    ///   // ... details omitted ...
3391    /// }
3392    /// ```
3393    #[derive(Clone, Debug)]
3394    pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
3395
3396    impl CreateService {
3397        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3398            Self(RequestBuilder::new(stub))
3399        }
3400
3401        /// Sets the full request, replacing any prior values.
3402        pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
3403            self.0.request = v.into();
3404            self
3405        }
3406
3407        /// Sets all the options, replacing any prior values.
3408        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3409            self.0.options = v.into();
3410            self
3411        }
3412
3413        /// Sends the request.
3414        ///
3415        /// # Long running operations
3416        ///
3417        /// This starts, but does not poll, a longrunning operation. More information
3418        /// on [create_service][crate::client::Services::create_service].
3419        pub async fn send(self) -> Result<longrunning::model::Operation> {
3420            (*self.0.stub)
3421                .create_service(self.0.request, self.0.options)
3422                .await
3423                .map(gax::response::Response::into_body)
3424        }
3425
3426        /// Creates a [Poller][lro::Poller] to work with `create_service`.
3427        pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
3428            type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
3429            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3430            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3431
3432            let stub = self.0.stub.clone();
3433            let mut options = self.0.options.clone();
3434            options.set_retry_policy(gax::retry_policy::NeverRetry);
3435            let query = move |name| {
3436                let stub = stub.clone();
3437                let options = options.clone();
3438                async {
3439                    let op = GetOperation::new(stub)
3440                        .set_name(name)
3441                        .with_options(options)
3442                        .send()
3443                        .await?;
3444                    Ok(Operation::new(op))
3445                }
3446            };
3447
3448            let start = move || async {
3449                let op = self.send().await?;
3450                Ok(Operation::new(op))
3451            };
3452
3453            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3454        }
3455
3456        /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
3457        ///
3458        /// This is a **required** field for requests.
3459        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3460            self.0.request.parent = v.into();
3461            self
3462        }
3463
3464        /// Sets the value of [service][crate::model::CreateServiceRequest::service].
3465        ///
3466        /// This is a **required** field for requests.
3467        pub fn set_service<T>(mut self, v: T) -> Self
3468        where
3469            T: std::convert::Into<crate::model::Service>,
3470        {
3471            self.0.request.service = std::option::Option::Some(v.into());
3472            self
3473        }
3474
3475        /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
3476        ///
3477        /// This is a **required** field for requests.
3478        pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
3479        where
3480            T: std::convert::Into<crate::model::Service>,
3481        {
3482            self.0.request.service = v.map(|x| x.into());
3483            self
3484        }
3485
3486        /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
3487        ///
3488        /// This is a **required** field for requests.
3489        pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3490            self.0.request.service_id = v.into();
3491            self
3492        }
3493
3494        /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
3495        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3496            self.0.request.validate_only = v.into();
3497            self
3498        }
3499    }
3500
3501    #[doc(hidden)]
3502    impl gax::options::internal::RequestBuilder for CreateService {
3503        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3504            &mut self.0.options
3505        }
3506    }
3507
3508    /// The request builder for [Services::get_service][crate::client::Services::get_service] calls.
3509    ///
3510    /// # Example
3511    /// ```no_run
3512    /// # use google_cloud_run_v2::builder;
3513    /// use builder::services::GetService;
3514    /// # tokio_test::block_on(async {
3515    ///
3516    /// let builder = prepare_request_builder();
3517    /// let response = builder.send().await?;
3518    /// # gax::Result::<()>::Ok(()) });
3519    ///
3520    /// fn prepare_request_builder() -> GetService {
3521    ///   # panic!();
3522    ///   // ... details omitted ...
3523    /// }
3524    /// ```
3525    #[derive(Clone, Debug)]
3526    pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
3527
3528    impl GetService {
3529        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3530            Self(RequestBuilder::new(stub))
3531        }
3532
3533        /// Sets the full request, replacing any prior values.
3534        pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
3535            self.0.request = v.into();
3536            self
3537        }
3538
3539        /// Sets all the options, replacing any prior values.
3540        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3541            self.0.options = v.into();
3542            self
3543        }
3544
3545        /// Sends the request.
3546        pub async fn send(self) -> Result<crate::model::Service> {
3547            (*self.0.stub)
3548                .get_service(self.0.request, self.0.options)
3549                .await
3550                .map(gax::response::Response::into_body)
3551        }
3552
3553        /// Sets the value of [name][crate::model::GetServiceRequest::name].
3554        ///
3555        /// This is a **required** field for requests.
3556        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3557            self.0.request.name = v.into();
3558            self
3559        }
3560    }
3561
3562    #[doc(hidden)]
3563    impl gax::options::internal::RequestBuilder for GetService {
3564        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3565            &mut self.0.options
3566        }
3567    }
3568
3569    /// The request builder for [Services::list_services][crate::client::Services::list_services] calls.
3570    ///
3571    /// # Example
3572    /// ```no_run
3573    /// # use google_cloud_run_v2::builder;
3574    /// use builder::services::ListServices;
3575    /// # tokio_test::block_on(async {
3576    /// use gax::paginator::ItemPaginator;
3577    ///
3578    /// let builder = prepare_request_builder();
3579    /// let mut items = builder.by_item();
3580    /// while let Some(result) = items.next().await {
3581    ///   let item = result?;
3582    /// }
3583    /// # gax::Result::<()>::Ok(()) });
3584    ///
3585    /// fn prepare_request_builder() -> ListServices {
3586    ///   # panic!();
3587    ///   // ... details omitted ...
3588    /// }
3589    /// ```
3590    #[derive(Clone, Debug)]
3591    pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
3592
3593    impl ListServices {
3594        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3595            Self(RequestBuilder::new(stub))
3596        }
3597
3598        /// Sets the full request, replacing any prior values.
3599        pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
3600            self.0.request = v.into();
3601            self
3602        }
3603
3604        /// Sets all the options, replacing any prior values.
3605        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3606            self.0.options = v.into();
3607            self
3608        }
3609
3610        /// Sends the request.
3611        pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
3612            (*self.0.stub)
3613                .list_services(self.0.request, self.0.options)
3614                .await
3615                .map(gax::response::Response::into_body)
3616        }
3617
3618        /// Streams each page in the collection.
3619        pub fn by_page(
3620            self,
3621        ) -> impl gax::paginator::Paginator<crate::model::ListServicesResponse, gax::error::Error>
3622        {
3623            use std::clone::Clone;
3624            let token = self.0.request.page_token.clone();
3625            let execute = move |token: String| {
3626                let mut builder = self.clone();
3627                builder.0.request = builder.0.request.set_page_token(token);
3628                builder.send()
3629            };
3630            gax::paginator::internal::new_paginator(token, execute)
3631        }
3632
3633        /// Streams each item in the collection.
3634        pub fn by_item(
3635            self,
3636        ) -> impl gax::paginator::ItemPaginator<crate::model::ListServicesResponse, gax::error::Error>
3637        {
3638            use gax::paginator::Paginator;
3639            self.by_page().items()
3640        }
3641
3642        /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
3643        ///
3644        /// This is a **required** field for requests.
3645        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3646            self.0.request.parent = v.into();
3647            self
3648        }
3649
3650        /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
3651        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3652            self.0.request.page_size = v.into();
3653            self
3654        }
3655
3656        /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
3657        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3658            self.0.request.page_token = v.into();
3659            self
3660        }
3661
3662        /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
3663        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3664            self.0.request.show_deleted = v.into();
3665            self
3666        }
3667    }
3668
3669    #[doc(hidden)]
3670    impl gax::options::internal::RequestBuilder for ListServices {
3671        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3672            &mut self.0.options
3673        }
3674    }
3675
3676    /// The request builder for [Services::update_service][crate::client::Services::update_service] calls.
3677    ///
3678    /// # Example
3679    /// ```no_run
3680    /// # use google_cloud_run_v2::builder;
3681    /// use builder::services::UpdateService;
3682    /// # tokio_test::block_on(async {
3683    /// use lro::Poller;
3684    ///
3685    /// let builder = prepare_request_builder();
3686    /// let response = builder.poller().until_done().await?;
3687    /// # gax::Result::<()>::Ok(()) });
3688    ///
3689    /// fn prepare_request_builder() -> UpdateService {
3690    ///   # panic!();
3691    ///   // ... details omitted ...
3692    /// }
3693    /// ```
3694    #[derive(Clone, Debug)]
3695    pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
3696
3697    impl UpdateService {
3698        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3699            Self(RequestBuilder::new(stub))
3700        }
3701
3702        /// Sets the full request, replacing any prior values.
3703        pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
3704            self.0.request = v.into();
3705            self
3706        }
3707
3708        /// Sets all the options, replacing any prior values.
3709        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3710            self.0.options = v.into();
3711            self
3712        }
3713
3714        /// Sends the request.
3715        ///
3716        /// # Long running operations
3717        ///
3718        /// This starts, but does not poll, a longrunning operation. More information
3719        /// on [update_service][crate::client::Services::update_service].
3720        pub async fn send(self) -> Result<longrunning::model::Operation> {
3721            (*self.0.stub)
3722                .update_service(self.0.request, self.0.options)
3723                .await
3724                .map(gax::response::Response::into_body)
3725        }
3726
3727        /// Creates a [Poller][lro::Poller] to work with `update_service`.
3728        pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
3729            type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
3730            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3731            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3732
3733            let stub = self.0.stub.clone();
3734            let mut options = self.0.options.clone();
3735            options.set_retry_policy(gax::retry_policy::NeverRetry);
3736            let query = move |name| {
3737                let stub = stub.clone();
3738                let options = options.clone();
3739                async {
3740                    let op = GetOperation::new(stub)
3741                        .set_name(name)
3742                        .with_options(options)
3743                        .send()
3744                        .await?;
3745                    Ok(Operation::new(op))
3746                }
3747            };
3748
3749            let start = move || async {
3750                let op = self.send().await?;
3751                Ok(Operation::new(op))
3752            };
3753
3754            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3755        }
3756
3757        /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
3758        pub fn set_update_mask<T>(mut self, v: T) -> Self
3759        where
3760            T: std::convert::Into<wkt::FieldMask>,
3761        {
3762            self.0.request.update_mask = std::option::Option::Some(v.into());
3763            self
3764        }
3765
3766        /// Sets or clears the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
3767        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3768        where
3769            T: std::convert::Into<wkt::FieldMask>,
3770        {
3771            self.0.request.update_mask = v.map(|x| x.into());
3772            self
3773        }
3774
3775        /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
3776        ///
3777        /// This is a **required** field for requests.
3778        pub fn set_service<T>(mut self, v: T) -> Self
3779        where
3780            T: std::convert::Into<crate::model::Service>,
3781        {
3782            self.0.request.service = std::option::Option::Some(v.into());
3783            self
3784        }
3785
3786        /// Sets or clears the value of [service][crate::model::UpdateServiceRequest::service].
3787        ///
3788        /// This is a **required** field for requests.
3789        pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
3790        where
3791            T: std::convert::Into<crate::model::Service>,
3792        {
3793            self.0.request.service = v.map(|x| x.into());
3794            self
3795        }
3796
3797        /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
3798        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3799            self.0.request.validate_only = v.into();
3800            self
3801        }
3802
3803        /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
3804        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
3805            self.0.request.allow_missing = v.into();
3806            self
3807        }
3808    }
3809
3810    #[doc(hidden)]
3811    impl gax::options::internal::RequestBuilder for UpdateService {
3812        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3813            &mut self.0.options
3814        }
3815    }
3816
3817    /// The request builder for [Services::delete_service][crate::client::Services::delete_service] calls.
3818    ///
3819    /// # Example
3820    /// ```no_run
3821    /// # use google_cloud_run_v2::builder;
3822    /// use builder::services::DeleteService;
3823    /// # tokio_test::block_on(async {
3824    /// use lro::Poller;
3825    ///
3826    /// let builder = prepare_request_builder();
3827    /// let response = builder.poller().until_done().await?;
3828    /// # gax::Result::<()>::Ok(()) });
3829    ///
3830    /// fn prepare_request_builder() -> DeleteService {
3831    ///   # panic!();
3832    ///   // ... details omitted ...
3833    /// }
3834    /// ```
3835    #[derive(Clone, Debug)]
3836    pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
3837
3838    impl DeleteService {
3839        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3840            Self(RequestBuilder::new(stub))
3841        }
3842
3843        /// Sets the full request, replacing any prior values.
3844        pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
3845            self.0.request = v.into();
3846            self
3847        }
3848
3849        /// Sets all the options, replacing any prior values.
3850        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3851            self.0.options = v.into();
3852            self
3853        }
3854
3855        /// Sends the request.
3856        ///
3857        /// # Long running operations
3858        ///
3859        /// This starts, but does not poll, a longrunning operation. More information
3860        /// on [delete_service][crate::client::Services::delete_service].
3861        pub async fn send(self) -> Result<longrunning::model::Operation> {
3862            (*self.0.stub)
3863                .delete_service(self.0.request, self.0.options)
3864                .await
3865                .map(gax::response::Response::into_body)
3866        }
3867
3868        /// Creates a [Poller][lro::Poller] to work with `delete_service`.
3869        pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
3870            type Operation = lro::internal::Operation<crate::model::Service, crate::model::Service>;
3871            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3872            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3873
3874            let stub = self.0.stub.clone();
3875            let mut options = self.0.options.clone();
3876            options.set_retry_policy(gax::retry_policy::NeverRetry);
3877            let query = move |name| {
3878                let stub = stub.clone();
3879                let options = options.clone();
3880                async {
3881                    let op = GetOperation::new(stub)
3882                        .set_name(name)
3883                        .with_options(options)
3884                        .send()
3885                        .await?;
3886                    Ok(Operation::new(op))
3887                }
3888            };
3889
3890            let start = move || async {
3891                let op = self.send().await?;
3892                Ok(Operation::new(op))
3893            };
3894
3895            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3896        }
3897
3898        /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
3899        ///
3900        /// This is a **required** field for requests.
3901        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3902            self.0.request.name = v.into();
3903            self
3904        }
3905
3906        /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
3907        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3908            self.0.request.validate_only = v.into();
3909            self
3910        }
3911
3912        /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
3913        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
3914            self.0.request.etag = v.into();
3915            self
3916        }
3917    }
3918
3919    #[doc(hidden)]
3920    impl gax::options::internal::RequestBuilder for DeleteService {
3921        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3922            &mut self.0.options
3923        }
3924    }
3925
3926    /// The request builder for [Services::get_iam_policy][crate::client::Services::get_iam_policy] calls.
3927    ///
3928    /// # Example
3929    /// ```no_run
3930    /// # use google_cloud_run_v2::builder;
3931    /// use builder::services::GetIamPolicy;
3932    /// # tokio_test::block_on(async {
3933    ///
3934    /// let builder = prepare_request_builder();
3935    /// let response = builder.send().await?;
3936    /// # gax::Result::<()>::Ok(()) });
3937    ///
3938    /// fn prepare_request_builder() -> GetIamPolicy {
3939    ///   # panic!();
3940    ///   // ... details omitted ...
3941    /// }
3942    /// ```
3943    #[derive(Clone, Debug)]
3944    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
3945
3946    impl GetIamPolicy {
3947        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3948            Self(RequestBuilder::new(stub))
3949        }
3950
3951        /// Sets the full request, replacing any prior values.
3952        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
3953            self.0.request = v.into();
3954            self
3955        }
3956
3957        /// Sets all the options, replacing any prior values.
3958        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3959            self.0.options = v.into();
3960            self
3961        }
3962
3963        /// Sends the request.
3964        pub async fn send(self) -> Result<iam_v1::model::Policy> {
3965            (*self.0.stub)
3966                .get_iam_policy(self.0.request, self.0.options)
3967                .await
3968                .map(gax::response::Response::into_body)
3969        }
3970
3971        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
3972        ///
3973        /// This is a **required** field for requests.
3974        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3975            self.0.request.resource = v.into();
3976            self
3977        }
3978
3979        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
3980        pub fn set_options<T>(mut self, v: T) -> Self
3981        where
3982            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3983        {
3984            self.0.request.options = std::option::Option::Some(v.into());
3985            self
3986        }
3987
3988        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
3989        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
3990        where
3991            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
3992        {
3993            self.0.request.options = v.map(|x| x.into());
3994            self
3995        }
3996    }
3997
3998    #[doc(hidden)]
3999    impl gax::options::internal::RequestBuilder for GetIamPolicy {
4000        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4001            &mut self.0.options
4002        }
4003    }
4004
4005    /// The request builder for [Services::set_iam_policy][crate::client::Services::set_iam_policy] calls.
4006    ///
4007    /// # Example
4008    /// ```no_run
4009    /// # use google_cloud_run_v2::builder;
4010    /// use builder::services::SetIamPolicy;
4011    /// # tokio_test::block_on(async {
4012    ///
4013    /// let builder = prepare_request_builder();
4014    /// let response = builder.send().await?;
4015    /// # gax::Result::<()>::Ok(()) });
4016    ///
4017    /// fn prepare_request_builder() -> SetIamPolicy {
4018    ///   # panic!();
4019    ///   // ... details omitted ...
4020    /// }
4021    /// ```
4022    #[derive(Clone, Debug)]
4023    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
4024
4025    impl SetIamPolicy {
4026        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4027            Self(RequestBuilder::new(stub))
4028        }
4029
4030        /// Sets the full request, replacing any prior values.
4031        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
4032            self.0.request = v.into();
4033            self
4034        }
4035
4036        /// Sets all the options, replacing any prior values.
4037        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4038            self.0.options = v.into();
4039            self
4040        }
4041
4042        /// Sends the request.
4043        pub async fn send(self) -> Result<iam_v1::model::Policy> {
4044            (*self.0.stub)
4045                .set_iam_policy(self.0.request, self.0.options)
4046                .await
4047                .map(gax::response::Response::into_body)
4048        }
4049
4050        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
4051        ///
4052        /// This is a **required** field for requests.
4053        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4054            self.0.request.resource = v.into();
4055            self
4056        }
4057
4058        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
4059        ///
4060        /// This is a **required** field for requests.
4061        pub fn set_policy<T>(mut self, v: T) -> Self
4062        where
4063            T: std::convert::Into<iam_v1::model::Policy>,
4064        {
4065            self.0.request.policy = std::option::Option::Some(v.into());
4066            self
4067        }
4068
4069        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
4070        ///
4071        /// This is a **required** field for requests.
4072        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4073        where
4074            T: std::convert::Into<iam_v1::model::Policy>,
4075        {
4076            self.0.request.policy = v.map(|x| x.into());
4077            self
4078        }
4079
4080        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
4081        pub fn set_update_mask<T>(mut self, v: T) -> Self
4082        where
4083            T: std::convert::Into<wkt::FieldMask>,
4084        {
4085            self.0.request.update_mask = std::option::Option::Some(v.into());
4086            self
4087        }
4088
4089        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
4090        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4091        where
4092            T: std::convert::Into<wkt::FieldMask>,
4093        {
4094            self.0.request.update_mask = v.map(|x| x.into());
4095            self
4096        }
4097    }
4098
4099    #[doc(hidden)]
4100    impl gax::options::internal::RequestBuilder for SetIamPolicy {
4101        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4102            &mut self.0.options
4103        }
4104    }
4105
4106    /// The request builder for [Services::test_iam_permissions][crate::client::Services::test_iam_permissions] calls.
4107    ///
4108    /// # Example
4109    /// ```no_run
4110    /// # use google_cloud_run_v2::builder;
4111    /// use builder::services::TestIamPermissions;
4112    /// # tokio_test::block_on(async {
4113    ///
4114    /// let builder = prepare_request_builder();
4115    /// let response = builder.send().await?;
4116    /// # gax::Result::<()>::Ok(()) });
4117    ///
4118    /// fn prepare_request_builder() -> TestIamPermissions {
4119    ///   # panic!();
4120    ///   // ... details omitted ...
4121    /// }
4122    /// ```
4123    #[derive(Clone, Debug)]
4124    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
4125
4126    impl TestIamPermissions {
4127        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4128            Self(RequestBuilder::new(stub))
4129        }
4130
4131        /// Sets the full request, replacing any prior values.
4132        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
4133            mut self,
4134            v: V,
4135        ) -> Self {
4136            self.0.request = v.into();
4137            self
4138        }
4139
4140        /// Sets all the options, replacing any prior values.
4141        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4142            self.0.options = v.into();
4143            self
4144        }
4145
4146        /// Sends the request.
4147        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
4148            (*self.0.stub)
4149                .test_iam_permissions(self.0.request, self.0.options)
4150                .await
4151                .map(gax::response::Response::into_body)
4152        }
4153
4154        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
4155        ///
4156        /// This is a **required** field for requests.
4157        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4158            self.0.request.resource = v.into();
4159            self
4160        }
4161
4162        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
4163        ///
4164        /// This is a **required** field for requests.
4165        pub fn set_permissions<T, V>(mut self, v: T) -> Self
4166        where
4167            T: std::iter::IntoIterator<Item = V>,
4168            V: std::convert::Into<std::string::String>,
4169        {
4170            use std::iter::Iterator;
4171            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
4172            self
4173        }
4174    }
4175
4176    #[doc(hidden)]
4177    impl gax::options::internal::RequestBuilder for TestIamPermissions {
4178        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4179            &mut self.0.options
4180        }
4181    }
4182
4183    /// The request builder for [Services::list_operations][crate::client::Services::list_operations] calls.
4184    ///
4185    /// # Example
4186    /// ```no_run
4187    /// # use google_cloud_run_v2::builder;
4188    /// use builder::services::ListOperations;
4189    /// # tokio_test::block_on(async {
4190    /// use gax::paginator::ItemPaginator;
4191    ///
4192    /// let builder = prepare_request_builder();
4193    /// let mut items = builder.by_item();
4194    /// while let Some(result) = items.next().await {
4195    ///   let item = result?;
4196    /// }
4197    /// # gax::Result::<()>::Ok(()) });
4198    ///
4199    /// fn prepare_request_builder() -> ListOperations {
4200    ///   # panic!();
4201    ///   // ... details omitted ...
4202    /// }
4203    /// ```
4204    #[derive(Clone, Debug)]
4205    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4206
4207    impl ListOperations {
4208        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4209            Self(RequestBuilder::new(stub))
4210        }
4211
4212        /// Sets the full request, replacing any prior values.
4213        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4214            mut self,
4215            v: V,
4216        ) -> Self {
4217            self.0.request = v.into();
4218            self
4219        }
4220
4221        /// Sets all the options, replacing any prior values.
4222        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4223            self.0.options = v.into();
4224            self
4225        }
4226
4227        /// Sends the request.
4228        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4229            (*self.0.stub)
4230                .list_operations(self.0.request, self.0.options)
4231                .await
4232                .map(gax::response::Response::into_body)
4233        }
4234
4235        /// Streams each page in the collection.
4236        pub fn by_page(
4237            self,
4238        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4239        {
4240            use std::clone::Clone;
4241            let token = self.0.request.page_token.clone();
4242            let execute = move |token: String| {
4243                let mut builder = self.clone();
4244                builder.0.request = builder.0.request.set_page_token(token);
4245                builder.send()
4246            };
4247            gax::paginator::internal::new_paginator(token, execute)
4248        }
4249
4250        /// Streams each item in the collection.
4251        pub fn by_item(
4252            self,
4253        ) -> impl gax::paginator::ItemPaginator<
4254            longrunning::model::ListOperationsResponse,
4255            gax::error::Error,
4256        > {
4257            use gax::paginator::Paginator;
4258            self.by_page().items()
4259        }
4260
4261        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4262        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4263            self.0.request.name = v.into();
4264            self
4265        }
4266
4267        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4268        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4269            self.0.request.filter = v.into();
4270            self
4271        }
4272
4273        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4274        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4275            self.0.request.page_size = v.into();
4276            self
4277        }
4278
4279        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4280        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4281            self.0.request.page_token = v.into();
4282            self
4283        }
4284
4285        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
4286        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4287            self.0.request.return_partial_success = v.into();
4288            self
4289        }
4290    }
4291
4292    #[doc(hidden)]
4293    impl gax::options::internal::RequestBuilder for ListOperations {
4294        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4295            &mut self.0.options
4296        }
4297    }
4298
4299    /// The request builder for [Services::get_operation][crate::client::Services::get_operation] calls.
4300    ///
4301    /// # Example
4302    /// ```no_run
4303    /// # use google_cloud_run_v2::builder;
4304    /// use builder::services::GetOperation;
4305    /// # tokio_test::block_on(async {
4306    ///
4307    /// let builder = prepare_request_builder();
4308    /// let response = builder.send().await?;
4309    /// # gax::Result::<()>::Ok(()) });
4310    ///
4311    /// fn prepare_request_builder() -> GetOperation {
4312    ///   # panic!();
4313    ///   // ... details omitted ...
4314    /// }
4315    /// ```
4316    #[derive(Clone, Debug)]
4317    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4318
4319    impl GetOperation {
4320        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4321            Self(RequestBuilder::new(stub))
4322        }
4323
4324        /// Sets the full request, replacing any prior values.
4325        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4326            mut self,
4327            v: V,
4328        ) -> Self {
4329            self.0.request = v.into();
4330            self
4331        }
4332
4333        /// Sets all the options, replacing any prior values.
4334        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4335            self.0.options = v.into();
4336            self
4337        }
4338
4339        /// Sends the request.
4340        pub async fn send(self) -> Result<longrunning::model::Operation> {
4341            (*self.0.stub)
4342                .get_operation(self.0.request, self.0.options)
4343                .await
4344                .map(gax::response::Response::into_body)
4345        }
4346
4347        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4348        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4349            self.0.request.name = v.into();
4350            self
4351        }
4352    }
4353
4354    #[doc(hidden)]
4355    impl gax::options::internal::RequestBuilder for GetOperation {
4356        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4357            &mut self.0.options
4358        }
4359    }
4360
4361    /// The request builder for [Services::delete_operation][crate::client::Services::delete_operation] calls.
4362    ///
4363    /// # Example
4364    /// ```no_run
4365    /// # use google_cloud_run_v2::builder;
4366    /// use builder::services::DeleteOperation;
4367    /// # tokio_test::block_on(async {
4368    ///
4369    /// let builder = prepare_request_builder();
4370    /// let response = builder.send().await?;
4371    /// # gax::Result::<()>::Ok(()) });
4372    ///
4373    /// fn prepare_request_builder() -> DeleteOperation {
4374    ///   # panic!();
4375    ///   // ... details omitted ...
4376    /// }
4377    /// ```
4378    #[derive(Clone, Debug)]
4379    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
4380
4381    impl DeleteOperation {
4382        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4383            Self(RequestBuilder::new(stub))
4384        }
4385
4386        /// Sets the full request, replacing any prior values.
4387        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
4388            mut self,
4389            v: V,
4390        ) -> Self {
4391            self.0.request = v.into();
4392            self
4393        }
4394
4395        /// Sets all the options, replacing any prior values.
4396        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4397            self.0.options = v.into();
4398            self
4399        }
4400
4401        /// Sends the request.
4402        pub async fn send(self) -> Result<()> {
4403            (*self.0.stub)
4404                .delete_operation(self.0.request, self.0.options)
4405                .await
4406                .map(gax::response::Response::into_body)
4407        }
4408
4409        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
4410        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4411            self.0.request.name = v.into();
4412            self
4413        }
4414    }
4415
4416    #[doc(hidden)]
4417    impl gax::options::internal::RequestBuilder for DeleteOperation {
4418        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4419            &mut self.0.options
4420        }
4421    }
4422
4423    /// The request builder for [Services::wait_operation][crate::client::Services::wait_operation] calls.
4424    ///
4425    /// # Example
4426    /// ```no_run
4427    /// # use google_cloud_run_v2::builder;
4428    /// use builder::services::WaitOperation;
4429    /// # tokio_test::block_on(async {
4430    ///
4431    /// let builder = prepare_request_builder();
4432    /// let response = builder.send().await?;
4433    /// # gax::Result::<()>::Ok(()) });
4434    ///
4435    /// fn prepare_request_builder() -> WaitOperation {
4436    ///   # panic!();
4437    ///   // ... details omitted ...
4438    /// }
4439    /// ```
4440    #[derive(Clone, Debug)]
4441    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
4442
4443    impl WaitOperation {
4444        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Services>) -> Self {
4445            Self(RequestBuilder::new(stub))
4446        }
4447
4448        /// Sets the full request, replacing any prior values.
4449        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
4450            mut self,
4451            v: V,
4452        ) -> Self {
4453            self.0.request = v.into();
4454            self
4455        }
4456
4457        /// Sets all the options, replacing any prior values.
4458        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4459            self.0.options = v.into();
4460            self
4461        }
4462
4463        /// Sends the request.
4464        pub async fn send(self) -> Result<longrunning::model::Operation> {
4465            (*self.0.stub)
4466                .wait_operation(self.0.request, self.0.options)
4467                .await
4468                .map(gax::response::Response::into_body)
4469        }
4470
4471        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
4472        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4473            self.0.request.name = v.into();
4474            self
4475        }
4476
4477        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
4478        pub fn set_timeout<T>(mut self, v: T) -> Self
4479        where
4480            T: std::convert::Into<wkt::Duration>,
4481        {
4482            self.0.request.timeout = std::option::Option::Some(v.into());
4483            self
4484        }
4485
4486        /// Sets or clears the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
4487        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4488        where
4489            T: std::convert::Into<wkt::Duration>,
4490        {
4491            self.0.request.timeout = v.map(|x| x.into());
4492            self
4493        }
4494    }
4495
4496    #[doc(hidden)]
4497    impl gax::options::internal::RequestBuilder for WaitOperation {
4498        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4499            &mut self.0.options
4500        }
4501    }
4502}
4503
4504pub mod tasks {
4505    use crate::Result;
4506
4507    /// A builder for [Tasks][crate::client::Tasks].
4508    ///
4509    /// ```
4510    /// # tokio_test::block_on(async {
4511    /// # use google_cloud_run_v2::*;
4512    /// # use builder::tasks::ClientBuilder;
4513    /// # use client::Tasks;
4514    /// let builder : ClientBuilder = Tasks::builder();
4515    /// let client = builder
4516    ///     .with_endpoint("https://run.googleapis.com")
4517    ///     .build().await?;
4518    /// # gax::client_builder::Result::<()>::Ok(()) });
4519    /// ```
4520    pub type ClientBuilder =
4521        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4522
4523    pub(crate) mod client {
4524        use super::super::super::client::Tasks;
4525        pub struct Factory;
4526        impl gax::client_builder::internal::ClientFactory for Factory {
4527            type Client = Tasks;
4528            type Credentials = gaxi::options::Credentials;
4529            async fn build(
4530                self,
4531                config: gaxi::options::ClientConfig,
4532            ) -> gax::client_builder::Result<Self::Client> {
4533                Self::Client::new(config).await
4534            }
4535        }
4536    }
4537
4538    /// Common implementation for [crate::client::Tasks] request builders.
4539    #[derive(Clone, Debug)]
4540    pub(crate) struct RequestBuilder<R: std::default::Default> {
4541        stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>,
4542        request: R,
4543        options: gax::options::RequestOptions,
4544    }
4545
4546    impl<R> RequestBuilder<R>
4547    where
4548        R: std::default::Default,
4549    {
4550        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4551            Self {
4552                stub,
4553                request: R::default(),
4554                options: gax::options::RequestOptions::default(),
4555            }
4556        }
4557    }
4558
4559    /// The request builder for [Tasks::get_task][crate::client::Tasks::get_task] calls.
4560    ///
4561    /// # Example
4562    /// ```no_run
4563    /// # use google_cloud_run_v2::builder;
4564    /// use builder::tasks::GetTask;
4565    /// # tokio_test::block_on(async {
4566    ///
4567    /// let builder = prepare_request_builder();
4568    /// let response = builder.send().await?;
4569    /// # gax::Result::<()>::Ok(()) });
4570    ///
4571    /// fn prepare_request_builder() -> GetTask {
4572    ///   # panic!();
4573    ///   // ... details omitted ...
4574    /// }
4575    /// ```
4576    #[derive(Clone, Debug)]
4577    pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
4578
4579    impl GetTask {
4580        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4581            Self(RequestBuilder::new(stub))
4582        }
4583
4584        /// Sets the full request, replacing any prior values.
4585        pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
4586            self.0.request = v.into();
4587            self
4588        }
4589
4590        /// Sets all the options, replacing any prior values.
4591        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4592            self.0.options = v.into();
4593            self
4594        }
4595
4596        /// Sends the request.
4597        pub async fn send(self) -> Result<crate::model::Task> {
4598            (*self.0.stub)
4599                .get_task(self.0.request, self.0.options)
4600                .await
4601                .map(gax::response::Response::into_body)
4602        }
4603
4604        /// Sets the value of [name][crate::model::GetTaskRequest::name].
4605        ///
4606        /// This is a **required** field for requests.
4607        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4608            self.0.request.name = v.into();
4609            self
4610        }
4611    }
4612
4613    #[doc(hidden)]
4614    impl gax::options::internal::RequestBuilder for GetTask {
4615        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4616            &mut self.0.options
4617        }
4618    }
4619
4620    /// The request builder for [Tasks::list_tasks][crate::client::Tasks::list_tasks] calls.
4621    ///
4622    /// # Example
4623    /// ```no_run
4624    /// # use google_cloud_run_v2::builder;
4625    /// use builder::tasks::ListTasks;
4626    /// # tokio_test::block_on(async {
4627    /// use gax::paginator::ItemPaginator;
4628    ///
4629    /// let builder = prepare_request_builder();
4630    /// let mut items = builder.by_item();
4631    /// while let Some(result) = items.next().await {
4632    ///   let item = result?;
4633    /// }
4634    /// # gax::Result::<()>::Ok(()) });
4635    ///
4636    /// fn prepare_request_builder() -> ListTasks {
4637    ///   # panic!();
4638    ///   // ... details omitted ...
4639    /// }
4640    /// ```
4641    #[derive(Clone, Debug)]
4642    pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
4643
4644    impl ListTasks {
4645        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4646            Self(RequestBuilder::new(stub))
4647        }
4648
4649        /// Sets the full request, replacing any prior values.
4650        pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
4651            self.0.request = v.into();
4652            self
4653        }
4654
4655        /// Sets all the options, replacing any prior values.
4656        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4657            self.0.options = v.into();
4658            self
4659        }
4660
4661        /// Sends the request.
4662        pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
4663            (*self.0.stub)
4664                .list_tasks(self.0.request, self.0.options)
4665                .await
4666                .map(gax::response::Response::into_body)
4667        }
4668
4669        /// Streams each page in the collection.
4670        pub fn by_page(
4671            self,
4672        ) -> impl gax::paginator::Paginator<crate::model::ListTasksResponse, gax::error::Error>
4673        {
4674            use std::clone::Clone;
4675            let token = self.0.request.page_token.clone();
4676            let execute = move |token: String| {
4677                let mut builder = self.clone();
4678                builder.0.request = builder.0.request.set_page_token(token);
4679                builder.send()
4680            };
4681            gax::paginator::internal::new_paginator(token, execute)
4682        }
4683
4684        /// Streams each item in the collection.
4685        pub fn by_item(
4686            self,
4687        ) -> impl gax::paginator::ItemPaginator<crate::model::ListTasksResponse, gax::error::Error>
4688        {
4689            use gax::paginator::Paginator;
4690            self.by_page().items()
4691        }
4692
4693        /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
4694        ///
4695        /// This is a **required** field for requests.
4696        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4697            self.0.request.parent = v.into();
4698            self
4699        }
4700
4701        /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
4702        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4703            self.0.request.page_size = v.into();
4704            self
4705        }
4706
4707        /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
4708        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4709            self.0.request.page_token = v.into();
4710            self
4711        }
4712
4713        /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
4714        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
4715            self.0.request.show_deleted = v.into();
4716            self
4717        }
4718    }
4719
4720    #[doc(hidden)]
4721    impl gax::options::internal::RequestBuilder for ListTasks {
4722        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4723            &mut self.0.options
4724        }
4725    }
4726
4727    /// The request builder for [Tasks::list_operations][crate::client::Tasks::list_operations] calls.
4728    ///
4729    /// # Example
4730    /// ```no_run
4731    /// # use google_cloud_run_v2::builder;
4732    /// use builder::tasks::ListOperations;
4733    /// # tokio_test::block_on(async {
4734    /// use gax::paginator::ItemPaginator;
4735    ///
4736    /// let builder = prepare_request_builder();
4737    /// let mut items = builder.by_item();
4738    /// while let Some(result) = items.next().await {
4739    ///   let item = result?;
4740    /// }
4741    /// # gax::Result::<()>::Ok(()) });
4742    ///
4743    /// fn prepare_request_builder() -> ListOperations {
4744    ///   # panic!();
4745    ///   // ... details omitted ...
4746    /// }
4747    /// ```
4748    #[derive(Clone, Debug)]
4749    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4750
4751    impl ListOperations {
4752        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4753            Self(RequestBuilder::new(stub))
4754        }
4755
4756        /// Sets the full request, replacing any prior values.
4757        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4758            mut self,
4759            v: V,
4760        ) -> Self {
4761            self.0.request = v.into();
4762            self
4763        }
4764
4765        /// Sets all the options, replacing any prior values.
4766        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4767            self.0.options = v.into();
4768            self
4769        }
4770
4771        /// Sends the request.
4772        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4773            (*self.0.stub)
4774                .list_operations(self.0.request, self.0.options)
4775                .await
4776                .map(gax::response::Response::into_body)
4777        }
4778
4779        /// Streams each page in the collection.
4780        pub fn by_page(
4781            self,
4782        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4783        {
4784            use std::clone::Clone;
4785            let token = self.0.request.page_token.clone();
4786            let execute = move |token: String| {
4787                let mut builder = self.clone();
4788                builder.0.request = builder.0.request.set_page_token(token);
4789                builder.send()
4790            };
4791            gax::paginator::internal::new_paginator(token, execute)
4792        }
4793
4794        /// Streams each item in the collection.
4795        pub fn by_item(
4796            self,
4797        ) -> impl gax::paginator::ItemPaginator<
4798            longrunning::model::ListOperationsResponse,
4799            gax::error::Error,
4800        > {
4801            use gax::paginator::Paginator;
4802            self.by_page().items()
4803        }
4804
4805        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4806        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4807            self.0.request.name = v.into();
4808            self
4809        }
4810
4811        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4812        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4813            self.0.request.filter = v.into();
4814            self
4815        }
4816
4817        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4818        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4819            self.0.request.page_size = v.into();
4820            self
4821        }
4822
4823        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4824        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4825            self.0.request.page_token = v.into();
4826            self
4827        }
4828
4829        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
4830        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4831            self.0.request.return_partial_success = v.into();
4832            self
4833        }
4834    }
4835
4836    #[doc(hidden)]
4837    impl gax::options::internal::RequestBuilder for ListOperations {
4838        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4839            &mut self.0.options
4840        }
4841    }
4842
4843    /// The request builder for [Tasks::get_operation][crate::client::Tasks::get_operation] calls.
4844    ///
4845    /// # Example
4846    /// ```no_run
4847    /// # use google_cloud_run_v2::builder;
4848    /// use builder::tasks::GetOperation;
4849    /// # tokio_test::block_on(async {
4850    ///
4851    /// let builder = prepare_request_builder();
4852    /// let response = builder.send().await?;
4853    /// # gax::Result::<()>::Ok(()) });
4854    ///
4855    /// fn prepare_request_builder() -> GetOperation {
4856    ///   # panic!();
4857    ///   // ... details omitted ...
4858    /// }
4859    /// ```
4860    #[derive(Clone, Debug)]
4861    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4862
4863    impl GetOperation {
4864        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4865            Self(RequestBuilder::new(stub))
4866        }
4867
4868        /// Sets the full request, replacing any prior values.
4869        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4870            mut self,
4871            v: V,
4872        ) -> Self {
4873            self.0.request = v.into();
4874            self
4875        }
4876
4877        /// Sets all the options, replacing any prior values.
4878        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4879            self.0.options = v.into();
4880            self
4881        }
4882
4883        /// Sends the request.
4884        pub async fn send(self) -> Result<longrunning::model::Operation> {
4885            (*self.0.stub)
4886                .get_operation(self.0.request, self.0.options)
4887                .await
4888                .map(gax::response::Response::into_body)
4889        }
4890
4891        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4892        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4893            self.0.request.name = v.into();
4894            self
4895        }
4896    }
4897
4898    #[doc(hidden)]
4899    impl gax::options::internal::RequestBuilder for GetOperation {
4900        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4901            &mut self.0.options
4902        }
4903    }
4904
4905    /// The request builder for [Tasks::delete_operation][crate::client::Tasks::delete_operation] calls.
4906    ///
4907    /// # Example
4908    /// ```no_run
4909    /// # use google_cloud_run_v2::builder;
4910    /// use builder::tasks::DeleteOperation;
4911    /// # tokio_test::block_on(async {
4912    ///
4913    /// let builder = prepare_request_builder();
4914    /// let response = builder.send().await?;
4915    /// # gax::Result::<()>::Ok(()) });
4916    ///
4917    /// fn prepare_request_builder() -> DeleteOperation {
4918    ///   # panic!();
4919    ///   // ... details omitted ...
4920    /// }
4921    /// ```
4922    #[derive(Clone, Debug)]
4923    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
4924
4925    impl DeleteOperation {
4926        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4927            Self(RequestBuilder::new(stub))
4928        }
4929
4930        /// Sets the full request, replacing any prior values.
4931        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
4932            mut self,
4933            v: V,
4934        ) -> Self {
4935            self.0.request = v.into();
4936            self
4937        }
4938
4939        /// Sets all the options, replacing any prior values.
4940        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4941            self.0.options = v.into();
4942            self
4943        }
4944
4945        /// Sends the request.
4946        pub async fn send(self) -> Result<()> {
4947            (*self.0.stub)
4948                .delete_operation(self.0.request, self.0.options)
4949                .await
4950                .map(gax::response::Response::into_body)
4951        }
4952
4953        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
4954        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4955            self.0.request.name = v.into();
4956            self
4957        }
4958    }
4959
4960    #[doc(hidden)]
4961    impl gax::options::internal::RequestBuilder for DeleteOperation {
4962        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4963            &mut self.0.options
4964        }
4965    }
4966
4967    /// The request builder for [Tasks::wait_operation][crate::client::Tasks::wait_operation] calls.
4968    ///
4969    /// # Example
4970    /// ```no_run
4971    /// # use google_cloud_run_v2::builder;
4972    /// use builder::tasks::WaitOperation;
4973    /// # tokio_test::block_on(async {
4974    ///
4975    /// let builder = prepare_request_builder();
4976    /// let response = builder.send().await?;
4977    /// # gax::Result::<()>::Ok(()) });
4978    ///
4979    /// fn prepare_request_builder() -> WaitOperation {
4980    ///   # panic!();
4981    ///   // ... details omitted ...
4982    /// }
4983    /// ```
4984    #[derive(Clone, Debug)]
4985    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
4986
4987    impl WaitOperation {
4988        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
4989            Self(RequestBuilder::new(stub))
4990        }
4991
4992        /// Sets the full request, replacing any prior values.
4993        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
4994            mut self,
4995            v: V,
4996        ) -> Self {
4997            self.0.request = v.into();
4998            self
4999        }
5000
5001        /// Sets all the options, replacing any prior values.
5002        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5003            self.0.options = v.into();
5004            self
5005        }
5006
5007        /// Sends the request.
5008        pub async fn send(self) -> Result<longrunning::model::Operation> {
5009            (*self.0.stub)
5010                .wait_operation(self.0.request, self.0.options)
5011                .await
5012                .map(gax::response::Response::into_body)
5013        }
5014
5015        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
5016        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5017            self.0.request.name = v.into();
5018            self
5019        }
5020
5021        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
5022        pub fn set_timeout<T>(mut self, v: T) -> Self
5023        where
5024            T: std::convert::Into<wkt::Duration>,
5025        {
5026            self.0.request.timeout = std::option::Option::Some(v.into());
5027            self
5028        }
5029
5030        /// Sets or clears the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
5031        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
5032        where
5033            T: std::convert::Into<wkt::Duration>,
5034        {
5035            self.0.request.timeout = v.map(|x| x.into());
5036            self
5037        }
5038    }
5039
5040    #[doc(hidden)]
5041    impl gax::options::internal::RequestBuilder for WaitOperation {
5042        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5043            &mut self.0.options
5044        }
5045    }
5046}
5047
5048pub mod worker_pools {
5049    use crate::Result;
5050
5051    /// A builder for [WorkerPools][crate::client::WorkerPools].
5052    ///
5053    /// ```
5054    /// # tokio_test::block_on(async {
5055    /// # use google_cloud_run_v2::*;
5056    /// # use builder::worker_pools::ClientBuilder;
5057    /// # use client::WorkerPools;
5058    /// let builder : ClientBuilder = WorkerPools::builder();
5059    /// let client = builder
5060    ///     .with_endpoint("https://run.googleapis.com")
5061    ///     .build().await?;
5062    /// # gax::client_builder::Result::<()>::Ok(()) });
5063    /// ```
5064    pub type ClientBuilder =
5065        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5066
5067    pub(crate) mod client {
5068        use super::super::super::client::WorkerPools;
5069        pub struct Factory;
5070        impl gax::client_builder::internal::ClientFactory for Factory {
5071            type Client = WorkerPools;
5072            type Credentials = gaxi::options::Credentials;
5073            async fn build(
5074                self,
5075                config: gaxi::options::ClientConfig,
5076            ) -> gax::client_builder::Result<Self::Client> {
5077                Self::Client::new(config).await
5078            }
5079        }
5080    }
5081
5082    /// Common implementation for [crate::client::WorkerPools] request builders.
5083    #[derive(Clone, Debug)]
5084    pub(crate) struct RequestBuilder<R: std::default::Default> {
5085        stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5086        request: R,
5087        options: gax::options::RequestOptions,
5088    }
5089
5090    impl<R> RequestBuilder<R>
5091    where
5092        R: std::default::Default,
5093    {
5094        pub(crate) fn new(
5095            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5096        ) -> Self {
5097            Self {
5098                stub,
5099                request: R::default(),
5100                options: gax::options::RequestOptions::default(),
5101            }
5102        }
5103    }
5104
5105    /// The request builder for [WorkerPools::create_worker_pool][crate::client::WorkerPools::create_worker_pool] calls.
5106    ///
5107    /// # Example
5108    /// ```no_run
5109    /// # use google_cloud_run_v2::builder;
5110    /// use builder::worker_pools::CreateWorkerPool;
5111    /// # tokio_test::block_on(async {
5112    /// use lro::Poller;
5113    ///
5114    /// let builder = prepare_request_builder();
5115    /// let response = builder.poller().until_done().await?;
5116    /// # gax::Result::<()>::Ok(()) });
5117    ///
5118    /// fn prepare_request_builder() -> CreateWorkerPool {
5119    ///   # panic!();
5120    ///   // ... details omitted ...
5121    /// }
5122    /// ```
5123    #[derive(Clone, Debug)]
5124    pub struct CreateWorkerPool(RequestBuilder<crate::model::CreateWorkerPoolRequest>);
5125
5126    impl CreateWorkerPool {
5127        pub(crate) fn new(
5128            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5129        ) -> Self {
5130            Self(RequestBuilder::new(stub))
5131        }
5132
5133        /// Sets the full request, replacing any prior values.
5134        pub fn with_request<V: Into<crate::model::CreateWorkerPoolRequest>>(
5135            mut self,
5136            v: V,
5137        ) -> Self {
5138            self.0.request = v.into();
5139            self
5140        }
5141
5142        /// Sets all the options, replacing any prior values.
5143        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5144            self.0.options = v.into();
5145            self
5146        }
5147
5148        /// Sends the request.
5149        ///
5150        /// # Long running operations
5151        ///
5152        /// This starts, but does not poll, a longrunning operation. More information
5153        /// on [create_worker_pool][crate::client::WorkerPools::create_worker_pool].
5154        pub async fn send(self) -> Result<longrunning::model::Operation> {
5155            (*self.0.stub)
5156                .create_worker_pool(self.0.request, self.0.options)
5157                .await
5158                .map(gax::response::Response::into_body)
5159        }
5160
5161        /// Creates a [Poller][lro::Poller] to work with `create_worker_pool`.
5162        pub fn poller(
5163            self,
5164        ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
5165            type Operation =
5166                lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
5167            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5168            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5169
5170            let stub = self.0.stub.clone();
5171            let mut options = self.0.options.clone();
5172            options.set_retry_policy(gax::retry_policy::NeverRetry);
5173            let query = move |name| {
5174                let stub = stub.clone();
5175                let options = options.clone();
5176                async {
5177                    let op = GetOperation::new(stub)
5178                        .set_name(name)
5179                        .with_options(options)
5180                        .send()
5181                        .await?;
5182                    Ok(Operation::new(op))
5183                }
5184            };
5185
5186            let start = move || async {
5187                let op = self.send().await?;
5188                Ok(Operation::new(op))
5189            };
5190
5191            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5192        }
5193
5194        /// Sets the value of [parent][crate::model::CreateWorkerPoolRequest::parent].
5195        ///
5196        /// This is a **required** field for requests.
5197        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5198            self.0.request.parent = v.into();
5199            self
5200        }
5201
5202        /// Sets the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
5203        ///
5204        /// This is a **required** field for requests.
5205        pub fn set_worker_pool<T>(mut self, v: T) -> Self
5206        where
5207            T: std::convert::Into<crate::model::WorkerPool>,
5208        {
5209            self.0.request.worker_pool = std::option::Option::Some(v.into());
5210            self
5211        }
5212
5213        /// Sets or clears the value of [worker_pool][crate::model::CreateWorkerPoolRequest::worker_pool].
5214        ///
5215        /// This is a **required** field for requests.
5216        pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
5217        where
5218            T: std::convert::Into<crate::model::WorkerPool>,
5219        {
5220            self.0.request.worker_pool = v.map(|x| x.into());
5221            self
5222        }
5223
5224        /// Sets the value of [worker_pool_id][crate::model::CreateWorkerPoolRequest::worker_pool_id].
5225        ///
5226        /// This is a **required** field for requests.
5227        pub fn set_worker_pool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5228            self.0.request.worker_pool_id = v.into();
5229            self
5230        }
5231
5232        /// Sets the value of [validate_only][crate::model::CreateWorkerPoolRequest::validate_only].
5233        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5234            self.0.request.validate_only = v.into();
5235            self
5236        }
5237    }
5238
5239    #[doc(hidden)]
5240    impl gax::options::internal::RequestBuilder for CreateWorkerPool {
5241        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5242            &mut self.0.options
5243        }
5244    }
5245
5246    /// The request builder for [WorkerPools::get_worker_pool][crate::client::WorkerPools::get_worker_pool] calls.
5247    ///
5248    /// # Example
5249    /// ```no_run
5250    /// # use google_cloud_run_v2::builder;
5251    /// use builder::worker_pools::GetWorkerPool;
5252    /// # tokio_test::block_on(async {
5253    ///
5254    /// let builder = prepare_request_builder();
5255    /// let response = builder.send().await?;
5256    /// # gax::Result::<()>::Ok(()) });
5257    ///
5258    /// fn prepare_request_builder() -> GetWorkerPool {
5259    ///   # panic!();
5260    ///   // ... details omitted ...
5261    /// }
5262    /// ```
5263    #[derive(Clone, Debug)]
5264    pub struct GetWorkerPool(RequestBuilder<crate::model::GetWorkerPoolRequest>);
5265
5266    impl GetWorkerPool {
5267        pub(crate) fn new(
5268            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5269        ) -> Self {
5270            Self(RequestBuilder::new(stub))
5271        }
5272
5273        /// Sets the full request, replacing any prior values.
5274        pub fn with_request<V: Into<crate::model::GetWorkerPoolRequest>>(mut self, v: V) -> Self {
5275            self.0.request = v.into();
5276            self
5277        }
5278
5279        /// Sets all the options, replacing any prior values.
5280        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5281            self.0.options = v.into();
5282            self
5283        }
5284
5285        /// Sends the request.
5286        pub async fn send(self) -> Result<crate::model::WorkerPool> {
5287            (*self.0.stub)
5288                .get_worker_pool(self.0.request, self.0.options)
5289                .await
5290                .map(gax::response::Response::into_body)
5291        }
5292
5293        /// Sets the value of [name][crate::model::GetWorkerPoolRequest::name].
5294        ///
5295        /// This is a **required** field for requests.
5296        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5297            self.0.request.name = v.into();
5298            self
5299        }
5300    }
5301
5302    #[doc(hidden)]
5303    impl gax::options::internal::RequestBuilder for GetWorkerPool {
5304        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5305            &mut self.0.options
5306        }
5307    }
5308
5309    /// The request builder for [WorkerPools::list_worker_pools][crate::client::WorkerPools::list_worker_pools] calls.
5310    ///
5311    /// # Example
5312    /// ```no_run
5313    /// # use google_cloud_run_v2::builder;
5314    /// use builder::worker_pools::ListWorkerPools;
5315    /// # tokio_test::block_on(async {
5316    /// use gax::paginator::ItemPaginator;
5317    ///
5318    /// let builder = prepare_request_builder();
5319    /// let mut items = builder.by_item();
5320    /// while let Some(result) = items.next().await {
5321    ///   let item = result?;
5322    /// }
5323    /// # gax::Result::<()>::Ok(()) });
5324    ///
5325    /// fn prepare_request_builder() -> ListWorkerPools {
5326    ///   # panic!();
5327    ///   // ... details omitted ...
5328    /// }
5329    /// ```
5330    #[derive(Clone, Debug)]
5331    pub struct ListWorkerPools(RequestBuilder<crate::model::ListWorkerPoolsRequest>);
5332
5333    impl ListWorkerPools {
5334        pub(crate) fn new(
5335            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5336        ) -> Self {
5337            Self(RequestBuilder::new(stub))
5338        }
5339
5340        /// Sets the full request, replacing any prior values.
5341        pub fn with_request<V: Into<crate::model::ListWorkerPoolsRequest>>(mut self, v: V) -> Self {
5342            self.0.request = v.into();
5343            self
5344        }
5345
5346        /// Sets all the options, replacing any prior values.
5347        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5348            self.0.options = v.into();
5349            self
5350        }
5351
5352        /// Sends the request.
5353        pub async fn send(self) -> Result<crate::model::ListWorkerPoolsResponse> {
5354            (*self.0.stub)
5355                .list_worker_pools(self.0.request, self.0.options)
5356                .await
5357                .map(gax::response::Response::into_body)
5358        }
5359
5360        /// Streams each page in the collection.
5361        pub fn by_page(
5362            self,
5363        ) -> impl gax::paginator::Paginator<crate::model::ListWorkerPoolsResponse, gax::error::Error>
5364        {
5365            use std::clone::Clone;
5366            let token = self.0.request.page_token.clone();
5367            let execute = move |token: String| {
5368                let mut builder = self.clone();
5369                builder.0.request = builder.0.request.set_page_token(token);
5370                builder.send()
5371            };
5372            gax::paginator::internal::new_paginator(token, execute)
5373        }
5374
5375        /// Streams each item in the collection.
5376        pub fn by_item(
5377            self,
5378        ) -> impl gax::paginator::ItemPaginator<crate::model::ListWorkerPoolsResponse, gax::error::Error>
5379        {
5380            use gax::paginator::Paginator;
5381            self.by_page().items()
5382        }
5383
5384        /// Sets the value of [parent][crate::model::ListWorkerPoolsRequest::parent].
5385        ///
5386        /// This is a **required** field for requests.
5387        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5388            self.0.request.parent = v.into();
5389            self
5390        }
5391
5392        /// Sets the value of [page_size][crate::model::ListWorkerPoolsRequest::page_size].
5393        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5394            self.0.request.page_size = v.into();
5395            self
5396        }
5397
5398        /// Sets the value of [page_token][crate::model::ListWorkerPoolsRequest::page_token].
5399        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5400            self.0.request.page_token = v.into();
5401            self
5402        }
5403
5404        /// Sets the value of [show_deleted][crate::model::ListWorkerPoolsRequest::show_deleted].
5405        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
5406            self.0.request.show_deleted = v.into();
5407            self
5408        }
5409    }
5410
5411    #[doc(hidden)]
5412    impl gax::options::internal::RequestBuilder for ListWorkerPools {
5413        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5414            &mut self.0.options
5415        }
5416    }
5417
5418    /// The request builder for [WorkerPools::update_worker_pool][crate::client::WorkerPools::update_worker_pool] calls.
5419    ///
5420    /// # Example
5421    /// ```no_run
5422    /// # use google_cloud_run_v2::builder;
5423    /// use builder::worker_pools::UpdateWorkerPool;
5424    /// # tokio_test::block_on(async {
5425    /// use lro::Poller;
5426    ///
5427    /// let builder = prepare_request_builder();
5428    /// let response = builder.poller().until_done().await?;
5429    /// # gax::Result::<()>::Ok(()) });
5430    ///
5431    /// fn prepare_request_builder() -> UpdateWorkerPool {
5432    ///   # panic!();
5433    ///   // ... details omitted ...
5434    /// }
5435    /// ```
5436    #[derive(Clone, Debug)]
5437    pub struct UpdateWorkerPool(RequestBuilder<crate::model::UpdateWorkerPoolRequest>);
5438
5439    impl UpdateWorkerPool {
5440        pub(crate) fn new(
5441            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5442        ) -> Self {
5443            Self(RequestBuilder::new(stub))
5444        }
5445
5446        /// Sets the full request, replacing any prior values.
5447        pub fn with_request<V: Into<crate::model::UpdateWorkerPoolRequest>>(
5448            mut self,
5449            v: V,
5450        ) -> Self {
5451            self.0.request = v.into();
5452            self
5453        }
5454
5455        /// Sets all the options, replacing any prior values.
5456        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5457            self.0.options = v.into();
5458            self
5459        }
5460
5461        /// Sends the request.
5462        ///
5463        /// # Long running operations
5464        ///
5465        /// This starts, but does not poll, a longrunning operation. More information
5466        /// on [update_worker_pool][crate::client::WorkerPools::update_worker_pool].
5467        pub async fn send(self) -> Result<longrunning::model::Operation> {
5468            (*self.0.stub)
5469                .update_worker_pool(self.0.request, self.0.options)
5470                .await
5471                .map(gax::response::Response::into_body)
5472        }
5473
5474        /// Creates a [Poller][lro::Poller] to work with `update_worker_pool`.
5475        pub fn poller(
5476            self,
5477        ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
5478            type Operation =
5479                lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
5480            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5481            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5482
5483            let stub = self.0.stub.clone();
5484            let mut options = self.0.options.clone();
5485            options.set_retry_policy(gax::retry_policy::NeverRetry);
5486            let query = move |name| {
5487                let stub = stub.clone();
5488                let options = options.clone();
5489                async {
5490                    let op = GetOperation::new(stub)
5491                        .set_name(name)
5492                        .with_options(options)
5493                        .send()
5494                        .await?;
5495                    Ok(Operation::new(op))
5496                }
5497            };
5498
5499            let start = move || async {
5500                let op = self.send().await?;
5501                Ok(Operation::new(op))
5502            };
5503
5504            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5505        }
5506
5507        /// Sets the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
5508        pub fn set_update_mask<T>(mut self, v: T) -> Self
5509        where
5510            T: std::convert::Into<wkt::FieldMask>,
5511        {
5512            self.0.request.update_mask = std::option::Option::Some(v.into());
5513            self
5514        }
5515
5516        /// Sets or clears the value of [update_mask][crate::model::UpdateWorkerPoolRequest::update_mask].
5517        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5518        where
5519            T: std::convert::Into<wkt::FieldMask>,
5520        {
5521            self.0.request.update_mask = v.map(|x| x.into());
5522            self
5523        }
5524
5525        /// Sets the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
5526        ///
5527        /// This is a **required** field for requests.
5528        pub fn set_worker_pool<T>(mut self, v: T) -> Self
5529        where
5530            T: std::convert::Into<crate::model::WorkerPool>,
5531        {
5532            self.0.request.worker_pool = std::option::Option::Some(v.into());
5533            self
5534        }
5535
5536        /// Sets or clears the value of [worker_pool][crate::model::UpdateWorkerPoolRequest::worker_pool].
5537        ///
5538        /// This is a **required** field for requests.
5539        pub fn set_or_clear_worker_pool<T>(mut self, v: std::option::Option<T>) -> Self
5540        where
5541            T: std::convert::Into<crate::model::WorkerPool>,
5542        {
5543            self.0.request.worker_pool = v.map(|x| x.into());
5544            self
5545        }
5546
5547        /// Sets the value of [validate_only][crate::model::UpdateWorkerPoolRequest::validate_only].
5548        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5549            self.0.request.validate_only = v.into();
5550            self
5551        }
5552
5553        /// Sets the value of [allow_missing][crate::model::UpdateWorkerPoolRequest::allow_missing].
5554        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5555            self.0.request.allow_missing = v.into();
5556            self
5557        }
5558
5559        /// Sets the value of [force_new_revision][crate::model::UpdateWorkerPoolRequest::force_new_revision].
5560        pub fn set_force_new_revision<T: Into<bool>>(mut self, v: T) -> Self {
5561            self.0.request.force_new_revision = v.into();
5562            self
5563        }
5564    }
5565
5566    #[doc(hidden)]
5567    impl gax::options::internal::RequestBuilder for UpdateWorkerPool {
5568        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5569            &mut self.0.options
5570        }
5571    }
5572
5573    /// The request builder for [WorkerPools::delete_worker_pool][crate::client::WorkerPools::delete_worker_pool] calls.
5574    ///
5575    /// # Example
5576    /// ```no_run
5577    /// # use google_cloud_run_v2::builder;
5578    /// use builder::worker_pools::DeleteWorkerPool;
5579    /// # tokio_test::block_on(async {
5580    /// use lro::Poller;
5581    ///
5582    /// let builder = prepare_request_builder();
5583    /// let response = builder.poller().until_done().await?;
5584    /// # gax::Result::<()>::Ok(()) });
5585    ///
5586    /// fn prepare_request_builder() -> DeleteWorkerPool {
5587    ///   # panic!();
5588    ///   // ... details omitted ...
5589    /// }
5590    /// ```
5591    #[derive(Clone, Debug)]
5592    pub struct DeleteWorkerPool(RequestBuilder<crate::model::DeleteWorkerPoolRequest>);
5593
5594    impl DeleteWorkerPool {
5595        pub(crate) fn new(
5596            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5597        ) -> Self {
5598            Self(RequestBuilder::new(stub))
5599        }
5600
5601        /// Sets the full request, replacing any prior values.
5602        pub fn with_request<V: Into<crate::model::DeleteWorkerPoolRequest>>(
5603            mut self,
5604            v: V,
5605        ) -> Self {
5606            self.0.request = v.into();
5607            self
5608        }
5609
5610        /// Sets all the options, replacing any prior values.
5611        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5612            self.0.options = v.into();
5613            self
5614        }
5615
5616        /// Sends the request.
5617        ///
5618        /// # Long running operations
5619        ///
5620        /// This starts, but does not poll, a longrunning operation. More information
5621        /// on [delete_worker_pool][crate::client::WorkerPools::delete_worker_pool].
5622        pub async fn send(self) -> Result<longrunning::model::Operation> {
5623            (*self.0.stub)
5624                .delete_worker_pool(self.0.request, self.0.options)
5625                .await
5626                .map(gax::response::Response::into_body)
5627        }
5628
5629        /// Creates a [Poller][lro::Poller] to work with `delete_worker_pool`.
5630        pub fn poller(
5631            self,
5632        ) -> impl lro::Poller<crate::model::WorkerPool, crate::model::WorkerPool> {
5633            type Operation =
5634                lro::internal::Operation<crate::model::WorkerPool, crate::model::WorkerPool>;
5635            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5636            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5637
5638            let stub = self.0.stub.clone();
5639            let mut options = self.0.options.clone();
5640            options.set_retry_policy(gax::retry_policy::NeverRetry);
5641            let query = move |name| {
5642                let stub = stub.clone();
5643                let options = options.clone();
5644                async {
5645                    let op = GetOperation::new(stub)
5646                        .set_name(name)
5647                        .with_options(options)
5648                        .send()
5649                        .await?;
5650                    Ok(Operation::new(op))
5651                }
5652            };
5653
5654            let start = move || async {
5655                let op = self.send().await?;
5656                Ok(Operation::new(op))
5657            };
5658
5659            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5660        }
5661
5662        /// Sets the value of [name][crate::model::DeleteWorkerPoolRequest::name].
5663        ///
5664        /// This is a **required** field for requests.
5665        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5666            self.0.request.name = v.into();
5667            self
5668        }
5669
5670        /// Sets the value of [validate_only][crate::model::DeleteWorkerPoolRequest::validate_only].
5671        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5672            self.0.request.validate_only = v.into();
5673            self
5674        }
5675
5676        /// Sets the value of [etag][crate::model::DeleteWorkerPoolRequest::etag].
5677        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5678            self.0.request.etag = v.into();
5679            self
5680        }
5681    }
5682
5683    #[doc(hidden)]
5684    impl gax::options::internal::RequestBuilder for DeleteWorkerPool {
5685        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5686            &mut self.0.options
5687        }
5688    }
5689
5690    /// The request builder for [WorkerPools::get_iam_policy][crate::client::WorkerPools::get_iam_policy] calls.
5691    ///
5692    /// # Example
5693    /// ```no_run
5694    /// # use google_cloud_run_v2::builder;
5695    /// use builder::worker_pools::GetIamPolicy;
5696    /// # tokio_test::block_on(async {
5697    ///
5698    /// let builder = prepare_request_builder();
5699    /// let response = builder.send().await?;
5700    /// # gax::Result::<()>::Ok(()) });
5701    ///
5702    /// fn prepare_request_builder() -> GetIamPolicy {
5703    ///   # panic!();
5704    ///   // ... details omitted ...
5705    /// }
5706    /// ```
5707    #[derive(Clone, Debug)]
5708    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
5709
5710    impl GetIamPolicy {
5711        pub(crate) fn new(
5712            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5713        ) -> Self {
5714            Self(RequestBuilder::new(stub))
5715        }
5716
5717        /// Sets the full request, replacing any prior values.
5718        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
5719            self.0.request = v.into();
5720            self
5721        }
5722
5723        /// Sets all the options, replacing any prior values.
5724        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5725            self.0.options = v.into();
5726            self
5727        }
5728
5729        /// Sends the request.
5730        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5731            (*self.0.stub)
5732                .get_iam_policy(self.0.request, self.0.options)
5733                .await
5734                .map(gax::response::Response::into_body)
5735        }
5736
5737        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
5738        ///
5739        /// This is a **required** field for requests.
5740        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5741            self.0.request.resource = v.into();
5742            self
5743        }
5744
5745        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5746        pub fn set_options<T>(mut self, v: T) -> Self
5747        where
5748            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5749        {
5750            self.0.request.options = std::option::Option::Some(v.into());
5751            self
5752        }
5753
5754        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
5755        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5756        where
5757            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
5758        {
5759            self.0.request.options = v.map(|x| x.into());
5760            self
5761        }
5762    }
5763
5764    #[doc(hidden)]
5765    impl gax::options::internal::RequestBuilder for GetIamPolicy {
5766        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5767            &mut self.0.options
5768        }
5769    }
5770
5771    /// The request builder for [WorkerPools::set_iam_policy][crate::client::WorkerPools::set_iam_policy] calls.
5772    ///
5773    /// # Example
5774    /// ```no_run
5775    /// # use google_cloud_run_v2::builder;
5776    /// use builder::worker_pools::SetIamPolicy;
5777    /// # tokio_test::block_on(async {
5778    ///
5779    /// let builder = prepare_request_builder();
5780    /// let response = builder.send().await?;
5781    /// # gax::Result::<()>::Ok(()) });
5782    ///
5783    /// fn prepare_request_builder() -> SetIamPolicy {
5784    ///   # panic!();
5785    ///   // ... details omitted ...
5786    /// }
5787    /// ```
5788    #[derive(Clone, Debug)]
5789    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
5790
5791    impl SetIamPolicy {
5792        pub(crate) fn new(
5793            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5794        ) -> Self {
5795            Self(RequestBuilder::new(stub))
5796        }
5797
5798        /// Sets the full request, replacing any prior values.
5799        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
5800            self.0.request = v.into();
5801            self
5802        }
5803
5804        /// Sets all the options, replacing any prior values.
5805        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5806            self.0.options = v.into();
5807            self
5808        }
5809
5810        /// Sends the request.
5811        pub async fn send(self) -> Result<iam_v1::model::Policy> {
5812            (*self.0.stub)
5813                .set_iam_policy(self.0.request, self.0.options)
5814                .await
5815                .map(gax::response::Response::into_body)
5816        }
5817
5818        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
5819        ///
5820        /// This is a **required** field for requests.
5821        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5822            self.0.request.resource = v.into();
5823            self
5824        }
5825
5826        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5827        ///
5828        /// This is a **required** field for requests.
5829        pub fn set_policy<T>(mut self, v: T) -> Self
5830        where
5831            T: std::convert::Into<iam_v1::model::Policy>,
5832        {
5833            self.0.request.policy = std::option::Option::Some(v.into());
5834            self
5835        }
5836
5837        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
5838        ///
5839        /// This is a **required** field for requests.
5840        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5841        where
5842            T: std::convert::Into<iam_v1::model::Policy>,
5843        {
5844            self.0.request.policy = v.map(|x| x.into());
5845            self
5846        }
5847
5848        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5849        pub fn set_update_mask<T>(mut self, v: T) -> Self
5850        where
5851            T: std::convert::Into<wkt::FieldMask>,
5852        {
5853            self.0.request.update_mask = std::option::Option::Some(v.into());
5854            self
5855        }
5856
5857        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
5858        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5859        where
5860            T: std::convert::Into<wkt::FieldMask>,
5861        {
5862            self.0.request.update_mask = v.map(|x| x.into());
5863            self
5864        }
5865    }
5866
5867    #[doc(hidden)]
5868    impl gax::options::internal::RequestBuilder for SetIamPolicy {
5869        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5870            &mut self.0.options
5871        }
5872    }
5873
5874    /// The request builder for [WorkerPools::test_iam_permissions][crate::client::WorkerPools::test_iam_permissions] calls.
5875    ///
5876    /// # Example
5877    /// ```no_run
5878    /// # use google_cloud_run_v2::builder;
5879    /// use builder::worker_pools::TestIamPermissions;
5880    /// # tokio_test::block_on(async {
5881    ///
5882    /// let builder = prepare_request_builder();
5883    /// let response = builder.send().await?;
5884    /// # gax::Result::<()>::Ok(()) });
5885    ///
5886    /// fn prepare_request_builder() -> TestIamPermissions {
5887    ///   # panic!();
5888    ///   // ... details omitted ...
5889    /// }
5890    /// ```
5891    #[derive(Clone, Debug)]
5892    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
5893
5894    impl TestIamPermissions {
5895        pub(crate) fn new(
5896            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5897        ) -> Self {
5898            Self(RequestBuilder::new(stub))
5899        }
5900
5901        /// Sets the full request, replacing any prior values.
5902        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
5903            mut self,
5904            v: V,
5905        ) -> Self {
5906            self.0.request = v.into();
5907            self
5908        }
5909
5910        /// Sets all the options, replacing any prior values.
5911        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5912            self.0.options = v.into();
5913            self
5914        }
5915
5916        /// Sends the request.
5917        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
5918            (*self.0.stub)
5919                .test_iam_permissions(self.0.request, self.0.options)
5920                .await
5921                .map(gax::response::Response::into_body)
5922        }
5923
5924        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
5925        ///
5926        /// This is a **required** field for requests.
5927        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5928            self.0.request.resource = v.into();
5929            self
5930        }
5931
5932        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
5933        ///
5934        /// This is a **required** field for requests.
5935        pub fn set_permissions<T, V>(mut self, v: T) -> Self
5936        where
5937            T: std::iter::IntoIterator<Item = V>,
5938            V: std::convert::Into<std::string::String>,
5939        {
5940            use std::iter::Iterator;
5941            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5942            self
5943        }
5944    }
5945
5946    #[doc(hidden)]
5947    impl gax::options::internal::RequestBuilder for TestIamPermissions {
5948        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5949            &mut self.0.options
5950        }
5951    }
5952
5953    /// The request builder for [WorkerPools::list_operations][crate::client::WorkerPools::list_operations] calls.
5954    ///
5955    /// # Example
5956    /// ```no_run
5957    /// # use google_cloud_run_v2::builder;
5958    /// use builder::worker_pools::ListOperations;
5959    /// # tokio_test::block_on(async {
5960    /// use gax::paginator::ItemPaginator;
5961    ///
5962    /// let builder = prepare_request_builder();
5963    /// let mut items = builder.by_item();
5964    /// while let Some(result) = items.next().await {
5965    ///   let item = result?;
5966    /// }
5967    /// # gax::Result::<()>::Ok(()) });
5968    ///
5969    /// fn prepare_request_builder() -> ListOperations {
5970    ///   # panic!();
5971    ///   // ... details omitted ...
5972    /// }
5973    /// ```
5974    #[derive(Clone, Debug)]
5975    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5976
5977    impl ListOperations {
5978        pub(crate) fn new(
5979            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
5980        ) -> Self {
5981            Self(RequestBuilder::new(stub))
5982        }
5983
5984        /// Sets the full request, replacing any prior values.
5985        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5986            mut self,
5987            v: V,
5988        ) -> Self {
5989            self.0.request = v.into();
5990            self
5991        }
5992
5993        /// Sets all the options, replacing any prior values.
5994        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5995            self.0.options = v.into();
5996            self
5997        }
5998
5999        /// Sends the request.
6000        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6001            (*self.0.stub)
6002                .list_operations(self.0.request, self.0.options)
6003                .await
6004                .map(gax::response::Response::into_body)
6005        }
6006
6007        /// Streams each page in the collection.
6008        pub fn by_page(
6009            self,
6010        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6011        {
6012            use std::clone::Clone;
6013            let token = self.0.request.page_token.clone();
6014            let execute = move |token: String| {
6015                let mut builder = self.clone();
6016                builder.0.request = builder.0.request.set_page_token(token);
6017                builder.send()
6018            };
6019            gax::paginator::internal::new_paginator(token, execute)
6020        }
6021
6022        /// Streams each item in the collection.
6023        pub fn by_item(
6024            self,
6025        ) -> impl gax::paginator::ItemPaginator<
6026            longrunning::model::ListOperationsResponse,
6027            gax::error::Error,
6028        > {
6029            use gax::paginator::Paginator;
6030            self.by_page().items()
6031        }
6032
6033        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
6034        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6035            self.0.request.name = v.into();
6036            self
6037        }
6038
6039        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
6040        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6041            self.0.request.filter = v.into();
6042            self
6043        }
6044
6045        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
6046        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6047            self.0.request.page_size = v.into();
6048            self
6049        }
6050
6051        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
6052        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6053            self.0.request.page_token = v.into();
6054            self
6055        }
6056
6057        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
6058        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6059            self.0.request.return_partial_success = v.into();
6060            self
6061        }
6062    }
6063
6064    #[doc(hidden)]
6065    impl gax::options::internal::RequestBuilder for ListOperations {
6066        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6067            &mut self.0.options
6068        }
6069    }
6070
6071    /// The request builder for [WorkerPools::get_operation][crate::client::WorkerPools::get_operation] calls.
6072    ///
6073    /// # Example
6074    /// ```no_run
6075    /// # use google_cloud_run_v2::builder;
6076    /// use builder::worker_pools::GetOperation;
6077    /// # tokio_test::block_on(async {
6078    ///
6079    /// let builder = prepare_request_builder();
6080    /// let response = builder.send().await?;
6081    /// # gax::Result::<()>::Ok(()) });
6082    ///
6083    /// fn prepare_request_builder() -> GetOperation {
6084    ///   # panic!();
6085    ///   // ... details omitted ...
6086    /// }
6087    /// ```
6088    #[derive(Clone, Debug)]
6089    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6090
6091    impl GetOperation {
6092        pub(crate) fn new(
6093            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6094        ) -> Self {
6095            Self(RequestBuilder::new(stub))
6096        }
6097
6098        /// Sets the full request, replacing any prior values.
6099        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6100            mut self,
6101            v: V,
6102        ) -> Self {
6103            self.0.request = v.into();
6104            self
6105        }
6106
6107        /// Sets all the options, replacing any prior values.
6108        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6109            self.0.options = v.into();
6110            self
6111        }
6112
6113        /// Sends the request.
6114        pub async fn send(self) -> Result<longrunning::model::Operation> {
6115            (*self.0.stub)
6116                .get_operation(self.0.request, self.0.options)
6117                .await
6118                .map(gax::response::Response::into_body)
6119        }
6120
6121        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
6122        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6123            self.0.request.name = v.into();
6124            self
6125        }
6126    }
6127
6128    #[doc(hidden)]
6129    impl gax::options::internal::RequestBuilder for GetOperation {
6130        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6131            &mut self.0.options
6132        }
6133    }
6134
6135    /// The request builder for [WorkerPools::delete_operation][crate::client::WorkerPools::delete_operation] calls.
6136    ///
6137    /// # Example
6138    /// ```no_run
6139    /// # use google_cloud_run_v2::builder;
6140    /// use builder::worker_pools::DeleteOperation;
6141    /// # tokio_test::block_on(async {
6142    ///
6143    /// let builder = prepare_request_builder();
6144    /// let response = builder.send().await?;
6145    /// # gax::Result::<()>::Ok(()) });
6146    ///
6147    /// fn prepare_request_builder() -> DeleteOperation {
6148    ///   # panic!();
6149    ///   // ... details omitted ...
6150    /// }
6151    /// ```
6152    #[derive(Clone, Debug)]
6153    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
6154
6155    impl DeleteOperation {
6156        pub(crate) fn new(
6157            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6158        ) -> Self {
6159            Self(RequestBuilder::new(stub))
6160        }
6161
6162        /// Sets the full request, replacing any prior values.
6163        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
6164            mut self,
6165            v: V,
6166        ) -> Self {
6167            self.0.request = v.into();
6168            self
6169        }
6170
6171        /// Sets all the options, replacing any prior values.
6172        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6173            self.0.options = v.into();
6174            self
6175        }
6176
6177        /// Sends the request.
6178        pub async fn send(self) -> Result<()> {
6179            (*self.0.stub)
6180                .delete_operation(self.0.request, self.0.options)
6181                .await
6182                .map(gax::response::Response::into_body)
6183        }
6184
6185        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
6186        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6187            self.0.request.name = v.into();
6188            self
6189        }
6190    }
6191
6192    #[doc(hidden)]
6193    impl gax::options::internal::RequestBuilder for DeleteOperation {
6194        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6195            &mut self.0.options
6196        }
6197    }
6198
6199    /// The request builder for [WorkerPools::wait_operation][crate::client::WorkerPools::wait_operation] calls.
6200    ///
6201    /// # Example
6202    /// ```no_run
6203    /// # use google_cloud_run_v2::builder;
6204    /// use builder::worker_pools::WaitOperation;
6205    /// # tokio_test::block_on(async {
6206    ///
6207    /// let builder = prepare_request_builder();
6208    /// let response = builder.send().await?;
6209    /// # gax::Result::<()>::Ok(()) });
6210    ///
6211    /// fn prepare_request_builder() -> WaitOperation {
6212    ///   # panic!();
6213    ///   // ... details omitted ...
6214    /// }
6215    /// ```
6216    #[derive(Clone, Debug)]
6217    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
6218
6219    impl WaitOperation {
6220        pub(crate) fn new(
6221            stub: std::sync::Arc<dyn super::super::stub::dynamic::WorkerPools>,
6222        ) -> Self {
6223            Self(RequestBuilder::new(stub))
6224        }
6225
6226        /// Sets the full request, replacing any prior values.
6227        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
6228            mut self,
6229            v: V,
6230        ) -> Self {
6231            self.0.request = v.into();
6232            self
6233        }
6234
6235        /// Sets all the options, replacing any prior values.
6236        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6237            self.0.options = v.into();
6238            self
6239        }
6240
6241        /// Sends the request.
6242        pub async fn send(self) -> Result<longrunning::model::Operation> {
6243            (*self.0.stub)
6244                .wait_operation(self.0.request, self.0.options)
6245                .await
6246                .map(gax::response::Response::into_body)
6247        }
6248
6249        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
6250        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6251            self.0.request.name = v.into();
6252            self
6253        }
6254
6255        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
6256        pub fn set_timeout<T>(mut self, v: T) -> Self
6257        where
6258            T: std::convert::Into<wkt::Duration>,
6259        {
6260            self.0.request.timeout = std::option::Option::Some(v.into());
6261            self
6262        }
6263
6264        /// Sets or clears the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
6265        pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
6266        where
6267            T: std::convert::Into<wkt::Duration>,
6268        {
6269            self.0.request.timeout = v.map(|x| x.into());
6270            self
6271        }
6272    }
6273
6274    #[doc(hidden)]
6275    impl gax::options::internal::RequestBuilder for WaitOperation {
6276        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6277            &mut self.0.options
6278        }
6279    }
6280}