1pub mod function_service {
19 use crate::Result;
20
21 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 #[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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108 self.0.options = v.into();
109 self
110 }
111
112 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
180 self.0.options = v.into();
181 self
182 }
183
184 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 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
293 self.0.options = v.into();
294 self
295 }
296
297 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
438 self.0.options = v.into();
439 self
440 }
441
442 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
587 self.0.options = v.into();
588 self
589 }
590
591 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
701 self.0.options = v.into();
702 self
703 }
704
705 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
778 self.0.options = v.into();
779 self
780 }
781
782 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
840 self.0.options = v.into();
841 self
842 }
843
844 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
915 self.0.options = v.into();
916 self
917 }
918
919 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1024 self.0.options = v.into();
1025 self
1026 }
1027
1028 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1129 self.0.options = v.into();
1130 self
1131 }
1132
1133 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1214 self.0.options = v.into();
1215 self
1216 }
1217
1218 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1298 self.0.options = v.into();
1299 self
1300 }
1301
1302 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 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1413 self.0.options = v.into();
1414 self
1415 }
1416
1417 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 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}