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