Skip to main content

google_cloud_functions_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 function_service {
18    use crate::Result;
19
20    /// A builder for [FunctionService][crate::client::FunctionService].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_functions_v2::*;
25    /// # use builder::function_service::ClientBuilder;
26    /// # use client::FunctionService;
27    /// let builder : ClientBuilder = FunctionService::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://cloudfunctions.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder =
34        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::FunctionService;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = FunctionService;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> gax::client_builder::Result<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::FunctionService] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
55        request: R,
56        options: gax::options::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(
64            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
65        ) -> Self {
66            Self {
67                stub,
68                request: R::default(),
69                options: gax::options::RequestOptions::default(),
70            }
71        }
72    }
73
74    /// The request builder for [FunctionService::get_function][crate::client::FunctionService::get_function] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_functions_v2::builder::function_service::GetFunction;
79    /// # async fn sample() -> gax::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> GetFunction {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[derive(Clone, Debug)]
91    pub struct GetFunction(RequestBuilder<crate::model::GetFunctionRequest>);
92
93    impl GetFunction {
94        pub(crate) fn new(
95            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
96        ) -> Self {
97            Self(RequestBuilder::new(stub))
98        }
99
100        /// Sets the full request, replacing any prior values.
101        pub fn with_request<V: Into<crate::model::GetFunctionRequest>>(mut self, v: V) -> Self {
102            self.0.request = v.into();
103            self
104        }
105
106        /// Sets all the options, replacing any prior values.
107        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
108            self.0.options = v.into();
109            self
110        }
111
112        /// Sends the request.
113        pub async fn send(self) -> Result<crate::model::Function> {
114            (*self.0.stub)
115                .get_function(self.0.request, self.0.options)
116                .await
117                .map(gax::response::Response::into_body)
118        }
119
120        /// Sets the value of [name][crate::model::GetFunctionRequest::name].
121        ///
122        /// This is a **required** field for requests.
123        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
124            self.0.request.name = v.into();
125            self
126        }
127
128        /// Sets the value of [revision][crate::model::GetFunctionRequest::revision].
129        pub fn set_revision<T: Into<std::string::String>>(mut self, v: T) -> Self {
130            self.0.request.revision = v.into();
131            self
132        }
133    }
134
135    #[doc(hidden)]
136    impl gax::options::internal::RequestBuilder for GetFunction {
137        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
138            &mut self.0.options
139        }
140    }
141
142    /// The request builder for [FunctionService::list_functions][crate::client::FunctionService::list_functions] calls.
143    ///
144    /// # Example
145    /// ```
146    /// # use google_cloud_functions_v2::builder::function_service::ListFunctions;
147    /// # async fn sample() -> gax::Result<()> {
148    /// use gax::paginator::ItemPaginator;
149    ///
150    /// let builder = prepare_request_builder();
151    /// let mut items = builder.by_item();
152    /// while let Some(result) = items.next().await {
153    ///   let item = result?;
154    /// }
155    /// # Ok(()) }
156    ///
157    /// fn prepare_request_builder() -> ListFunctions {
158    ///   # panic!();
159    ///   // ... details omitted ...
160    /// }
161    /// ```
162    #[derive(Clone, Debug)]
163    pub struct ListFunctions(RequestBuilder<crate::model::ListFunctionsRequest>);
164
165    impl ListFunctions {
166        pub(crate) fn new(
167            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
168        ) -> Self {
169            Self(RequestBuilder::new(stub))
170        }
171
172        /// Sets the full request, replacing any prior values.
173        pub fn with_request<V: Into<crate::model::ListFunctionsRequest>>(mut self, v: V) -> Self {
174            self.0.request = v.into();
175            self
176        }
177
178        /// Sets all the options, replacing any prior values.
179        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
180            self.0.options = v.into();
181            self
182        }
183
184        /// Sends the request.
185        pub async fn send(self) -> Result<crate::model::ListFunctionsResponse> {
186            (*self.0.stub)
187                .list_functions(self.0.request, self.0.options)
188                .await
189                .map(gax::response::Response::into_body)
190        }
191
192        /// Streams each page in the collection.
193        pub fn by_page(
194            self,
195        ) -> impl gax::paginator::Paginator<crate::model::ListFunctionsResponse, gax::error::Error>
196        {
197            use std::clone::Clone;
198            let token = self.0.request.page_token.clone();
199            let execute = move |token: String| {
200                let mut builder = self.clone();
201                builder.0.request = builder.0.request.set_page_token(token);
202                builder.send()
203            };
204            gax::paginator::internal::new_paginator(token, execute)
205        }
206
207        /// Streams each item in the collection.
208        pub fn by_item(
209            self,
210        ) -> impl gax::paginator::ItemPaginator<crate::model::ListFunctionsResponse, gax::error::Error>
211        {
212            use gax::paginator::Paginator;
213            self.by_page().items()
214        }
215
216        /// Sets the value of [parent][crate::model::ListFunctionsRequest::parent].
217        ///
218        /// This is a **required** field for requests.
219        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
220            self.0.request.parent = v.into();
221            self
222        }
223
224        /// Sets the value of [page_size][crate::model::ListFunctionsRequest::page_size].
225        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
226            self.0.request.page_size = v.into();
227            self
228        }
229
230        /// Sets the value of [page_token][crate::model::ListFunctionsRequest::page_token].
231        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
232            self.0.request.page_token = v.into();
233            self
234        }
235
236        /// Sets the value of [filter][crate::model::ListFunctionsRequest::filter].
237        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
238            self.0.request.filter = v.into();
239            self
240        }
241
242        /// Sets the value of [order_by][crate::model::ListFunctionsRequest::order_by].
243        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
244            self.0.request.order_by = v.into();
245            self
246        }
247    }
248
249    #[doc(hidden)]
250    impl gax::options::internal::RequestBuilder for ListFunctions {
251        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
252            &mut self.0.options
253        }
254    }
255
256    /// The request builder for [FunctionService::create_function][crate::client::FunctionService::create_function] calls.
257    ///
258    /// # Example
259    /// ```
260    /// # use google_cloud_functions_v2::builder::function_service::CreateFunction;
261    /// # async fn sample() -> gax::Result<()> {
262    /// use lro::Poller;
263    ///
264    /// let builder = prepare_request_builder();
265    /// let response = builder.poller().until_done().await?;
266    /// # Ok(()) }
267    ///
268    /// fn prepare_request_builder() -> CreateFunction {
269    ///   # panic!();
270    ///   // ... details omitted ...
271    /// }
272    /// ```
273    #[derive(Clone, Debug)]
274    pub struct CreateFunction(RequestBuilder<crate::model::CreateFunctionRequest>);
275
276    impl CreateFunction {
277        pub(crate) fn new(
278            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
279        ) -> Self {
280            Self(RequestBuilder::new(stub))
281        }
282
283        /// Sets the full request, replacing any prior values.
284        pub fn with_request<V: Into<crate::model::CreateFunctionRequest>>(mut self, v: V) -> Self {
285            self.0.request = v.into();
286            self
287        }
288
289        /// Sets all the options, replacing any prior values.
290        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
291            self.0.options = v.into();
292            self
293        }
294
295        /// Sends the request.
296        ///
297        /// # Long running operations
298        ///
299        /// This starts, but does not poll, a longrunning operation. More information
300        /// on [create_function][crate::client::FunctionService::create_function].
301        pub async fn send(self) -> Result<longrunning::model::Operation> {
302            (*self.0.stub)
303                .create_function(self.0.request, self.0.options)
304                .await
305                .map(gax::response::Response::into_body)
306        }
307
308        /// Creates a [Poller][lro::Poller] to work with `create_function`.
309        pub fn poller(
310            self,
311        ) -> impl lro::Poller<crate::model::Function, crate::model::OperationMetadata> {
312            type Operation =
313                lro::internal::Operation<crate::model::Function, crate::model::OperationMetadata>;
314            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
315            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
316
317            let stub = self.0.stub.clone();
318            let mut options = self.0.options.clone();
319            options.set_retry_policy(gax::retry_policy::NeverRetry);
320            let query = move |name| {
321                let stub = stub.clone();
322                let options = options.clone();
323                async {
324                    let op = GetOperation::new(stub)
325                        .set_name(name)
326                        .with_options(options)
327                        .send()
328                        .await?;
329                    Ok(Operation::new(op))
330                }
331            };
332
333            let start = move || async {
334                let op = self.send().await?;
335                Ok(Operation::new(op))
336            };
337
338            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
339        }
340
341        /// Sets the value of [parent][crate::model::CreateFunctionRequest::parent].
342        ///
343        /// This is a **required** field for requests.
344        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
345            self.0.request.parent = v.into();
346            self
347        }
348
349        /// Sets the value of [function][crate::model::CreateFunctionRequest::function].
350        ///
351        /// This is a **required** field for requests.
352        pub fn set_function<T>(mut self, v: T) -> Self
353        where
354            T: std::convert::Into<crate::model::Function>,
355        {
356            self.0.request.function = std::option::Option::Some(v.into());
357            self
358        }
359
360        /// Sets or clears the value of [function][crate::model::CreateFunctionRequest::function].
361        ///
362        /// This is a **required** field for requests.
363        pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
364        where
365            T: std::convert::Into<crate::model::Function>,
366        {
367            self.0.request.function = v.map(|x| x.into());
368            self
369        }
370
371        /// Sets the value of [function_id][crate::model::CreateFunctionRequest::function_id].
372        pub fn set_function_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
373            self.0.request.function_id = v.into();
374            self
375        }
376    }
377
378    #[doc(hidden)]
379    impl gax::options::internal::RequestBuilder for CreateFunction {
380        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
381            &mut self.0.options
382        }
383    }
384
385    /// The request builder for [FunctionService::update_function][crate::client::FunctionService::update_function] calls.
386    ///
387    /// # Example
388    /// ```
389    /// # use google_cloud_functions_v2::builder::function_service::UpdateFunction;
390    /// # async fn sample() -> gax::Result<()> {
391    /// use lro::Poller;
392    ///
393    /// let builder = prepare_request_builder();
394    /// let response = builder.poller().until_done().await?;
395    /// # Ok(()) }
396    ///
397    /// fn prepare_request_builder() -> UpdateFunction {
398    ///   # panic!();
399    ///   // ... details omitted ...
400    /// }
401    /// ```
402    #[derive(Clone, Debug)]
403    pub struct UpdateFunction(RequestBuilder<crate::model::UpdateFunctionRequest>);
404
405    impl UpdateFunction {
406        pub(crate) fn new(
407            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
408        ) -> Self {
409            Self(RequestBuilder::new(stub))
410        }
411
412        /// Sets the full request, replacing any prior values.
413        pub fn with_request<V: Into<crate::model::UpdateFunctionRequest>>(mut self, v: V) -> Self {
414            self.0.request = v.into();
415            self
416        }
417
418        /// Sets all the options, replacing any prior values.
419        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
420            self.0.options = v.into();
421            self
422        }
423
424        /// Sends the request.
425        ///
426        /// # Long running operations
427        ///
428        /// This starts, but does not poll, a longrunning operation. More information
429        /// on [update_function][crate::client::FunctionService::update_function].
430        pub async fn send(self) -> Result<longrunning::model::Operation> {
431            (*self.0.stub)
432                .update_function(self.0.request, self.0.options)
433                .await
434                .map(gax::response::Response::into_body)
435        }
436
437        /// Creates a [Poller][lro::Poller] to work with `update_function`.
438        pub fn poller(
439            self,
440        ) -> impl lro::Poller<crate::model::Function, crate::model::OperationMetadata> {
441            type Operation =
442                lro::internal::Operation<crate::model::Function, crate::model::OperationMetadata>;
443            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
444            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
445
446            let stub = self.0.stub.clone();
447            let mut options = self.0.options.clone();
448            options.set_retry_policy(gax::retry_policy::NeverRetry);
449            let query = move |name| {
450                let stub = stub.clone();
451                let options = options.clone();
452                async {
453                    let op = GetOperation::new(stub)
454                        .set_name(name)
455                        .with_options(options)
456                        .send()
457                        .await?;
458                    Ok(Operation::new(op))
459                }
460            };
461
462            let start = move || async {
463                let op = self.send().await?;
464                Ok(Operation::new(op))
465            };
466
467            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
468        }
469
470        /// Sets the value of [function][crate::model::UpdateFunctionRequest::function].
471        ///
472        /// This is a **required** field for requests.
473        pub fn set_function<T>(mut self, v: T) -> Self
474        where
475            T: std::convert::Into<crate::model::Function>,
476        {
477            self.0.request.function = std::option::Option::Some(v.into());
478            self
479        }
480
481        /// Sets or clears the value of [function][crate::model::UpdateFunctionRequest::function].
482        ///
483        /// This is a **required** field for requests.
484        pub fn set_or_clear_function<T>(mut self, v: std::option::Option<T>) -> Self
485        where
486            T: std::convert::Into<crate::model::Function>,
487        {
488            self.0.request.function = v.map(|x| x.into());
489            self
490        }
491
492        /// Sets the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
493        pub fn set_update_mask<T>(mut self, v: T) -> Self
494        where
495            T: std::convert::Into<wkt::FieldMask>,
496        {
497            self.0.request.update_mask = std::option::Option::Some(v.into());
498            self
499        }
500
501        /// Sets or clears the value of [update_mask][crate::model::UpdateFunctionRequest::update_mask].
502        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
503        where
504            T: std::convert::Into<wkt::FieldMask>,
505        {
506            self.0.request.update_mask = v.map(|x| x.into());
507            self
508        }
509    }
510
511    #[doc(hidden)]
512    impl gax::options::internal::RequestBuilder for UpdateFunction {
513        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
514            &mut self.0.options
515        }
516    }
517
518    /// The request builder for [FunctionService::delete_function][crate::client::FunctionService::delete_function] calls.
519    ///
520    /// # Example
521    /// ```
522    /// # use google_cloud_functions_v2::builder::function_service::DeleteFunction;
523    /// # async fn sample() -> gax::Result<()> {
524    /// use lro::Poller;
525    ///
526    /// let builder = prepare_request_builder();
527    /// let response = builder.poller().until_done().await?;
528    /// # Ok(()) }
529    ///
530    /// fn prepare_request_builder() -> DeleteFunction {
531    ///   # panic!();
532    ///   // ... details omitted ...
533    /// }
534    /// ```
535    #[derive(Clone, Debug)]
536    pub struct DeleteFunction(RequestBuilder<crate::model::DeleteFunctionRequest>);
537
538    impl DeleteFunction {
539        pub(crate) fn new(
540            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
541        ) -> Self {
542            Self(RequestBuilder::new(stub))
543        }
544
545        /// Sets the full request, replacing any prior values.
546        pub fn with_request<V: Into<crate::model::DeleteFunctionRequest>>(mut self, v: V) -> Self {
547            self.0.request = v.into();
548            self
549        }
550
551        /// Sets all the options, replacing any prior values.
552        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
553            self.0.options = v.into();
554            self
555        }
556
557        /// Sends the request.
558        ///
559        /// # Long running operations
560        ///
561        /// This starts, but does not poll, a longrunning operation. More information
562        /// on [delete_function][crate::client::FunctionService::delete_function].
563        pub async fn send(self) -> Result<longrunning::model::Operation> {
564            (*self.0.stub)
565                .delete_function(self.0.request, self.0.options)
566                .await
567                .map(gax::response::Response::into_body)
568        }
569
570        /// Creates a [Poller][lro::Poller] to work with `delete_function`.
571        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
572            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
573            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
574            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
575
576            let stub = self.0.stub.clone();
577            let mut options = self.0.options.clone();
578            options.set_retry_policy(gax::retry_policy::NeverRetry);
579            let query = move |name| {
580                let stub = stub.clone();
581                let options = options.clone();
582                async {
583                    let op = GetOperation::new(stub)
584                        .set_name(name)
585                        .with_options(options)
586                        .send()
587                        .await?;
588                    Ok(Operation::new(op))
589                }
590            };
591
592            let start = move || async {
593                let op = self.send().await?;
594                Ok(Operation::new(op))
595            };
596
597            lro::internal::new_unit_response_poller(
598                polling_error_policy,
599                polling_backoff_policy,
600                start,
601                query,
602            )
603        }
604
605        /// Sets the value of [name][crate::model::DeleteFunctionRequest::name].
606        ///
607        /// This is a **required** field for requests.
608        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
609            self.0.request.name = v.into();
610            self
611        }
612    }
613
614    #[doc(hidden)]
615    impl gax::options::internal::RequestBuilder for DeleteFunction {
616        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
617            &mut self.0.options
618        }
619    }
620
621    /// The request builder for [FunctionService::generate_upload_url][crate::client::FunctionService::generate_upload_url] calls.
622    ///
623    /// # Example
624    /// ```
625    /// # use google_cloud_functions_v2::builder::function_service::GenerateUploadUrl;
626    /// # async fn sample() -> gax::Result<()> {
627    ///
628    /// let builder = prepare_request_builder();
629    /// let response = builder.send().await?;
630    /// # Ok(()) }
631    ///
632    /// fn prepare_request_builder() -> GenerateUploadUrl {
633    ///   # panic!();
634    ///   // ... details omitted ...
635    /// }
636    /// ```
637    #[derive(Clone, Debug)]
638    pub struct GenerateUploadUrl(RequestBuilder<crate::model::GenerateUploadUrlRequest>);
639
640    impl GenerateUploadUrl {
641        pub(crate) fn new(
642            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
643        ) -> Self {
644            Self(RequestBuilder::new(stub))
645        }
646
647        /// Sets the full request, replacing any prior values.
648        pub fn with_request<V: Into<crate::model::GenerateUploadUrlRequest>>(
649            mut self,
650            v: V,
651        ) -> Self {
652            self.0.request = v.into();
653            self
654        }
655
656        /// Sets all the options, replacing any prior values.
657        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
658            self.0.options = v.into();
659            self
660        }
661
662        /// Sends the request.
663        pub async fn send(self) -> Result<crate::model::GenerateUploadUrlResponse> {
664            (*self.0.stub)
665                .generate_upload_url(self.0.request, self.0.options)
666                .await
667                .map(gax::response::Response::into_body)
668        }
669
670        /// Sets the value of [parent][crate::model::GenerateUploadUrlRequest::parent].
671        ///
672        /// This is a **required** field for requests.
673        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
674            self.0.request.parent = v.into();
675            self
676        }
677
678        /// Sets the value of [kms_key_name][crate::model::GenerateUploadUrlRequest::kms_key_name].
679        pub fn set_kms_key_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
680            self.0.request.kms_key_name = v.into();
681            self
682        }
683
684        /// Sets the value of [environment][crate::model::GenerateUploadUrlRequest::environment].
685        pub fn set_environment<T: Into<crate::model::Environment>>(mut self, v: T) -> Self {
686            self.0.request.environment = v.into();
687            self
688        }
689    }
690
691    #[doc(hidden)]
692    impl gax::options::internal::RequestBuilder for GenerateUploadUrl {
693        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
694            &mut self.0.options
695        }
696    }
697
698    /// The request builder for [FunctionService::generate_download_url][crate::client::FunctionService::generate_download_url] calls.
699    ///
700    /// # Example
701    /// ```
702    /// # use google_cloud_functions_v2::builder::function_service::GenerateDownloadUrl;
703    /// # async fn sample() -> gax::Result<()> {
704    ///
705    /// let builder = prepare_request_builder();
706    /// let response = builder.send().await?;
707    /// # Ok(()) }
708    ///
709    /// fn prepare_request_builder() -> GenerateDownloadUrl {
710    ///   # panic!();
711    ///   // ... details omitted ...
712    /// }
713    /// ```
714    #[derive(Clone, Debug)]
715    pub struct GenerateDownloadUrl(RequestBuilder<crate::model::GenerateDownloadUrlRequest>);
716
717    impl GenerateDownloadUrl {
718        pub(crate) fn new(
719            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
720        ) -> Self {
721            Self(RequestBuilder::new(stub))
722        }
723
724        /// Sets the full request, replacing any prior values.
725        pub fn with_request<V: Into<crate::model::GenerateDownloadUrlRequest>>(
726            mut self,
727            v: V,
728        ) -> Self {
729            self.0.request = v.into();
730            self
731        }
732
733        /// Sets all the options, replacing any prior values.
734        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
735            self.0.options = v.into();
736            self
737        }
738
739        /// Sends the request.
740        pub async fn send(self) -> Result<crate::model::GenerateDownloadUrlResponse> {
741            (*self.0.stub)
742                .generate_download_url(self.0.request, self.0.options)
743                .await
744                .map(gax::response::Response::into_body)
745        }
746
747        /// Sets the value of [name][crate::model::GenerateDownloadUrlRequest::name].
748        ///
749        /// This is a **required** field for requests.
750        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
751            self.0.request.name = v.into();
752            self
753        }
754    }
755
756    #[doc(hidden)]
757    impl gax::options::internal::RequestBuilder for GenerateDownloadUrl {
758        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
759            &mut self.0.options
760        }
761    }
762
763    /// The request builder for [FunctionService::list_runtimes][crate::client::FunctionService::list_runtimes] calls.
764    ///
765    /// # Example
766    /// ```
767    /// # use google_cloud_functions_v2::builder::function_service::ListRuntimes;
768    /// # async fn sample() -> gax::Result<()> {
769    ///
770    /// let builder = prepare_request_builder();
771    /// let response = builder.send().await?;
772    /// # Ok(()) }
773    ///
774    /// fn prepare_request_builder() -> ListRuntimes {
775    ///   # panic!();
776    ///   // ... details omitted ...
777    /// }
778    /// ```
779    #[derive(Clone, Debug)]
780    pub struct ListRuntimes(RequestBuilder<crate::model::ListRuntimesRequest>);
781
782    impl ListRuntimes {
783        pub(crate) fn new(
784            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
785        ) -> Self {
786            Self(RequestBuilder::new(stub))
787        }
788
789        /// Sets the full request, replacing any prior values.
790        pub fn with_request<V: Into<crate::model::ListRuntimesRequest>>(mut self, v: V) -> Self {
791            self.0.request = v.into();
792            self
793        }
794
795        /// Sets all the options, replacing any prior values.
796        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
797            self.0.options = v.into();
798            self
799        }
800
801        /// Sends the request.
802        pub async fn send(self) -> Result<crate::model::ListRuntimesResponse> {
803            (*self.0.stub)
804                .list_runtimes(self.0.request, self.0.options)
805                .await
806                .map(gax::response::Response::into_body)
807        }
808
809        /// Sets the value of [parent][crate::model::ListRuntimesRequest::parent].
810        ///
811        /// This is a **required** field for requests.
812        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
813            self.0.request.parent = v.into();
814            self
815        }
816
817        /// Sets the value of [filter][crate::model::ListRuntimesRequest::filter].
818        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
819            self.0.request.filter = v.into();
820            self
821        }
822    }
823
824    #[doc(hidden)]
825    impl gax::options::internal::RequestBuilder for ListRuntimes {
826        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
827            &mut self.0.options
828        }
829    }
830
831    /// The request builder for [FunctionService::list_locations][crate::client::FunctionService::list_locations] calls.
832    ///
833    /// # Example
834    /// ```
835    /// # use google_cloud_functions_v2::builder::function_service::ListLocations;
836    /// # async fn sample() -> gax::Result<()> {
837    /// use gax::paginator::ItemPaginator;
838    ///
839    /// let builder = prepare_request_builder();
840    /// let mut items = builder.by_item();
841    /// while let Some(result) = items.next().await {
842    ///   let item = result?;
843    /// }
844    /// # Ok(()) }
845    ///
846    /// fn prepare_request_builder() -> ListLocations {
847    ///   # panic!();
848    ///   // ... details omitted ...
849    /// }
850    /// ```
851    #[derive(Clone, Debug)]
852    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
853
854    impl ListLocations {
855        pub(crate) fn new(
856            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
857        ) -> Self {
858            Self(RequestBuilder::new(stub))
859        }
860
861        /// Sets the full request, replacing any prior values.
862        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
863            mut self,
864            v: V,
865        ) -> Self {
866            self.0.request = v.into();
867            self
868        }
869
870        /// Sets all the options, replacing any prior values.
871        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
872            self.0.options = v.into();
873            self
874        }
875
876        /// Sends the request.
877        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
878            (*self.0.stub)
879                .list_locations(self.0.request, self.0.options)
880                .await
881                .map(gax::response::Response::into_body)
882        }
883
884        /// Streams each page in the collection.
885        pub fn by_page(
886            self,
887        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
888        {
889            use std::clone::Clone;
890            let token = self.0.request.page_token.clone();
891            let execute = move |token: String| {
892                let mut builder = self.clone();
893                builder.0.request = builder.0.request.set_page_token(token);
894                builder.send()
895            };
896            gax::paginator::internal::new_paginator(token, execute)
897        }
898
899        /// Streams each item in the collection.
900        pub fn by_item(
901            self,
902        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
903        {
904            use gax::paginator::Paginator;
905            self.by_page().items()
906        }
907
908        /// Sets the value of [name][location::model::ListLocationsRequest::name].
909        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
910            self.0.request.name = v.into();
911            self
912        }
913
914        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
915        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
916            self.0.request.filter = v.into();
917            self
918        }
919
920        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
921        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
922            self.0.request.page_size = v.into();
923            self
924        }
925
926        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
927        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
928            self.0.request.page_token = v.into();
929            self
930        }
931    }
932
933    #[doc(hidden)]
934    impl gax::options::internal::RequestBuilder for ListLocations {
935        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
936            &mut self.0.options
937        }
938    }
939
940    /// The request builder for [FunctionService::set_iam_policy][crate::client::FunctionService::set_iam_policy] calls.
941    ///
942    /// # Example
943    /// ```
944    /// # use google_cloud_functions_v2::builder::function_service::SetIamPolicy;
945    /// # async fn sample() -> gax::Result<()> {
946    ///
947    /// let builder = prepare_request_builder();
948    /// let response = builder.send().await?;
949    /// # Ok(()) }
950    ///
951    /// fn prepare_request_builder() -> SetIamPolicy {
952    ///   # panic!();
953    ///   // ... details omitted ...
954    /// }
955    /// ```
956    #[derive(Clone, Debug)]
957    pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
958
959    impl SetIamPolicy {
960        pub(crate) fn new(
961            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
962        ) -> Self {
963            Self(RequestBuilder::new(stub))
964        }
965
966        /// Sets the full request, replacing any prior values.
967        pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
968            self.0.request = v.into();
969            self
970        }
971
972        /// Sets all the options, replacing any prior values.
973        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
974            self.0.options = v.into();
975            self
976        }
977
978        /// Sends the request.
979        pub async fn send(self) -> Result<iam_v1::model::Policy> {
980            (*self.0.stub)
981                .set_iam_policy(self.0.request, self.0.options)
982                .await
983                .map(gax::response::Response::into_body)
984        }
985
986        /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
987        ///
988        /// This is a **required** field for requests.
989        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
990            self.0.request.resource = v.into();
991            self
992        }
993
994        /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
995        ///
996        /// This is a **required** field for requests.
997        pub fn set_policy<T>(mut self, v: T) -> Self
998        where
999            T: std::convert::Into<iam_v1::model::Policy>,
1000        {
1001            self.0.request.policy = std::option::Option::Some(v.into());
1002            self
1003        }
1004
1005        /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1006        ///
1007        /// This is a **required** field for requests.
1008        pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1009        where
1010            T: std::convert::Into<iam_v1::model::Policy>,
1011        {
1012            self.0.request.policy = v.map(|x| x.into());
1013            self
1014        }
1015
1016        /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1017        pub fn set_update_mask<T>(mut self, v: T) -> Self
1018        where
1019            T: std::convert::Into<wkt::FieldMask>,
1020        {
1021            self.0.request.update_mask = std::option::Option::Some(v.into());
1022            self
1023        }
1024
1025        /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1026        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1027        where
1028            T: std::convert::Into<wkt::FieldMask>,
1029        {
1030            self.0.request.update_mask = v.map(|x| x.into());
1031            self
1032        }
1033    }
1034
1035    #[doc(hidden)]
1036    impl gax::options::internal::RequestBuilder for SetIamPolicy {
1037        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1038            &mut self.0.options
1039        }
1040    }
1041
1042    /// The request builder for [FunctionService::get_iam_policy][crate::client::FunctionService::get_iam_policy] calls.
1043    ///
1044    /// # Example
1045    /// ```
1046    /// # use google_cloud_functions_v2::builder::function_service::GetIamPolicy;
1047    /// # async fn sample() -> gax::Result<()> {
1048    ///
1049    /// let builder = prepare_request_builder();
1050    /// let response = builder.send().await?;
1051    /// # Ok(()) }
1052    ///
1053    /// fn prepare_request_builder() -> GetIamPolicy {
1054    ///   # panic!();
1055    ///   // ... details omitted ...
1056    /// }
1057    /// ```
1058    #[derive(Clone, Debug)]
1059    pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1060
1061    impl GetIamPolicy {
1062        pub(crate) fn new(
1063            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
1064        ) -> Self {
1065            Self(RequestBuilder::new(stub))
1066        }
1067
1068        /// Sets the full request, replacing any prior values.
1069        pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1070            self.0.request = v.into();
1071            self
1072        }
1073
1074        /// Sets all the options, replacing any prior values.
1075        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1076            self.0.options = v.into();
1077            self
1078        }
1079
1080        /// Sends the request.
1081        pub async fn send(self) -> Result<iam_v1::model::Policy> {
1082            (*self.0.stub)
1083                .get_iam_policy(self.0.request, self.0.options)
1084                .await
1085                .map(gax::response::Response::into_body)
1086        }
1087
1088        /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1089        ///
1090        /// This is a **required** field for requests.
1091        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1092            self.0.request.resource = v.into();
1093            self
1094        }
1095
1096        /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1097        pub fn set_options<T>(mut self, v: T) -> Self
1098        where
1099            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1100        {
1101            self.0.request.options = std::option::Option::Some(v.into());
1102            self
1103        }
1104
1105        /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1106        pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1107        where
1108            T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1109        {
1110            self.0.request.options = v.map(|x| x.into());
1111            self
1112        }
1113    }
1114
1115    #[doc(hidden)]
1116    impl gax::options::internal::RequestBuilder for GetIamPolicy {
1117        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1118            &mut self.0.options
1119        }
1120    }
1121
1122    /// The request builder for [FunctionService::test_iam_permissions][crate::client::FunctionService::test_iam_permissions] calls.
1123    ///
1124    /// # Example
1125    /// ```
1126    /// # use google_cloud_functions_v2::builder::function_service::TestIamPermissions;
1127    /// # async fn sample() -> gax::Result<()> {
1128    ///
1129    /// let builder = prepare_request_builder();
1130    /// let response = builder.send().await?;
1131    /// # Ok(()) }
1132    ///
1133    /// fn prepare_request_builder() -> TestIamPermissions {
1134    ///   # panic!();
1135    ///   // ... details omitted ...
1136    /// }
1137    /// ```
1138    #[derive(Clone, Debug)]
1139    pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1140
1141    impl TestIamPermissions {
1142        pub(crate) fn new(
1143            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
1144        ) -> Self {
1145            Self(RequestBuilder::new(stub))
1146        }
1147
1148        /// Sets the full request, replacing any prior values.
1149        pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1150            mut self,
1151            v: V,
1152        ) -> Self {
1153            self.0.request = v.into();
1154            self
1155        }
1156
1157        /// Sets all the options, replacing any prior values.
1158        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1159            self.0.options = v.into();
1160            self
1161        }
1162
1163        /// Sends the request.
1164        pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1165            (*self.0.stub)
1166                .test_iam_permissions(self.0.request, self.0.options)
1167                .await
1168                .map(gax::response::Response::into_body)
1169        }
1170
1171        /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1172        ///
1173        /// This is a **required** field for requests.
1174        pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1175            self.0.request.resource = v.into();
1176            self
1177        }
1178
1179        /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1180        ///
1181        /// This is a **required** field for requests.
1182        pub fn set_permissions<T, V>(mut self, v: T) -> Self
1183        where
1184            T: std::iter::IntoIterator<Item = V>,
1185            V: std::convert::Into<std::string::String>,
1186        {
1187            use std::iter::Iterator;
1188            self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1189            self
1190        }
1191    }
1192
1193    #[doc(hidden)]
1194    impl gax::options::internal::RequestBuilder for TestIamPermissions {
1195        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1196            &mut self.0.options
1197        }
1198    }
1199
1200    /// The request builder for [FunctionService::list_operations][crate::client::FunctionService::list_operations] calls.
1201    ///
1202    /// # Example
1203    /// ```
1204    /// # use google_cloud_functions_v2::builder::function_service::ListOperations;
1205    /// # async fn sample() -> gax::Result<()> {
1206    /// use gax::paginator::ItemPaginator;
1207    ///
1208    /// let builder = prepare_request_builder();
1209    /// let mut items = builder.by_item();
1210    /// while let Some(result) = items.next().await {
1211    ///   let item = result?;
1212    /// }
1213    /// # Ok(()) }
1214    ///
1215    /// fn prepare_request_builder() -> ListOperations {
1216    ///   # panic!();
1217    ///   // ... details omitted ...
1218    /// }
1219    /// ```
1220    #[derive(Clone, Debug)]
1221    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1222
1223    impl ListOperations {
1224        pub(crate) fn new(
1225            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
1226        ) -> Self {
1227            Self(RequestBuilder::new(stub))
1228        }
1229
1230        /// Sets the full request, replacing any prior values.
1231        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1232            mut self,
1233            v: V,
1234        ) -> Self {
1235            self.0.request = v.into();
1236            self
1237        }
1238
1239        /// Sets all the options, replacing any prior values.
1240        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1241            self.0.options = v.into();
1242            self
1243        }
1244
1245        /// Sends the request.
1246        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1247            (*self.0.stub)
1248                .list_operations(self.0.request, self.0.options)
1249                .await
1250                .map(gax::response::Response::into_body)
1251        }
1252
1253        /// Streams each page in the collection.
1254        pub fn by_page(
1255            self,
1256        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1257        {
1258            use std::clone::Clone;
1259            let token = self.0.request.page_token.clone();
1260            let execute = move |token: String| {
1261                let mut builder = self.clone();
1262                builder.0.request = builder.0.request.set_page_token(token);
1263                builder.send()
1264            };
1265            gax::paginator::internal::new_paginator(token, execute)
1266        }
1267
1268        /// Streams each item in the collection.
1269        pub fn by_item(
1270            self,
1271        ) -> impl gax::paginator::ItemPaginator<
1272            longrunning::model::ListOperationsResponse,
1273            gax::error::Error,
1274        > {
1275            use gax::paginator::Paginator;
1276            self.by_page().items()
1277        }
1278
1279        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1280        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1281            self.0.request.name = v.into();
1282            self
1283        }
1284
1285        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1286        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1287            self.0.request.filter = v.into();
1288            self
1289        }
1290
1291        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1292        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1293            self.0.request.page_size = v.into();
1294            self
1295        }
1296
1297        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1298        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1299            self.0.request.page_token = v.into();
1300            self
1301        }
1302
1303        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1304        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1305            self.0.request.return_partial_success = v.into();
1306            self
1307        }
1308    }
1309
1310    #[doc(hidden)]
1311    impl gax::options::internal::RequestBuilder for ListOperations {
1312        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1313            &mut self.0.options
1314        }
1315    }
1316
1317    /// The request builder for [FunctionService::get_operation][crate::client::FunctionService::get_operation] calls.
1318    ///
1319    /// # Example
1320    /// ```
1321    /// # use google_cloud_functions_v2::builder::function_service::GetOperation;
1322    /// # async fn sample() -> gax::Result<()> {
1323    ///
1324    /// let builder = prepare_request_builder();
1325    /// let response = builder.send().await?;
1326    /// # Ok(()) }
1327    ///
1328    /// fn prepare_request_builder() -> GetOperation {
1329    ///   # panic!();
1330    ///   // ... details omitted ...
1331    /// }
1332    /// ```
1333    #[derive(Clone, Debug)]
1334    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1335
1336    impl GetOperation {
1337        pub(crate) fn new(
1338            stub: std::sync::Arc<dyn super::super::stub::dynamic::FunctionService>,
1339        ) -> Self {
1340            Self(RequestBuilder::new(stub))
1341        }
1342
1343        /// Sets the full request, replacing any prior values.
1344        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1345            mut self,
1346            v: V,
1347        ) -> Self {
1348            self.0.request = v.into();
1349            self
1350        }
1351
1352        /// Sets all the options, replacing any prior values.
1353        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1354            self.0.options = v.into();
1355            self
1356        }
1357
1358        /// Sends the request.
1359        pub async fn send(self) -> Result<longrunning::model::Operation> {
1360            (*self.0.stub)
1361                .get_operation(self.0.request, self.0.options)
1362                .await
1363                .map(gax::response::Response::into_body)
1364        }
1365
1366        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1367        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1368            self.0.request.name = v.into();
1369            self
1370        }
1371    }
1372
1373    #[doc(hidden)]
1374    impl gax::options::internal::RequestBuilder for GetOperation {
1375        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1376            &mut self.0.options
1377        }
1378    }
1379}