1pub mod folders {
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::Folders;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = Folders;
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::Folders>,
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(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
64 Self {
65 stub,
66 request: R::default(),
67 options: crate::RequestOptions::default(),
68 }
69 }
70 }
71
72 #[derive(Clone, Debug)]
89 pub struct GetFolder(RequestBuilder<crate::model::GetFolderRequest>);
90
91 impl GetFolder {
92 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
93 Self(RequestBuilder::new(stub))
94 }
95
96 pub fn with_request<V: Into<crate::model::GetFolderRequest>>(mut self, v: V) -> Self {
98 self.0.request = v.into();
99 self
100 }
101
102 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
104 self.0.options = v.into();
105 self
106 }
107
108 pub async fn send(self) -> Result<crate::model::Folder> {
110 (*self.0.stub)
111 .get_folder(self.0.request, self.0.options)
112 .await
113 .map(crate::Response::into_body)
114 }
115
116 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
120 self.0.request.name = v.into();
121 self
122 }
123 }
124
125 #[doc(hidden)]
126 impl crate::RequestBuilder for GetFolder {
127 fn request_options(&mut self) -> &mut crate::RequestOptions {
128 &mut self.0.options
129 }
130 }
131
132 #[derive(Clone, Debug)]
153 pub struct ListFolders(RequestBuilder<crate::model::ListFoldersRequest>);
154
155 impl ListFolders {
156 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
157 Self(RequestBuilder::new(stub))
158 }
159
160 pub fn with_request<V: Into<crate::model::ListFoldersRequest>>(mut self, v: V) -> Self {
162 self.0.request = v.into();
163 self
164 }
165
166 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
168 self.0.options = v.into();
169 self
170 }
171
172 pub async fn send(self) -> Result<crate::model::ListFoldersResponse> {
174 (*self.0.stub)
175 .list_folders(self.0.request, self.0.options)
176 .await
177 .map(crate::Response::into_body)
178 }
179
180 pub fn by_page(
182 self,
183 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListFoldersResponse, crate::Error>
184 {
185 use std::clone::Clone;
186 let token = self.0.request.page_token.clone();
187 let execute = move |token: String| {
188 let mut builder = self.clone();
189 builder.0.request = builder.0.request.set_page_token(token);
190 builder.send()
191 };
192 google_cloud_gax::paginator::internal::new_paginator(token, execute)
193 }
194
195 pub fn by_item(
197 self,
198 ) -> impl google_cloud_gax::paginator::ItemPaginator<
199 crate::model::ListFoldersResponse,
200 crate::Error,
201 > {
202 use google_cloud_gax::paginator::Paginator;
203 self.by_page().items()
204 }
205
206 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
210 self.0.request.parent = v.into();
211 self
212 }
213
214 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
216 self.0.request.page_size = v.into();
217 self
218 }
219
220 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
222 self.0.request.page_token = v.into();
223 self
224 }
225
226 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
228 self.0.request.show_deleted = v.into();
229 self
230 }
231 }
232
233 #[doc(hidden)]
234 impl crate::RequestBuilder for ListFolders {
235 fn request_options(&mut self) -> &mut crate::RequestOptions {
236 &mut self.0.options
237 }
238 }
239
240 #[derive(Clone, Debug)]
261 pub struct SearchFolders(RequestBuilder<crate::model::SearchFoldersRequest>);
262
263 impl SearchFolders {
264 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
265 Self(RequestBuilder::new(stub))
266 }
267
268 pub fn with_request<V: Into<crate::model::SearchFoldersRequest>>(mut self, v: V) -> Self {
270 self.0.request = v.into();
271 self
272 }
273
274 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
276 self.0.options = v.into();
277 self
278 }
279
280 pub async fn send(self) -> Result<crate::model::SearchFoldersResponse> {
282 (*self.0.stub)
283 .search_folders(self.0.request, self.0.options)
284 .await
285 .map(crate::Response::into_body)
286 }
287
288 pub fn by_page(
290 self,
291 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchFoldersResponse, crate::Error>
292 {
293 use std::clone::Clone;
294 let token = self.0.request.page_token.clone();
295 let execute = move |token: String| {
296 let mut builder = self.clone();
297 builder.0.request = builder.0.request.set_page_token(token);
298 builder.send()
299 };
300 google_cloud_gax::paginator::internal::new_paginator(token, execute)
301 }
302
303 pub fn by_item(
305 self,
306 ) -> impl google_cloud_gax::paginator::ItemPaginator<
307 crate::model::SearchFoldersResponse,
308 crate::Error,
309 > {
310 use google_cloud_gax::paginator::Paginator;
311 self.by_page().items()
312 }
313
314 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
316 self.0.request.page_size = v.into();
317 self
318 }
319
320 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
322 self.0.request.page_token = v.into();
323 self
324 }
325
326 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
328 self.0.request.query = v.into();
329 self
330 }
331 }
332
333 #[doc(hidden)]
334 impl crate::RequestBuilder for SearchFolders {
335 fn request_options(&mut self) -> &mut crate::RequestOptions {
336 &mut self.0.options
337 }
338 }
339
340 #[derive(Clone, Debug)]
358 pub struct CreateFolder(RequestBuilder<crate::model::CreateFolderRequest>);
359
360 impl CreateFolder {
361 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
362 Self(RequestBuilder::new(stub))
363 }
364
365 pub fn with_request<V: Into<crate::model::CreateFolderRequest>>(mut self, v: V) -> Self {
367 self.0.request = v.into();
368 self
369 }
370
371 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
373 self.0.options = v.into();
374 self
375 }
376
377 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
384 (*self.0.stub)
385 .create_folder(self.0.request, self.0.options)
386 .await
387 .map(crate::Response::into_body)
388 }
389
390 pub fn poller(
392 self,
393 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::CreateFolderMetadata>
394 {
395 type Operation = google_cloud_lro::internal::Operation<
396 crate::model::Folder,
397 crate::model::CreateFolderMetadata,
398 >;
399 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
400 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
401
402 let stub = self.0.stub.clone();
403 let mut options = self.0.options.clone();
404 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
405 let query = move |name| {
406 let stub = stub.clone();
407 let options = options.clone();
408 async {
409 let op = GetOperation::new(stub)
410 .set_name(name)
411 .with_options(options)
412 .send()
413 .await?;
414 Ok(Operation::new(op))
415 }
416 };
417
418 let start = move || async {
419 let op = self.send().await?;
420 Ok(Operation::new(op))
421 };
422
423 google_cloud_lro::internal::new_poller(
424 polling_error_policy,
425 polling_backoff_policy,
426 start,
427 query,
428 )
429 }
430
431 pub fn set_folder<T>(mut self, v: T) -> Self
435 where
436 T: std::convert::Into<crate::model::Folder>,
437 {
438 self.0.request.folder = std::option::Option::Some(v.into());
439 self
440 }
441
442 pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
446 where
447 T: std::convert::Into<crate::model::Folder>,
448 {
449 self.0.request.folder = v.map(|x| x.into());
450 self
451 }
452 }
453
454 #[doc(hidden)]
455 impl crate::RequestBuilder for CreateFolder {
456 fn request_options(&mut self) -> &mut crate::RequestOptions {
457 &mut self.0.options
458 }
459 }
460
461 #[derive(Clone, Debug)]
479 pub struct UpdateFolder(RequestBuilder<crate::model::UpdateFolderRequest>);
480
481 impl UpdateFolder {
482 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
483 Self(RequestBuilder::new(stub))
484 }
485
486 pub fn with_request<V: Into<crate::model::UpdateFolderRequest>>(mut self, v: V) -> Self {
488 self.0.request = v.into();
489 self
490 }
491
492 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
494 self.0.options = v.into();
495 self
496 }
497
498 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
505 (*self.0.stub)
506 .update_folder(self.0.request, self.0.options)
507 .await
508 .map(crate::Response::into_body)
509 }
510
511 pub fn poller(
513 self,
514 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::UpdateFolderMetadata>
515 {
516 type Operation = google_cloud_lro::internal::Operation<
517 crate::model::Folder,
518 crate::model::UpdateFolderMetadata,
519 >;
520 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
521 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
522
523 let stub = self.0.stub.clone();
524 let mut options = self.0.options.clone();
525 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
526 let query = move |name| {
527 let stub = stub.clone();
528 let options = options.clone();
529 async {
530 let op = GetOperation::new(stub)
531 .set_name(name)
532 .with_options(options)
533 .send()
534 .await?;
535 Ok(Operation::new(op))
536 }
537 };
538
539 let start = move || async {
540 let op = self.send().await?;
541 Ok(Operation::new(op))
542 };
543
544 google_cloud_lro::internal::new_poller(
545 polling_error_policy,
546 polling_backoff_policy,
547 start,
548 query,
549 )
550 }
551
552 pub fn set_folder<T>(mut self, v: T) -> Self
556 where
557 T: std::convert::Into<crate::model::Folder>,
558 {
559 self.0.request.folder = std::option::Option::Some(v.into());
560 self
561 }
562
563 pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
567 where
568 T: std::convert::Into<crate::model::Folder>,
569 {
570 self.0.request.folder = v.map(|x| x.into());
571 self
572 }
573
574 pub fn set_update_mask<T>(mut self, v: T) -> Self
578 where
579 T: std::convert::Into<wkt::FieldMask>,
580 {
581 self.0.request.update_mask = std::option::Option::Some(v.into());
582 self
583 }
584
585 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
589 where
590 T: std::convert::Into<wkt::FieldMask>,
591 {
592 self.0.request.update_mask = v.map(|x| x.into());
593 self
594 }
595 }
596
597 #[doc(hidden)]
598 impl crate::RequestBuilder for UpdateFolder {
599 fn request_options(&mut self) -> &mut crate::RequestOptions {
600 &mut self.0.options
601 }
602 }
603
604 #[derive(Clone, Debug)]
622 pub struct MoveFolder(RequestBuilder<crate::model::MoveFolderRequest>);
623
624 impl MoveFolder {
625 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
626 Self(RequestBuilder::new(stub))
627 }
628
629 pub fn with_request<V: Into<crate::model::MoveFolderRequest>>(mut self, v: V) -> Self {
631 self.0.request = v.into();
632 self
633 }
634
635 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
637 self.0.options = v.into();
638 self
639 }
640
641 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
648 (*self.0.stub)
649 .move_folder(self.0.request, self.0.options)
650 .await
651 .map(crate::Response::into_body)
652 }
653
654 pub fn poller(
656 self,
657 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::MoveFolderMetadata>
658 {
659 type Operation = google_cloud_lro::internal::Operation<
660 crate::model::Folder,
661 crate::model::MoveFolderMetadata,
662 >;
663 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
664 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
665
666 let stub = self.0.stub.clone();
667 let mut options = self.0.options.clone();
668 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
669 let query = move |name| {
670 let stub = stub.clone();
671 let options = options.clone();
672 async {
673 let op = GetOperation::new(stub)
674 .set_name(name)
675 .with_options(options)
676 .send()
677 .await?;
678 Ok(Operation::new(op))
679 }
680 };
681
682 let start = move || async {
683 let op = self.send().await?;
684 Ok(Operation::new(op))
685 };
686
687 google_cloud_lro::internal::new_poller(
688 polling_error_policy,
689 polling_backoff_policy,
690 start,
691 query,
692 )
693 }
694
695 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
699 self.0.request.name = v.into();
700 self
701 }
702
703 pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
707 self.0.request.destination_parent = v.into();
708 self
709 }
710 }
711
712 #[doc(hidden)]
713 impl crate::RequestBuilder for MoveFolder {
714 fn request_options(&mut self) -> &mut crate::RequestOptions {
715 &mut self.0.options
716 }
717 }
718
719 #[derive(Clone, Debug)]
737 pub struct DeleteFolder(RequestBuilder<crate::model::DeleteFolderRequest>);
738
739 impl DeleteFolder {
740 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
741 Self(RequestBuilder::new(stub))
742 }
743
744 pub fn with_request<V: Into<crate::model::DeleteFolderRequest>>(mut self, v: V) -> Self {
746 self.0.request = v.into();
747 self
748 }
749
750 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
752 self.0.options = v.into();
753 self
754 }
755
756 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
763 (*self.0.stub)
764 .delete_folder(self.0.request, self.0.options)
765 .await
766 .map(crate::Response::into_body)
767 }
768
769 pub fn poller(
771 self,
772 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::DeleteFolderMetadata>
773 {
774 type Operation = google_cloud_lro::internal::Operation<
775 crate::model::Folder,
776 crate::model::DeleteFolderMetadata,
777 >;
778 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
779 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
780
781 let stub = self.0.stub.clone();
782 let mut options = self.0.options.clone();
783 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
784 let query = move |name| {
785 let stub = stub.clone();
786 let options = options.clone();
787 async {
788 let op = GetOperation::new(stub)
789 .set_name(name)
790 .with_options(options)
791 .send()
792 .await?;
793 Ok(Operation::new(op))
794 }
795 };
796
797 let start = move || async {
798 let op = self.send().await?;
799 Ok(Operation::new(op))
800 };
801
802 google_cloud_lro::internal::new_poller(
803 polling_error_policy,
804 polling_backoff_policy,
805 start,
806 query,
807 )
808 }
809
810 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
814 self.0.request.name = v.into();
815 self
816 }
817 }
818
819 #[doc(hidden)]
820 impl crate::RequestBuilder for DeleteFolder {
821 fn request_options(&mut self) -> &mut crate::RequestOptions {
822 &mut self.0.options
823 }
824 }
825
826 #[derive(Clone, Debug)]
844 pub struct UndeleteFolder(RequestBuilder<crate::model::UndeleteFolderRequest>);
845
846 impl UndeleteFolder {
847 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
848 Self(RequestBuilder::new(stub))
849 }
850
851 pub fn with_request<V: Into<crate::model::UndeleteFolderRequest>>(mut self, v: V) -> Self {
853 self.0.request = v.into();
854 self
855 }
856
857 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
859 self.0.options = v.into();
860 self
861 }
862
863 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
870 (*self.0.stub)
871 .undelete_folder(self.0.request, self.0.options)
872 .await
873 .map(crate::Response::into_body)
874 }
875
876 pub fn poller(
878 self,
879 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::UndeleteFolderMetadata>
880 {
881 type Operation = google_cloud_lro::internal::Operation<
882 crate::model::Folder,
883 crate::model::UndeleteFolderMetadata,
884 >;
885 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
886 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
887
888 let stub = self.0.stub.clone();
889 let mut options = self.0.options.clone();
890 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
891 let query = move |name| {
892 let stub = stub.clone();
893 let options = options.clone();
894 async {
895 let op = GetOperation::new(stub)
896 .set_name(name)
897 .with_options(options)
898 .send()
899 .await?;
900 Ok(Operation::new(op))
901 }
902 };
903
904 let start = move || async {
905 let op = self.send().await?;
906 Ok(Operation::new(op))
907 };
908
909 google_cloud_lro::internal::new_poller(
910 polling_error_policy,
911 polling_backoff_policy,
912 start,
913 query,
914 )
915 }
916
917 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
921 self.0.request.name = v.into();
922 self
923 }
924 }
925
926 #[doc(hidden)]
927 impl crate::RequestBuilder for UndeleteFolder {
928 fn request_options(&mut self) -> &mut crate::RequestOptions {
929 &mut self.0.options
930 }
931 }
932
933 #[derive(Clone, Debug)]
950 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
951
952 impl GetIamPolicy {
953 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
954 Self(RequestBuilder::new(stub))
955 }
956
957 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
959 mut self,
960 v: V,
961 ) -> Self {
962 self.0.request = v.into();
963 self
964 }
965
966 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
968 self.0.options = v.into();
969 self
970 }
971
972 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
974 (*self.0.stub)
975 .get_iam_policy(self.0.request, self.0.options)
976 .await
977 .map(crate::Response::into_body)
978 }
979
980 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
984 self.0.request.resource = v.into();
985 self
986 }
987
988 pub fn set_options<T>(mut self, v: T) -> Self
990 where
991 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
992 {
993 self.0.request.options = std::option::Option::Some(v.into());
994 self
995 }
996
997 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
999 where
1000 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1001 {
1002 self.0.request.options = v.map(|x| x.into());
1003 self
1004 }
1005 }
1006
1007 #[doc(hidden)]
1008 impl crate::RequestBuilder for GetIamPolicy {
1009 fn request_options(&mut self) -> &mut crate::RequestOptions {
1010 &mut self.0.options
1011 }
1012 }
1013
1014 #[derive(Clone, Debug)]
1031 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1032
1033 impl SetIamPolicy {
1034 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1035 Self(RequestBuilder::new(stub))
1036 }
1037
1038 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1040 mut self,
1041 v: V,
1042 ) -> Self {
1043 self.0.request = v.into();
1044 self
1045 }
1046
1047 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1049 self.0.options = v.into();
1050 self
1051 }
1052
1053 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1055 (*self.0.stub)
1056 .set_iam_policy(self.0.request, self.0.options)
1057 .await
1058 .map(crate::Response::into_body)
1059 }
1060
1061 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1065 self.0.request.resource = v.into();
1066 self
1067 }
1068
1069 pub fn set_policy<T>(mut self, v: T) -> Self
1073 where
1074 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1075 {
1076 self.0.request.policy = std::option::Option::Some(v.into());
1077 self
1078 }
1079
1080 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1084 where
1085 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1086 {
1087 self.0.request.policy = v.map(|x| x.into());
1088 self
1089 }
1090
1091 pub fn set_update_mask<T>(mut self, v: T) -> Self
1093 where
1094 T: std::convert::Into<wkt::FieldMask>,
1095 {
1096 self.0.request.update_mask = std::option::Option::Some(v.into());
1097 self
1098 }
1099
1100 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1102 where
1103 T: std::convert::Into<wkt::FieldMask>,
1104 {
1105 self.0.request.update_mask = v.map(|x| x.into());
1106 self
1107 }
1108 }
1109
1110 #[doc(hidden)]
1111 impl crate::RequestBuilder for SetIamPolicy {
1112 fn request_options(&mut self) -> &mut crate::RequestOptions {
1113 &mut self.0.options
1114 }
1115 }
1116
1117 #[derive(Clone, Debug)]
1134 pub struct TestIamPermissions(
1135 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1136 );
1137
1138 impl TestIamPermissions {
1139 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1140 Self(RequestBuilder::new(stub))
1141 }
1142
1143 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1145 mut self,
1146 v: V,
1147 ) -> Self {
1148 self.0.request = v.into();
1149 self
1150 }
1151
1152 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1154 self.0.options = v.into();
1155 self
1156 }
1157
1158 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1160 (*self.0.stub)
1161 .test_iam_permissions(self.0.request, self.0.options)
1162 .await
1163 .map(crate::Response::into_body)
1164 }
1165
1166 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1170 self.0.request.resource = v.into();
1171 self
1172 }
1173
1174 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1178 where
1179 T: std::iter::IntoIterator<Item = V>,
1180 V: std::convert::Into<std::string::String>,
1181 {
1182 use std::iter::Iterator;
1183 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1184 self
1185 }
1186 }
1187
1188 #[doc(hidden)]
1189 impl crate::RequestBuilder for TestIamPermissions {
1190 fn request_options(&mut self) -> &mut crate::RequestOptions {
1191 &mut self.0.options
1192 }
1193 }
1194
1195 #[derive(Clone, Debug)]
1212 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1213
1214 impl GetOperation {
1215 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1216 Self(RequestBuilder::new(stub))
1217 }
1218
1219 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1221 mut self,
1222 v: V,
1223 ) -> Self {
1224 self.0.request = v.into();
1225 self
1226 }
1227
1228 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1230 self.0.options = v.into();
1231 self
1232 }
1233
1234 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1236 (*self.0.stub)
1237 .get_operation(self.0.request, self.0.options)
1238 .await
1239 .map(crate::Response::into_body)
1240 }
1241
1242 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1244 self.0.request.name = v.into();
1245 self
1246 }
1247 }
1248
1249 #[doc(hidden)]
1250 impl crate::RequestBuilder for GetOperation {
1251 fn request_options(&mut self) -> &mut crate::RequestOptions {
1252 &mut self.0.options
1253 }
1254 }
1255}
1256
1257pub mod organizations {
1259 use crate::Result;
1260
1261 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1275
1276 pub(crate) mod client {
1277 use super::super::super::client::Organizations;
1278 pub struct Factory;
1279 impl crate::ClientFactory for Factory {
1280 type Client = Organizations;
1281 type Credentials = gaxi::options::Credentials;
1282 async fn build(
1283 self,
1284 config: gaxi::options::ClientConfig,
1285 ) -> crate::ClientBuilderResult<Self::Client> {
1286 Self::Client::new(config).await
1287 }
1288 }
1289 }
1290
1291 #[derive(Clone, Debug)]
1293 pub(crate) struct RequestBuilder<R: std::default::Default> {
1294 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1295 request: R,
1296 options: crate::RequestOptions,
1297 }
1298
1299 impl<R> RequestBuilder<R>
1300 where
1301 R: std::default::Default,
1302 {
1303 pub(crate) fn new(
1304 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1305 ) -> Self {
1306 Self {
1307 stub,
1308 request: R::default(),
1309 options: crate::RequestOptions::default(),
1310 }
1311 }
1312 }
1313
1314 #[derive(Clone, Debug)]
1331 pub struct GetOrganization(RequestBuilder<crate::model::GetOrganizationRequest>);
1332
1333 impl GetOrganization {
1334 pub(crate) fn new(
1335 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1336 ) -> Self {
1337 Self(RequestBuilder::new(stub))
1338 }
1339
1340 pub fn with_request<V: Into<crate::model::GetOrganizationRequest>>(mut self, v: V) -> Self {
1342 self.0.request = v.into();
1343 self
1344 }
1345
1346 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1348 self.0.options = v.into();
1349 self
1350 }
1351
1352 pub async fn send(self) -> Result<crate::model::Organization> {
1354 (*self.0.stub)
1355 .get_organization(self.0.request, self.0.options)
1356 .await
1357 .map(crate::Response::into_body)
1358 }
1359
1360 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1364 self.0.request.name = v.into();
1365 self
1366 }
1367 }
1368
1369 #[doc(hidden)]
1370 impl crate::RequestBuilder for GetOrganization {
1371 fn request_options(&mut self) -> &mut crate::RequestOptions {
1372 &mut self.0.options
1373 }
1374 }
1375
1376 #[derive(Clone, Debug)]
1397 pub struct SearchOrganizations(RequestBuilder<crate::model::SearchOrganizationsRequest>);
1398
1399 impl SearchOrganizations {
1400 pub(crate) fn new(
1401 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1402 ) -> Self {
1403 Self(RequestBuilder::new(stub))
1404 }
1405
1406 pub fn with_request<V: Into<crate::model::SearchOrganizationsRequest>>(
1408 mut self,
1409 v: V,
1410 ) -> Self {
1411 self.0.request = v.into();
1412 self
1413 }
1414
1415 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1417 self.0.options = v.into();
1418 self
1419 }
1420
1421 pub async fn send(self) -> Result<crate::model::SearchOrganizationsResponse> {
1423 (*self.0.stub)
1424 .search_organizations(self.0.request, self.0.options)
1425 .await
1426 .map(crate::Response::into_body)
1427 }
1428
1429 pub fn by_page(
1431 self,
1432 ) -> impl google_cloud_gax::paginator::Paginator<
1433 crate::model::SearchOrganizationsResponse,
1434 crate::Error,
1435 > {
1436 use std::clone::Clone;
1437 let token = self.0.request.page_token.clone();
1438 let execute = move |token: String| {
1439 let mut builder = self.clone();
1440 builder.0.request = builder.0.request.set_page_token(token);
1441 builder.send()
1442 };
1443 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1444 }
1445
1446 pub fn by_item(
1448 self,
1449 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1450 crate::model::SearchOrganizationsResponse,
1451 crate::Error,
1452 > {
1453 use google_cloud_gax::paginator::Paginator;
1454 self.by_page().items()
1455 }
1456
1457 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1459 self.0.request.page_size = v.into();
1460 self
1461 }
1462
1463 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1465 self.0.request.page_token = v.into();
1466 self
1467 }
1468
1469 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1471 self.0.request.query = v.into();
1472 self
1473 }
1474 }
1475
1476 #[doc(hidden)]
1477 impl crate::RequestBuilder for SearchOrganizations {
1478 fn request_options(&mut self) -> &mut crate::RequestOptions {
1479 &mut self.0.options
1480 }
1481 }
1482
1483 #[derive(Clone, Debug)]
1500 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1501
1502 impl GetIamPolicy {
1503 pub(crate) fn new(
1504 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1505 ) -> Self {
1506 Self(RequestBuilder::new(stub))
1507 }
1508
1509 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1511 mut self,
1512 v: V,
1513 ) -> Self {
1514 self.0.request = v.into();
1515 self
1516 }
1517
1518 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1520 self.0.options = v.into();
1521 self
1522 }
1523
1524 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1526 (*self.0.stub)
1527 .get_iam_policy(self.0.request, self.0.options)
1528 .await
1529 .map(crate::Response::into_body)
1530 }
1531
1532 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1536 self.0.request.resource = v.into();
1537 self
1538 }
1539
1540 pub fn set_options<T>(mut self, v: T) -> Self
1542 where
1543 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1544 {
1545 self.0.request.options = std::option::Option::Some(v.into());
1546 self
1547 }
1548
1549 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1551 where
1552 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1553 {
1554 self.0.request.options = v.map(|x| x.into());
1555 self
1556 }
1557 }
1558
1559 #[doc(hidden)]
1560 impl crate::RequestBuilder for GetIamPolicy {
1561 fn request_options(&mut self) -> &mut crate::RequestOptions {
1562 &mut self.0.options
1563 }
1564 }
1565
1566 #[derive(Clone, Debug)]
1583 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1584
1585 impl SetIamPolicy {
1586 pub(crate) fn new(
1587 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1588 ) -> Self {
1589 Self(RequestBuilder::new(stub))
1590 }
1591
1592 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1594 mut self,
1595 v: V,
1596 ) -> Self {
1597 self.0.request = v.into();
1598 self
1599 }
1600
1601 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1603 self.0.options = v.into();
1604 self
1605 }
1606
1607 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1609 (*self.0.stub)
1610 .set_iam_policy(self.0.request, self.0.options)
1611 .await
1612 .map(crate::Response::into_body)
1613 }
1614
1615 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1619 self.0.request.resource = v.into();
1620 self
1621 }
1622
1623 pub fn set_policy<T>(mut self, v: T) -> Self
1627 where
1628 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1629 {
1630 self.0.request.policy = std::option::Option::Some(v.into());
1631 self
1632 }
1633
1634 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1638 where
1639 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1640 {
1641 self.0.request.policy = v.map(|x| x.into());
1642 self
1643 }
1644
1645 pub fn set_update_mask<T>(mut self, v: T) -> Self
1647 where
1648 T: std::convert::Into<wkt::FieldMask>,
1649 {
1650 self.0.request.update_mask = std::option::Option::Some(v.into());
1651 self
1652 }
1653
1654 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1656 where
1657 T: std::convert::Into<wkt::FieldMask>,
1658 {
1659 self.0.request.update_mask = v.map(|x| x.into());
1660 self
1661 }
1662 }
1663
1664 #[doc(hidden)]
1665 impl crate::RequestBuilder for SetIamPolicy {
1666 fn request_options(&mut self) -> &mut crate::RequestOptions {
1667 &mut self.0.options
1668 }
1669 }
1670
1671 #[derive(Clone, Debug)]
1688 pub struct TestIamPermissions(
1689 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1690 );
1691
1692 impl TestIamPermissions {
1693 pub(crate) fn new(
1694 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1695 ) -> Self {
1696 Self(RequestBuilder::new(stub))
1697 }
1698
1699 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1701 mut self,
1702 v: V,
1703 ) -> Self {
1704 self.0.request = v.into();
1705 self
1706 }
1707
1708 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1710 self.0.options = v.into();
1711 self
1712 }
1713
1714 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1716 (*self.0.stub)
1717 .test_iam_permissions(self.0.request, self.0.options)
1718 .await
1719 .map(crate::Response::into_body)
1720 }
1721
1722 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1726 self.0.request.resource = v.into();
1727 self
1728 }
1729
1730 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1734 where
1735 T: std::iter::IntoIterator<Item = V>,
1736 V: std::convert::Into<std::string::String>,
1737 {
1738 use std::iter::Iterator;
1739 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1740 self
1741 }
1742 }
1743
1744 #[doc(hidden)]
1745 impl crate::RequestBuilder for TestIamPermissions {
1746 fn request_options(&mut self) -> &mut crate::RequestOptions {
1747 &mut self.0.options
1748 }
1749 }
1750
1751 #[derive(Clone, Debug)]
1768 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1769
1770 impl GetOperation {
1771 pub(crate) fn new(
1772 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1773 ) -> Self {
1774 Self(RequestBuilder::new(stub))
1775 }
1776
1777 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1779 mut self,
1780 v: V,
1781 ) -> Self {
1782 self.0.request = v.into();
1783 self
1784 }
1785
1786 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1788 self.0.options = v.into();
1789 self
1790 }
1791
1792 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1794 (*self.0.stub)
1795 .get_operation(self.0.request, self.0.options)
1796 .await
1797 .map(crate::Response::into_body)
1798 }
1799
1800 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1802 self.0.request.name = v.into();
1803 self
1804 }
1805 }
1806
1807 #[doc(hidden)]
1808 impl crate::RequestBuilder for GetOperation {
1809 fn request_options(&mut self) -> &mut crate::RequestOptions {
1810 &mut self.0.options
1811 }
1812 }
1813}
1814
1815pub mod projects {
1817 use crate::Result;
1818
1819 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1833
1834 pub(crate) mod client {
1835 use super::super::super::client::Projects;
1836 pub struct Factory;
1837 impl crate::ClientFactory for Factory {
1838 type Client = Projects;
1839 type Credentials = gaxi::options::Credentials;
1840 async fn build(
1841 self,
1842 config: gaxi::options::ClientConfig,
1843 ) -> crate::ClientBuilderResult<Self::Client> {
1844 Self::Client::new(config).await
1845 }
1846 }
1847 }
1848
1849 #[derive(Clone, Debug)]
1851 pub(crate) struct RequestBuilder<R: std::default::Default> {
1852 stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>,
1853 request: R,
1854 options: crate::RequestOptions,
1855 }
1856
1857 impl<R> RequestBuilder<R>
1858 where
1859 R: std::default::Default,
1860 {
1861 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1862 Self {
1863 stub,
1864 request: R::default(),
1865 options: crate::RequestOptions::default(),
1866 }
1867 }
1868 }
1869
1870 #[derive(Clone, Debug)]
1887 pub struct GetProject(RequestBuilder<crate::model::GetProjectRequest>);
1888
1889 impl GetProject {
1890 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1891 Self(RequestBuilder::new(stub))
1892 }
1893
1894 pub fn with_request<V: Into<crate::model::GetProjectRequest>>(mut self, v: V) -> Self {
1896 self.0.request = v.into();
1897 self
1898 }
1899
1900 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1902 self.0.options = v.into();
1903 self
1904 }
1905
1906 pub async fn send(self) -> Result<crate::model::Project> {
1908 (*self.0.stub)
1909 .get_project(self.0.request, self.0.options)
1910 .await
1911 .map(crate::Response::into_body)
1912 }
1913
1914 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1918 self.0.request.name = v.into();
1919 self
1920 }
1921 }
1922
1923 #[doc(hidden)]
1924 impl crate::RequestBuilder for GetProject {
1925 fn request_options(&mut self) -> &mut crate::RequestOptions {
1926 &mut self.0.options
1927 }
1928 }
1929
1930 #[derive(Clone, Debug)]
1951 pub struct ListProjects(RequestBuilder<crate::model::ListProjectsRequest>);
1952
1953 impl ListProjects {
1954 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1955 Self(RequestBuilder::new(stub))
1956 }
1957
1958 pub fn with_request<V: Into<crate::model::ListProjectsRequest>>(mut self, v: V) -> Self {
1960 self.0.request = v.into();
1961 self
1962 }
1963
1964 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1966 self.0.options = v.into();
1967 self
1968 }
1969
1970 pub async fn send(self) -> Result<crate::model::ListProjectsResponse> {
1972 (*self.0.stub)
1973 .list_projects(self.0.request, self.0.options)
1974 .await
1975 .map(crate::Response::into_body)
1976 }
1977
1978 pub fn by_page(
1980 self,
1981 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListProjectsResponse, crate::Error>
1982 {
1983 use std::clone::Clone;
1984 let token = self.0.request.page_token.clone();
1985 let execute = move |token: String| {
1986 let mut builder = self.clone();
1987 builder.0.request = builder.0.request.set_page_token(token);
1988 builder.send()
1989 };
1990 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1991 }
1992
1993 pub fn by_item(
1995 self,
1996 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1997 crate::model::ListProjectsResponse,
1998 crate::Error,
1999 > {
2000 use google_cloud_gax::paginator::Paginator;
2001 self.by_page().items()
2002 }
2003
2004 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2008 self.0.request.parent = v.into();
2009 self
2010 }
2011
2012 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2014 self.0.request.page_token = v.into();
2015 self
2016 }
2017
2018 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2020 self.0.request.page_size = v.into();
2021 self
2022 }
2023
2024 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2026 self.0.request.show_deleted = v.into();
2027 self
2028 }
2029 }
2030
2031 #[doc(hidden)]
2032 impl crate::RequestBuilder for ListProjects {
2033 fn request_options(&mut self) -> &mut crate::RequestOptions {
2034 &mut self.0.options
2035 }
2036 }
2037
2038 #[derive(Clone, Debug)]
2059 pub struct SearchProjects(RequestBuilder<crate::model::SearchProjectsRequest>);
2060
2061 impl SearchProjects {
2062 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2063 Self(RequestBuilder::new(stub))
2064 }
2065
2066 pub fn with_request<V: Into<crate::model::SearchProjectsRequest>>(mut self, v: V) -> Self {
2068 self.0.request = v.into();
2069 self
2070 }
2071
2072 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2074 self.0.options = v.into();
2075 self
2076 }
2077
2078 pub async fn send(self) -> Result<crate::model::SearchProjectsResponse> {
2080 (*self.0.stub)
2081 .search_projects(self.0.request, self.0.options)
2082 .await
2083 .map(crate::Response::into_body)
2084 }
2085
2086 pub fn by_page(
2088 self,
2089 ) -> impl google_cloud_gax::paginator::Paginator<
2090 crate::model::SearchProjectsResponse,
2091 crate::Error,
2092 > {
2093 use std::clone::Clone;
2094 let token = self.0.request.page_token.clone();
2095 let execute = move |token: String| {
2096 let mut builder = self.clone();
2097 builder.0.request = builder.0.request.set_page_token(token);
2098 builder.send()
2099 };
2100 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2101 }
2102
2103 pub fn by_item(
2105 self,
2106 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2107 crate::model::SearchProjectsResponse,
2108 crate::Error,
2109 > {
2110 use google_cloud_gax::paginator::Paginator;
2111 self.by_page().items()
2112 }
2113
2114 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
2116 self.0.request.query = v.into();
2117 self
2118 }
2119
2120 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2122 self.0.request.page_token = v.into();
2123 self
2124 }
2125
2126 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2128 self.0.request.page_size = v.into();
2129 self
2130 }
2131 }
2132
2133 #[doc(hidden)]
2134 impl crate::RequestBuilder for SearchProjects {
2135 fn request_options(&mut self) -> &mut crate::RequestOptions {
2136 &mut self.0.options
2137 }
2138 }
2139
2140 #[derive(Clone, Debug)]
2158 pub struct CreateProject(RequestBuilder<crate::model::CreateProjectRequest>);
2159
2160 impl CreateProject {
2161 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2162 Self(RequestBuilder::new(stub))
2163 }
2164
2165 pub fn with_request<V: Into<crate::model::CreateProjectRequest>>(mut self, v: V) -> Self {
2167 self.0.request = v.into();
2168 self
2169 }
2170
2171 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2173 self.0.options = v.into();
2174 self
2175 }
2176
2177 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2184 (*self.0.stub)
2185 .create_project(self.0.request, self.0.options)
2186 .await
2187 .map(crate::Response::into_body)
2188 }
2189
2190 pub fn poller(
2192 self,
2193 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::CreateProjectMetadata>
2194 {
2195 type Operation = google_cloud_lro::internal::Operation<
2196 crate::model::Project,
2197 crate::model::CreateProjectMetadata,
2198 >;
2199 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2200 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2201
2202 let stub = self.0.stub.clone();
2203 let mut options = self.0.options.clone();
2204 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2205 let query = move |name| {
2206 let stub = stub.clone();
2207 let options = options.clone();
2208 async {
2209 let op = GetOperation::new(stub)
2210 .set_name(name)
2211 .with_options(options)
2212 .send()
2213 .await?;
2214 Ok(Operation::new(op))
2215 }
2216 };
2217
2218 let start = move || async {
2219 let op = self.send().await?;
2220 Ok(Operation::new(op))
2221 };
2222
2223 google_cloud_lro::internal::new_poller(
2224 polling_error_policy,
2225 polling_backoff_policy,
2226 start,
2227 query,
2228 )
2229 }
2230
2231 pub fn set_project<T>(mut self, v: T) -> Self
2235 where
2236 T: std::convert::Into<crate::model::Project>,
2237 {
2238 self.0.request.project = std::option::Option::Some(v.into());
2239 self
2240 }
2241
2242 pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
2246 where
2247 T: std::convert::Into<crate::model::Project>,
2248 {
2249 self.0.request.project = v.map(|x| x.into());
2250 self
2251 }
2252 }
2253
2254 #[doc(hidden)]
2255 impl crate::RequestBuilder for CreateProject {
2256 fn request_options(&mut self) -> &mut crate::RequestOptions {
2257 &mut self.0.options
2258 }
2259 }
2260
2261 #[derive(Clone, Debug)]
2279 pub struct UpdateProject(RequestBuilder<crate::model::UpdateProjectRequest>);
2280
2281 impl UpdateProject {
2282 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2283 Self(RequestBuilder::new(stub))
2284 }
2285
2286 pub fn with_request<V: Into<crate::model::UpdateProjectRequest>>(mut self, v: V) -> Self {
2288 self.0.request = v.into();
2289 self
2290 }
2291
2292 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2294 self.0.options = v.into();
2295 self
2296 }
2297
2298 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2305 (*self.0.stub)
2306 .update_project(self.0.request, self.0.options)
2307 .await
2308 .map(crate::Response::into_body)
2309 }
2310
2311 pub fn poller(
2313 self,
2314 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::UpdateProjectMetadata>
2315 {
2316 type Operation = google_cloud_lro::internal::Operation<
2317 crate::model::Project,
2318 crate::model::UpdateProjectMetadata,
2319 >;
2320 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2321 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2322
2323 let stub = self.0.stub.clone();
2324 let mut options = self.0.options.clone();
2325 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2326 let query = move |name| {
2327 let stub = stub.clone();
2328 let options = options.clone();
2329 async {
2330 let op = GetOperation::new(stub)
2331 .set_name(name)
2332 .with_options(options)
2333 .send()
2334 .await?;
2335 Ok(Operation::new(op))
2336 }
2337 };
2338
2339 let start = move || async {
2340 let op = self.send().await?;
2341 Ok(Operation::new(op))
2342 };
2343
2344 google_cloud_lro::internal::new_poller(
2345 polling_error_policy,
2346 polling_backoff_policy,
2347 start,
2348 query,
2349 )
2350 }
2351
2352 pub fn set_project<T>(mut self, v: T) -> Self
2356 where
2357 T: std::convert::Into<crate::model::Project>,
2358 {
2359 self.0.request.project = std::option::Option::Some(v.into());
2360 self
2361 }
2362
2363 pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
2367 where
2368 T: std::convert::Into<crate::model::Project>,
2369 {
2370 self.0.request.project = v.map(|x| x.into());
2371 self
2372 }
2373
2374 pub fn set_update_mask<T>(mut self, v: T) -> Self
2376 where
2377 T: std::convert::Into<wkt::FieldMask>,
2378 {
2379 self.0.request.update_mask = std::option::Option::Some(v.into());
2380 self
2381 }
2382
2383 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2385 where
2386 T: std::convert::Into<wkt::FieldMask>,
2387 {
2388 self.0.request.update_mask = v.map(|x| x.into());
2389 self
2390 }
2391 }
2392
2393 #[doc(hidden)]
2394 impl crate::RequestBuilder for UpdateProject {
2395 fn request_options(&mut self) -> &mut crate::RequestOptions {
2396 &mut self.0.options
2397 }
2398 }
2399
2400 #[derive(Clone, Debug)]
2418 pub struct MoveProject(RequestBuilder<crate::model::MoveProjectRequest>);
2419
2420 impl MoveProject {
2421 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2422 Self(RequestBuilder::new(stub))
2423 }
2424
2425 pub fn with_request<V: Into<crate::model::MoveProjectRequest>>(mut self, v: V) -> Self {
2427 self.0.request = v.into();
2428 self
2429 }
2430
2431 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2433 self.0.options = v.into();
2434 self
2435 }
2436
2437 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2444 (*self.0.stub)
2445 .move_project(self.0.request, self.0.options)
2446 .await
2447 .map(crate::Response::into_body)
2448 }
2449
2450 pub fn poller(
2452 self,
2453 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::MoveProjectMetadata>
2454 {
2455 type Operation = google_cloud_lro::internal::Operation<
2456 crate::model::Project,
2457 crate::model::MoveProjectMetadata,
2458 >;
2459 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2460 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2461
2462 let stub = self.0.stub.clone();
2463 let mut options = self.0.options.clone();
2464 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2465 let query = move |name| {
2466 let stub = stub.clone();
2467 let options = options.clone();
2468 async {
2469 let op = GetOperation::new(stub)
2470 .set_name(name)
2471 .with_options(options)
2472 .send()
2473 .await?;
2474 Ok(Operation::new(op))
2475 }
2476 };
2477
2478 let start = move || async {
2479 let op = self.send().await?;
2480 Ok(Operation::new(op))
2481 };
2482
2483 google_cloud_lro::internal::new_poller(
2484 polling_error_policy,
2485 polling_backoff_policy,
2486 start,
2487 query,
2488 )
2489 }
2490
2491 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2495 self.0.request.name = v.into();
2496 self
2497 }
2498
2499 pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2503 self.0.request.destination_parent = v.into();
2504 self
2505 }
2506 }
2507
2508 #[doc(hidden)]
2509 impl crate::RequestBuilder for MoveProject {
2510 fn request_options(&mut self) -> &mut crate::RequestOptions {
2511 &mut self.0.options
2512 }
2513 }
2514
2515 #[derive(Clone, Debug)]
2533 pub struct DeleteProject(RequestBuilder<crate::model::DeleteProjectRequest>);
2534
2535 impl DeleteProject {
2536 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2537 Self(RequestBuilder::new(stub))
2538 }
2539
2540 pub fn with_request<V: Into<crate::model::DeleteProjectRequest>>(mut self, v: V) -> Self {
2542 self.0.request = v.into();
2543 self
2544 }
2545
2546 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2548 self.0.options = v.into();
2549 self
2550 }
2551
2552 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2559 (*self.0.stub)
2560 .delete_project(self.0.request, self.0.options)
2561 .await
2562 .map(crate::Response::into_body)
2563 }
2564
2565 pub fn poller(
2567 self,
2568 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::DeleteProjectMetadata>
2569 {
2570 type Operation = google_cloud_lro::internal::Operation<
2571 crate::model::Project,
2572 crate::model::DeleteProjectMetadata,
2573 >;
2574 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2575 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2576
2577 let stub = self.0.stub.clone();
2578 let mut options = self.0.options.clone();
2579 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2580 let query = move |name| {
2581 let stub = stub.clone();
2582 let options = options.clone();
2583 async {
2584 let op = GetOperation::new(stub)
2585 .set_name(name)
2586 .with_options(options)
2587 .send()
2588 .await?;
2589 Ok(Operation::new(op))
2590 }
2591 };
2592
2593 let start = move || async {
2594 let op = self.send().await?;
2595 Ok(Operation::new(op))
2596 };
2597
2598 google_cloud_lro::internal::new_poller(
2599 polling_error_policy,
2600 polling_backoff_policy,
2601 start,
2602 query,
2603 )
2604 }
2605
2606 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2610 self.0.request.name = v.into();
2611 self
2612 }
2613 }
2614
2615 #[doc(hidden)]
2616 impl crate::RequestBuilder for DeleteProject {
2617 fn request_options(&mut self) -> &mut crate::RequestOptions {
2618 &mut self.0.options
2619 }
2620 }
2621
2622 #[derive(Clone, Debug)]
2640 pub struct UndeleteProject(RequestBuilder<crate::model::UndeleteProjectRequest>);
2641
2642 impl UndeleteProject {
2643 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2644 Self(RequestBuilder::new(stub))
2645 }
2646
2647 pub fn with_request<V: Into<crate::model::UndeleteProjectRequest>>(mut self, v: V) -> Self {
2649 self.0.request = v.into();
2650 self
2651 }
2652
2653 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2655 self.0.options = v.into();
2656 self
2657 }
2658
2659 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2666 (*self.0.stub)
2667 .undelete_project(self.0.request, self.0.options)
2668 .await
2669 .map(crate::Response::into_body)
2670 }
2671
2672 pub fn poller(
2674 self,
2675 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::UndeleteProjectMetadata>
2676 {
2677 type Operation = google_cloud_lro::internal::Operation<
2678 crate::model::Project,
2679 crate::model::UndeleteProjectMetadata,
2680 >;
2681 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2682 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2683
2684 let stub = self.0.stub.clone();
2685 let mut options = self.0.options.clone();
2686 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2687 let query = move |name| {
2688 let stub = stub.clone();
2689 let options = options.clone();
2690 async {
2691 let op = GetOperation::new(stub)
2692 .set_name(name)
2693 .with_options(options)
2694 .send()
2695 .await?;
2696 Ok(Operation::new(op))
2697 }
2698 };
2699
2700 let start = move || async {
2701 let op = self.send().await?;
2702 Ok(Operation::new(op))
2703 };
2704
2705 google_cloud_lro::internal::new_poller(
2706 polling_error_policy,
2707 polling_backoff_policy,
2708 start,
2709 query,
2710 )
2711 }
2712
2713 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2717 self.0.request.name = v.into();
2718 self
2719 }
2720 }
2721
2722 #[doc(hidden)]
2723 impl crate::RequestBuilder for UndeleteProject {
2724 fn request_options(&mut self) -> &mut crate::RequestOptions {
2725 &mut self.0.options
2726 }
2727 }
2728
2729 #[derive(Clone, Debug)]
2746 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
2747
2748 impl GetIamPolicy {
2749 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2750 Self(RequestBuilder::new(stub))
2751 }
2752
2753 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
2755 mut self,
2756 v: V,
2757 ) -> Self {
2758 self.0.request = v.into();
2759 self
2760 }
2761
2762 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2764 self.0.options = v.into();
2765 self
2766 }
2767
2768 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2770 (*self.0.stub)
2771 .get_iam_policy(self.0.request, self.0.options)
2772 .await
2773 .map(crate::Response::into_body)
2774 }
2775
2776 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2780 self.0.request.resource = v.into();
2781 self
2782 }
2783
2784 pub fn set_options<T>(mut self, v: T) -> Self
2786 where
2787 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2788 {
2789 self.0.request.options = std::option::Option::Some(v.into());
2790 self
2791 }
2792
2793 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2795 where
2796 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2797 {
2798 self.0.request.options = v.map(|x| x.into());
2799 self
2800 }
2801 }
2802
2803 #[doc(hidden)]
2804 impl crate::RequestBuilder for GetIamPolicy {
2805 fn request_options(&mut self) -> &mut crate::RequestOptions {
2806 &mut self.0.options
2807 }
2808 }
2809
2810 #[derive(Clone, Debug)]
2827 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
2828
2829 impl SetIamPolicy {
2830 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2831 Self(RequestBuilder::new(stub))
2832 }
2833
2834 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
2836 mut self,
2837 v: V,
2838 ) -> Self {
2839 self.0.request = v.into();
2840 self
2841 }
2842
2843 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2845 self.0.options = v.into();
2846 self
2847 }
2848
2849 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2851 (*self.0.stub)
2852 .set_iam_policy(self.0.request, self.0.options)
2853 .await
2854 .map(crate::Response::into_body)
2855 }
2856
2857 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2861 self.0.request.resource = v.into();
2862 self
2863 }
2864
2865 pub fn set_policy<T>(mut self, v: T) -> Self
2869 where
2870 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2871 {
2872 self.0.request.policy = std::option::Option::Some(v.into());
2873 self
2874 }
2875
2876 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2880 where
2881 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2882 {
2883 self.0.request.policy = v.map(|x| x.into());
2884 self
2885 }
2886
2887 pub fn set_update_mask<T>(mut self, v: T) -> Self
2889 where
2890 T: std::convert::Into<wkt::FieldMask>,
2891 {
2892 self.0.request.update_mask = std::option::Option::Some(v.into());
2893 self
2894 }
2895
2896 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2898 where
2899 T: std::convert::Into<wkt::FieldMask>,
2900 {
2901 self.0.request.update_mask = v.map(|x| x.into());
2902 self
2903 }
2904 }
2905
2906 #[doc(hidden)]
2907 impl crate::RequestBuilder for SetIamPolicy {
2908 fn request_options(&mut self) -> &mut crate::RequestOptions {
2909 &mut self.0.options
2910 }
2911 }
2912
2913 #[derive(Clone, Debug)]
2930 pub struct TestIamPermissions(
2931 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
2932 );
2933
2934 impl TestIamPermissions {
2935 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2936 Self(RequestBuilder::new(stub))
2937 }
2938
2939 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
2941 mut self,
2942 v: V,
2943 ) -> Self {
2944 self.0.request = v.into();
2945 self
2946 }
2947
2948 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2950 self.0.options = v.into();
2951 self
2952 }
2953
2954 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
2956 (*self.0.stub)
2957 .test_iam_permissions(self.0.request, self.0.options)
2958 .await
2959 .map(crate::Response::into_body)
2960 }
2961
2962 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2966 self.0.request.resource = v.into();
2967 self
2968 }
2969
2970 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2974 where
2975 T: std::iter::IntoIterator<Item = V>,
2976 V: std::convert::Into<std::string::String>,
2977 {
2978 use std::iter::Iterator;
2979 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2980 self
2981 }
2982 }
2983
2984 #[doc(hidden)]
2985 impl crate::RequestBuilder for TestIamPermissions {
2986 fn request_options(&mut self) -> &mut crate::RequestOptions {
2987 &mut self.0.options
2988 }
2989 }
2990
2991 #[derive(Clone, Debug)]
3008 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3009
3010 impl GetOperation {
3011 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
3012 Self(RequestBuilder::new(stub))
3013 }
3014
3015 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3017 mut self,
3018 v: V,
3019 ) -> Self {
3020 self.0.request = v.into();
3021 self
3022 }
3023
3024 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3026 self.0.options = v.into();
3027 self
3028 }
3029
3030 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3032 (*self.0.stub)
3033 .get_operation(self.0.request, self.0.options)
3034 .await
3035 .map(crate::Response::into_body)
3036 }
3037
3038 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3040 self.0.request.name = v.into();
3041 self
3042 }
3043 }
3044
3045 #[doc(hidden)]
3046 impl crate::RequestBuilder for GetOperation {
3047 fn request_options(&mut self) -> &mut crate::RequestOptions {
3048 &mut self.0.options
3049 }
3050 }
3051}
3052
3053pub mod tag_bindings {
3055 use crate::Result;
3056
3057 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3071
3072 pub(crate) mod client {
3073 use super::super::super::client::TagBindings;
3074 pub struct Factory;
3075 impl crate::ClientFactory for Factory {
3076 type Client = TagBindings;
3077 type Credentials = gaxi::options::Credentials;
3078 async fn build(
3079 self,
3080 config: gaxi::options::ClientConfig,
3081 ) -> crate::ClientBuilderResult<Self::Client> {
3082 Self::Client::new(config).await
3083 }
3084 }
3085 }
3086
3087 #[derive(Clone, Debug)]
3089 pub(crate) struct RequestBuilder<R: std::default::Default> {
3090 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3091 request: R,
3092 options: crate::RequestOptions,
3093 }
3094
3095 impl<R> RequestBuilder<R>
3096 where
3097 R: std::default::Default,
3098 {
3099 pub(crate) fn new(
3100 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3101 ) -> Self {
3102 Self {
3103 stub,
3104 request: R::default(),
3105 options: crate::RequestOptions::default(),
3106 }
3107 }
3108 }
3109
3110 #[derive(Clone, Debug)]
3131 pub struct ListTagBindings(RequestBuilder<crate::model::ListTagBindingsRequest>);
3132
3133 impl ListTagBindings {
3134 pub(crate) fn new(
3135 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3136 ) -> Self {
3137 Self(RequestBuilder::new(stub))
3138 }
3139
3140 pub fn with_request<V: Into<crate::model::ListTagBindingsRequest>>(mut self, v: V) -> Self {
3142 self.0.request = v.into();
3143 self
3144 }
3145
3146 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3148 self.0.options = v.into();
3149 self
3150 }
3151
3152 pub async fn send(self) -> Result<crate::model::ListTagBindingsResponse> {
3154 (*self.0.stub)
3155 .list_tag_bindings(self.0.request, self.0.options)
3156 .await
3157 .map(crate::Response::into_body)
3158 }
3159
3160 pub fn by_page(
3162 self,
3163 ) -> impl google_cloud_gax::paginator::Paginator<
3164 crate::model::ListTagBindingsResponse,
3165 crate::Error,
3166 > {
3167 use std::clone::Clone;
3168 let token = self.0.request.page_token.clone();
3169 let execute = move |token: String| {
3170 let mut builder = self.clone();
3171 builder.0.request = builder.0.request.set_page_token(token);
3172 builder.send()
3173 };
3174 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3175 }
3176
3177 pub fn by_item(
3179 self,
3180 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3181 crate::model::ListTagBindingsResponse,
3182 crate::Error,
3183 > {
3184 use google_cloud_gax::paginator::Paginator;
3185 self.by_page().items()
3186 }
3187
3188 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3192 self.0.request.parent = v.into();
3193 self
3194 }
3195
3196 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3198 self.0.request.page_size = v.into();
3199 self
3200 }
3201
3202 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3204 self.0.request.page_token = v.into();
3205 self
3206 }
3207 }
3208
3209 #[doc(hidden)]
3210 impl crate::RequestBuilder for ListTagBindings {
3211 fn request_options(&mut self) -> &mut crate::RequestOptions {
3212 &mut self.0.options
3213 }
3214 }
3215
3216 #[derive(Clone, Debug)]
3234 pub struct CreateTagBinding(RequestBuilder<crate::model::CreateTagBindingRequest>);
3235
3236 impl CreateTagBinding {
3237 pub(crate) fn new(
3238 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3239 ) -> Self {
3240 Self(RequestBuilder::new(stub))
3241 }
3242
3243 pub fn with_request<V: Into<crate::model::CreateTagBindingRequest>>(
3245 mut self,
3246 v: V,
3247 ) -> Self {
3248 self.0.request = v.into();
3249 self
3250 }
3251
3252 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3254 self.0.options = v.into();
3255 self
3256 }
3257
3258 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3265 (*self.0.stub)
3266 .create_tag_binding(self.0.request, self.0.options)
3267 .await
3268 .map(crate::Response::into_body)
3269 }
3270
3271 pub fn poller(
3273 self,
3274 ) -> impl google_cloud_lro::Poller<
3275 crate::model::TagBinding,
3276 crate::model::CreateTagBindingMetadata,
3277 > {
3278 type Operation = google_cloud_lro::internal::Operation<
3279 crate::model::TagBinding,
3280 crate::model::CreateTagBindingMetadata,
3281 >;
3282 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3283 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3284
3285 let stub = self.0.stub.clone();
3286 let mut options = self.0.options.clone();
3287 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3288 let query = move |name| {
3289 let stub = stub.clone();
3290 let options = options.clone();
3291 async {
3292 let op = GetOperation::new(stub)
3293 .set_name(name)
3294 .with_options(options)
3295 .send()
3296 .await?;
3297 Ok(Operation::new(op))
3298 }
3299 };
3300
3301 let start = move || async {
3302 let op = self.send().await?;
3303 Ok(Operation::new(op))
3304 };
3305
3306 google_cloud_lro::internal::new_poller(
3307 polling_error_policy,
3308 polling_backoff_policy,
3309 start,
3310 query,
3311 )
3312 }
3313
3314 pub fn set_tag_binding<T>(mut self, v: T) -> Self
3318 where
3319 T: std::convert::Into<crate::model::TagBinding>,
3320 {
3321 self.0.request.tag_binding = std::option::Option::Some(v.into());
3322 self
3323 }
3324
3325 pub fn set_or_clear_tag_binding<T>(mut self, v: std::option::Option<T>) -> Self
3329 where
3330 T: std::convert::Into<crate::model::TagBinding>,
3331 {
3332 self.0.request.tag_binding = v.map(|x| x.into());
3333 self
3334 }
3335
3336 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3338 self.0.request.validate_only = v.into();
3339 self
3340 }
3341 }
3342
3343 #[doc(hidden)]
3344 impl crate::RequestBuilder for CreateTagBinding {
3345 fn request_options(&mut self) -> &mut crate::RequestOptions {
3346 &mut self.0.options
3347 }
3348 }
3349
3350 #[derive(Clone, Debug)]
3368 pub struct DeleteTagBinding(RequestBuilder<crate::model::DeleteTagBindingRequest>);
3369
3370 impl DeleteTagBinding {
3371 pub(crate) fn new(
3372 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3373 ) -> Self {
3374 Self(RequestBuilder::new(stub))
3375 }
3376
3377 pub fn with_request<V: Into<crate::model::DeleteTagBindingRequest>>(
3379 mut self,
3380 v: V,
3381 ) -> Self {
3382 self.0.request = v.into();
3383 self
3384 }
3385
3386 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3388 self.0.options = v.into();
3389 self
3390 }
3391
3392 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3399 (*self.0.stub)
3400 .delete_tag_binding(self.0.request, self.0.options)
3401 .await
3402 .map(crate::Response::into_body)
3403 }
3404
3405 pub fn poller(
3407 self,
3408 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTagBindingMetadata> {
3409 type Operation = google_cloud_lro::internal::Operation<
3410 wkt::Empty,
3411 crate::model::DeleteTagBindingMetadata,
3412 >;
3413 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3414 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3415
3416 let stub = self.0.stub.clone();
3417 let mut options = self.0.options.clone();
3418 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3419 let query = move |name| {
3420 let stub = stub.clone();
3421 let options = options.clone();
3422 async {
3423 let op = GetOperation::new(stub)
3424 .set_name(name)
3425 .with_options(options)
3426 .send()
3427 .await?;
3428 Ok(Operation::new(op))
3429 }
3430 };
3431
3432 let start = move || async {
3433 let op = self.send().await?;
3434 Ok(Operation::new(op))
3435 };
3436
3437 google_cloud_lro::internal::new_unit_response_poller(
3438 polling_error_policy,
3439 polling_backoff_policy,
3440 start,
3441 query,
3442 )
3443 }
3444
3445 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3449 self.0.request.name = v.into();
3450 self
3451 }
3452 }
3453
3454 #[doc(hidden)]
3455 impl crate::RequestBuilder for DeleteTagBinding {
3456 fn request_options(&mut self) -> &mut crate::RequestOptions {
3457 &mut self.0.options
3458 }
3459 }
3460
3461 #[derive(Clone, Debug)]
3482 pub struct ListEffectiveTags(RequestBuilder<crate::model::ListEffectiveTagsRequest>);
3483
3484 impl ListEffectiveTags {
3485 pub(crate) fn new(
3486 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3487 ) -> Self {
3488 Self(RequestBuilder::new(stub))
3489 }
3490
3491 pub fn with_request<V: Into<crate::model::ListEffectiveTagsRequest>>(
3493 mut self,
3494 v: V,
3495 ) -> Self {
3496 self.0.request = v.into();
3497 self
3498 }
3499
3500 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3502 self.0.options = v.into();
3503 self
3504 }
3505
3506 pub async fn send(self) -> Result<crate::model::ListEffectiveTagsResponse> {
3508 (*self.0.stub)
3509 .list_effective_tags(self.0.request, self.0.options)
3510 .await
3511 .map(crate::Response::into_body)
3512 }
3513
3514 pub fn by_page(
3516 self,
3517 ) -> impl google_cloud_gax::paginator::Paginator<
3518 crate::model::ListEffectiveTagsResponse,
3519 crate::Error,
3520 > {
3521 use std::clone::Clone;
3522 let token = self.0.request.page_token.clone();
3523 let execute = move |token: String| {
3524 let mut builder = self.clone();
3525 builder.0.request = builder.0.request.set_page_token(token);
3526 builder.send()
3527 };
3528 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3529 }
3530
3531 pub fn by_item(
3533 self,
3534 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3535 crate::model::ListEffectiveTagsResponse,
3536 crate::Error,
3537 > {
3538 use google_cloud_gax::paginator::Paginator;
3539 self.by_page().items()
3540 }
3541
3542 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3546 self.0.request.parent = v.into();
3547 self
3548 }
3549
3550 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3552 self.0.request.page_size = v.into();
3553 self
3554 }
3555
3556 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3558 self.0.request.page_token = v.into();
3559 self
3560 }
3561 }
3562
3563 #[doc(hidden)]
3564 impl crate::RequestBuilder for ListEffectiveTags {
3565 fn request_options(&mut self) -> &mut crate::RequestOptions {
3566 &mut self.0.options
3567 }
3568 }
3569
3570 #[derive(Clone, Debug)]
3587 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3588
3589 impl GetOperation {
3590 pub(crate) fn new(
3591 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3592 ) -> Self {
3593 Self(RequestBuilder::new(stub))
3594 }
3595
3596 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3598 mut self,
3599 v: V,
3600 ) -> Self {
3601 self.0.request = v.into();
3602 self
3603 }
3604
3605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3607 self.0.options = v.into();
3608 self
3609 }
3610
3611 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3613 (*self.0.stub)
3614 .get_operation(self.0.request, self.0.options)
3615 .await
3616 .map(crate::Response::into_body)
3617 }
3618
3619 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3621 self.0.request.name = v.into();
3622 self
3623 }
3624 }
3625
3626 #[doc(hidden)]
3627 impl crate::RequestBuilder for GetOperation {
3628 fn request_options(&mut self) -> &mut crate::RequestOptions {
3629 &mut self.0.options
3630 }
3631 }
3632}
3633
3634pub mod tag_holds {
3636 use crate::Result;
3637
3638 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3652
3653 pub(crate) mod client {
3654 use super::super::super::client::TagHolds;
3655 pub struct Factory;
3656 impl crate::ClientFactory for Factory {
3657 type Client = TagHolds;
3658 type Credentials = gaxi::options::Credentials;
3659 async fn build(
3660 self,
3661 config: gaxi::options::ClientConfig,
3662 ) -> crate::ClientBuilderResult<Self::Client> {
3663 Self::Client::new(config).await
3664 }
3665 }
3666 }
3667
3668 #[derive(Clone, Debug)]
3670 pub(crate) struct RequestBuilder<R: std::default::Default> {
3671 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>,
3672 request: R,
3673 options: crate::RequestOptions,
3674 }
3675
3676 impl<R> RequestBuilder<R>
3677 where
3678 R: std::default::Default,
3679 {
3680 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3681 Self {
3682 stub,
3683 request: R::default(),
3684 options: crate::RequestOptions::default(),
3685 }
3686 }
3687 }
3688
3689 #[derive(Clone, Debug)]
3707 pub struct CreateTagHold(RequestBuilder<crate::model::CreateTagHoldRequest>);
3708
3709 impl CreateTagHold {
3710 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3711 Self(RequestBuilder::new(stub))
3712 }
3713
3714 pub fn with_request<V: Into<crate::model::CreateTagHoldRequest>>(mut self, v: V) -> Self {
3716 self.0.request = v.into();
3717 self
3718 }
3719
3720 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3722 self.0.options = v.into();
3723 self
3724 }
3725
3726 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3733 (*self.0.stub)
3734 .create_tag_hold(self.0.request, self.0.options)
3735 .await
3736 .map(crate::Response::into_body)
3737 }
3738
3739 pub fn poller(
3741 self,
3742 ) -> impl google_cloud_lro::Poller<crate::model::TagHold, crate::model::CreateTagHoldMetadata>
3743 {
3744 type Operation = google_cloud_lro::internal::Operation<
3745 crate::model::TagHold,
3746 crate::model::CreateTagHoldMetadata,
3747 >;
3748 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3749 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3750
3751 let stub = self.0.stub.clone();
3752 let mut options = self.0.options.clone();
3753 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3754 let query = move |name| {
3755 let stub = stub.clone();
3756 let options = options.clone();
3757 async {
3758 let op = GetOperation::new(stub)
3759 .set_name(name)
3760 .with_options(options)
3761 .send()
3762 .await?;
3763 Ok(Operation::new(op))
3764 }
3765 };
3766
3767 let start = move || async {
3768 let op = self.send().await?;
3769 Ok(Operation::new(op))
3770 };
3771
3772 google_cloud_lro::internal::new_poller(
3773 polling_error_policy,
3774 polling_backoff_policy,
3775 start,
3776 query,
3777 )
3778 }
3779
3780 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3784 self.0.request.parent = v.into();
3785 self
3786 }
3787
3788 pub fn set_tag_hold<T>(mut self, v: T) -> Self
3792 where
3793 T: std::convert::Into<crate::model::TagHold>,
3794 {
3795 self.0.request.tag_hold = std::option::Option::Some(v.into());
3796 self
3797 }
3798
3799 pub fn set_or_clear_tag_hold<T>(mut self, v: std::option::Option<T>) -> Self
3803 where
3804 T: std::convert::Into<crate::model::TagHold>,
3805 {
3806 self.0.request.tag_hold = v.map(|x| x.into());
3807 self
3808 }
3809
3810 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3812 self.0.request.validate_only = v.into();
3813 self
3814 }
3815 }
3816
3817 #[doc(hidden)]
3818 impl crate::RequestBuilder for CreateTagHold {
3819 fn request_options(&mut self) -> &mut crate::RequestOptions {
3820 &mut self.0.options
3821 }
3822 }
3823
3824 #[derive(Clone, Debug)]
3842 pub struct DeleteTagHold(RequestBuilder<crate::model::DeleteTagHoldRequest>);
3843
3844 impl DeleteTagHold {
3845 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3846 Self(RequestBuilder::new(stub))
3847 }
3848
3849 pub fn with_request<V: Into<crate::model::DeleteTagHoldRequest>>(mut self, v: V) -> Self {
3851 self.0.request = v.into();
3852 self
3853 }
3854
3855 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3857 self.0.options = v.into();
3858 self
3859 }
3860
3861 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3868 (*self.0.stub)
3869 .delete_tag_hold(self.0.request, self.0.options)
3870 .await
3871 .map(crate::Response::into_body)
3872 }
3873
3874 pub fn poller(
3876 self,
3877 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTagHoldMetadata> {
3878 type Operation = google_cloud_lro::internal::Operation<
3879 wkt::Empty,
3880 crate::model::DeleteTagHoldMetadata,
3881 >;
3882 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3883 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3884
3885 let stub = self.0.stub.clone();
3886 let mut options = self.0.options.clone();
3887 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3888 let query = move |name| {
3889 let stub = stub.clone();
3890 let options = options.clone();
3891 async {
3892 let op = GetOperation::new(stub)
3893 .set_name(name)
3894 .with_options(options)
3895 .send()
3896 .await?;
3897 Ok(Operation::new(op))
3898 }
3899 };
3900
3901 let start = move || async {
3902 let op = self.send().await?;
3903 Ok(Operation::new(op))
3904 };
3905
3906 google_cloud_lro::internal::new_unit_response_poller(
3907 polling_error_policy,
3908 polling_backoff_policy,
3909 start,
3910 query,
3911 )
3912 }
3913
3914 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3918 self.0.request.name = v.into();
3919 self
3920 }
3921
3922 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3924 self.0.request.validate_only = v.into();
3925 self
3926 }
3927 }
3928
3929 #[doc(hidden)]
3930 impl crate::RequestBuilder for DeleteTagHold {
3931 fn request_options(&mut self) -> &mut crate::RequestOptions {
3932 &mut self.0.options
3933 }
3934 }
3935
3936 #[derive(Clone, Debug)]
3957 pub struct ListTagHolds(RequestBuilder<crate::model::ListTagHoldsRequest>);
3958
3959 impl ListTagHolds {
3960 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3961 Self(RequestBuilder::new(stub))
3962 }
3963
3964 pub fn with_request<V: Into<crate::model::ListTagHoldsRequest>>(mut self, v: V) -> Self {
3966 self.0.request = v.into();
3967 self
3968 }
3969
3970 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3972 self.0.options = v.into();
3973 self
3974 }
3975
3976 pub async fn send(self) -> Result<crate::model::ListTagHoldsResponse> {
3978 (*self.0.stub)
3979 .list_tag_holds(self.0.request, self.0.options)
3980 .await
3981 .map(crate::Response::into_body)
3982 }
3983
3984 pub fn by_page(
3986 self,
3987 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTagHoldsResponse, crate::Error>
3988 {
3989 use std::clone::Clone;
3990 let token = self.0.request.page_token.clone();
3991 let execute = move |token: String| {
3992 let mut builder = self.clone();
3993 builder.0.request = builder.0.request.set_page_token(token);
3994 builder.send()
3995 };
3996 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3997 }
3998
3999 pub fn by_item(
4001 self,
4002 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4003 crate::model::ListTagHoldsResponse,
4004 crate::Error,
4005 > {
4006 use google_cloud_gax::paginator::Paginator;
4007 self.by_page().items()
4008 }
4009
4010 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4014 self.0.request.parent = v.into();
4015 self
4016 }
4017
4018 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4020 self.0.request.page_size = v.into();
4021 self
4022 }
4023
4024 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4026 self.0.request.page_token = v.into();
4027 self
4028 }
4029
4030 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4032 self.0.request.filter = v.into();
4033 self
4034 }
4035 }
4036
4037 #[doc(hidden)]
4038 impl crate::RequestBuilder for ListTagHolds {
4039 fn request_options(&mut self) -> &mut crate::RequestOptions {
4040 &mut self.0.options
4041 }
4042 }
4043
4044 #[derive(Clone, Debug)]
4061 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4062
4063 impl GetOperation {
4064 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
4065 Self(RequestBuilder::new(stub))
4066 }
4067
4068 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4070 mut self,
4071 v: V,
4072 ) -> Self {
4073 self.0.request = v.into();
4074 self
4075 }
4076
4077 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4079 self.0.options = v.into();
4080 self
4081 }
4082
4083 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4085 (*self.0.stub)
4086 .get_operation(self.0.request, self.0.options)
4087 .await
4088 .map(crate::Response::into_body)
4089 }
4090
4091 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4093 self.0.request.name = v.into();
4094 self
4095 }
4096 }
4097
4098 #[doc(hidden)]
4099 impl crate::RequestBuilder for GetOperation {
4100 fn request_options(&mut self) -> &mut crate::RequestOptions {
4101 &mut self.0.options
4102 }
4103 }
4104}
4105
4106pub mod tag_keys {
4108 use crate::Result;
4109
4110 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4124
4125 pub(crate) mod client {
4126 use super::super::super::client::TagKeys;
4127 pub struct Factory;
4128 impl crate::ClientFactory for Factory {
4129 type Client = TagKeys;
4130 type Credentials = gaxi::options::Credentials;
4131 async fn build(
4132 self,
4133 config: gaxi::options::ClientConfig,
4134 ) -> crate::ClientBuilderResult<Self::Client> {
4135 Self::Client::new(config).await
4136 }
4137 }
4138 }
4139
4140 #[derive(Clone, Debug)]
4142 pub(crate) struct RequestBuilder<R: std::default::Default> {
4143 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>,
4144 request: R,
4145 options: crate::RequestOptions,
4146 }
4147
4148 impl<R> RequestBuilder<R>
4149 where
4150 R: std::default::Default,
4151 {
4152 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4153 Self {
4154 stub,
4155 request: R::default(),
4156 options: crate::RequestOptions::default(),
4157 }
4158 }
4159 }
4160
4161 #[derive(Clone, Debug)]
4182 pub struct ListTagKeys(RequestBuilder<crate::model::ListTagKeysRequest>);
4183
4184 impl ListTagKeys {
4185 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4186 Self(RequestBuilder::new(stub))
4187 }
4188
4189 pub fn with_request<V: Into<crate::model::ListTagKeysRequest>>(mut self, v: V) -> Self {
4191 self.0.request = v.into();
4192 self
4193 }
4194
4195 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4197 self.0.options = v.into();
4198 self
4199 }
4200
4201 pub async fn send(self) -> Result<crate::model::ListTagKeysResponse> {
4203 (*self.0.stub)
4204 .list_tag_keys(self.0.request, self.0.options)
4205 .await
4206 .map(crate::Response::into_body)
4207 }
4208
4209 pub fn by_page(
4211 self,
4212 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTagKeysResponse, crate::Error>
4213 {
4214 use std::clone::Clone;
4215 let token = self.0.request.page_token.clone();
4216 let execute = move |token: String| {
4217 let mut builder = self.clone();
4218 builder.0.request = builder.0.request.set_page_token(token);
4219 builder.send()
4220 };
4221 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4222 }
4223
4224 pub fn by_item(
4226 self,
4227 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4228 crate::model::ListTagKeysResponse,
4229 crate::Error,
4230 > {
4231 use google_cloud_gax::paginator::Paginator;
4232 self.by_page().items()
4233 }
4234
4235 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4239 self.0.request.parent = v.into();
4240 self
4241 }
4242
4243 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4245 self.0.request.page_size = v.into();
4246 self
4247 }
4248
4249 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4251 self.0.request.page_token = v.into();
4252 self
4253 }
4254 }
4255
4256 #[doc(hidden)]
4257 impl crate::RequestBuilder for ListTagKeys {
4258 fn request_options(&mut self) -> &mut crate::RequestOptions {
4259 &mut self.0.options
4260 }
4261 }
4262
4263 #[derive(Clone, Debug)]
4280 pub struct GetTagKey(RequestBuilder<crate::model::GetTagKeyRequest>);
4281
4282 impl GetTagKey {
4283 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4284 Self(RequestBuilder::new(stub))
4285 }
4286
4287 pub fn with_request<V: Into<crate::model::GetTagKeyRequest>>(mut self, v: V) -> Self {
4289 self.0.request = v.into();
4290 self
4291 }
4292
4293 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4295 self.0.options = v.into();
4296 self
4297 }
4298
4299 pub async fn send(self) -> Result<crate::model::TagKey> {
4301 (*self.0.stub)
4302 .get_tag_key(self.0.request, self.0.options)
4303 .await
4304 .map(crate::Response::into_body)
4305 }
4306
4307 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4311 self.0.request.name = v.into();
4312 self
4313 }
4314 }
4315
4316 #[doc(hidden)]
4317 impl crate::RequestBuilder for GetTagKey {
4318 fn request_options(&mut self) -> &mut crate::RequestOptions {
4319 &mut self.0.options
4320 }
4321 }
4322
4323 #[derive(Clone, Debug)]
4340 pub struct GetNamespacedTagKey(RequestBuilder<crate::model::GetNamespacedTagKeyRequest>);
4341
4342 impl GetNamespacedTagKey {
4343 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4344 Self(RequestBuilder::new(stub))
4345 }
4346
4347 pub fn with_request<V: Into<crate::model::GetNamespacedTagKeyRequest>>(
4349 mut self,
4350 v: V,
4351 ) -> Self {
4352 self.0.request = v.into();
4353 self
4354 }
4355
4356 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4358 self.0.options = v.into();
4359 self
4360 }
4361
4362 pub async fn send(self) -> Result<crate::model::TagKey> {
4364 (*self.0.stub)
4365 .get_namespaced_tag_key(self.0.request, self.0.options)
4366 .await
4367 .map(crate::Response::into_body)
4368 }
4369
4370 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4374 self.0.request.name = v.into();
4375 self
4376 }
4377 }
4378
4379 #[doc(hidden)]
4380 impl crate::RequestBuilder for GetNamespacedTagKey {
4381 fn request_options(&mut self) -> &mut crate::RequestOptions {
4382 &mut self.0.options
4383 }
4384 }
4385
4386 #[derive(Clone, Debug)]
4404 pub struct CreateTagKey(RequestBuilder<crate::model::CreateTagKeyRequest>);
4405
4406 impl CreateTagKey {
4407 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4408 Self(RequestBuilder::new(stub))
4409 }
4410
4411 pub fn with_request<V: Into<crate::model::CreateTagKeyRequest>>(mut self, v: V) -> Self {
4413 self.0.request = v.into();
4414 self
4415 }
4416
4417 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4419 self.0.options = v.into();
4420 self
4421 }
4422
4423 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4430 (*self.0.stub)
4431 .create_tag_key(self.0.request, self.0.options)
4432 .await
4433 .map(crate::Response::into_body)
4434 }
4435
4436 pub fn poller(
4438 self,
4439 ) -> impl google_cloud_lro::Poller<crate::model::TagKey, crate::model::CreateTagKeyMetadata>
4440 {
4441 type Operation = google_cloud_lro::internal::Operation<
4442 crate::model::TagKey,
4443 crate::model::CreateTagKeyMetadata,
4444 >;
4445 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4446 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4447
4448 let stub = self.0.stub.clone();
4449 let mut options = self.0.options.clone();
4450 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4451 let query = move |name| {
4452 let stub = stub.clone();
4453 let options = options.clone();
4454 async {
4455 let op = GetOperation::new(stub)
4456 .set_name(name)
4457 .with_options(options)
4458 .send()
4459 .await?;
4460 Ok(Operation::new(op))
4461 }
4462 };
4463
4464 let start = move || async {
4465 let op = self.send().await?;
4466 Ok(Operation::new(op))
4467 };
4468
4469 google_cloud_lro::internal::new_poller(
4470 polling_error_policy,
4471 polling_backoff_policy,
4472 start,
4473 query,
4474 )
4475 }
4476
4477 pub fn set_tag_key<T>(mut self, v: T) -> Self
4481 where
4482 T: std::convert::Into<crate::model::TagKey>,
4483 {
4484 self.0.request.tag_key = std::option::Option::Some(v.into());
4485 self
4486 }
4487
4488 pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
4492 where
4493 T: std::convert::Into<crate::model::TagKey>,
4494 {
4495 self.0.request.tag_key = v.map(|x| x.into());
4496 self
4497 }
4498
4499 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4501 self.0.request.validate_only = v.into();
4502 self
4503 }
4504 }
4505
4506 #[doc(hidden)]
4507 impl crate::RequestBuilder for CreateTagKey {
4508 fn request_options(&mut self) -> &mut crate::RequestOptions {
4509 &mut self.0.options
4510 }
4511 }
4512
4513 #[derive(Clone, Debug)]
4531 pub struct UpdateTagKey(RequestBuilder<crate::model::UpdateTagKeyRequest>);
4532
4533 impl UpdateTagKey {
4534 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4535 Self(RequestBuilder::new(stub))
4536 }
4537
4538 pub fn with_request<V: Into<crate::model::UpdateTagKeyRequest>>(mut self, v: V) -> Self {
4540 self.0.request = v.into();
4541 self
4542 }
4543
4544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4546 self.0.options = v.into();
4547 self
4548 }
4549
4550 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4557 (*self.0.stub)
4558 .update_tag_key(self.0.request, self.0.options)
4559 .await
4560 .map(crate::Response::into_body)
4561 }
4562
4563 pub fn poller(
4565 self,
4566 ) -> impl google_cloud_lro::Poller<crate::model::TagKey, crate::model::UpdateTagKeyMetadata>
4567 {
4568 type Operation = google_cloud_lro::internal::Operation<
4569 crate::model::TagKey,
4570 crate::model::UpdateTagKeyMetadata,
4571 >;
4572 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4573 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4574
4575 let stub = self.0.stub.clone();
4576 let mut options = self.0.options.clone();
4577 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4578 let query = move |name| {
4579 let stub = stub.clone();
4580 let options = options.clone();
4581 async {
4582 let op = GetOperation::new(stub)
4583 .set_name(name)
4584 .with_options(options)
4585 .send()
4586 .await?;
4587 Ok(Operation::new(op))
4588 }
4589 };
4590
4591 let start = move || async {
4592 let op = self.send().await?;
4593 Ok(Operation::new(op))
4594 };
4595
4596 google_cloud_lro::internal::new_poller(
4597 polling_error_policy,
4598 polling_backoff_policy,
4599 start,
4600 query,
4601 )
4602 }
4603
4604 pub fn set_tag_key<T>(mut self, v: T) -> Self
4608 where
4609 T: std::convert::Into<crate::model::TagKey>,
4610 {
4611 self.0.request.tag_key = std::option::Option::Some(v.into());
4612 self
4613 }
4614
4615 pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
4619 where
4620 T: std::convert::Into<crate::model::TagKey>,
4621 {
4622 self.0.request.tag_key = v.map(|x| x.into());
4623 self
4624 }
4625
4626 pub fn set_update_mask<T>(mut self, v: T) -> Self
4628 where
4629 T: std::convert::Into<wkt::FieldMask>,
4630 {
4631 self.0.request.update_mask = std::option::Option::Some(v.into());
4632 self
4633 }
4634
4635 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4637 where
4638 T: std::convert::Into<wkt::FieldMask>,
4639 {
4640 self.0.request.update_mask = v.map(|x| x.into());
4641 self
4642 }
4643
4644 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4646 self.0.request.validate_only = v.into();
4647 self
4648 }
4649 }
4650
4651 #[doc(hidden)]
4652 impl crate::RequestBuilder for UpdateTagKey {
4653 fn request_options(&mut self) -> &mut crate::RequestOptions {
4654 &mut self.0.options
4655 }
4656 }
4657
4658 #[derive(Clone, Debug)]
4676 pub struct DeleteTagKey(RequestBuilder<crate::model::DeleteTagKeyRequest>);
4677
4678 impl DeleteTagKey {
4679 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4680 Self(RequestBuilder::new(stub))
4681 }
4682
4683 pub fn with_request<V: Into<crate::model::DeleteTagKeyRequest>>(mut self, v: V) -> Self {
4685 self.0.request = v.into();
4686 self
4687 }
4688
4689 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4691 self.0.options = v.into();
4692 self
4693 }
4694
4695 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4702 (*self.0.stub)
4703 .delete_tag_key(self.0.request, self.0.options)
4704 .await
4705 .map(crate::Response::into_body)
4706 }
4707
4708 pub fn poller(
4710 self,
4711 ) -> impl google_cloud_lro::Poller<crate::model::TagKey, crate::model::DeleteTagKeyMetadata>
4712 {
4713 type Operation = google_cloud_lro::internal::Operation<
4714 crate::model::TagKey,
4715 crate::model::DeleteTagKeyMetadata,
4716 >;
4717 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4718 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4719
4720 let stub = self.0.stub.clone();
4721 let mut options = self.0.options.clone();
4722 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4723 let query = move |name| {
4724 let stub = stub.clone();
4725 let options = options.clone();
4726 async {
4727 let op = GetOperation::new(stub)
4728 .set_name(name)
4729 .with_options(options)
4730 .send()
4731 .await?;
4732 Ok(Operation::new(op))
4733 }
4734 };
4735
4736 let start = move || async {
4737 let op = self.send().await?;
4738 Ok(Operation::new(op))
4739 };
4740
4741 google_cloud_lro::internal::new_poller(
4742 polling_error_policy,
4743 polling_backoff_policy,
4744 start,
4745 query,
4746 )
4747 }
4748
4749 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4753 self.0.request.name = v.into();
4754 self
4755 }
4756
4757 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4759 self.0.request.validate_only = v.into();
4760 self
4761 }
4762
4763 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4765 self.0.request.etag = v.into();
4766 self
4767 }
4768 }
4769
4770 #[doc(hidden)]
4771 impl crate::RequestBuilder for DeleteTagKey {
4772 fn request_options(&mut self) -> &mut crate::RequestOptions {
4773 &mut self.0.options
4774 }
4775 }
4776
4777 #[derive(Clone, Debug)]
4794 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
4795
4796 impl GetIamPolicy {
4797 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4798 Self(RequestBuilder::new(stub))
4799 }
4800
4801 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
4803 mut self,
4804 v: V,
4805 ) -> Self {
4806 self.0.request = v.into();
4807 self
4808 }
4809
4810 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4812 self.0.options = v.into();
4813 self
4814 }
4815
4816 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4818 (*self.0.stub)
4819 .get_iam_policy(self.0.request, self.0.options)
4820 .await
4821 .map(crate::Response::into_body)
4822 }
4823
4824 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4828 self.0.request.resource = v.into();
4829 self
4830 }
4831
4832 pub fn set_options<T>(mut self, v: T) -> Self
4834 where
4835 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4836 {
4837 self.0.request.options = std::option::Option::Some(v.into());
4838 self
4839 }
4840
4841 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4843 where
4844 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4845 {
4846 self.0.request.options = v.map(|x| x.into());
4847 self
4848 }
4849 }
4850
4851 #[doc(hidden)]
4852 impl crate::RequestBuilder for GetIamPolicy {
4853 fn request_options(&mut self) -> &mut crate::RequestOptions {
4854 &mut self.0.options
4855 }
4856 }
4857
4858 #[derive(Clone, Debug)]
4875 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
4876
4877 impl SetIamPolicy {
4878 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4879 Self(RequestBuilder::new(stub))
4880 }
4881
4882 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
4884 mut self,
4885 v: V,
4886 ) -> Self {
4887 self.0.request = v.into();
4888 self
4889 }
4890
4891 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4893 self.0.options = v.into();
4894 self
4895 }
4896
4897 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4899 (*self.0.stub)
4900 .set_iam_policy(self.0.request, self.0.options)
4901 .await
4902 .map(crate::Response::into_body)
4903 }
4904
4905 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4909 self.0.request.resource = v.into();
4910 self
4911 }
4912
4913 pub fn set_policy<T>(mut self, v: T) -> Self
4917 where
4918 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4919 {
4920 self.0.request.policy = std::option::Option::Some(v.into());
4921 self
4922 }
4923
4924 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4928 where
4929 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4930 {
4931 self.0.request.policy = v.map(|x| x.into());
4932 self
4933 }
4934
4935 pub fn set_update_mask<T>(mut self, v: T) -> Self
4937 where
4938 T: std::convert::Into<wkt::FieldMask>,
4939 {
4940 self.0.request.update_mask = std::option::Option::Some(v.into());
4941 self
4942 }
4943
4944 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4946 where
4947 T: std::convert::Into<wkt::FieldMask>,
4948 {
4949 self.0.request.update_mask = v.map(|x| x.into());
4950 self
4951 }
4952 }
4953
4954 #[doc(hidden)]
4955 impl crate::RequestBuilder for SetIamPolicy {
4956 fn request_options(&mut self) -> &mut crate::RequestOptions {
4957 &mut self.0.options
4958 }
4959 }
4960
4961 #[derive(Clone, Debug)]
4978 pub struct TestIamPermissions(
4979 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
4980 );
4981
4982 impl TestIamPermissions {
4983 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4984 Self(RequestBuilder::new(stub))
4985 }
4986
4987 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
4989 mut self,
4990 v: V,
4991 ) -> Self {
4992 self.0.request = v.into();
4993 self
4994 }
4995
4996 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4998 self.0.options = v.into();
4999 self
5000 }
5001
5002 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
5004 (*self.0.stub)
5005 .test_iam_permissions(self.0.request, self.0.options)
5006 .await
5007 .map(crate::Response::into_body)
5008 }
5009
5010 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5014 self.0.request.resource = v.into();
5015 self
5016 }
5017
5018 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5022 where
5023 T: std::iter::IntoIterator<Item = V>,
5024 V: std::convert::Into<std::string::String>,
5025 {
5026 use std::iter::Iterator;
5027 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5028 self
5029 }
5030 }
5031
5032 #[doc(hidden)]
5033 impl crate::RequestBuilder for TestIamPermissions {
5034 fn request_options(&mut self) -> &mut crate::RequestOptions {
5035 &mut self.0.options
5036 }
5037 }
5038
5039 #[derive(Clone, Debug)]
5056 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5057
5058 impl GetOperation {
5059 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
5060 Self(RequestBuilder::new(stub))
5061 }
5062
5063 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5065 mut self,
5066 v: V,
5067 ) -> Self {
5068 self.0.request = v.into();
5069 self
5070 }
5071
5072 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5074 self.0.options = v.into();
5075 self
5076 }
5077
5078 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5080 (*self.0.stub)
5081 .get_operation(self.0.request, self.0.options)
5082 .await
5083 .map(crate::Response::into_body)
5084 }
5085
5086 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5088 self.0.request.name = v.into();
5089 self
5090 }
5091 }
5092
5093 #[doc(hidden)]
5094 impl crate::RequestBuilder for GetOperation {
5095 fn request_options(&mut self) -> &mut crate::RequestOptions {
5096 &mut self.0.options
5097 }
5098 }
5099}
5100
5101pub mod tag_values {
5103 use crate::Result;
5104
5105 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5119
5120 pub(crate) mod client {
5121 use super::super::super::client::TagValues;
5122 pub struct Factory;
5123 impl crate::ClientFactory for Factory {
5124 type Client = TagValues;
5125 type Credentials = gaxi::options::Credentials;
5126 async fn build(
5127 self,
5128 config: gaxi::options::ClientConfig,
5129 ) -> crate::ClientBuilderResult<Self::Client> {
5130 Self::Client::new(config).await
5131 }
5132 }
5133 }
5134
5135 #[derive(Clone, Debug)]
5137 pub(crate) struct RequestBuilder<R: std::default::Default> {
5138 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5139 request: R,
5140 options: crate::RequestOptions,
5141 }
5142
5143 impl<R> RequestBuilder<R>
5144 where
5145 R: std::default::Default,
5146 {
5147 pub(crate) fn new(
5148 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5149 ) -> Self {
5150 Self {
5151 stub,
5152 request: R::default(),
5153 options: crate::RequestOptions::default(),
5154 }
5155 }
5156 }
5157
5158 #[derive(Clone, Debug)]
5179 pub struct ListTagValues(RequestBuilder<crate::model::ListTagValuesRequest>);
5180
5181 impl ListTagValues {
5182 pub(crate) fn new(
5183 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5184 ) -> Self {
5185 Self(RequestBuilder::new(stub))
5186 }
5187
5188 pub fn with_request<V: Into<crate::model::ListTagValuesRequest>>(mut self, v: V) -> Self {
5190 self.0.request = v.into();
5191 self
5192 }
5193
5194 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5196 self.0.options = v.into();
5197 self
5198 }
5199
5200 pub async fn send(self) -> Result<crate::model::ListTagValuesResponse> {
5202 (*self.0.stub)
5203 .list_tag_values(self.0.request, self.0.options)
5204 .await
5205 .map(crate::Response::into_body)
5206 }
5207
5208 pub fn by_page(
5210 self,
5211 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTagValuesResponse, crate::Error>
5212 {
5213 use std::clone::Clone;
5214 let token = self.0.request.page_token.clone();
5215 let execute = move |token: String| {
5216 let mut builder = self.clone();
5217 builder.0.request = builder.0.request.set_page_token(token);
5218 builder.send()
5219 };
5220 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5221 }
5222
5223 pub fn by_item(
5225 self,
5226 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5227 crate::model::ListTagValuesResponse,
5228 crate::Error,
5229 > {
5230 use google_cloud_gax::paginator::Paginator;
5231 self.by_page().items()
5232 }
5233
5234 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5238 self.0.request.parent = v.into();
5239 self
5240 }
5241
5242 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5244 self.0.request.page_size = v.into();
5245 self
5246 }
5247
5248 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5250 self.0.request.page_token = v.into();
5251 self
5252 }
5253 }
5254
5255 #[doc(hidden)]
5256 impl crate::RequestBuilder for ListTagValues {
5257 fn request_options(&mut self) -> &mut crate::RequestOptions {
5258 &mut self.0.options
5259 }
5260 }
5261
5262 #[derive(Clone, Debug)]
5279 pub struct GetTagValue(RequestBuilder<crate::model::GetTagValueRequest>);
5280
5281 impl GetTagValue {
5282 pub(crate) fn new(
5283 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5284 ) -> Self {
5285 Self(RequestBuilder::new(stub))
5286 }
5287
5288 pub fn with_request<V: Into<crate::model::GetTagValueRequest>>(mut self, v: V) -> Self {
5290 self.0.request = v.into();
5291 self
5292 }
5293
5294 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5296 self.0.options = v.into();
5297 self
5298 }
5299
5300 pub async fn send(self) -> Result<crate::model::TagValue> {
5302 (*self.0.stub)
5303 .get_tag_value(self.0.request, self.0.options)
5304 .await
5305 .map(crate::Response::into_body)
5306 }
5307
5308 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5312 self.0.request.name = v.into();
5313 self
5314 }
5315 }
5316
5317 #[doc(hidden)]
5318 impl crate::RequestBuilder for GetTagValue {
5319 fn request_options(&mut self) -> &mut crate::RequestOptions {
5320 &mut self.0.options
5321 }
5322 }
5323
5324 #[derive(Clone, Debug)]
5341 pub struct GetNamespacedTagValue(RequestBuilder<crate::model::GetNamespacedTagValueRequest>);
5342
5343 impl GetNamespacedTagValue {
5344 pub(crate) fn new(
5345 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5346 ) -> Self {
5347 Self(RequestBuilder::new(stub))
5348 }
5349
5350 pub fn with_request<V: Into<crate::model::GetNamespacedTagValueRequest>>(
5352 mut self,
5353 v: V,
5354 ) -> Self {
5355 self.0.request = v.into();
5356 self
5357 }
5358
5359 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5361 self.0.options = v.into();
5362 self
5363 }
5364
5365 pub async fn send(self) -> Result<crate::model::TagValue> {
5367 (*self.0.stub)
5368 .get_namespaced_tag_value(self.0.request, self.0.options)
5369 .await
5370 .map(crate::Response::into_body)
5371 }
5372
5373 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5377 self.0.request.name = v.into();
5378 self
5379 }
5380 }
5381
5382 #[doc(hidden)]
5383 impl crate::RequestBuilder for GetNamespacedTagValue {
5384 fn request_options(&mut self) -> &mut crate::RequestOptions {
5385 &mut self.0.options
5386 }
5387 }
5388
5389 #[derive(Clone, Debug)]
5407 pub struct CreateTagValue(RequestBuilder<crate::model::CreateTagValueRequest>);
5408
5409 impl CreateTagValue {
5410 pub(crate) fn new(
5411 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5412 ) -> Self {
5413 Self(RequestBuilder::new(stub))
5414 }
5415
5416 pub fn with_request<V: Into<crate::model::CreateTagValueRequest>>(mut self, v: V) -> Self {
5418 self.0.request = v.into();
5419 self
5420 }
5421
5422 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5424 self.0.options = v.into();
5425 self
5426 }
5427
5428 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5435 (*self.0.stub)
5436 .create_tag_value(self.0.request, self.0.options)
5437 .await
5438 .map(crate::Response::into_body)
5439 }
5440
5441 pub fn poller(
5443 self,
5444 ) -> impl google_cloud_lro::Poller<crate::model::TagValue, crate::model::CreateTagValueMetadata>
5445 {
5446 type Operation = google_cloud_lro::internal::Operation<
5447 crate::model::TagValue,
5448 crate::model::CreateTagValueMetadata,
5449 >;
5450 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5451 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5452
5453 let stub = self.0.stub.clone();
5454 let mut options = self.0.options.clone();
5455 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5456 let query = move |name| {
5457 let stub = stub.clone();
5458 let options = options.clone();
5459 async {
5460 let op = GetOperation::new(stub)
5461 .set_name(name)
5462 .with_options(options)
5463 .send()
5464 .await?;
5465 Ok(Operation::new(op))
5466 }
5467 };
5468
5469 let start = move || async {
5470 let op = self.send().await?;
5471 Ok(Operation::new(op))
5472 };
5473
5474 google_cloud_lro::internal::new_poller(
5475 polling_error_policy,
5476 polling_backoff_policy,
5477 start,
5478 query,
5479 )
5480 }
5481
5482 pub fn set_tag_value<T>(mut self, v: T) -> Self
5486 where
5487 T: std::convert::Into<crate::model::TagValue>,
5488 {
5489 self.0.request.tag_value = std::option::Option::Some(v.into());
5490 self
5491 }
5492
5493 pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
5497 where
5498 T: std::convert::Into<crate::model::TagValue>,
5499 {
5500 self.0.request.tag_value = v.map(|x| x.into());
5501 self
5502 }
5503
5504 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5506 self.0.request.validate_only = v.into();
5507 self
5508 }
5509 }
5510
5511 #[doc(hidden)]
5512 impl crate::RequestBuilder for CreateTagValue {
5513 fn request_options(&mut self) -> &mut crate::RequestOptions {
5514 &mut self.0.options
5515 }
5516 }
5517
5518 #[derive(Clone, Debug)]
5536 pub struct UpdateTagValue(RequestBuilder<crate::model::UpdateTagValueRequest>);
5537
5538 impl UpdateTagValue {
5539 pub(crate) fn new(
5540 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5541 ) -> Self {
5542 Self(RequestBuilder::new(stub))
5543 }
5544
5545 pub fn with_request<V: Into<crate::model::UpdateTagValueRequest>>(mut self, v: V) -> Self {
5547 self.0.request = v.into();
5548 self
5549 }
5550
5551 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5553 self.0.options = v.into();
5554 self
5555 }
5556
5557 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5564 (*self.0.stub)
5565 .update_tag_value(self.0.request, self.0.options)
5566 .await
5567 .map(crate::Response::into_body)
5568 }
5569
5570 pub fn poller(
5572 self,
5573 ) -> impl google_cloud_lro::Poller<crate::model::TagValue, crate::model::UpdateTagValueMetadata>
5574 {
5575 type Operation = google_cloud_lro::internal::Operation<
5576 crate::model::TagValue,
5577 crate::model::UpdateTagValueMetadata,
5578 >;
5579 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5580 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5581
5582 let stub = self.0.stub.clone();
5583 let mut options = self.0.options.clone();
5584 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5585 let query = move |name| {
5586 let stub = stub.clone();
5587 let options = options.clone();
5588 async {
5589 let op = GetOperation::new(stub)
5590 .set_name(name)
5591 .with_options(options)
5592 .send()
5593 .await?;
5594 Ok(Operation::new(op))
5595 }
5596 };
5597
5598 let start = move || async {
5599 let op = self.send().await?;
5600 Ok(Operation::new(op))
5601 };
5602
5603 google_cloud_lro::internal::new_poller(
5604 polling_error_policy,
5605 polling_backoff_policy,
5606 start,
5607 query,
5608 )
5609 }
5610
5611 pub fn set_tag_value<T>(mut self, v: T) -> Self
5615 where
5616 T: std::convert::Into<crate::model::TagValue>,
5617 {
5618 self.0.request.tag_value = std::option::Option::Some(v.into());
5619 self
5620 }
5621
5622 pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
5626 where
5627 T: std::convert::Into<crate::model::TagValue>,
5628 {
5629 self.0.request.tag_value = v.map(|x| x.into());
5630 self
5631 }
5632
5633 pub fn set_update_mask<T>(mut self, v: T) -> Self
5635 where
5636 T: std::convert::Into<wkt::FieldMask>,
5637 {
5638 self.0.request.update_mask = std::option::Option::Some(v.into());
5639 self
5640 }
5641
5642 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5644 where
5645 T: std::convert::Into<wkt::FieldMask>,
5646 {
5647 self.0.request.update_mask = v.map(|x| x.into());
5648 self
5649 }
5650
5651 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5653 self.0.request.validate_only = v.into();
5654 self
5655 }
5656 }
5657
5658 #[doc(hidden)]
5659 impl crate::RequestBuilder for UpdateTagValue {
5660 fn request_options(&mut self) -> &mut crate::RequestOptions {
5661 &mut self.0.options
5662 }
5663 }
5664
5665 #[derive(Clone, Debug)]
5683 pub struct DeleteTagValue(RequestBuilder<crate::model::DeleteTagValueRequest>);
5684
5685 impl DeleteTagValue {
5686 pub(crate) fn new(
5687 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5688 ) -> Self {
5689 Self(RequestBuilder::new(stub))
5690 }
5691
5692 pub fn with_request<V: Into<crate::model::DeleteTagValueRequest>>(mut self, v: V) -> Self {
5694 self.0.request = v.into();
5695 self
5696 }
5697
5698 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5700 self.0.options = v.into();
5701 self
5702 }
5703
5704 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5711 (*self.0.stub)
5712 .delete_tag_value(self.0.request, self.0.options)
5713 .await
5714 .map(crate::Response::into_body)
5715 }
5716
5717 pub fn poller(
5719 self,
5720 ) -> impl google_cloud_lro::Poller<crate::model::TagValue, crate::model::DeleteTagValueMetadata>
5721 {
5722 type Operation = google_cloud_lro::internal::Operation<
5723 crate::model::TagValue,
5724 crate::model::DeleteTagValueMetadata,
5725 >;
5726 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5727 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5728
5729 let stub = self.0.stub.clone();
5730 let mut options = self.0.options.clone();
5731 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5732 let query = move |name| {
5733 let stub = stub.clone();
5734 let options = options.clone();
5735 async {
5736 let op = GetOperation::new(stub)
5737 .set_name(name)
5738 .with_options(options)
5739 .send()
5740 .await?;
5741 Ok(Operation::new(op))
5742 }
5743 };
5744
5745 let start = move || async {
5746 let op = self.send().await?;
5747 Ok(Operation::new(op))
5748 };
5749
5750 google_cloud_lro::internal::new_poller(
5751 polling_error_policy,
5752 polling_backoff_policy,
5753 start,
5754 query,
5755 )
5756 }
5757
5758 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5762 self.0.request.name = v.into();
5763 self
5764 }
5765
5766 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5768 self.0.request.validate_only = v.into();
5769 self
5770 }
5771
5772 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5774 self.0.request.etag = v.into();
5775 self
5776 }
5777 }
5778
5779 #[doc(hidden)]
5780 impl crate::RequestBuilder for DeleteTagValue {
5781 fn request_options(&mut self) -> &mut crate::RequestOptions {
5782 &mut self.0.options
5783 }
5784 }
5785
5786 #[derive(Clone, Debug)]
5803 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
5804
5805 impl GetIamPolicy {
5806 pub(crate) fn new(
5807 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5808 ) -> Self {
5809 Self(RequestBuilder::new(stub))
5810 }
5811
5812 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
5814 mut self,
5815 v: V,
5816 ) -> Self {
5817 self.0.request = v.into();
5818 self
5819 }
5820
5821 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5823 self.0.options = v.into();
5824 self
5825 }
5826
5827 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5829 (*self.0.stub)
5830 .get_iam_policy(self.0.request, self.0.options)
5831 .await
5832 .map(crate::Response::into_body)
5833 }
5834
5835 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5839 self.0.request.resource = v.into();
5840 self
5841 }
5842
5843 pub fn set_options<T>(mut self, v: T) -> Self
5845 where
5846 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5847 {
5848 self.0.request.options = std::option::Option::Some(v.into());
5849 self
5850 }
5851
5852 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5854 where
5855 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5856 {
5857 self.0.request.options = v.map(|x| x.into());
5858 self
5859 }
5860 }
5861
5862 #[doc(hidden)]
5863 impl crate::RequestBuilder for GetIamPolicy {
5864 fn request_options(&mut self) -> &mut crate::RequestOptions {
5865 &mut self.0.options
5866 }
5867 }
5868
5869 #[derive(Clone, Debug)]
5886 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
5887
5888 impl SetIamPolicy {
5889 pub(crate) fn new(
5890 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5891 ) -> Self {
5892 Self(RequestBuilder::new(stub))
5893 }
5894
5895 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
5897 mut self,
5898 v: V,
5899 ) -> Self {
5900 self.0.request = v.into();
5901 self
5902 }
5903
5904 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5906 self.0.options = v.into();
5907 self
5908 }
5909
5910 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5912 (*self.0.stub)
5913 .set_iam_policy(self.0.request, self.0.options)
5914 .await
5915 .map(crate::Response::into_body)
5916 }
5917
5918 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5922 self.0.request.resource = v.into();
5923 self
5924 }
5925
5926 pub fn set_policy<T>(mut self, v: T) -> Self
5930 where
5931 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5932 {
5933 self.0.request.policy = std::option::Option::Some(v.into());
5934 self
5935 }
5936
5937 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5941 where
5942 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5943 {
5944 self.0.request.policy = v.map(|x| x.into());
5945 self
5946 }
5947
5948 pub fn set_update_mask<T>(mut self, v: T) -> Self
5950 where
5951 T: std::convert::Into<wkt::FieldMask>,
5952 {
5953 self.0.request.update_mask = std::option::Option::Some(v.into());
5954 self
5955 }
5956
5957 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5959 where
5960 T: std::convert::Into<wkt::FieldMask>,
5961 {
5962 self.0.request.update_mask = v.map(|x| x.into());
5963 self
5964 }
5965 }
5966
5967 #[doc(hidden)]
5968 impl crate::RequestBuilder for SetIamPolicy {
5969 fn request_options(&mut self) -> &mut crate::RequestOptions {
5970 &mut self.0.options
5971 }
5972 }
5973
5974 #[derive(Clone, Debug)]
5991 pub struct TestIamPermissions(
5992 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
5993 );
5994
5995 impl TestIamPermissions {
5996 pub(crate) fn new(
5997 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5998 ) -> Self {
5999 Self(RequestBuilder::new(stub))
6000 }
6001
6002 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
6004 mut self,
6005 v: V,
6006 ) -> Self {
6007 self.0.request = v.into();
6008 self
6009 }
6010
6011 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6013 self.0.options = v.into();
6014 self
6015 }
6016
6017 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
6019 (*self.0.stub)
6020 .test_iam_permissions(self.0.request, self.0.options)
6021 .await
6022 .map(crate::Response::into_body)
6023 }
6024
6025 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6029 self.0.request.resource = v.into();
6030 self
6031 }
6032
6033 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6037 where
6038 T: std::iter::IntoIterator<Item = V>,
6039 V: std::convert::Into<std::string::String>,
6040 {
6041 use std::iter::Iterator;
6042 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6043 self
6044 }
6045 }
6046
6047 #[doc(hidden)]
6048 impl crate::RequestBuilder for TestIamPermissions {
6049 fn request_options(&mut self) -> &mut crate::RequestOptions {
6050 &mut self.0.options
6051 }
6052 }
6053
6054 #[derive(Clone, Debug)]
6071 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6072
6073 impl GetOperation {
6074 pub(crate) fn new(
6075 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
6076 ) -> Self {
6077 Self(RequestBuilder::new(stub))
6078 }
6079
6080 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6082 mut self,
6083 v: V,
6084 ) -> Self {
6085 self.0.request = v.into();
6086 self
6087 }
6088
6089 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6091 self.0.options = v.into();
6092 self
6093 }
6094
6095 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6097 (*self.0.stub)
6098 .get_operation(self.0.request, self.0.options)
6099 .await
6100 .map(crate::Response::into_body)
6101 }
6102
6103 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6105 self.0.request.name = v.into();
6106 self
6107 }
6108 }
6109
6110 #[doc(hidden)]
6111 impl crate::RequestBuilder for GetOperation {
6112 fn request_options(&mut self) -> &mut crate::RequestOptions {
6113 &mut self.0.options
6114 }
6115 }
6116}