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    use std::sync::Arc;
20
21    /// A builder for [Builds][super::super::client::Builds].
22    ///
23    /// ```
24    /// # tokio_test::block_on(async {
25    /// # use google_cloud_run_v2::*;
26    /// # use builder::builds::ClientBuilder;
27    /// # use client::Builds;
28    /// let builder : ClientBuilder = Builds::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://run.googleapis.com")
31    ///     .build().await?;
32    /// # gax::Result::<()>::Ok(()) });
33    /// ```
34    pub type ClientBuilder =
35        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37    pub(crate) mod client {
38        use super::super::super::client::Builds;
39        pub struct Factory;
40        impl gax::client_builder::internal::ClientFactory for Factory {
41            type Client = Builds;
42            type Credentials = gaxi::options::Credentials;
43            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
44                Self::Client::new(config).await
45            }
46        }
47    }
48
49    /// Common implementation for [super::super::client::Builds] request builders.
50    #[derive(Clone, Debug)]
51    pub(crate) struct RequestBuilder<R: std::default::Default> {
52        stub: Arc<dyn super::super::stub::dynamic::Builds>,
53        request: R,
54        options: gax::options::RequestOptions,
55    }
56
57    impl<R> RequestBuilder<R>
58    where
59        R: std::default::Default,
60    {
61        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
62            Self {
63                stub,
64                request: R::default(),
65                options: gax::options::RequestOptions::default(),
66            }
67        }
68    }
69
70    /// The request builder for [Builds::submit_build][super::super::client::Builds::submit_build] calls.
71    #[derive(Clone, Debug)]
72    pub struct SubmitBuild(RequestBuilder<crate::model::SubmitBuildRequest>);
73
74    impl SubmitBuild {
75        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
76            Self(RequestBuilder::new(stub))
77        }
78
79        /// Sets the full request, replacing any prior values.
80        pub fn with_request<V: Into<crate::model::SubmitBuildRequest>>(mut self, v: V) -> Self {
81            self.0.request = v.into();
82            self
83        }
84
85        /// Sets all the options, replacing any prior values.
86        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
87            self.0.options = v.into();
88            self
89        }
90
91        /// Sends the request.
92        pub async fn send(self) -> Result<crate::model::SubmitBuildResponse> {
93            (*self.0.stub)
94                .submit_build(self.0.request, self.0.options)
95                .await
96                .map(gax::response::Response::into_body)
97        }
98
99        /// Sets the value of [parent][crate::model::SubmitBuildRequest::parent].
100        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
101            self.0.request.parent = v.into();
102            self
103        }
104
105        /// Sets the value of [image_uri][crate::model::SubmitBuildRequest::image_uri].
106        pub fn set_image_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
107            self.0.request.image_uri = v.into();
108            self
109        }
110
111        /// Sets the value of [service_account][crate::model::SubmitBuildRequest::service_account].
112        pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
113            self.0.request.service_account = v.into();
114            self
115        }
116
117        /// Sets the value of [worker_pool][crate::model::SubmitBuildRequest::worker_pool].
118        pub fn set_worker_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
119            self.0.request.worker_pool = v.into();
120            self
121        }
122
123        /// Sets the value of [tags][crate::model::SubmitBuildRequest::tags].
124        pub fn set_tags<T, V>(mut self, v: T) -> Self
125        where
126            T: std::iter::IntoIterator<Item = V>,
127            V: std::convert::Into<std::string::String>,
128        {
129            use std::iter::Iterator;
130            self.0.request.tags = v.into_iter().map(|i| i.into()).collect();
131            self
132        }
133
134        /// Sets the value of [source][crate::model::SubmitBuildRequest::source].
135        ///
136        /// Note that all the setters affecting `source` are
137        /// mutually exclusive.
138        pub fn set_source<T: Into<Option<crate::model::submit_build_request::Source>>>(
139            mut self,
140            v: T,
141        ) -> Self {
142            self.0.request.source = v.into();
143            self
144        }
145
146        /// Sets the value of [source][crate::model::SubmitBuildRequest::source]
147        /// to hold a `StorageSource`.
148        ///
149        /// Note that all the setters affecting `source` are
150        /// mutually exclusive.
151        pub fn set_storage_source<
152            T: std::convert::Into<std::boxed::Box<crate::model::StorageSource>>,
153        >(
154            mut self,
155            v: T,
156        ) -> Self {
157            self.0.request = self.0.request.set_storage_source(v);
158            self
159        }
160
161        /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type].
162        ///
163        /// Note that all the setters affecting `build_type` are
164        /// mutually exclusive.
165        pub fn set_build_type<T: Into<Option<crate::model::submit_build_request::BuildType>>>(
166            mut self,
167            v: T,
168        ) -> Self {
169            self.0.request.build_type = v.into();
170            self
171        }
172
173        /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
174        /// to hold a `BuildpackBuild`.
175        ///
176        /// Note that all the setters affecting `build_type` are
177        /// mutually exclusive.
178        pub fn set_buildpack_build<
179            T: std::convert::Into<
180                    std::boxed::Box<crate::model::submit_build_request::BuildpacksBuild>,
181                >,
182        >(
183            mut self,
184            v: T,
185        ) -> Self {
186            self.0.request = self.0.request.set_buildpack_build(v);
187            self
188        }
189
190        /// Sets the value of [build_type][crate::model::SubmitBuildRequest::build_type]
191        /// to hold a `DockerBuild`.
192        ///
193        /// Note that all the setters affecting `build_type` are
194        /// mutually exclusive.
195        pub fn set_docker_build<
196            T: std::convert::Into<std::boxed::Box<crate::model::submit_build_request::DockerBuild>>,
197        >(
198            mut self,
199            v: T,
200        ) -> Self {
201            self.0.request = self.0.request.set_docker_build(v);
202            self
203        }
204    }
205
206    #[doc(hidden)]
207    impl gax::options::internal::RequestBuilder for SubmitBuild {
208        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
209            &mut self.0.options
210        }
211    }
212
213    /// The request builder for [Builds::list_operations][super::super::client::Builds::list_operations] calls.
214    #[derive(Clone, Debug)]
215    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
216
217    impl ListOperations {
218        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
219            Self(RequestBuilder::new(stub))
220        }
221
222        /// Sets the full request, replacing any prior values.
223        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
224            mut self,
225            v: V,
226        ) -> Self {
227            self.0.request = v.into();
228            self
229        }
230
231        /// Sets all the options, replacing any prior values.
232        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
233            self.0.options = v.into();
234            self
235        }
236
237        /// Sends the request.
238        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
239            (*self.0.stub)
240                .list_operations(self.0.request, self.0.options)
241                .await
242                .map(gax::response::Response::into_body)
243        }
244
245        /// Streams the responses back.
246        pub async fn paginator(
247            self,
248        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
249        {
250            use std::clone::Clone;
251            let token = self.0.request.page_token.clone();
252            let execute = move |token: String| {
253                let mut builder = self.clone();
254                builder.0.request = builder.0.request.set_page_token(token);
255                builder.send()
256            };
257            gax::paginator::internal::new_paginator(token, execute)
258        }
259
260        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
261        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
262            self.0.request.name = v.into();
263            self
264        }
265
266        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
267        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
268            self.0.request.filter = v.into();
269            self
270        }
271
272        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
273        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
274            self.0.request.page_size = v.into();
275            self
276        }
277
278        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
279        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
280            self.0.request.page_token = v.into();
281            self
282        }
283    }
284
285    #[doc(hidden)]
286    impl gax::options::internal::RequestBuilder for ListOperations {
287        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
288            &mut self.0.options
289        }
290    }
291
292    /// The request builder for [Builds::get_operation][super::super::client::Builds::get_operation] calls.
293    #[derive(Clone, Debug)]
294    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
295
296    impl GetOperation {
297        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
298            Self(RequestBuilder::new(stub))
299        }
300
301        /// Sets the full request, replacing any prior values.
302        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
303            mut self,
304            v: V,
305        ) -> Self {
306            self.0.request = v.into();
307            self
308        }
309
310        /// Sets all the options, replacing any prior values.
311        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
312            self.0.options = v.into();
313            self
314        }
315
316        /// Sends the request.
317        pub async fn send(self) -> Result<longrunning::model::Operation> {
318            (*self.0.stub)
319                .get_operation(self.0.request, self.0.options)
320                .await
321                .map(gax::response::Response::into_body)
322        }
323
324        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
325        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
326            self.0.request.name = v.into();
327            self
328        }
329    }
330
331    #[doc(hidden)]
332    impl gax::options::internal::RequestBuilder for GetOperation {
333        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
334            &mut self.0.options
335        }
336    }
337
338    /// The request builder for [Builds::delete_operation][super::super::client::Builds::delete_operation] calls.
339    #[derive(Clone, Debug)]
340    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
341
342    impl DeleteOperation {
343        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
344            Self(RequestBuilder::new(stub))
345        }
346
347        /// Sets the full request, replacing any prior values.
348        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
349            mut self,
350            v: V,
351        ) -> Self {
352            self.0.request = v.into();
353            self
354        }
355
356        /// Sets all the options, replacing any prior values.
357        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
358            self.0.options = v.into();
359            self
360        }
361
362        /// Sends the request.
363        pub async fn send(self) -> Result<()> {
364            (*self.0.stub)
365                .delete_operation(self.0.request, self.0.options)
366                .await
367                .map(gax::response::Response::into_body)
368        }
369
370        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
371        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
372            self.0.request.name = v.into();
373            self
374        }
375    }
376
377    #[doc(hidden)]
378    impl gax::options::internal::RequestBuilder for DeleteOperation {
379        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
380            &mut self.0.options
381        }
382    }
383
384    /// The request builder for [Builds::wait_operation][super::super::client::Builds::wait_operation] calls.
385    #[derive(Clone, Debug)]
386    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
387
388    impl WaitOperation {
389        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Builds>) -> Self {
390            Self(RequestBuilder::new(stub))
391        }
392
393        /// Sets the full request, replacing any prior values.
394        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
395            mut self,
396            v: V,
397        ) -> Self {
398            self.0.request = v.into();
399            self
400        }
401
402        /// Sets all the options, replacing any prior values.
403        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
404            self.0.options = v.into();
405            self
406        }
407
408        /// Sends the request.
409        pub async fn send(self) -> Result<longrunning::model::Operation> {
410            (*self.0.stub)
411                .wait_operation(self.0.request, self.0.options)
412                .await
413                .map(gax::response::Response::into_body)
414        }
415
416        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
417        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
418            self.0.request.name = v.into();
419            self
420        }
421
422        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
423        pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
424            self.0.request.timeout = v.into();
425            self
426        }
427    }
428
429    #[doc(hidden)]
430    impl gax::options::internal::RequestBuilder for WaitOperation {
431        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
432            &mut self.0.options
433        }
434    }
435}
436
437pub mod executions {
438    use crate::Result;
439    use std::sync::Arc;
440
441    /// A builder for [Executions][super::super::client::Executions].
442    ///
443    /// ```
444    /// # tokio_test::block_on(async {
445    /// # use google_cloud_run_v2::*;
446    /// # use builder::executions::ClientBuilder;
447    /// # use client::Executions;
448    /// let builder : ClientBuilder = Executions::builder();
449    /// let client = builder
450    ///     .with_endpoint("https://run.googleapis.com")
451    ///     .build().await?;
452    /// # gax::Result::<()>::Ok(()) });
453    /// ```
454    pub type ClientBuilder =
455        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
456
457    pub(crate) mod client {
458        use super::super::super::client::Executions;
459        pub struct Factory;
460        impl gax::client_builder::internal::ClientFactory for Factory {
461            type Client = Executions;
462            type Credentials = gaxi::options::Credentials;
463            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
464                Self::Client::new(config).await
465            }
466        }
467    }
468
469    /// Common implementation for [super::super::client::Executions] request builders.
470    #[derive(Clone, Debug)]
471    pub(crate) struct RequestBuilder<R: std::default::Default> {
472        stub: Arc<dyn super::super::stub::dynamic::Executions>,
473        request: R,
474        options: gax::options::RequestOptions,
475    }
476
477    impl<R> RequestBuilder<R>
478    where
479        R: std::default::Default,
480    {
481        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
482            Self {
483                stub,
484                request: R::default(),
485                options: gax::options::RequestOptions::default(),
486            }
487        }
488    }
489
490    /// The request builder for [Executions::get_execution][super::super::client::Executions::get_execution] calls.
491    #[derive(Clone, Debug)]
492    pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
493
494    impl GetExecution {
495        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
496            Self(RequestBuilder::new(stub))
497        }
498
499        /// Sets the full request, replacing any prior values.
500        pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(mut self, v: V) -> Self {
501            self.0.request = v.into();
502            self
503        }
504
505        /// Sets all the options, replacing any prior values.
506        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
507            self.0.options = v.into();
508            self
509        }
510
511        /// Sends the request.
512        pub async fn send(self) -> Result<crate::model::Execution> {
513            (*self.0.stub)
514                .get_execution(self.0.request, self.0.options)
515                .await
516                .map(gax::response::Response::into_body)
517        }
518
519        /// Sets the value of [name][crate::model::GetExecutionRequest::name].
520        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
521            self.0.request.name = v.into();
522            self
523        }
524    }
525
526    #[doc(hidden)]
527    impl gax::options::internal::RequestBuilder for GetExecution {
528        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
529            &mut self.0.options
530        }
531    }
532
533    /// The request builder for [Executions::list_executions][super::super::client::Executions::list_executions] calls.
534    #[derive(Clone, Debug)]
535    pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
536
537    impl ListExecutions {
538        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
539            Self(RequestBuilder::new(stub))
540        }
541
542        /// Sets the full request, replacing any prior values.
543        pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> Self {
544            self.0.request = v.into();
545            self
546        }
547
548        /// Sets all the options, replacing any prior values.
549        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
550            self.0.options = v.into();
551            self
552        }
553
554        /// Sends the request.
555        pub async fn send(self) -> Result<crate::model::ListExecutionsResponse> {
556            (*self.0.stub)
557                .list_executions(self.0.request, self.0.options)
558                .await
559                .map(gax::response::Response::into_body)
560        }
561
562        /// Streams the responses back.
563        pub async fn paginator(
564            self,
565        ) -> impl gax::paginator::Paginator<crate::model::ListExecutionsResponse, gax::error::Error>
566        {
567            use std::clone::Clone;
568            let token = self.0.request.page_token.clone();
569            let execute = move |token: String| {
570                let mut builder = self.clone();
571                builder.0.request = builder.0.request.set_page_token(token);
572                builder.send()
573            };
574            gax::paginator::internal::new_paginator(token, execute)
575        }
576
577        /// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
578        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
579            self.0.request.parent = v.into();
580            self
581        }
582
583        /// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
584        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
585            self.0.request.page_size = v.into();
586            self
587        }
588
589        /// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
590        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
591            self.0.request.page_token = v.into();
592            self
593        }
594
595        /// Sets the value of [show_deleted][crate::model::ListExecutionsRequest::show_deleted].
596        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
597            self.0.request.show_deleted = v.into();
598            self
599        }
600    }
601
602    #[doc(hidden)]
603    impl gax::options::internal::RequestBuilder for ListExecutions {
604        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
605            &mut self.0.options
606        }
607    }
608
609    /// The request builder for [Executions::delete_execution][super::super::client::Executions::delete_execution] calls.
610    #[derive(Clone, Debug)]
611    pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
612
613    impl DeleteExecution {
614        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
615            Self(RequestBuilder::new(stub))
616        }
617
618        /// Sets the full request, replacing any prior values.
619        pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
620            self.0.request = v.into();
621            self
622        }
623
624        /// Sets all the options, replacing any prior values.
625        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
626            self.0.options = v.into();
627            self
628        }
629
630        /// Sends the request.
631        ///
632        /// # Long running operations
633        ///
634        /// This starts, but does not poll, a longrunning operation. More information
635        /// on [delete_execution][super::super::client::Executions::delete_execution].
636        pub async fn send(self) -> Result<longrunning::model::Operation> {
637            (*self.0.stub)
638                .delete_execution(self.0.request, self.0.options)
639                .await
640                .map(gax::response::Response::into_body)
641        }
642
643        /// Creates a [Poller][lro::Poller] to work with `delete_execution`.
644        pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
645            type Operation = lro::Operation<crate::model::Execution, crate::model::Execution>;
646            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
647            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
648
649            let stub = self.0.stub.clone();
650            let mut options = self.0.options.clone();
651            options.set_retry_policy(gax::retry_policy::NeverRetry);
652            let query = move |name| {
653                let stub = stub.clone();
654                let options = options.clone();
655                async {
656                    let op = GetOperation::new(stub)
657                        .set_name(name)
658                        .with_options(options)
659                        .send()
660                        .await?;
661                    Ok(Operation::new(op))
662                }
663            };
664
665            let start = move || async {
666                let op = self.send().await?;
667                Ok(Operation::new(op))
668            };
669
670            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
671        }
672
673        /// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
674        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
675            self.0.request.name = v.into();
676            self
677        }
678
679        /// Sets the value of [validate_only][crate::model::DeleteExecutionRequest::validate_only].
680        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
681            self.0.request.validate_only = v.into();
682            self
683        }
684
685        /// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
686        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
687            self.0.request.etag = v.into();
688            self
689        }
690    }
691
692    #[doc(hidden)]
693    impl gax::options::internal::RequestBuilder for DeleteExecution {
694        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
695            &mut self.0.options
696        }
697    }
698
699    /// The request builder for [Executions::cancel_execution][super::super::client::Executions::cancel_execution] calls.
700    #[derive(Clone, Debug)]
701    pub struct CancelExecution(RequestBuilder<crate::model::CancelExecutionRequest>);
702
703    impl CancelExecution {
704        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
705            Self(RequestBuilder::new(stub))
706        }
707
708        /// Sets the full request, replacing any prior values.
709        pub fn with_request<V: Into<crate::model::CancelExecutionRequest>>(mut self, v: V) -> Self {
710            self.0.request = v.into();
711            self
712        }
713
714        /// Sets all the options, replacing any prior values.
715        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
716            self.0.options = v.into();
717            self
718        }
719
720        /// Sends the request.
721        ///
722        /// # Long running operations
723        ///
724        /// This starts, but does not poll, a longrunning operation. More information
725        /// on [cancel_execution][super::super::client::Executions::cancel_execution].
726        pub async fn send(self) -> Result<longrunning::model::Operation> {
727            (*self.0.stub)
728                .cancel_execution(self.0.request, self.0.options)
729                .await
730                .map(gax::response::Response::into_body)
731        }
732
733        /// Creates a [Poller][lro::Poller] to work with `cancel_execution`.
734        pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
735            type Operation = lro::Operation<crate::model::Execution, crate::model::Execution>;
736            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
737            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
738
739            let stub = self.0.stub.clone();
740            let mut options = self.0.options.clone();
741            options.set_retry_policy(gax::retry_policy::NeverRetry);
742            let query = move |name| {
743                let stub = stub.clone();
744                let options = options.clone();
745                async {
746                    let op = GetOperation::new(stub)
747                        .set_name(name)
748                        .with_options(options)
749                        .send()
750                        .await?;
751                    Ok(Operation::new(op))
752                }
753            };
754
755            let start = move || async {
756                let op = self.send().await?;
757                Ok(Operation::new(op))
758            };
759
760            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
761        }
762
763        /// Sets the value of [name][crate::model::CancelExecutionRequest::name].
764        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
765            self.0.request.name = v.into();
766            self
767        }
768
769        /// Sets the value of [validate_only][crate::model::CancelExecutionRequest::validate_only].
770        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
771            self.0.request.validate_only = v.into();
772            self
773        }
774
775        /// Sets the value of [etag][crate::model::CancelExecutionRequest::etag].
776        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
777            self.0.request.etag = v.into();
778            self
779        }
780    }
781
782    #[doc(hidden)]
783    impl gax::options::internal::RequestBuilder for CancelExecution {
784        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
785            &mut self.0.options
786        }
787    }
788
789    /// The request builder for [Executions::list_operations][super::super::client::Executions::list_operations] calls.
790    #[derive(Clone, Debug)]
791    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
792
793    impl ListOperations {
794        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
795            Self(RequestBuilder::new(stub))
796        }
797
798        /// Sets the full request, replacing any prior values.
799        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
800            mut self,
801            v: V,
802        ) -> Self {
803            self.0.request = v.into();
804            self
805        }
806
807        /// Sets all the options, replacing any prior values.
808        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
809            self.0.options = v.into();
810            self
811        }
812
813        /// Sends the request.
814        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
815            (*self.0.stub)
816                .list_operations(self.0.request, self.0.options)
817                .await
818                .map(gax::response::Response::into_body)
819        }
820
821        /// Streams the responses back.
822        pub async fn paginator(
823            self,
824        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
825        {
826            use std::clone::Clone;
827            let token = self.0.request.page_token.clone();
828            let execute = move |token: String| {
829                let mut builder = self.clone();
830                builder.0.request = builder.0.request.set_page_token(token);
831                builder.send()
832            };
833            gax::paginator::internal::new_paginator(token, execute)
834        }
835
836        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
837        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
838            self.0.request.name = v.into();
839            self
840        }
841
842        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
843        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
844            self.0.request.filter = v.into();
845            self
846        }
847
848        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
849        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
850            self.0.request.page_size = v.into();
851            self
852        }
853
854        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
855        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
856            self.0.request.page_token = v.into();
857            self
858        }
859    }
860
861    #[doc(hidden)]
862    impl gax::options::internal::RequestBuilder for ListOperations {
863        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
864            &mut self.0.options
865        }
866    }
867
868    /// The request builder for [Executions::get_operation][super::super::client::Executions::get_operation] calls.
869    #[derive(Clone, Debug)]
870    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
871
872    impl GetOperation {
873        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
874            Self(RequestBuilder::new(stub))
875        }
876
877        /// Sets the full request, replacing any prior values.
878        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
879            mut self,
880            v: V,
881        ) -> Self {
882            self.0.request = v.into();
883            self
884        }
885
886        /// Sets all the options, replacing any prior values.
887        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
888            self.0.options = v.into();
889            self
890        }
891
892        /// Sends the request.
893        pub async fn send(self) -> Result<longrunning::model::Operation> {
894            (*self.0.stub)
895                .get_operation(self.0.request, self.0.options)
896                .await
897                .map(gax::response::Response::into_body)
898        }
899
900        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
901        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
902            self.0.request.name = v.into();
903            self
904        }
905    }
906
907    #[doc(hidden)]
908    impl gax::options::internal::RequestBuilder for GetOperation {
909        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
910            &mut self.0.options
911        }
912    }
913
914    /// The request builder for [Executions::delete_operation][super::super::client::Executions::delete_operation] calls.
915    #[derive(Clone, Debug)]
916    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
917
918    impl DeleteOperation {
919        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
920            Self(RequestBuilder::new(stub))
921        }
922
923        /// Sets the full request, replacing any prior values.
924        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
925            mut self,
926            v: V,
927        ) -> Self {
928            self.0.request = v.into();
929            self
930        }
931
932        /// Sets all the options, replacing any prior values.
933        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
934            self.0.options = v.into();
935            self
936        }
937
938        /// Sends the request.
939        pub async fn send(self) -> Result<()> {
940            (*self.0.stub)
941                .delete_operation(self.0.request, self.0.options)
942                .await
943                .map(gax::response::Response::into_body)
944        }
945
946        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
947        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
948            self.0.request.name = v.into();
949            self
950        }
951    }
952
953    #[doc(hidden)]
954    impl gax::options::internal::RequestBuilder for DeleteOperation {
955        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
956            &mut self.0.options
957        }
958    }
959
960    /// The request builder for [Executions::wait_operation][super::super::client::Executions::wait_operation] calls.
961    #[derive(Clone, Debug)]
962    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
963
964    impl WaitOperation {
965        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Executions>) -> Self {
966            Self(RequestBuilder::new(stub))
967        }
968
969        /// Sets the full request, replacing any prior values.
970        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
971            mut self,
972            v: V,
973        ) -> Self {
974            self.0.request = v.into();
975            self
976        }
977
978        /// Sets all the options, replacing any prior values.
979        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
980            self.0.options = v.into();
981            self
982        }
983
984        /// Sends the request.
985        pub async fn send(self) -> Result<longrunning::model::Operation> {
986            (*self.0.stub)
987                .wait_operation(self.0.request, self.0.options)
988                .await
989                .map(gax::response::Response::into_body)
990        }
991
992        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
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 [timeout][longrunning::model::WaitOperationRequest::timeout].
999        pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
1000            self.0.request.timeout = v.into();
1001            self
1002        }
1003    }
1004
1005    #[doc(hidden)]
1006    impl gax::options::internal::RequestBuilder for WaitOperation {
1007        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1008            &mut self.0.options
1009        }
1010    }
1011}
1012
1013pub mod jobs {
1014    use crate::Result;
1015    use std::sync::Arc;
1016
1017    /// A builder for [Jobs][super::super::client::Jobs].
1018    ///
1019    /// ```
1020    /// # tokio_test::block_on(async {
1021    /// # use google_cloud_run_v2::*;
1022    /// # use builder::jobs::ClientBuilder;
1023    /// # use client::Jobs;
1024    /// let builder : ClientBuilder = Jobs::builder();
1025    /// let client = builder
1026    ///     .with_endpoint("https://run.googleapis.com")
1027    ///     .build().await?;
1028    /// # gax::Result::<()>::Ok(()) });
1029    /// ```
1030    pub type ClientBuilder =
1031        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1032
1033    pub(crate) mod client {
1034        use super::super::super::client::Jobs;
1035        pub struct Factory;
1036        impl gax::client_builder::internal::ClientFactory for Factory {
1037            type Client = Jobs;
1038            type Credentials = gaxi::options::Credentials;
1039            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
1040                Self::Client::new(config).await
1041            }
1042        }
1043    }
1044
1045    /// Common implementation for [super::super::client::Jobs] request builders.
1046    #[derive(Clone, Debug)]
1047    pub(crate) struct RequestBuilder<R: std::default::Default> {
1048        stub: Arc<dyn super::super::stub::dynamic::Jobs>,
1049        request: R,
1050        options: gax::options::RequestOptions,
1051    }
1052
1053    impl<R> RequestBuilder<R>
1054    where
1055        R: std::default::Default,
1056    {
1057        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1058            Self {
1059                stub,
1060                request: R::default(),
1061                options: gax::options::RequestOptions::default(),
1062            }
1063        }
1064    }
1065
1066    /// The request builder for [Jobs::create_job][super::super::client::Jobs::create_job] calls.
1067    #[derive(Clone, Debug)]
1068    pub struct CreateJob(RequestBuilder<crate::model::CreateJobRequest>);
1069
1070    impl CreateJob {
1071        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1072            Self(RequestBuilder::new(stub))
1073        }
1074
1075        /// Sets the full request, replacing any prior values.
1076        pub fn with_request<V: Into<crate::model::CreateJobRequest>>(mut self, v: V) -> Self {
1077            self.0.request = v.into();
1078            self
1079        }
1080
1081        /// Sets all the options, replacing any prior values.
1082        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1083            self.0.options = v.into();
1084            self
1085        }
1086
1087        /// Sends the request.
1088        ///
1089        /// # Long running operations
1090        ///
1091        /// This starts, but does not poll, a longrunning operation. More information
1092        /// on [create_job][super::super::client::Jobs::create_job].
1093        pub async fn send(self) -> Result<longrunning::model::Operation> {
1094            (*self.0.stub)
1095                .create_job(self.0.request, self.0.options)
1096                .await
1097                .map(gax::response::Response::into_body)
1098        }
1099
1100        /// Creates a [Poller][lro::Poller] to work with `create_job`.
1101        pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1102            type Operation = lro::Operation<crate::model::Job, crate::model::Job>;
1103            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1104            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1105
1106            let stub = self.0.stub.clone();
1107            let mut options = self.0.options.clone();
1108            options.set_retry_policy(gax::retry_policy::NeverRetry);
1109            let query = move |name| {
1110                let stub = stub.clone();
1111                let options = options.clone();
1112                async {
1113                    let op = GetOperation::new(stub)
1114                        .set_name(name)
1115                        .with_options(options)
1116                        .send()
1117                        .await?;
1118                    Ok(Operation::new(op))
1119                }
1120            };
1121
1122            let start = move || async {
1123                let op = self.send().await?;
1124                Ok(Operation::new(op))
1125            };
1126
1127            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1128        }
1129
1130        /// Sets the value of [parent][crate::model::CreateJobRequest::parent].
1131        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1132            self.0.request.parent = v.into();
1133            self
1134        }
1135
1136        /// Sets the value of [job][crate::model::CreateJobRequest::job].
1137        pub fn set_job<T: Into<std::option::Option<crate::model::Job>>>(mut self, v: T) -> Self {
1138            self.0.request.job = v.into();
1139            self
1140        }
1141
1142        /// Sets the value of [job_id][crate::model::CreateJobRequest::job_id].
1143        pub fn set_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1144            self.0.request.job_id = v.into();
1145            self
1146        }
1147
1148        /// Sets the value of [validate_only][crate::model::CreateJobRequest::validate_only].
1149        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1150            self.0.request.validate_only = v.into();
1151            self
1152        }
1153    }
1154
1155    #[doc(hidden)]
1156    impl gax::options::internal::RequestBuilder for CreateJob {
1157        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1158            &mut self.0.options
1159        }
1160    }
1161
1162    /// The request builder for [Jobs::get_job][super::super::client::Jobs::get_job] calls.
1163    #[derive(Clone, Debug)]
1164    pub struct GetJob(RequestBuilder<crate::model::GetJobRequest>);
1165
1166    impl GetJob {
1167        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1168            Self(RequestBuilder::new(stub))
1169        }
1170
1171        /// Sets the full request, replacing any prior values.
1172        pub fn with_request<V: Into<crate::model::GetJobRequest>>(mut self, v: V) -> Self {
1173            self.0.request = v.into();
1174            self
1175        }
1176
1177        /// Sets all the options, replacing any prior values.
1178        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1179            self.0.options = v.into();
1180            self
1181        }
1182
1183        /// Sends the request.
1184        pub async fn send(self) -> Result<crate::model::Job> {
1185            (*self.0.stub)
1186                .get_job(self.0.request, self.0.options)
1187                .await
1188                .map(gax::response::Response::into_body)
1189        }
1190
1191        /// Sets the value of [name][crate::model::GetJobRequest::name].
1192        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1193            self.0.request.name = v.into();
1194            self
1195        }
1196    }
1197
1198    #[doc(hidden)]
1199    impl gax::options::internal::RequestBuilder for GetJob {
1200        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1201            &mut self.0.options
1202        }
1203    }
1204
1205    /// The request builder for [Jobs::list_jobs][super::super::client::Jobs::list_jobs] calls.
1206    #[derive(Clone, Debug)]
1207    pub struct ListJobs(RequestBuilder<crate::model::ListJobsRequest>);
1208
1209    impl ListJobs {
1210        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1211            Self(RequestBuilder::new(stub))
1212        }
1213
1214        /// Sets the full request, replacing any prior values.
1215        pub fn with_request<V: Into<crate::model::ListJobsRequest>>(mut self, v: V) -> Self {
1216            self.0.request = v.into();
1217            self
1218        }
1219
1220        /// Sets all the options, replacing any prior values.
1221        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1222            self.0.options = v.into();
1223            self
1224        }
1225
1226        /// Sends the request.
1227        pub async fn send(self) -> Result<crate::model::ListJobsResponse> {
1228            (*self.0.stub)
1229                .list_jobs(self.0.request, self.0.options)
1230                .await
1231                .map(gax::response::Response::into_body)
1232        }
1233
1234        /// Streams the responses back.
1235        pub async fn paginator(
1236            self,
1237        ) -> impl gax::paginator::Paginator<crate::model::ListJobsResponse, gax::error::Error>
1238        {
1239            use std::clone::Clone;
1240            let token = self.0.request.page_token.clone();
1241            let execute = move |token: String| {
1242                let mut builder = self.clone();
1243                builder.0.request = builder.0.request.set_page_token(token);
1244                builder.send()
1245            };
1246            gax::paginator::internal::new_paginator(token, execute)
1247        }
1248
1249        /// Sets the value of [parent][crate::model::ListJobsRequest::parent].
1250        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1251            self.0.request.parent = v.into();
1252            self
1253        }
1254
1255        /// Sets the value of [page_size][crate::model::ListJobsRequest::page_size].
1256        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1257            self.0.request.page_size = v.into();
1258            self
1259        }
1260
1261        /// Sets the value of [page_token][crate::model::ListJobsRequest::page_token].
1262        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1263            self.0.request.page_token = v.into();
1264            self
1265        }
1266
1267        /// Sets the value of [show_deleted][crate::model::ListJobsRequest::show_deleted].
1268        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1269            self.0.request.show_deleted = v.into();
1270            self
1271        }
1272    }
1273
1274    #[doc(hidden)]
1275    impl gax::options::internal::RequestBuilder for ListJobs {
1276        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1277            &mut self.0.options
1278        }
1279    }
1280
1281    /// The request builder for [Jobs::update_job][super::super::client::Jobs::update_job] calls.
1282    #[derive(Clone, Debug)]
1283    pub struct UpdateJob(RequestBuilder<crate::model::UpdateJobRequest>);
1284
1285    impl UpdateJob {
1286        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1287            Self(RequestBuilder::new(stub))
1288        }
1289
1290        /// Sets the full request, replacing any prior values.
1291        pub fn with_request<V: Into<crate::model::UpdateJobRequest>>(mut self, v: V) -> 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        ///
1304        /// # Long running operations
1305        ///
1306        /// This starts, but does not poll, a longrunning operation. More information
1307        /// on [update_job][super::super::client::Jobs::update_job].
1308        pub async fn send(self) -> Result<longrunning::model::Operation> {
1309            (*self.0.stub)
1310                .update_job(self.0.request, self.0.options)
1311                .await
1312                .map(gax::response::Response::into_body)
1313        }
1314
1315        /// Creates a [Poller][lro::Poller] to work with `update_job`.
1316        pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1317            type Operation = lro::Operation<crate::model::Job, crate::model::Job>;
1318            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1319            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1320
1321            let stub = self.0.stub.clone();
1322            let mut options = self.0.options.clone();
1323            options.set_retry_policy(gax::retry_policy::NeverRetry);
1324            let query = move |name| {
1325                let stub = stub.clone();
1326                let options = options.clone();
1327                async {
1328                    let op = GetOperation::new(stub)
1329                        .set_name(name)
1330                        .with_options(options)
1331                        .send()
1332                        .await?;
1333                    Ok(Operation::new(op))
1334                }
1335            };
1336
1337            let start = move || async {
1338                let op = self.send().await?;
1339                Ok(Operation::new(op))
1340            };
1341
1342            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1343        }
1344
1345        /// Sets the value of [job][crate::model::UpdateJobRequest::job].
1346        pub fn set_job<T: Into<std::option::Option<crate::model::Job>>>(mut self, v: T) -> Self {
1347            self.0.request.job = v.into();
1348            self
1349        }
1350
1351        /// Sets the value of [validate_only][crate::model::UpdateJobRequest::validate_only].
1352        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1353            self.0.request.validate_only = v.into();
1354            self
1355        }
1356
1357        /// Sets the value of [allow_missing][crate::model::UpdateJobRequest::allow_missing].
1358        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1359            self.0.request.allow_missing = v.into();
1360            self
1361        }
1362    }
1363
1364    #[doc(hidden)]
1365    impl gax::options::internal::RequestBuilder for UpdateJob {
1366        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1367            &mut self.0.options
1368        }
1369    }
1370
1371    /// The request builder for [Jobs::delete_job][super::super::client::Jobs::delete_job] calls.
1372    #[derive(Clone, Debug)]
1373    pub struct DeleteJob(RequestBuilder<crate::model::DeleteJobRequest>);
1374
1375    impl DeleteJob {
1376        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1377            Self(RequestBuilder::new(stub))
1378        }
1379
1380        /// Sets the full request, replacing any prior values.
1381        pub fn with_request<V: Into<crate::model::DeleteJobRequest>>(mut self, v: V) -> Self {
1382            self.0.request = v.into();
1383            self
1384        }
1385
1386        /// Sets all the options, replacing any prior values.
1387        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1388            self.0.options = v.into();
1389            self
1390        }
1391
1392        /// Sends the request.
1393        ///
1394        /// # Long running operations
1395        ///
1396        /// This starts, but does not poll, a longrunning operation. More information
1397        /// on [delete_job][super::super::client::Jobs::delete_job].
1398        pub async fn send(self) -> Result<longrunning::model::Operation> {
1399            (*self.0.stub)
1400                .delete_job(self.0.request, self.0.options)
1401                .await
1402                .map(gax::response::Response::into_body)
1403        }
1404
1405        /// Creates a [Poller][lro::Poller] to work with `delete_job`.
1406        pub fn poller(self) -> impl lro::Poller<crate::model::Job, crate::model::Job> {
1407            type Operation = lro::Operation<crate::model::Job, crate::model::Job>;
1408            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1409            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1410
1411            let stub = self.0.stub.clone();
1412            let mut options = self.0.options.clone();
1413            options.set_retry_policy(gax::retry_policy::NeverRetry);
1414            let query = move |name| {
1415                let stub = stub.clone();
1416                let options = options.clone();
1417                async {
1418                    let op = GetOperation::new(stub)
1419                        .set_name(name)
1420                        .with_options(options)
1421                        .send()
1422                        .await?;
1423                    Ok(Operation::new(op))
1424                }
1425            };
1426
1427            let start = move || async {
1428                let op = self.send().await?;
1429                Ok(Operation::new(op))
1430            };
1431
1432            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1433        }
1434
1435        /// Sets the value of [name][crate::model::DeleteJobRequest::name].
1436        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1437            self.0.request.name = v.into();
1438            self
1439        }
1440
1441        /// Sets the value of [validate_only][crate::model::DeleteJobRequest::validate_only].
1442        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1443            self.0.request.validate_only = v.into();
1444            self
1445        }
1446
1447        /// Sets the value of [etag][crate::model::DeleteJobRequest::etag].
1448        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1449            self.0.request.etag = v.into();
1450            self
1451        }
1452    }
1453
1454    #[doc(hidden)]
1455    impl gax::options::internal::RequestBuilder for DeleteJob {
1456        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1457            &mut self.0.options
1458        }
1459    }
1460
1461    /// The request builder for [Jobs::run_job][super::super::client::Jobs::run_job] calls.
1462    #[derive(Clone, Debug)]
1463    pub struct RunJob(RequestBuilder<crate::model::RunJobRequest>);
1464
1465    impl RunJob {
1466        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1467            Self(RequestBuilder::new(stub))
1468        }
1469
1470        /// Sets the full request, replacing any prior values.
1471        pub fn with_request<V: Into<crate::model::RunJobRequest>>(mut self, v: V) -> Self {
1472            self.0.request = v.into();
1473            self
1474        }
1475
1476        /// Sets all the options, replacing any prior values.
1477        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1478            self.0.options = v.into();
1479            self
1480        }
1481
1482        /// Sends the request.
1483        ///
1484        /// # Long running operations
1485        ///
1486        /// This starts, but does not poll, a longrunning operation. More information
1487        /// on [run_job][super::super::client::Jobs::run_job].
1488        pub async fn send(self) -> Result<longrunning::model::Operation> {
1489            (*self.0.stub)
1490                .run_job(self.0.request, self.0.options)
1491                .await
1492                .map(gax::response::Response::into_body)
1493        }
1494
1495        /// Creates a [Poller][lro::Poller] to work with `run_job`.
1496        pub fn poller(self) -> impl lro::Poller<crate::model::Execution, crate::model::Execution> {
1497            type Operation = lro::Operation<crate::model::Execution, crate::model::Execution>;
1498            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1499            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1500
1501            let stub = self.0.stub.clone();
1502            let mut options = self.0.options.clone();
1503            options.set_retry_policy(gax::retry_policy::NeverRetry);
1504            let query = move |name| {
1505                let stub = stub.clone();
1506                let options = options.clone();
1507                async {
1508                    let op = GetOperation::new(stub)
1509                        .set_name(name)
1510                        .with_options(options)
1511                        .send()
1512                        .await?;
1513                    Ok(Operation::new(op))
1514                }
1515            };
1516
1517            let start = move || async {
1518                let op = self.send().await?;
1519                Ok(Operation::new(op))
1520            };
1521
1522            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1523        }
1524
1525        /// Sets the value of [name][crate::model::RunJobRequest::name].
1526        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1527            self.0.request.name = v.into();
1528            self
1529        }
1530
1531        /// Sets the value of [validate_only][crate::model::RunJobRequest::validate_only].
1532        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1533            self.0.request.validate_only = v.into();
1534            self
1535        }
1536
1537        /// Sets the value of [etag][crate::model::RunJobRequest::etag].
1538        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1539            self.0.request.etag = v.into();
1540            self
1541        }
1542
1543        /// Sets the value of [overrides][crate::model::RunJobRequest::overrides].
1544        pub fn set_overrides<
1545            T: Into<std::option::Option<crate::model::run_job_request::Overrides>>,
1546        >(
1547            mut self,
1548            v: T,
1549        ) -> Self {
1550            self.0.request.overrides = v.into();
1551            self
1552        }
1553    }
1554
1555    #[doc(hidden)]
1556    impl gax::options::internal::RequestBuilder for RunJob {
1557        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1558            &mut self.0.options
1559        }
1560    }
1561
1562    /// The request builder for [Jobs::get_iam_policy][super::super::client::Jobs::get_iam_policy] calls.
1563    #[derive(Clone, Debug)]
1564    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1565
1566    impl GetIamPolicy {
1567        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1568            Self(RequestBuilder::new(stub))
1569        }
1570
1571        /// Sets the full request, replacing any prior values.
1572        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1573            self.0.request = v.into();
1574            self
1575        }
1576
1577        /// Sets all the options, replacing any prior values.
1578        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1579            self.0.options = v.into();
1580            self
1581        }
1582
1583        /// Sends the request.
1584        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1585            (*self.0.stub)
1586                .get_iam_policy(self.0.request, self.0.options)
1587                .await
1588                .map(gax::response::Response::into_body)
1589        }
1590
1591        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1592        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1593            self.0.request.resource = v.into();
1594            self
1595        }
1596
1597        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1598        pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
1599            mut self,
1600            v: T,
1601        ) -> Self {
1602            self.0.request.options = v.into();
1603            self
1604        }
1605    }
1606
1607    #[doc(hidden)]
1608    impl gax::options::internal::RequestBuilder for GetIamPolicy {
1609        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1610            &mut self.0.options
1611        }
1612    }
1613
1614    /// The request builder for [Jobs::set_iam_policy][super::super::client::Jobs::set_iam_policy] calls.
1615    #[derive(Clone, Debug)]
1616    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1617
1618    impl SetIamPolicy {
1619        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1620            Self(RequestBuilder::new(stub))
1621        }
1622
1623        /// Sets the full request, replacing any prior values.
1624        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1625            self.0.request = v.into();
1626            self
1627        }
1628
1629        /// Sets all the options, replacing any prior values.
1630        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1631            self.0.options = v.into();
1632            self
1633        }
1634
1635        /// Sends the request.
1636        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1637            (*self.0.stub)
1638                .set_iam_policy(self.0.request, self.0.options)
1639                .await
1640                .map(gax::response::Response::into_body)
1641        }
1642
1643        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1644        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1645            self.0.request.resource = v.into();
1646            self
1647        }
1648
1649        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1650        pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
1651            mut self,
1652            v: T,
1653        ) -> Self {
1654            self.0.request.policy = v.into();
1655            self
1656        }
1657
1658        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1659        pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
1660            mut self,
1661            v: T,
1662        ) -> Self {
1663            self.0.request.update_mask = v.into();
1664            self
1665        }
1666    }
1667
1668    #[doc(hidden)]
1669    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1670        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1671            &mut self.0.options
1672        }
1673    }
1674
1675    /// The request builder for [Jobs::test_iam_permissions][super::super::client::Jobs::test_iam_permissions] calls.
1676    #[derive(Clone, Debug)]
1677    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1678
1679    impl TestIamPermissions {
1680        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1681            Self(RequestBuilder::new(stub))
1682        }
1683
1684        /// Sets the full request, replacing any prior values.
1685        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1686            mut self,
1687            v: V,
1688        ) -> Self {
1689            self.0.request = v.into();
1690            self
1691        }
1692
1693        /// Sets all the options, replacing any prior values.
1694        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1695            self.0.options = v.into();
1696            self
1697        }
1698
1699        /// Sends the request.
1700        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1701            (*self.0.stub)
1702                .test_iam_permissions(self.0.request, self.0.options)
1703                .await
1704                .map(gax::response::Response::into_body)
1705        }
1706
1707        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1708        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709            self.0.request.resource = v.into();
1710            self
1711        }
1712
1713        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1714        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1715        where
1716            T: std::iter::IntoIterator<Item = V>,
1717            V: std::convert::Into<std::string::String>,
1718        {
1719            use std::iter::Iterator;
1720            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1721            self
1722        }
1723    }
1724
1725    #[doc(hidden)]
1726    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1727        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1728            &mut self.0.options
1729        }
1730    }
1731
1732    /// The request builder for [Jobs::list_operations][super::super::client::Jobs::list_operations] calls.
1733    #[derive(Clone, Debug)]
1734    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1735
1736    impl ListOperations {
1737        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1738            Self(RequestBuilder::new(stub))
1739        }
1740
1741        /// Sets the full request, replacing any prior values.
1742        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1743            mut self,
1744            v: V,
1745        ) -> Self {
1746            self.0.request = v.into();
1747            self
1748        }
1749
1750        /// Sets all the options, replacing any prior values.
1751        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1752            self.0.options = v.into();
1753            self
1754        }
1755
1756        /// Sends the request.
1757        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1758            (*self.0.stub)
1759                .list_operations(self.0.request, self.0.options)
1760                .await
1761                .map(gax::response::Response::into_body)
1762        }
1763
1764        /// Streams the responses back.
1765        pub async fn paginator(
1766            self,
1767        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1768        {
1769            use std::clone::Clone;
1770            let token = self.0.request.page_token.clone();
1771            let execute = move |token: String| {
1772                let mut builder = self.clone();
1773                builder.0.request = builder.0.request.set_page_token(token);
1774                builder.send()
1775            };
1776            gax::paginator::internal::new_paginator(token, execute)
1777        }
1778
1779        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1780        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1781            self.0.request.name = v.into();
1782            self
1783        }
1784
1785        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1786        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1787            self.0.request.filter = v.into();
1788            self
1789        }
1790
1791        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1792        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1793            self.0.request.page_size = v.into();
1794            self
1795        }
1796
1797        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1798        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1799            self.0.request.page_token = v.into();
1800            self
1801        }
1802    }
1803
1804    #[doc(hidden)]
1805    impl gax::options::internal::RequestBuilder for ListOperations {
1806        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1807            &mut self.0.options
1808        }
1809    }
1810
1811    /// The request builder for [Jobs::get_operation][super::super::client::Jobs::get_operation] calls.
1812    #[derive(Clone, Debug)]
1813    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1814
1815    impl GetOperation {
1816        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1817            Self(RequestBuilder::new(stub))
1818        }
1819
1820        /// Sets the full request, replacing any prior values.
1821        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1822            mut self,
1823            v: V,
1824        ) -> Self {
1825            self.0.request = v.into();
1826            self
1827        }
1828
1829        /// Sets all the options, replacing any prior values.
1830        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1831            self.0.options = v.into();
1832            self
1833        }
1834
1835        /// Sends the request.
1836        pub async fn send(self) -> Result<longrunning::model::Operation> {
1837            (*self.0.stub)
1838                .get_operation(self.0.request, self.0.options)
1839                .await
1840                .map(gax::response::Response::into_body)
1841        }
1842
1843        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1844        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845            self.0.request.name = v.into();
1846            self
1847        }
1848    }
1849
1850    #[doc(hidden)]
1851    impl gax::options::internal::RequestBuilder for GetOperation {
1852        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1853            &mut self.0.options
1854        }
1855    }
1856
1857    /// The request builder for [Jobs::delete_operation][super::super::client::Jobs::delete_operation] calls.
1858    #[derive(Clone, Debug)]
1859    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
1860
1861    impl DeleteOperation {
1862        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1863            Self(RequestBuilder::new(stub))
1864        }
1865
1866        /// Sets the full request, replacing any prior values.
1867        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
1868            mut self,
1869            v: V,
1870        ) -> Self {
1871            self.0.request = v.into();
1872            self
1873        }
1874
1875        /// Sets all the options, replacing any prior values.
1876        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1877            self.0.options = v.into();
1878            self
1879        }
1880
1881        /// Sends the request.
1882        pub async fn send(self) -> Result<()> {
1883            (*self.0.stub)
1884                .delete_operation(self.0.request, self.0.options)
1885                .await
1886                .map(gax::response::Response::into_body)
1887        }
1888
1889        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
1890        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1891            self.0.request.name = v.into();
1892            self
1893        }
1894    }
1895
1896    #[doc(hidden)]
1897    impl gax::options::internal::RequestBuilder for DeleteOperation {
1898        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1899            &mut self.0.options
1900        }
1901    }
1902
1903    /// The request builder for [Jobs::wait_operation][super::super::client::Jobs::wait_operation] calls.
1904    #[derive(Clone, Debug)]
1905    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
1906
1907    impl WaitOperation {
1908        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Jobs>) -> Self {
1909            Self(RequestBuilder::new(stub))
1910        }
1911
1912        /// Sets the full request, replacing any prior values.
1913        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
1914            mut self,
1915            v: V,
1916        ) -> Self {
1917            self.0.request = v.into();
1918            self
1919        }
1920
1921        /// Sets all the options, replacing any prior values.
1922        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1923            self.0.options = v.into();
1924            self
1925        }
1926
1927        /// Sends the request.
1928        pub async fn send(self) -> Result<longrunning::model::Operation> {
1929            (*self.0.stub)
1930                .wait_operation(self.0.request, self.0.options)
1931                .await
1932                .map(gax::response::Response::into_body)
1933        }
1934
1935        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
1936        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1937            self.0.request.name = v.into();
1938            self
1939        }
1940
1941        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
1942        pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
1943            self.0.request.timeout = v.into();
1944            self
1945        }
1946    }
1947
1948    #[doc(hidden)]
1949    impl gax::options::internal::RequestBuilder for WaitOperation {
1950        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1951            &mut self.0.options
1952        }
1953    }
1954}
1955
1956pub mod revisions {
1957    use crate::Result;
1958    use std::sync::Arc;
1959
1960    /// A builder for [Revisions][super::super::client::Revisions].
1961    ///
1962    /// ```
1963    /// # tokio_test::block_on(async {
1964    /// # use google_cloud_run_v2::*;
1965    /// # use builder::revisions::ClientBuilder;
1966    /// # use client::Revisions;
1967    /// let builder : ClientBuilder = Revisions::builder();
1968    /// let client = builder
1969    ///     .with_endpoint("https://run.googleapis.com")
1970    ///     .build().await?;
1971    /// # gax::Result::<()>::Ok(()) });
1972    /// ```
1973    pub type ClientBuilder =
1974        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1975
1976    pub(crate) mod client {
1977        use super::super::super::client::Revisions;
1978        pub struct Factory;
1979        impl gax::client_builder::internal::ClientFactory for Factory {
1980            type Client = Revisions;
1981            type Credentials = gaxi::options::Credentials;
1982            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
1983                Self::Client::new(config).await
1984            }
1985        }
1986    }
1987
1988    /// Common implementation for [super::super::client::Revisions] request builders.
1989    #[derive(Clone, Debug)]
1990    pub(crate) struct RequestBuilder<R: std::default::Default> {
1991        stub: Arc<dyn super::super::stub::dynamic::Revisions>,
1992        request: R,
1993        options: gax::options::RequestOptions,
1994    }
1995
1996    impl<R> RequestBuilder<R>
1997    where
1998        R: std::default::Default,
1999    {
2000        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2001            Self {
2002                stub,
2003                request: R::default(),
2004                options: gax::options::RequestOptions::default(),
2005            }
2006        }
2007    }
2008
2009    /// The request builder for [Revisions::get_revision][super::super::client::Revisions::get_revision] calls.
2010    #[derive(Clone, Debug)]
2011    pub struct GetRevision(RequestBuilder<crate::model::GetRevisionRequest>);
2012
2013    impl GetRevision {
2014        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2015            Self(RequestBuilder::new(stub))
2016        }
2017
2018        /// Sets the full request, replacing any prior values.
2019        pub fn with_request<V: Into<crate::model::GetRevisionRequest>>(mut self, v: V) -> Self {
2020            self.0.request = v.into();
2021            self
2022        }
2023
2024        /// Sets all the options, replacing any prior values.
2025        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2026            self.0.options = v.into();
2027            self
2028        }
2029
2030        /// Sends the request.
2031        pub async fn send(self) -> Result<crate::model::Revision> {
2032            (*self.0.stub)
2033                .get_revision(self.0.request, self.0.options)
2034                .await
2035                .map(gax::response::Response::into_body)
2036        }
2037
2038        /// Sets the value of [name][crate::model::GetRevisionRequest::name].
2039        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2040            self.0.request.name = v.into();
2041            self
2042        }
2043    }
2044
2045    #[doc(hidden)]
2046    impl gax::options::internal::RequestBuilder for GetRevision {
2047        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2048            &mut self.0.options
2049        }
2050    }
2051
2052    /// The request builder for [Revisions::list_revisions][super::super::client::Revisions::list_revisions] calls.
2053    #[derive(Clone, Debug)]
2054    pub struct ListRevisions(RequestBuilder<crate::model::ListRevisionsRequest>);
2055
2056    impl ListRevisions {
2057        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2058            Self(RequestBuilder::new(stub))
2059        }
2060
2061        /// Sets the full request, replacing any prior values.
2062        pub fn with_request<V: Into<crate::model::ListRevisionsRequest>>(mut self, v: V) -> Self {
2063            self.0.request = v.into();
2064            self
2065        }
2066
2067        /// Sets all the options, replacing any prior values.
2068        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2069            self.0.options = v.into();
2070            self
2071        }
2072
2073        /// Sends the request.
2074        pub async fn send(self) -> Result<crate::model::ListRevisionsResponse> {
2075            (*self.0.stub)
2076                .list_revisions(self.0.request, self.0.options)
2077                .await
2078                .map(gax::response::Response::into_body)
2079        }
2080
2081        /// Streams the responses back.
2082        pub async fn paginator(
2083            self,
2084        ) -> impl gax::paginator::Paginator<crate::model::ListRevisionsResponse, gax::error::Error>
2085        {
2086            use std::clone::Clone;
2087            let token = self.0.request.page_token.clone();
2088            let execute = move |token: String| {
2089                let mut builder = self.clone();
2090                builder.0.request = builder.0.request.set_page_token(token);
2091                builder.send()
2092            };
2093            gax::paginator::internal::new_paginator(token, execute)
2094        }
2095
2096        /// Sets the value of [parent][crate::model::ListRevisionsRequest::parent].
2097        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2098            self.0.request.parent = v.into();
2099            self
2100        }
2101
2102        /// Sets the value of [page_size][crate::model::ListRevisionsRequest::page_size].
2103        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2104            self.0.request.page_size = v.into();
2105            self
2106        }
2107
2108        /// Sets the value of [page_token][crate::model::ListRevisionsRequest::page_token].
2109        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2110            self.0.request.page_token = v.into();
2111            self
2112        }
2113
2114        /// Sets the value of [show_deleted][crate::model::ListRevisionsRequest::show_deleted].
2115        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2116            self.0.request.show_deleted = v.into();
2117            self
2118        }
2119    }
2120
2121    #[doc(hidden)]
2122    impl gax::options::internal::RequestBuilder for ListRevisions {
2123        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2124            &mut self.0.options
2125        }
2126    }
2127
2128    /// The request builder for [Revisions::delete_revision][super::super::client::Revisions::delete_revision] calls.
2129    #[derive(Clone, Debug)]
2130    pub struct DeleteRevision(RequestBuilder<crate::model::DeleteRevisionRequest>);
2131
2132    impl DeleteRevision {
2133        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2134            Self(RequestBuilder::new(stub))
2135        }
2136
2137        /// Sets the full request, replacing any prior values.
2138        pub fn with_request<V: Into<crate::model::DeleteRevisionRequest>>(mut self, v: V) -> Self {
2139            self.0.request = v.into();
2140            self
2141        }
2142
2143        /// Sets all the options, replacing any prior values.
2144        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2145            self.0.options = v.into();
2146            self
2147        }
2148
2149        /// Sends the request.
2150        ///
2151        /// # Long running operations
2152        ///
2153        /// This starts, but does not poll, a longrunning operation. More information
2154        /// on [delete_revision][super::super::client::Revisions::delete_revision].
2155        pub async fn send(self) -> Result<longrunning::model::Operation> {
2156            (*self.0.stub)
2157                .delete_revision(self.0.request, self.0.options)
2158                .await
2159                .map(gax::response::Response::into_body)
2160        }
2161
2162        /// Creates a [Poller][lro::Poller] to work with `delete_revision`.
2163        pub fn poller(self) -> impl lro::Poller<crate::model::Revision, crate::model::Revision> {
2164            type Operation = lro::Operation<crate::model::Revision, crate::model::Revision>;
2165            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2166            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2167
2168            let stub = self.0.stub.clone();
2169            let mut options = self.0.options.clone();
2170            options.set_retry_policy(gax::retry_policy::NeverRetry);
2171            let query = move |name| {
2172                let stub = stub.clone();
2173                let options = options.clone();
2174                async {
2175                    let op = GetOperation::new(stub)
2176                        .set_name(name)
2177                        .with_options(options)
2178                        .send()
2179                        .await?;
2180                    Ok(Operation::new(op))
2181                }
2182            };
2183
2184            let start = move || async {
2185                let op = self.send().await?;
2186                Ok(Operation::new(op))
2187            };
2188
2189            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2190        }
2191
2192        /// Sets the value of [name][crate::model::DeleteRevisionRequest::name].
2193        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2194            self.0.request.name = v.into();
2195            self
2196        }
2197
2198        /// Sets the value of [validate_only][crate::model::DeleteRevisionRequest::validate_only].
2199        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2200            self.0.request.validate_only = v.into();
2201            self
2202        }
2203
2204        /// Sets the value of [etag][crate::model::DeleteRevisionRequest::etag].
2205        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2206            self.0.request.etag = v.into();
2207            self
2208        }
2209    }
2210
2211    #[doc(hidden)]
2212    impl gax::options::internal::RequestBuilder for DeleteRevision {
2213        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2214            &mut self.0.options
2215        }
2216    }
2217
2218    /// The request builder for [Revisions::list_operations][super::super::client::Revisions::list_operations] calls.
2219    #[derive(Clone, Debug)]
2220    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2221
2222    impl ListOperations {
2223        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2224            Self(RequestBuilder::new(stub))
2225        }
2226
2227        /// Sets the full request, replacing any prior values.
2228        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2229            mut self,
2230            v: V,
2231        ) -> Self {
2232            self.0.request = v.into();
2233            self
2234        }
2235
2236        /// Sets all the options, replacing any prior values.
2237        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2238            self.0.options = v.into();
2239            self
2240        }
2241
2242        /// Sends the request.
2243        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2244            (*self.0.stub)
2245                .list_operations(self.0.request, self.0.options)
2246                .await
2247                .map(gax::response::Response::into_body)
2248        }
2249
2250        /// Streams the responses back.
2251        pub async fn paginator(
2252            self,
2253        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2254        {
2255            use std::clone::Clone;
2256            let token = self.0.request.page_token.clone();
2257            let execute = move |token: String| {
2258                let mut builder = self.clone();
2259                builder.0.request = builder.0.request.set_page_token(token);
2260                builder.send()
2261            };
2262            gax::paginator::internal::new_paginator(token, execute)
2263        }
2264
2265        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
2266        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2267            self.0.request.name = v.into();
2268            self
2269        }
2270
2271        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
2272        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2273            self.0.request.filter = v.into();
2274            self
2275        }
2276
2277        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
2278        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2279            self.0.request.page_size = v.into();
2280            self
2281        }
2282
2283        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
2284        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2285            self.0.request.page_token = v.into();
2286            self
2287        }
2288    }
2289
2290    #[doc(hidden)]
2291    impl gax::options::internal::RequestBuilder for ListOperations {
2292        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2293            &mut self.0.options
2294        }
2295    }
2296
2297    /// The request builder for [Revisions::get_operation][super::super::client::Revisions::get_operation] calls.
2298    #[derive(Clone, Debug)]
2299    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2300
2301    impl GetOperation {
2302        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2303            Self(RequestBuilder::new(stub))
2304        }
2305
2306        /// Sets the full request, replacing any prior values.
2307        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2308            mut self,
2309            v: V,
2310        ) -> Self {
2311            self.0.request = v.into();
2312            self
2313        }
2314
2315        /// Sets all the options, replacing any prior values.
2316        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2317            self.0.options = v.into();
2318            self
2319        }
2320
2321        /// Sends the request.
2322        pub async fn send(self) -> Result<longrunning::model::Operation> {
2323            (*self.0.stub)
2324                .get_operation(self.0.request, self.0.options)
2325                .await
2326                .map(gax::response::Response::into_body)
2327        }
2328
2329        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2330        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2331            self.0.request.name = v.into();
2332            self
2333        }
2334    }
2335
2336    #[doc(hidden)]
2337    impl gax::options::internal::RequestBuilder for GetOperation {
2338        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2339            &mut self.0.options
2340        }
2341    }
2342
2343    /// The request builder for [Revisions::delete_operation][super::super::client::Revisions::delete_operation] calls.
2344    #[derive(Clone, Debug)]
2345    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2346
2347    impl DeleteOperation {
2348        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2349            Self(RequestBuilder::new(stub))
2350        }
2351
2352        /// Sets the full request, replacing any prior values.
2353        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2354            mut self,
2355            v: V,
2356        ) -> Self {
2357            self.0.request = v.into();
2358            self
2359        }
2360
2361        /// Sets all the options, replacing any prior values.
2362        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2363            self.0.options = v.into();
2364            self
2365        }
2366
2367        /// Sends the request.
2368        pub async fn send(self) -> Result<()> {
2369            (*self.0.stub)
2370                .delete_operation(self.0.request, self.0.options)
2371                .await
2372                .map(gax::response::Response::into_body)
2373        }
2374
2375        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
2376        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2377            self.0.request.name = v.into();
2378            self
2379        }
2380    }
2381
2382    #[doc(hidden)]
2383    impl gax::options::internal::RequestBuilder for DeleteOperation {
2384        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2385            &mut self.0.options
2386        }
2387    }
2388
2389    /// The request builder for [Revisions::wait_operation][super::super::client::Revisions::wait_operation] calls.
2390    #[derive(Clone, Debug)]
2391    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
2392
2393    impl WaitOperation {
2394        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Revisions>) -> Self {
2395            Self(RequestBuilder::new(stub))
2396        }
2397
2398        /// Sets the full request, replacing any prior values.
2399        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
2400            mut self,
2401            v: V,
2402        ) -> Self {
2403            self.0.request = v.into();
2404            self
2405        }
2406
2407        /// Sets all the options, replacing any prior values.
2408        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2409            self.0.options = v.into();
2410            self
2411        }
2412
2413        /// Sends the request.
2414        pub async fn send(self) -> Result<longrunning::model::Operation> {
2415            (*self.0.stub)
2416                .wait_operation(self.0.request, self.0.options)
2417                .await
2418                .map(gax::response::Response::into_body)
2419        }
2420
2421        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
2422        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2423            self.0.request.name = v.into();
2424            self
2425        }
2426
2427        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
2428        pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
2429            self.0.request.timeout = v.into();
2430            self
2431        }
2432    }
2433
2434    #[doc(hidden)]
2435    impl gax::options::internal::RequestBuilder for WaitOperation {
2436        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2437            &mut self.0.options
2438        }
2439    }
2440}
2441
2442pub mod services {
2443    use crate::Result;
2444    use std::sync::Arc;
2445
2446    /// A builder for [Services][super::super::client::Services].
2447    ///
2448    /// ```
2449    /// # tokio_test::block_on(async {
2450    /// # use google_cloud_run_v2::*;
2451    /// # use builder::services::ClientBuilder;
2452    /// # use client::Services;
2453    /// let builder : ClientBuilder = Services::builder();
2454    /// let client = builder
2455    ///     .with_endpoint("https://run.googleapis.com")
2456    ///     .build().await?;
2457    /// # gax::Result::<()>::Ok(()) });
2458    /// ```
2459    pub type ClientBuilder =
2460        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2461
2462    pub(crate) mod client {
2463        use super::super::super::client::Services;
2464        pub struct Factory;
2465        impl gax::client_builder::internal::ClientFactory for Factory {
2466            type Client = Services;
2467            type Credentials = gaxi::options::Credentials;
2468            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
2469                Self::Client::new(config).await
2470            }
2471        }
2472    }
2473
2474    /// Common implementation for [super::super::client::Services] request builders.
2475    #[derive(Clone, Debug)]
2476    pub(crate) struct RequestBuilder<R: std::default::Default> {
2477        stub: Arc<dyn super::super::stub::dynamic::Services>,
2478        request: R,
2479        options: gax::options::RequestOptions,
2480    }
2481
2482    impl<R> RequestBuilder<R>
2483    where
2484        R: std::default::Default,
2485    {
2486        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2487            Self {
2488                stub,
2489                request: R::default(),
2490                options: gax::options::RequestOptions::default(),
2491            }
2492        }
2493    }
2494
2495    /// The request builder for [Services::create_service][super::super::client::Services::create_service] calls.
2496    #[derive(Clone, Debug)]
2497    pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
2498
2499    impl CreateService {
2500        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2501            Self(RequestBuilder::new(stub))
2502        }
2503
2504        /// Sets the full request, replacing any prior values.
2505        pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
2506            self.0.request = v.into();
2507            self
2508        }
2509
2510        /// Sets all the options, replacing any prior values.
2511        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2512            self.0.options = v.into();
2513            self
2514        }
2515
2516        /// Sends the request.
2517        ///
2518        /// # Long running operations
2519        ///
2520        /// This starts, but does not poll, a longrunning operation. More information
2521        /// on [create_service][super::super::client::Services::create_service].
2522        pub async fn send(self) -> Result<longrunning::model::Operation> {
2523            (*self.0.stub)
2524                .create_service(self.0.request, self.0.options)
2525                .await
2526                .map(gax::response::Response::into_body)
2527        }
2528
2529        /// Creates a [Poller][lro::Poller] to work with `create_service`.
2530        pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
2531            type Operation = lro::Operation<crate::model::Service, crate::model::Service>;
2532            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2533            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2534
2535            let stub = self.0.stub.clone();
2536            let mut options = self.0.options.clone();
2537            options.set_retry_policy(gax::retry_policy::NeverRetry);
2538            let query = move |name| {
2539                let stub = stub.clone();
2540                let options = options.clone();
2541                async {
2542                    let op = GetOperation::new(stub)
2543                        .set_name(name)
2544                        .with_options(options)
2545                        .send()
2546                        .await?;
2547                    Ok(Operation::new(op))
2548                }
2549            };
2550
2551            let start = move || async {
2552                let op = self.send().await?;
2553                Ok(Operation::new(op))
2554            };
2555
2556            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2557        }
2558
2559        /// Sets the value of [parent][crate::model::CreateServiceRequest::parent].
2560        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2561            self.0.request.parent = v.into();
2562            self
2563        }
2564
2565        /// Sets the value of [service][crate::model::CreateServiceRequest::service].
2566        pub fn set_service<T: Into<std::option::Option<crate::model::Service>>>(
2567            mut self,
2568            v: T,
2569        ) -> Self {
2570            self.0.request.service = v.into();
2571            self
2572        }
2573
2574        /// Sets the value of [service_id][crate::model::CreateServiceRequest::service_id].
2575        pub fn set_service_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2576            self.0.request.service_id = v.into();
2577            self
2578        }
2579
2580        /// Sets the value of [validate_only][crate::model::CreateServiceRequest::validate_only].
2581        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2582            self.0.request.validate_only = v.into();
2583            self
2584        }
2585    }
2586
2587    #[doc(hidden)]
2588    impl gax::options::internal::RequestBuilder for CreateService {
2589        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2590            &mut self.0.options
2591        }
2592    }
2593
2594    /// The request builder for [Services::get_service][super::super::client::Services::get_service] calls.
2595    #[derive(Clone, Debug)]
2596    pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
2597
2598    impl GetService {
2599        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2600            Self(RequestBuilder::new(stub))
2601        }
2602
2603        /// Sets the full request, replacing any prior values.
2604        pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
2605            self.0.request = v.into();
2606            self
2607        }
2608
2609        /// Sets all the options, replacing any prior values.
2610        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2611            self.0.options = v.into();
2612            self
2613        }
2614
2615        /// Sends the request.
2616        pub async fn send(self) -> Result<crate::model::Service> {
2617            (*self.0.stub)
2618                .get_service(self.0.request, self.0.options)
2619                .await
2620                .map(gax::response::Response::into_body)
2621        }
2622
2623        /// Sets the value of [name][crate::model::GetServiceRequest::name].
2624        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2625            self.0.request.name = v.into();
2626            self
2627        }
2628    }
2629
2630    #[doc(hidden)]
2631    impl gax::options::internal::RequestBuilder for GetService {
2632        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2633            &mut self.0.options
2634        }
2635    }
2636
2637    /// The request builder for [Services::list_services][super::super::client::Services::list_services] calls.
2638    #[derive(Clone, Debug)]
2639    pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
2640
2641    impl ListServices {
2642        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2643            Self(RequestBuilder::new(stub))
2644        }
2645
2646        /// Sets the full request, replacing any prior values.
2647        pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
2648            self.0.request = v.into();
2649            self
2650        }
2651
2652        /// Sets all the options, replacing any prior values.
2653        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2654            self.0.options = v.into();
2655            self
2656        }
2657
2658        /// Sends the request.
2659        pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
2660            (*self.0.stub)
2661                .list_services(self.0.request, self.0.options)
2662                .await
2663                .map(gax::response::Response::into_body)
2664        }
2665
2666        /// Streams the responses back.
2667        pub async fn paginator(
2668            self,
2669        ) -> impl gax::paginator::Paginator<crate::model::ListServicesResponse, gax::error::Error>
2670        {
2671            use std::clone::Clone;
2672            let token = self.0.request.page_token.clone();
2673            let execute = move |token: String| {
2674                let mut builder = self.clone();
2675                builder.0.request = builder.0.request.set_page_token(token);
2676                builder.send()
2677            };
2678            gax::paginator::internal::new_paginator(token, execute)
2679        }
2680
2681        /// Sets the value of [parent][crate::model::ListServicesRequest::parent].
2682        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2683            self.0.request.parent = v.into();
2684            self
2685        }
2686
2687        /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
2688        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2689            self.0.request.page_size = v.into();
2690            self
2691        }
2692
2693        /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
2694        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2695            self.0.request.page_token = v.into();
2696            self
2697        }
2698
2699        /// Sets the value of [show_deleted][crate::model::ListServicesRequest::show_deleted].
2700        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2701            self.0.request.show_deleted = v.into();
2702            self
2703        }
2704    }
2705
2706    #[doc(hidden)]
2707    impl gax::options::internal::RequestBuilder for ListServices {
2708        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2709            &mut self.0.options
2710        }
2711    }
2712
2713    /// The request builder for [Services::update_service][super::super::client::Services::update_service] calls.
2714    #[derive(Clone, Debug)]
2715    pub struct UpdateService(RequestBuilder<crate::model::UpdateServiceRequest>);
2716
2717    impl UpdateService {
2718        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2719            Self(RequestBuilder::new(stub))
2720        }
2721
2722        /// Sets the full request, replacing any prior values.
2723        pub fn with_request<V: Into<crate::model::UpdateServiceRequest>>(mut self, v: V) -> Self {
2724            self.0.request = v.into();
2725            self
2726        }
2727
2728        /// Sets all the options, replacing any prior values.
2729        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2730            self.0.options = v.into();
2731            self
2732        }
2733
2734        /// Sends the request.
2735        ///
2736        /// # Long running operations
2737        ///
2738        /// This starts, but does not poll, a longrunning operation. More information
2739        /// on [update_service][super::super::client::Services::update_service].
2740        pub async fn send(self) -> Result<longrunning::model::Operation> {
2741            (*self.0.stub)
2742                .update_service(self.0.request, self.0.options)
2743                .await
2744                .map(gax::response::Response::into_body)
2745        }
2746
2747        /// Creates a [Poller][lro::Poller] to work with `update_service`.
2748        pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
2749            type Operation = lro::Operation<crate::model::Service, crate::model::Service>;
2750            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2751            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2752
2753            let stub = self.0.stub.clone();
2754            let mut options = self.0.options.clone();
2755            options.set_retry_policy(gax::retry_policy::NeverRetry);
2756            let query = move |name| {
2757                let stub = stub.clone();
2758                let options = options.clone();
2759                async {
2760                    let op = GetOperation::new(stub)
2761                        .set_name(name)
2762                        .with_options(options)
2763                        .send()
2764                        .await?;
2765                    Ok(Operation::new(op))
2766                }
2767            };
2768
2769            let start = move || async {
2770                let op = self.send().await?;
2771                Ok(Operation::new(op))
2772            };
2773
2774            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2775        }
2776
2777        /// Sets the value of [update_mask][crate::model::UpdateServiceRequest::update_mask].
2778        pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
2779            mut self,
2780            v: T,
2781        ) -> Self {
2782            self.0.request.update_mask = v.into();
2783            self
2784        }
2785
2786        /// Sets the value of [service][crate::model::UpdateServiceRequest::service].
2787        pub fn set_service<T: Into<std::option::Option<crate::model::Service>>>(
2788            mut self,
2789            v: T,
2790        ) -> Self {
2791            self.0.request.service = v.into();
2792            self
2793        }
2794
2795        /// Sets the value of [validate_only][crate::model::UpdateServiceRequest::validate_only].
2796        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2797            self.0.request.validate_only = v.into();
2798            self
2799        }
2800
2801        /// Sets the value of [allow_missing][crate::model::UpdateServiceRequest::allow_missing].
2802        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2803            self.0.request.allow_missing = v.into();
2804            self
2805        }
2806    }
2807
2808    #[doc(hidden)]
2809    impl gax::options::internal::RequestBuilder for UpdateService {
2810        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2811            &mut self.0.options
2812        }
2813    }
2814
2815    /// The request builder for [Services::delete_service][super::super::client::Services::delete_service] calls.
2816    #[derive(Clone, Debug)]
2817    pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
2818
2819    impl DeleteService {
2820        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2821            Self(RequestBuilder::new(stub))
2822        }
2823
2824        /// Sets the full request, replacing any prior values.
2825        pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
2826            self.0.request = v.into();
2827            self
2828        }
2829
2830        /// Sets all the options, replacing any prior values.
2831        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2832            self.0.options = v.into();
2833            self
2834        }
2835
2836        /// Sends the request.
2837        ///
2838        /// # Long running operations
2839        ///
2840        /// This starts, but does not poll, a longrunning operation. More information
2841        /// on [delete_service][super::super::client::Services::delete_service].
2842        pub async fn send(self) -> Result<longrunning::model::Operation> {
2843            (*self.0.stub)
2844                .delete_service(self.0.request, self.0.options)
2845                .await
2846                .map(gax::response::Response::into_body)
2847        }
2848
2849        /// Creates a [Poller][lro::Poller] to work with `delete_service`.
2850        pub fn poller(self) -> impl lro::Poller<crate::model::Service, crate::model::Service> {
2851            type Operation = lro::Operation<crate::model::Service, crate::model::Service>;
2852            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2853            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2854
2855            let stub = self.0.stub.clone();
2856            let mut options = self.0.options.clone();
2857            options.set_retry_policy(gax::retry_policy::NeverRetry);
2858            let query = move |name| {
2859                let stub = stub.clone();
2860                let options = options.clone();
2861                async {
2862                    let op = GetOperation::new(stub)
2863                        .set_name(name)
2864                        .with_options(options)
2865                        .send()
2866                        .await?;
2867                    Ok(Operation::new(op))
2868                }
2869            };
2870
2871            let start = move || async {
2872                let op = self.send().await?;
2873                Ok(Operation::new(op))
2874            };
2875
2876            lro::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2877        }
2878
2879        /// Sets the value of [name][crate::model::DeleteServiceRequest::name].
2880        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2881            self.0.request.name = v.into();
2882            self
2883        }
2884
2885        /// Sets the value of [validate_only][crate::model::DeleteServiceRequest::validate_only].
2886        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2887            self.0.request.validate_only = v.into();
2888            self
2889        }
2890
2891        /// Sets the value of [etag][crate::model::DeleteServiceRequest::etag].
2892        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2893            self.0.request.etag = v.into();
2894            self
2895        }
2896    }
2897
2898    #[doc(hidden)]
2899    impl gax::options::internal::RequestBuilder for DeleteService {
2900        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2901            &mut self.0.options
2902        }
2903    }
2904
2905    /// The request builder for [Services::get_iam_policy][super::super::client::Services::get_iam_policy] calls.
2906    #[derive(Clone, Debug)]
2907    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2908
2909    impl GetIamPolicy {
2910        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2911            Self(RequestBuilder::new(stub))
2912        }
2913
2914        /// Sets the full request, replacing any prior values.
2915        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2916            self.0.request = v.into();
2917            self
2918        }
2919
2920        /// Sets all the options, replacing any prior values.
2921        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2922            self.0.options = v.into();
2923            self
2924        }
2925
2926        /// Sends the request.
2927        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2928            (*self.0.stub)
2929                .get_iam_policy(self.0.request, self.0.options)
2930                .await
2931                .map(gax::response::Response::into_body)
2932        }
2933
2934        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
2935        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2936            self.0.request.resource = v.into();
2937            self
2938        }
2939
2940        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
2941        pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
2942            mut self,
2943            v: T,
2944        ) -> Self {
2945            self.0.request.options = v.into();
2946            self
2947        }
2948    }
2949
2950    #[doc(hidden)]
2951    impl gax::options::internal::RequestBuilder for GetIamPolicy {
2952        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2953            &mut self.0.options
2954        }
2955    }
2956
2957    /// The request builder for [Services::set_iam_policy][super::super::client::Services::set_iam_policy] calls.
2958    #[derive(Clone, Debug)]
2959    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2960
2961    impl SetIamPolicy {
2962        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
2963            Self(RequestBuilder::new(stub))
2964        }
2965
2966        /// Sets the full request, replacing any prior values.
2967        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2968            self.0.request = v.into();
2969            self
2970        }
2971
2972        /// Sets all the options, replacing any prior values.
2973        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2974            self.0.options = v.into();
2975            self
2976        }
2977
2978        /// Sends the request.
2979        pub async fn send(self) -> Result<iam_v1::model::Policy> {
2980            (*self.0.stub)
2981                .set_iam_policy(self.0.request, self.0.options)
2982                .await
2983                .map(gax::response::Response::into_body)
2984        }
2985
2986        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
2987        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2988            self.0.request.resource = v.into();
2989            self
2990        }
2991
2992        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
2993        pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
2994            mut self,
2995            v: T,
2996        ) -> Self {
2997            self.0.request.policy = v.into();
2998            self
2999        }
3000
3001        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
3002        pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
3003            mut self,
3004            v: T,
3005        ) -> Self {
3006            self.0.request.update_mask = v.into();
3007            self
3008        }
3009    }
3010
3011    #[doc(hidden)]
3012    impl gax::options::internal::RequestBuilder for SetIamPolicy {
3013        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3014            &mut self.0.options
3015        }
3016    }
3017
3018    /// The request builder for [Services::test_iam_permissions][super::super::client::Services::test_iam_permissions] calls.
3019    #[derive(Clone, Debug)]
3020    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
3021
3022    impl TestIamPermissions {
3023        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3024            Self(RequestBuilder::new(stub))
3025        }
3026
3027        /// Sets the full request, replacing any prior values.
3028        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
3029            mut self,
3030            v: V,
3031        ) -> Self {
3032            self.0.request = v.into();
3033            self
3034        }
3035
3036        /// Sets all the options, replacing any prior values.
3037        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3038            self.0.options = v.into();
3039            self
3040        }
3041
3042        /// Sends the request.
3043        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
3044            (*self.0.stub)
3045                .test_iam_permissions(self.0.request, self.0.options)
3046                .await
3047                .map(gax::response::Response::into_body)
3048        }
3049
3050        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
3051        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
3052            self.0.request.resource = v.into();
3053            self
3054        }
3055
3056        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
3057        pub fn set_permissions<T, V>(mut self, v: T) -> Self
3058        where
3059            T: std::iter::IntoIterator<Item = V>,
3060            V: std::convert::Into<std::string::String>,
3061        {
3062            use std::iter::Iterator;
3063            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
3064            self
3065        }
3066    }
3067
3068    #[doc(hidden)]
3069    impl gax::options::internal::RequestBuilder for TestIamPermissions {
3070        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3071            &mut self.0.options
3072        }
3073    }
3074
3075    /// The request builder for [Services::list_operations][super::super::client::Services::list_operations] calls.
3076    #[derive(Clone, Debug)]
3077    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3078
3079    impl ListOperations {
3080        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3081            Self(RequestBuilder::new(stub))
3082        }
3083
3084        /// Sets the full request, replacing any prior values.
3085        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3086            mut self,
3087            v: V,
3088        ) -> Self {
3089            self.0.request = v.into();
3090            self
3091        }
3092
3093        /// Sets all the options, replacing any prior values.
3094        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3095            self.0.options = v.into();
3096            self
3097        }
3098
3099        /// Sends the request.
3100        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3101            (*self.0.stub)
3102                .list_operations(self.0.request, self.0.options)
3103                .await
3104                .map(gax::response::Response::into_body)
3105        }
3106
3107        /// Streams the responses back.
3108        pub async fn paginator(
3109            self,
3110        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3111        {
3112            use std::clone::Clone;
3113            let token = self.0.request.page_token.clone();
3114            let execute = move |token: String| {
3115                let mut builder = self.clone();
3116                builder.0.request = builder.0.request.set_page_token(token);
3117                builder.send()
3118            };
3119            gax::paginator::internal::new_paginator(token, execute)
3120        }
3121
3122        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3123        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3124            self.0.request.name = v.into();
3125            self
3126        }
3127
3128        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3129        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3130            self.0.request.filter = v.into();
3131            self
3132        }
3133
3134        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3135        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3136            self.0.request.page_size = v.into();
3137            self
3138        }
3139
3140        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3141        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3142            self.0.request.page_token = v.into();
3143            self
3144        }
3145    }
3146
3147    #[doc(hidden)]
3148    impl gax::options::internal::RequestBuilder for ListOperations {
3149        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3150            &mut self.0.options
3151        }
3152    }
3153
3154    /// The request builder for [Services::get_operation][super::super::client::Services::get_operation] calls.
3155    #[derive(Clone, Debug)]
3156    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3157
3158    impl GetOperation {
3159        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3160            Self(RequestBuilder::new(stub))
3161        }
3162
3163        /// Sets the full request, replacing any prior values.
3164        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3165            mut self,
3166            v: V,
3167        ) -> Self {
3168            self.0.request = v.into();
3169            self
3170        }
3171
3172        /// Sets all the options, replacing any prior values.
3173        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3174            self.0.options = v.into();
3175            self
3176        }
3177
3178        /// Sends the request.
3179        pub async fn send(self) -> Result<longrunning::model::Operation> {
3180            (*self.0.stub)
3181                .get_operation(self.0.request, self.0.options)
3182                .await
3183                .map(gax::response::Response::into_body)
3184        }
3185
3186        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3187        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3188            self.0.request.name = v.into();
3189            self
3190        }
3191    }
3192
3193    #[doc(hidden)]
3194    impl gax::options::internal::RequestBuilder for GetOperation {
3195        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3196            &mut self.0.options
3197        }
3198    }
3199
3200    /// The request builder for [Services::delete_operation][super::super::client::Services::delete_operation] calls.
3201    #[derive(Clone, Debug)]
3202    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3203
3204    impl DeleteOperation {
3205        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3206            Self(RequestBuilder::new(stub))
3207        }
3208
3209        /// Sets the full request, replacing any prior values.
3210        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3211            mut self,
3212            v: V,
3213        ) -> Self {
3214            self.0.request = v.into();
3215            self
3216        }
3217
3218        /// Sets all the options, replacing any prior values.
3219        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3220            self.0.options = v.into();
3221            self
3222        }
3223
3224        /// Sends the request.
3225        pub async fn send(self) -> Result<()> {
3226            (*self.0.stub)
3227                .delete_operation(self.0.request, self.0.options)
3228                .await
3229                .map(gax::response::Response::into_body)
3230        }
3231
3232        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
3233        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3234            self.0.request.name = v.into();
3235            self
3236        }
3237    }
3238
3239    #[doc(hidden)]
3240    impl gax::options::internal::RequestBuilder for DeleteOperation {
3241        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3242            &mut self.0.options
3243        }
3244    }
3245
3246    /// The request builder for [Services::wait_operation][super::super::client::Services::wait_operation] calls.
3247    #[derive(Clone, Debug)]
3248    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
3249
3250    impl WaitOperation {
3251        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Services>) -> Self {
3252            Self(RequestBuilder::new(stub))
3253        }
3254
3255        /// Sets the full request, replacing any prior values.
3256        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
3257            mut self,
3258            v: V,
3259        ) -> Self {
3260            self.0.request = v.into();
3261            self
3262        }
3263
3264        /// Sets all the options, replacing any prior values.
3265        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3266            self.0.options = v.into();
3267            self
3268        }
3269
3270        /// Sends the request.
3271        pub async fn send(self) -> Result<longrunning::model::Operation> {
3272            (*self.0.stub)
3273                .wait_operation(self.0.request, self.0.options)
3274                .await
3275                .map(gax::response::Response::into_body)
3276        }
3277
3278        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
3279        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3280            self.0.request.name = v.into();
3281            self
3282        }
3283
3284        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
3285        pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
3286            self.0.request.timeout = v.into();
3287            self
3288        }
3289    }
3290
3291    #[doc(hidden)]
3292    impl gax::options::internal::RequestBuilder for WaitOperation {
3293        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3294            &mut self.0.options
3295        }
3296    }
3297}
3298
3299pub mod tasks {
3300    use crate::Result;
3301    use std::sync::Arc;
3302
3303    /// A builder for [Tasks][super::super::client::Tasks].
3304    ///
3305    /// ```
3306    /// # tokio_test::block_on(async {
3307    /// # use google_cloud_run_v2::*;
3308    /// # use builder::tasks::ClientBuilder;
3309    /// # use client::Tasks;
3310    /// let builder : ClientBuilder = Tasks::builder();
3311    /// let client = builder
3312    ///     .with_endpoint("https://run.googleapis.com")
3313    ///     .build().await?;
3314    /// # gax::Result::<()>::Ok(()) });
3315    /// ```
3316    pub type ClientBuilder =
3317        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3318
3319    pub(crate) mod client {
3320        use super::super::super::client::Tasks;
3321        pub struct Factory;
3322        impl gax::client_builder::internal::ClientFactory for Factory {
3323            type Client = Tasks;
3324            type Credentials = gaxi::options::Credentials;
3325            async fn build(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
3326                Self::Client::new(config).await
3327            }
3328        }
3329    }
3330
3331    /// Common implementation for [super::super::client::Tasks] request builders.
3332    #[derive(Clone, Debug)]
3333    pub(crate) struct RequestBuilder<R: std::default::Default> {
3334        stub: Arc<dyn super::super::stub::dynamic::Tasks>,
3335        request: R,
3336        options: gax::options::RequestOptions,
3337    }
3338
3339    impl<R> RequestBuilder<R>
3340    where
3341        R: std::default::Default,
3342    {
3343        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3344            Self {
3345                stub,
3346                request: R::default(),
3347                options: gax::options::RequestOptions::default(),
3348            }
3349        }
3350    }
3351
3352    /// The request builder for [Tasks::get_task][super::super::client::Tasks::get_task] calls.
3353    #[derive(Clone, Debug)]
3354    pub struct GetTask(RequestBuilder<crate::model::GetTaskRequest>);
3355
3356    impl GetTask {
3357        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3358            Self(RequestBuilder::new(stub))
3359        }
3360
3361        /// Sets the full request, replacing any prior values.
3362        pub fn with_request<V: Into<crate::model::GetTaskRequest>>(mut self, v: V) -> Self {
3363            self.0.request = v.into();
3364            self
3365        }
3366
3367        /// Sets all the options, replacing any prior values.
3368        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3369            self.0.options = v.into();
3370            self
3371        }
3372
3373        /// Sends the request.
3374        pub async fn send(self) -> Result<crate::model::Task> {
3375            (*self.0.stub)
3376                .get_task(self.0.request, self.0.options)
3377                .await
3378                .map(gax::response::Response::into_body)
3379        }
3380
3381        /// Sets the value of [name][crate::model::GetTaskRequest::name].
3382        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3383            self.0.request.name = v.into();
3384            self
3385        }
3386    }
3387
3388    #[doc(hidden)]
3389    impl gax::options::internal::RequestBuilder for GetTask {
3390        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3391            &mut self.0.options
3392        }
3393    }
3394
3395    /// The request builder for [Tasks::list_tasks][super::super::client::Tasks::list_tasks] calls.
3396    #[derive(Clone, Debug)]
3397    pub struct ListTasks(RequestBuilder<crate::model::ListTasksRequest>);
3398
3399    impl ListTasks {
3400        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3401            Self(RequestBuilder::new(stub))
3402        }
3403
3404        /// Sets the full request, replacing any prior values.
3405        pub fn with_request<V: Into<crate::model::ListTasksRequest>>(mut self, v: V) -> Self {
3406            self.0.request = v.into();
3407            self
3408        }
3409
3410        /// Sets all the options, replacing any prior values.
3411        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3412            self.0.options = v.into();
3413            self
3414        }
3415
3416        /// Sends the request.
3417        pub async fn send(self) -> Result<crate::model::ListTasksResponse> {
3418            (*self.0.stub)
3419                .list_tasks(self.0.request, self.0.options)
3420                .await
3421                .map(gax::response::Response::into_body)
3422        }
3423
3424        /// Streams the responses back.
3425        pub async fn paginator(
3426            self,
3427        ) -> impl gax::paginator::Paginator<crate::model::ListTasksResponse, gax::error::Error>
3428        {
3429            use std::clone::Clone;
3430            let token = self.0.request.page_token.clone();
3431            let execute = move |token: String| {
3432                let mut builder = self.clone();
3433                builder.0.request = builder.0.request.set_page_token(token);
3434                builder.send()
3435            };
3436            gax::paginator::internal::new_paginator(token, execute)
3437        }
3438
3439        /// Sets the value of [parent][crate::model::ListTasksRequest::parent].
3440        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3441            self.0.request.parent = v.into();
3442            self
3443        }
3444
3445        /// Sets the value of [page_size][crate::model::ListTasksRequest::page_size].
3446        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3447            self.0.request.page_size = v.into();
3448            self
3449        }
3450
3451        /// Sets the value of [page_token][crate::model::ListTasksRequest::page_token].
3452        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3453            self.0.request.page_token = v.into();
3454            self
3455        }
3456
3457        /// Sets the value of [show_deleted][crate::model::ListTasksRequest::show_deleted].
3458        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
3459            self.0.request.show_deleted = v.into();
3460            self
3461        }
3462    }
3463
3464    #[doc(hidden)]
3465    impl gax::options::internal::RequestBuilder for ListTasks {
3466        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3467            &mut self.0.options
3468        }
3469    }
3470
3471    /// The request builder for [Tasks::list_operations][super::super::client::Tasks::list_operations] calls.
3472    #[derive(Clone, Debug)]
3473    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3474
3475    impl ListOperations {
3476        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3477            Self(RequestBuilder::new(stub))
3478        }
3479
3480        /// Sets the full request, replacing any prior values.
3481        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3482            mut self,
3483            v: V,
3484        ) -> Self {
3485            self.0.request = v.into();
3486            self
3487        }
3488
3489        /// Sets all the options, replacing any prior values.
3490        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3491            self.0.options = v.into();
3492            self
3493        }
3494
3495        /// Sends the request.
3496        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3497            (*self.0.stub)
3498                .list_operations(self.0.request, self.0.options)
3499                .await
3500                .map(gax::response::Response::into_body)
3501        }
3502
3503        /// Streams the responses back.
3504        pub async fn paginator(
3505            self,
3506        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3507        {
3508            use std::clone::Clone;
3509            let token = self.0.request.page_token.clone();
3510            let execute = move |token: String| {
3511                let mut builder = self.clone();
3512                builder.0.request = builder.0.request.set_page_token(token);
3513                builder.send()
3514            };
3515            gax::paginator::internal::new_paginator(token, execute)
3516        }
3517
3518        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
3519        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3520            self.0.request.name = v.into();
3521            self
3522        }
3523
3524        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
3525        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3526            self.0.request.filter = v.into();
3527            self
3528        }
3529
3530        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
3531        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3532            self.0.request.page_size = v.into();
3533            self
3534        }
3535
3536        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
3537        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3538            self.0.request.page_token = v.into();
3539            self
3540        }
3541    }
3542
3543    #[doc(hidden)]
3544    impl gax::options::internal::RequestBuilder for ListOperations {
3545        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3546            &mut self.0.options
3547        }
3548    }
3549
3550    /// The request builder for [Tasks::get_operation][super::super::client::Tasks::get_operation] calls.
3551    #[derive(Clone, Debug)]
3552    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3553
3554    impl GetOperation {
3555        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3556            Self(RequestBuilder::new(stub))
3557        }
3558
3559        /// Sets the full request, replacing any prior values.
3560        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3561            mut self,
3562            v: V,
3563        ) -> Self {
3564            self.0.request = v.into();
3565            self
3566        }
3567
3568        /// Sets all the options, replacing any prior values.
3569        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3570            self.0.options = v.into();
3571            self
3572        }
3573
3574        /// Sends the request.
3575        pub async fn send(self) -> Result<longrunning::model::Operation> {
3576            (*self.0.stub)
3577                .get_operation(self.0.request, self.0.options)
3578                .await
3579                .map(gax::response::Response::into_body)
3580        }
3581
3582        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
3583        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3584            self.0.request.name = v.into();
3585            self
3586        }
3587    }
3588
3589    #[doc(hidden)]
3590    impl gax::options::internal::RequestBuilder for GetOperation {
3591        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3592            &mut self.0.options
3593        }
3594    }
3595
3596    /// The request builder for [Tasks::delete_operation][super::super::client::Tasks::delete_operation] calls.
3597    #[derive(Clone, Debug)]
3598    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
3599
3600    impl DeleteOperation {
3601        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3602            Self(RequestBuilder::new(stub))
3603        }
3604
3605        /// Sets the full request, replacing any prior values.
3606        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
3607            mut self,
3608            v: V,
3609        ) -> Self {
3610            self.0.request = v.into();
3611            self
3612        }
3613
3614        /// Sets all the options, replacing any prior values.
3615        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3616            self.0.options = v.into();
3617            self
3618        }
3619
3620        /// Sends the request.
3621        pub async fn send(self) -> Result<()> {
3622            (*self.0.stub)
3623                .delete_operation(self.0.request, self.0.options)
3624                .await
3625                .map(gax::response::Response::into_body)
3626        }
3627
3628        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
3629        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3630            self.0.request.name = v.into();
3631            self
3632        }
3633    }
3634
3635    #[doc(hidden)]
3636    impl gax::options::internal::RequestBuilder for DeleteOperation {
3637        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3638            &mut self.0.options
3639        }
3640    }
3641
3642    /// The request builder for [Tasks::wait_operation][super::super::client::Tasks::wait_operation] calls.
3643    #[derive(Clone, Debug)]
3644    pub struct WaitOperation(RequestBuilder<longrunning::model::WaitOperationRequest>);
3645
3646    impl WaitOperation {
3647        pub(crate) fn new(stub: Arc<dyn super::super::stub::dynamic::Tasks>) -> Self {
3648            Self(RequestBuilder::new(stub))
3649        }
3650
3651        /// Sets the full request, replacing any prior values.
3652        pub fn with_request<V: Into<longrunning::model::WaitOperationRequest>>(
3653            mut self,
3654            v: V,
3655        ) -> Self {
3656            self.0.request = v.into();
3657            self
3658        }
3659
3660        /// Sets all the options, replacing any prior values.
3661        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3662            self.0.options = v.into();
3663            self
3664        }
3665
3666        /// Sends the request.
3667        pub async fn send(self) -> Result<longrunning::model::Operation> {
3668            (*self.0.stub)
3669                .wait_operation(self.0.request, self.0.options)
3670                .await
3671                .map(gax::response::Response::into_body)
3672        }
3673
3674        /// Sets the value of [name][longrunning::model::WaitOperationRequest::name].
3675        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3676            self.0.request.name = v.into();
3677            self
3678        }
3679
3680        /// Sets the value of [timeout][longrunning::model::WaitOperationRequest::timeout].
3681        pub fn set_timeout<T: Into<std::option::Option<wkt::Duration>>>(mut self, v: T) -> Self {
3682            self.0.request.timeout = v.into();
3683            self
3684        }
3685    }
3686
3687    #[doc(hidden)]
3688    impl gax::options::internal::RequestBuilder for WaitOperation {
3689        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3690            &mut self.0.options
3691        }
3692    }
3693}