Skip to main content

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