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