1pub mod folders {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::Folders;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = Folders;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
63 Self {
64 stub,
65 request: R::default(),
66 options: crate::RequestOptions::default(),
67 }
68 }
69 }
70
71 #[derive(Clone, Debug)]
88 pub struct GetFolder(RequestBuilder<crate::model::GetFolderRequest>);
89
90 impl GetFolder {
91 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
92 Self(RequestBuilder::new(stub))
93 }
94
95 pub fn with_request<V: Into<crate::model::GetFolderRequest>>(mut self, v: V) -> Self {
97 self.0.request = v.into();
98 self
99 }
100
101 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
103 self.0.options = v.into();
104 self
105 }
106
107 pub async fn send(self) -> Result<crate::model::Folder> {
109 (*self.0.stub)
110 .get_folder(self.0.request, self.0.options)
111 .await
112 .map(crate::Response::into_body)
113 }
114
115 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
119 self.0.request.name = v.into();
120 self
121 }
122 }
123
124 #[doc(hidden)]
125 impl crate::RequestBuilder for GetFolder {
126 fn request_options(&mut self) -> &mut crate::RequestOptions {
127 &mut self.0.options
128 }
129 }
130
131 #[derive(Clone, Debug)]
152 pub struct ListFolders(RequestBuilder<crate::model::ListFoldersRequest>);
153
154 impl ListFolders {
155 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
156 Self(RequestBuilder::new(stub))
157 }
158
159 pub fn with_request<V: Into<crate::model::ListFoldersRequest>>(mut self, v: V) -> Self {
161 self.0.request = v.into();
162 self
163 }
164
165 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
167 self.0.options = v.into();
168 self
169 }
170
171 pub async fn send(self) -> Result<crate::model::ListFoldersResponse> {
173 (*self.0.stub)
174 .list_folders(self.0.request, self.0.options)
175 .await
176 .map(crate::Response::into_body)
177 }
178
179 pub fn by_page(
181 self,
182 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListFoldersResponse, crate::Error>
183 {
184 use std::clone::Clone;
185 let token = self.0.request.page_token.clone();
186 let execute = move |token: String| {
187 let mut builder = self.clone();
188 builder.0.request = builder.0.request.set_page_token(token);
189 builder.send()
190 };
191 google_cloud_gax::paginator::internal::new_paginator(token, execute)
192 }
193
194 pub fn by_item(
196 self,
197 ) -> impl google_cloud_gax::paginator::ItemPaginator<
198 crate::model::ListFoldersResponse,
199 crate::Error,
200 > {
201 use google_cloud_gax::paginator::Paginator;
202 self.by_page().items()
203 }
204
205 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
209 self.0.request.parent = v.into();
210 self
211 }
212
213 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
215 self.0.request.page_size = v.into();
216 self
217 }
218
219 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
221 self.0.request.page_token = v.into();
222 self
223 }
224
225 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
227 self.0.request.show_deleted = v.into();
228 self
229 }
230 }
231
232 #[doc(hidden)]
233 impl crate::RequestBuilder for ListFolders {
234 fn request_options(&mut self) -> &mut crate::RequestOptions {
235 &mut self.0.options
236 }
237 }
238
239 #[derive(Clone, Debug)]
260 pub struct SearchFolders(RequestBuilder<crate::model::SearchFoldersRequest>);
261
262 impl SearchFolders {
263 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
264 Self(RequestBuilder::new(stub))
265 }
266
267 pub fn with_request<V: Into<crate::model::SearchFoldersRequest>>(mut self, v: V) -> Self {
269 self.0.request = v.into();
270 self
271 }
272
273 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
275 self.0.options = v.into();
276 self
277 }
278
279 pub async fn send(self) -> Result<crate::model::SearchFoldersResponse> {
281 (*self.0.stub)
282 .search_folders(self.0.request, self.0.options)
283 .await
284 .map(crate::Response::into_body)
285 }
286
287 pub fn by_page(
289 self,
290 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchFoldersResponse, crate::Error>
291 {
292 use std::clone::Clone;
293 let token = self.0.request.page_token.clone();
294 let execute = move |token: String| {
295 let mut builder = self.clone();
296 builder.0.request = builder.0.request.set_page_token(token);
297 builder.send()
298 };
299 google_cloud_gax::paginator::internal::new_paginator(token, execute)
300 }
301
302 pub fn by_item(
304 self,
305 ) -> impl google_cloud_gax::paginator::ItemPaginator<
306 crate::model::SearchFoldersResponse,
307 crate::Error,
308 > {
309 use google_cloud_gax::paginator::Paginator;
310 self.by_page().items()
311 }
312
313 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
315 self.0.request.page_size = v.into();
316 self
317 }
318
319 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
321 self.0.request.page_token = v.into();
322 self
323 }
324
325 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
327 self.0.request.query = v.into();
328 self
329 }
330 }
331
332 #[doc(hidden)]
333 impl crate::RequestBuilder for SearchFolders {
334 fn request_options(&mut self) -> &mut crate::RequestOptions {
335 &mut self.0.options
336 }
337 }
338
339 #[derive(Clone, Debug)]
357 pub struct CreateFolder(RequestBuilder<crate::model::CreateFolderRequest>);
358
359 impl CreateFolder {
360 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
361 Self(RequestBuilder::new(stub))
362 }
363
364 pub fn with_request<V: Into<crate::model::CreateFolderRequest>>(mut self, v: V) -> Self {
366 self.0.request = v.into();
367 self
368 }
369
370 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
372 self.0.options = v.into();
373 self
374 }
375
376 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
383 (*self.0.stub)
384 .create_folder(self.0.request, self.0.options)
385 .await
386 .map(crate::Response::into_body)
387 }
388
389 pub fn poller(
391 self,
392 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::CreateFolderMetadata>
393 {
394 type Operation = google_cloud_lro::internal::Operation<
395 crate::model::Folder,
396 crate::model::CreateFolderMetadata,
397 >;
398 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
399 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
400
401 let stub = self.0.stub.clone();
402 let mut options = self.0.options.clone();
403 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
404 let query = move |name| {
405 let stub = stub.clone();
406 let options = options.clone();
407 async {
408 let op = GetOperation::new(stub)
409 .set_name(name)
410 .with_options(options)
411 .send()
412 .await?;
413 Ok(Operation::new(op))
414 }
415 };
416
417 let start = move || async {
418 let op = self.send().await?;
419 Ok(Operation::new(op))
420 };
421
422 google_cloud_lro::internal::new_poller(
423 polling_error_policy,
424 polling_backoff_policy,
425 start,
426 query,
427 )
428 }
429
430 pub fn set_folder<T>(mut self, v: T) -> Self
434 where
435 T: std::convert::Into<crate::model::Folder>,
436 {
437 self.0.request.folder = std::option::Option::Some(v.into());
438 self
439 }
440
441 pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
445 where
446 T: std::convert::Into<crate::model::Folder>,
447 {
448 self.0.request.folder = v.map(|x| x.into());
449 self
450 }
451 }
452
453 #[doc(hidden)]
454 impl crate::RequestBuilder for CreateFolder {
455 fn request_options(&mut self) -> &mut crate::RequestOptions {
456 &mut self.0.options
457 }
458 }
459
460 #[derive(Clone, Debug)]
478 pub struct UpdateFolder(RequestBuilder<crate::model::UpdateFolderRequest>);
479
480 impl UpdateFolder {
481 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
482 Self(RequestBuilder::new(stub))
483 }
484
485 pub fn with_request<V: Into<crate::model::UpdateFolderRequest>>(mut self, v: V) -> Self {
487 self.0.request = v.into();
488 self
489 }
490
491 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
493 self.0.options = v.into();
494 self
495 }
496
497 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
504 (*self.0.stub)
505 .update_folder(self.0.request, self.0.options)
506 .await
507 .map(crate::Response::into_body)
508 }
509
510 pub fn poller(
512 self,
513 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::UpdateFolderMetadata>
514 {
515 type Operation = google_cloud_lro::internal::Operation<
516 crate::model::Folder,
517 crate::model::UpdateFolderMetadata,
518 >;
519 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
520 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
521
522 let stub = self.0.stub.clone();
523 let mut options = self.0.options.clone();
524 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
525 let query = move |name| {
526 let stub = stub.clone();
527 let options = options.clone();
528 async {
529 let op = GetOperation::new(stub)
530 .set_name(name)
531 .with_options(options)
532 .send()
533 .await?;
534 Ok(Operation::new(op))
535 }
536 };
537
538 let start = move || async {
539 let op = self.send().await?;
540 Ok(Operation::new(op))
541 };
542
543 google_cloud_lro::internal::new_poller(
544 polling_error_policy,
545 polling_backoff_policy,
546 start,
547 query,
548 )
549 }
550
551 pub fn set_folder<T>(mut self, v: T) -> Self
555 where
556 T: std::convert::Into<crate::model::Folder>,
557 {
558 self.0.request.folder = std::option::Option::Some(v.into());
559 self
560 }
561
562 pub fn set_or_clear_folder<T>(mut self, v: std::option::Option<T>) -> Self
566 where
567 T: std::convert::Into<crate::model::Folder>,
568 {
569 self.0.request.folder = v.map(|x| x.into());
570 self
571 }
572
573 pub fn set_update_mask<T>(mut self, v: T) -> Self
577 where
578 T: std::convert::Into<wkt::FieldMask>,
579 {
580 self.0.request.update_mask = std::option::Option::Some(v.into());
581 self
582 }
583
584 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
588 where
589 T: std::convert::Into<wkt::FieldMask>,
590 {
591 self.0.request.update_mask = v.map(|x| x.into());
592 self
593 }
594 }
595
596 #[doc(hidden)]
597 impl crate::RequestBuilder for UpdateFolder {
598 fn request_options(&mut self) -> &mut crate::RequestOptions {
599 &mut self.0.options
600 }
601 }
602
603 #[derive(Clone, Debug)]
621 pub struct MoveFolder(RequestBuilder<crate::model::MoveFolderRequest>);
622
623 impl MoveFolder {
624 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
625 Self(RequestBuilder::new(stub))
626 }
627
628 pub fn with_request<V: Into<crate::model::MoveFolderRequest>>(mut self, v: V) -> Self {
630 self.0.request = v.into();
631 self
632 }
633
634 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
636 self.0.options = v.into();
637 self
638 }
639
640 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
647 (*self.0.stub)
648 .move_folder(self.0.request, self.0.options)
649 .await
650 .map(crate::Response::into_body)
651 }
652
653 pub fn poller(
655 self,
656 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::MoveFolderMetadata>
657 {
658 type Operation = google_cloud_lro::internal::Operation<
659 crate::model::Folder,
660 crate::model::MoveFolderMetadata,
661 >;
662 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
663 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
664
665 let stub = self.0.stub.clone();
666 let mut options = self.0.options.clone();
667 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
668 let query = move |name| {
669 let stub = stub.clone();
670 let options = options.clone();
671 async {
672 let op = GetOperation::new(stub)
673 .set_name(name)
674 .with_options(options)
675 .send()
676 .await?;
677 Ok(Operation::new(op))
678 }
679 };
680
681 let start = move || async {
682 let op = self.send().await?;
683 Ok(Operation::new(op))
684 };
685
686 google_cloud_lro::internal::new_poller(
687 polling_error_policy,
688 polling_backoff_policy,
689 start,
690 query,
691 )
692 }
693
694 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
698 self.0.request.name = v.into();
699 self
700 }
701
702 pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
706 self.0.request.destination_parent = v.into();
707 self
708 }
709 }
710
711 #[doc(hidden)]
712 impl crate::RequestBuilder for MoveFolder {
713 fn request_options(&mut self) -> &mut crate::RequestOptions {
714 &mut self.0.options
715 }
716 }
717
718 #[derive(Clone, Debug)]
736 pub struct DeleteFolder(RequestBuilder<crate::model::DeleteFolderRequest>);
737
738 impl DeleteFolder {
739 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
740 Self(RequestBuilder::new(stub))
741 }
742
743 pub fn with_request<V: Into<crate::model::DeleteFolderRequest>>(mut self, v: V) -> Self {
745 self.0.request = v.into();
746 self
747 }
748
749 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
751 self.0.options = v.into();
752 self
753 }
754
755 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
762 (*self.0.stub)
763 .delete_folder(self.0.request, self.0.options)
764 .await
765 .map(crate::Response::into_body)
766 }
767
768 pub fn poller(
770 self,
771 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::DeleteFolderMetadata>
772 {
773 type Operation = google_cloud_lro::internal::Operation<
774 crate::model::Folder,
775 crate::model::DeleteFolderMetadata,
776 >;
777 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
778 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
779
780 let stub = self.0.stub.clone();
781 let mut options = self.0.options.clone();
782 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
783 let query = move |name| {
784 let stub = stub.clone();
785 let options = options.clone();
786 async {
787 let op = GetOperation::new(stub)
788 .set_name(name)
789 .with_options(options)
790 .send()
791 .await?;
792 Ok(Operation::new(op))
793 }
794 };
795
796 let start = move || async {
797 let op = self.send().await?;
798 Ok(Operation::new(op))
799 };
800
801 google_cloud_lro::internal::new_poller(
802 polling_error_policy,
803 polling_backoff_policy,
804 start,
805 query,
806 )
807 }
808
809 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
813 self.0.request.name = v.into();
814 self
815 }
816 }
817
818 #[doc(hidden)]
819 impl crate::RequestBuilder for DeleteFolder {
820 fn request_options(&mut self) -> &mut crate::RequestOptions {
821 &mut self.0.options
822 }
823 }
824
825 #[derive(Clone, Debug)]
843 pub struct UndeleteFolder(RequestBuilder<crate::model::UndeleteFolderRequest>);
844
845 impl UndeleteFolder {
846 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
847 Self(RequestBuilder::new(stub))
848 }
849
850 pub fn with_request<V: Into<crate::model::UndeleteFolderRequest>>(mut self, v: V) -> Self {
852 self.0.request = v.into();
853 self
854 }
855
856 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
858 self.0.options = v.into();
859 self
860 }
861
862 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
869 (*self.0.stub)
870 .undelete_folder(self.0.request, self.0.options)
871 .await
872 .map(crate::Response::into_body)
873 }
874
875 pub fn poller(
877 self,
878 ) -> impl google_cloud_lro::Poller<crate::model::Folder, crate::model::UndeleteFolderMetadata>
879 {
880 type Operation = google_cloud_lro::internal::Operation<
881 crate::model::Folder,
882 crate::model::UndeleteFolderMetadata,
883 >;
884 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
885 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
886
887 let stub = self.0.stub.clone();
888 let mut options = self.0.options.clone();
889 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
890 let query = move |name| {
891 let stub = stub.clone();
892 let options = options.clone();
893 async {
894 let op = GetOperation::new(stub)
895 .set_name(name)
896 .with_options(options)
897 .send()
898 .await?;
899 Ok(Operation::new(op))
900 }
901 };
902
903 let start = move || async {
904 let op = self.send().await?;
905 Ok(Operation::new(op))
906 };
907
908 google_cloud_lro::internal::new_poller(
909 polling_error_policy,
910 polling_backoff_policy,
911 start,
912 query,
913 )
914 }
915
916 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
920 self.0.request.name = v.into();
921 self
922 }
923 }
924
925 #[doc(hidden)]
926 impl crate::RequestBuilder for UndeleteFolder {
927 fn request_options(&mut self) -> &mut crate::RequestOptions {
928 &mut self.0.options
929 }
930 }
931
932 #[derive(Clone, Debug)]
949 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
950
951 impl GetIamPolicy {
952 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
953 Self(RequestBuilder::new(stub))
954 }
955
956 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
958 mut self,
959 v: V,
960 ) -> Self {
961 self.0.request = v.into();
962 self
963 }
964
965 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
967 self.0.options = v.into();
968 self
969 }
970
971 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
973 (*self.0.stub)
974 .get_iam_policy(self.0.request, self.0.options)
975 .await
976 .map(crate::Response::into_body)
977 }
978
979 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
983 self.0.request.resource = v.into();
984 self
985 }
986
987 pub fn set_options<T>(mut self, v: T) -> Self
989 where
990 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
991 {
992 self.0.request.options = std::option::Option::Some(v.into());
993 self
994 }
995
996 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
998 where
999 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1000 {
1001 self.0.request.options = v.map(|x| x.into());
1002 self
1003 }
1004 }
1005
1006 #[doc(hidden)]
1007 impl crate::RequestBuilder for GetIamPolicy {
1008 fn request_options(&mut self) -> &mut crate::RequestOptions {
1009 &mut self.0.options
1010 }
1011 }
1012
1013 #[derive(Clone, Debug)]
1030 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1031
1032 impl SetIamPolicy {
1033 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1034 Self(RequestBuilder::new(stub))
1035 }
1036
1037 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1039 mut self,
1040 v: V,
1041 ) -> Self {
1042 self.0.request = v.into();
1043 self
1044 }
1045
1046 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1048 self.0.options = v.into();
1049 self
1050 }
1051
1052 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1054 (*self.0.stub)
1055 .set_iam_policy(self.0.request, self.0.options)
1056 .await
1057 .map(crate::Response::into_body)
1058 }
1059
1060 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1064 self.0.request.resource = v.into();
1065 self
1066 }
1067
1068 pub fn set_policy<T>(mut self, v: T) -> Self
1072 where
1073 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1074 {
1075 self.0.request.policy = std::option::Option::Some(v.into());
1076 self
1077 }
1078
1079 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1083 where
1084 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1085 {
1086 self.0.request.policy = v.map(|x| x.into());
1087 self
1088 }
1089
1090 pub fn set_update_mask<T>(mut self, v: T) -> Self
1092 where
1093 T: std::convert::Into<wkt::FieldMask>,
1094 {
1095 self.0.request.update_mask = std::option::Option::Some(v.into());
1096 self
1097 }
1098
1099 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1101 where
1102 T: std::convert::Into<wkt::FieldMask>,
1103 {
1104 self.0.request.update_mask = v.map(|x| x.into());
1105 self
1106 }
1107 }
1108
1109 #[doc(hidden)]
1110 impl crate::RequestBuilder for SetIamPolicy {
1111 fn request_options(&mut self) -> &mut crate::RequestOptions {
1112 &mut self.0.options
1113 }
1114 }
1115
1116 #[derive(Clone, Debug)]
1133 pub struct TestIamPermissions(
1134 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1135 );
1136
1137 impl TestIamPermissions {
1138 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1139 Self(RequestBuilder::new(stub))
1140 }
1141
1142 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1144 mut self,
1145 v: V,
1146 ) -> Self {
1147 self.0.request = v.into();
1148 self
1149 }
1150
1151 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1153 self.0.options = v.into();
1154 self
1155 }
1156
1157 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1159 (*self.0.stub)
1160 .test_iam_permissions(self.0.request, self.0.options)
1161 .await
1162 .map(crate::Response::into_body)
1163 }
1164
1165 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1169 self.0.request.resource = v.into();
1170 self
1171 }
1172
1173 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1177 where
1178 T: std::iter::IntoIterator<Item = V>,
1179 V: std::convert::Into<std::string::String>,
1180 {
1181 use std::iter::Iterator;
1182 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1183 self
1184 }
1185 }
1186
1187 #[doc(hidden)]
1188 impl crate::RequestBuilder for TestIamPermissions {
1189 fn request_options(&mut self) -> &mut crate::RequestOptions {
1190 &mut self.0.options
1191 }
1192 }
1193
1194 #[derive(Clone, Debug)]
1211 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1212
1213 impl GetOperation {
1214 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Folders>) -> Self {
1215 Self(RequestBuilder::new(stub))
1216 }
1217
1218 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1220 mut self,
1221 v: V,
1222 ) -> Self {
1223 self.0.request = v.into();
1224 self
1225 }
1226
1227 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1229 self.0.options = v.into();
1230 self
1231 }
1232
1233 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1235 (*self.0.stub)
1236 .get_operation(self.0.request, self.0.options)
1237 .await
1238 .map(crate::Response::into_body)
1239 }
1240
1241 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1243 self.0.request.name = v.into();
1244 self
1245 }
1246 }
1247
1248 #[doc(hidden)]
1249 impl crate::RequestBuilder for GetOperation {
1250 fn request_options(&mut self) -> &mut crate::RequestOptions {
1251 &mut self.0.options
1252 }
1253 }
1254}
1255
1256pub mod organizations {
1257 use crate::Result;
1258
1259 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1273
1274 pub(crate) mod client {
1275 use super::super::super::client::Organizations;
1276 pub struct Factory;
1277 impl crate::ClientFactory for Factory {
1278 type Client = Organizations;
1279 type Credentials = gaxi::options::Credentials;
1280 async fn build(
1281 self,
1282 config: gaxi::options::ClientConfig,
1283 ) -> crate::ClientBuilderResult<Self::Client> {
1284 Self::Client::new(config).await
1285 }
1286 }
1287 }
1288
1289 #[derive(Clone, Debug)]
1291 pub(crate) struct RequestBuilder<R: std::default::Default> {
1292 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1293 request: R,
1294 options: crate::RequestOptions,
1295 }
1296
1297 impl<R> RequestBuilder<R>
1298 where
1299 R: std::default::Default,
1300 {
1301 pub(crate) fn new(
1302 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1303 ) -> Self {
1304 Self {
1305 stub,
1306 request: R::default(),
1307 options: crate::RequestOptions::default(),
1308 }
1309 }
1310 }
1311
1312 #[derive(Clone, Debug)]
1329 pub struct GetOrganization(RequestBuilder<crate::model::GetOrganizationRequest>);
1330
1331 impl GetOrganization {
1332 pub(crate) fn new(
1333 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1334 ) -> Self {
1335 Self(RequestBuilder::new(stub))
1336 }
1337
1338 pub fn with_request<V: Into<crate::model::GetOrganizationRequest>>(mut self, v: V) -> Self {
1340 self.0.request = v.into();
1341 self
1342 }
1343
1344 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1346 self.0.options = v.into();
1347 self
1348 }
1349
1350 pub async fn send(self) -> Result<crate::model::Organization> {
1352 (*self.0.stub)
1353 .get_organization(self.0.request, self.0.options)
1354 .await
1355 .map(crate::Response::into_body)
1356 }
1357
1358 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1362 self.0.request.name = v.into();
1363 self
1364 }
1365 }
1366
1367 #[doc(hidden)]
1368 impl crate::RequestBuilder for GetOrganization {
1369 fn request_options(&mut self) -> &mut crate::RequestOptions {
1370 &mut self.0.options
1371 }
1372 }
1373
1374 #[derive(Clone, Debug)]
1395 pub struct SearchOrganizations(RequestBuilder<crate::model::SearchOrganizationsRequest>);
1396
1397 impl SearchOrganizations {
1398 pub(crate) fn new(
1399 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1400 ) -> Self {
1401 Self(RequestBuilder::new(stub))
1402 }
1403
1404 pub fn with_request<V: Into<crate::model::SearchOrganizationsRequest>>(
1406 mut self,
1407 v: V,
1408 ) -> Self {
1409 self.0.request = v.into();
1410 self
1411 }
1412
1413 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1415 self.0.options = v.into();
1416 self
1417 }
1418
1419 pub async fn send(self) -> Result<crate::model::SearchOrganizationsResponse> {
1421 (*self.0.stub)
1422 .search_organizations(self.0.request, self.0.options)
1423 .await
1424 .map(crate::Response::into_body)
1425 }
1426
1427 pub fn by_page(
1429 self,
1430 ) -> impl google_cloud_gax::paginator::Paginator<
1431 crate::model::SearchOrganizationsResponse,
1432 crate::Error,
1433 > {
1434 use std::clone::Clone;
1435 let token = self.0.request.page_token.clone();
1436 let execute = move |token: String| {
1437 let mut builder = self.clone();
1438 builder.0.request = builder.0.request.set_page_token(token);
1439 builder.send()
1440 };
1441 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1442 }
1443
1444 pub fn by_item(
1446 self,
1447 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1448 crate::model::SearchOrganizationsResponse,
1449 crate::Error,
1450 > {
1451 use google_cloud_gax::paginator::Paginator;
1452 self.by_page().items()
1453 }
1454
1455 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1457 self.0.request.page_size = v.into();
1458 self
1459 }
1460
1461 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1463 self.0.request.page_token = v.into();
1464 self
1465 }
1466
1467 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1469 self.0.request.query = v.into();
1470 self
1471 }
1472 }
1473
1474 #[doc(hidden)]
1475 impl crate::RequestBuilder for SearchOrganizations {
1476 fn request_options(&mut self) -> &mut crate::RequestOptions {
1477 &mut self.0.options
1478 }
1479 }
1480
1481 #[derive(Clone, Debug)]
1498 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1499
1500 impl GetIamPolicy {
1501 pub(crate) fn new(
1502 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1503 ) -> Self {
1504 Self(RequestBuilder::new(stub))
1505 }
1506
1507 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1509 mut self,
1510 v: V,
1511 ) -> Self {
1512 self.0.request = v.into();
1513 self
1514 }
1515
1516 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1518 self.0.options = v.into();
1519 self
1520 }
1521
1522 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1524 (*self.0.stub)
1525 .get_iam_policy(self.0.request, self.0.options)
1526 .await
1527 .map(crate::Response::into_body)
1528 }
1529
1530 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1534 self.0.request.resource = v.into();
1535 self
1536 }
1537
1538 pub fn set_options<T>(mut self, v: T) -> Self
1540 where
1541 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1542 {
1543 self.0.request.options = std::option::Option::Some(v.into());
1544 self
1545 }
1546
1547 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1549 where
1550 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1551 {
1552 self.0.request.options = v.map(|x| x.into());
1553 self
1554 }
1555 }
1556
1557 #[doc(hidden)]
1558 impl crate::RequestBuilder for GetIamPolicy {
1559 fn request_options(&mut self) -> &mut crate::RequestOptions {
1560 &mut self.0.options
1561 }
1562 }
1563
1564 #[derive(Clone, Debug)]
1581 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1582
1583 impl SetIamPolicy {
1584 pub(crate) fn new(
1585 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1586 ) -> Self {
1587 Self(RequestBuilder::new(stub))
1588 }
1589
1590 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1592 mut self,
1593 v: V,
1594 ) -> Self {
1595 self.0.request = v.into();
1596 self
1597 }
1598
1599 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1601 self.0.options = v.into();
1602 self
1603 }
1604
1605 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1607 (*self.0.stub)
1608 .set_iam_policy(self.0.request, self.0.options)
1609 .await
1610 .map(crate::Response::into_body)
1611 }
1612
1613 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1617 self.0.request.resource = v.into();
1618 self
1619 }
1620
1621 pub fn set_policy<T>(mut self, v: T) -> Self
1625 where
1626 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1627 {
1628 self.0.request.policy = std::option::Option::Some(v.into());
1629 self
1630 }
1631
1632 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1636 where
1637 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1638 {
1639 self.0.request.policy = v.map(|x| x.into());
1640 self
1641 }
1642
1643 pub fn set_update_mask<T>(mut self, v: T) -> Self
1645 where
1646 T: std::convert::Into<wkt::FieldMask>,
1647 {
1648 self.0.request.update_mask = std::option::Option::Some(v.into());
1649 self
1650 }
1651
1652 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1654 where
1655 T: std::convert::Into<wkt::FieldMask>,
1656 {
1657 self.0.request.update_mask = v.map(|x| x.into());
1658 self
1659 }
1660 }
1661
1662 #[doc(hidden)]
1663 impl crate::RequestBuilder for SetIamPolicy {
1664 fn request_options(&mut self) -> &mut crate::RequestOptions {
1665 &mut self.0.options
1666 }
1667 }
1668
1669 #[derive(Clone, Debug)]
1686 pub struct TestIamPermissions(
1687 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1688 );
1689
1690 impl TestIamPermissions {
1691 pub(crate) fn new(
1692 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1693 ) -> Self {
1694 Self(RequestBuilder::new(stub))
1695 }
1696
1697 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1699 mut self,
1700 v: V,
1701 ) -> Self {
1702 self.0.request = v.into();
1703 self
1704 }
1705
1706 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1708 self.0.options = v.into();
1709 self
1710 }
1711
1712 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1714 (*self.0.stub)
1715 .test_iam_permissions(self.0.request, self.0.options)
1716 .await
1717 .map(crate::Response::into_body)
1718 }
1719
1720 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1724 self.0.request.resource = v.into();
1725 self
1726 }
1727
1728 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1732 where
1733 T: std::iter::IntoIterator<Item = V>,
1734 V: std::convert::Into<std::string::String>,
1735 {
1736 use std::iter::Iterator;
1737 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1738 self
1739 }
1740 }
1741
1742 #[doc(hidden)]
1743 impl crate::RequestBuilder for TestIamPermissions {
1744 fn request_options(&mut self) -> &mut crate::RequestOptions {
1745 &mut self.0.options
1746 }
1747 }
1748
1749 #[derive(Clone, Debug)]
1766 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1767
1768 impl GetOperation {
1769 pub(crate) fn new(
1770 stub: std::sync::Arc<dyn super::super::stub::dynamic::Organizations>,
1771 ) -> Self {
1772 Self(RequestBuilder::new(stub))
1773 }
1774
1775 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1777 mut self,
1778 v: V,
1779 ) -> Self {
1780 self.0.request = v.into();
1781 self
1782 }
1783
1784 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1786 self.0.options = v.into();
1787 self
1788 }
1789
1790 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1792 (*self.0.stub)
1793 .get_operation(self.0.request, self.0.options)
1794 .await
1795 .map(crate::Response::into_body)
1796 }
1797
1798 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1800 self.0.request.name = v.into();
1801 self
1802 }
1803 }
1804
1805 #[doc(hidden)]
1806 impl crate::RequestBuilder for GetOperation {
1807 fn request_options(&mut self) -> &mut crate::RequestOptions {
1808 &mut self.0.options
1809 }
1810 }
1811}
1812
1813pub mod projects {
1814 use crate::Result;
1815
1816 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1830
1831 pub(crate) mod client {
1832 use super::super::super::client::Projects;
1833 pub struct Factory;
1834 impl crate::ClientFactory for Factory {
1835 type Client = Projects;
1836 type Credentials = gaxi::options::Credentials;
1837 async fn build(
1838 self,
1839 config: gaxi::options::ClientConfig,
1840 ) -> crate::ClientBuilderResult<Self::Client> {
1841 Self::Client::new(config).await
1842 }
1843 }
1844 }
1845
1846 #[derive(Clone, Debug)]
1848 pub(crate) struct RequestBuilder<R: std::default::Default> {
1849 stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>,
1850 request: R,
1851 options: crate::RequestOptions,
1852 }
1853
1854 impl<R> RequestBuilder<R>
1855 where
1856 R: std::default::Default,
1857 {
1858 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1859 Self {
1860 stub,
1861 request: R::default(),
1862 options: crate::RequestOptions::default(),
1863 }
1864 }
1865 }
1866
1867 #[derive(Clone, Debug)]
1884 pub struct GetProject(RequestBuilder<crate::model::GetProjectRequest>);
1885
1886 impl GetProject {
1887 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1888 Self(RequestBuilder::new(stub))
1889 }
1890
1891 pub fn with_request<V: Into<crate::model::GetProjectRequest>>(mut self, v: V) -> Self {
1893 self.0.request = v.into();
1894 self
1895 }
1896
1897 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1899 self.0.options = v.into();
1900 self
1901 }
1902
1903 pub async fn send(self) -> Result<crate::model::Project> {
1905 (*self.0.stub)
1906 .get_project(self.0.request, self.0.options)
1907 .await
1908 .map(crate::Response::into_body)
1909 }
1910
1911 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1915 self.0.request.name = v.into();
1916 self
1917 }
1918 }
1919
1920 #[doc(hidden)]
1921 impl crate::RequestBuilder for GetProject {
1922 fn request_options(&mut self) -> &mut crate::RequestOptions {
1923 &mut self.0.options
1924 }
1925 }
1926
1927 #[derive(Clone, Debug)]
1948 pub struct ListProjects(RequestBuilder<crate::model::ListProjectsRequest>);
1949
1950 impl ListProjects {
1951 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
1952 Self(RequestBuilder::new(stub))
1953 }
1954
1955 pub fn with_request<V: Into<crate::model::ListProjectsRequest>>(mut self, v: V) -> Self {
1957 self.0.request = v.into();
1958 self
1959 }
1960
1961 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1963 self.0.options = v.into();
1964 self
1965 }
1966
1967 pub async fn send(self) -> Result<crate::model::ListProjectsResponse> {
1969 (*self.0.stub)
1970 .list_projects(self.0.request, self.0.options)
1971 .await
1972 .map(crate::Response::into_body)
1973 }
1974
1975 pub fn by_page(
1977 self,
1978 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListProjectsResponse, crate::Error>
1979 {
1980 use std::clone::Clone;
1981 let token = self.0.request.page_token.clone();
1982 let execute = move |token: String| {
1983 let mut builder = self.clone();
1984 builder.0.request = builder.0.request.set_page_token(token);
1985 builder.send()
1986 };
1987 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1988 }
1989
1990 pub fn by_item(
1992 self,
1993 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1994 crate::model::ListProjectsResponse,
1995 crate::Error,
1996 > {
1997 use google_cloud_gax::paginator::Paginator;
1998 self.by_page().items()
1999 }
2000
2001 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2005 self.0.request.parent = v.into();
2006 self
2007 }
2008
2009 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2011 self.0.request.page_token = v.into();
2012 self
2013 }
2014
2015 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2017 self.0.request.page_size = v.into();
2018 self
2019 }
2020
2021 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2023 self.0.request.show_deleted = v.into();
2024 self
2025 }
2026 }
2027
2028 #[doc(hidden)]
2029 impl crate::RequestBuilder for ListProjects {
2030 fn request_options(&mut self) -> &mut crate::RequestOptions {
2031 &mut self.0.options
2032 }
2033 }
2034
2035 #[derive(Clone, Debug)]
2056 pub struct SearchProjects(RequestBuilder<crate::model::SearchProjectsRequest>);
2057
2058 impl SearchProjects {
2059 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2060 Self(RequestBuilder::new(stub))
2061 }
2062
2063 pub fn with_request<V: Into<crate::model::SearchProjectsRequest>>(mut self, v: V) -> Self {
2065 self.0.request = v.into();
2066 self
2067 }
2068
2069 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2071 self.0.options = v.into();
2072 self
2073 }
2074
2075 pub async fn send(self) -> Result<crate::model::SearchProjectsResponse> {
2077 (*self.0.stub)
2078 .search_projects(self.0.request, self.0.options)
2079 .await
2080 .map(crate::Response::into_body)
2081 }
2082
2083 pub fn by_page(
2085 self,
2086 ) -> impl google_cloud_gax::paginator::Paginator<
2087 crate::model::SearchProjectsResponse,
2088 crate::Error,
2089 > {
2090 use std::clone::Clone;
2091 let token = self.0.request.page_token.clone();
2092 let execute = move |token: String| {
2093 let mut builder = self.clone();
2094 builder.0.request = builder.0.request.set_page_token(token);
2095 builder.send()
2096 };
2097 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2098 }
2099
2100 pub fn by_item(
2102 self,
2103 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2104 crate::model::SearchProjectsResponse,
2105 crate::Error,
2106 > {
2107 use google_cloud_gax::paginator::Paginator;
2108 self.by_page().items()
2109 }
2110
2111 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
2113 self.0.request.query = v.into();
2114 self
2115 }
2116
2117 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2119 self.0.request.page_token = v.into();
2120 self
2121 }
2122
2123 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2125 self.0.request.page_size = v.into();
2126 self
2127 }
2128 }
2129
2130 #[doc(hidden)]
2131 impl crate::RequestBuilder for SearchProjects {
2132 fn request_options(&mut self) -> &mut crate::RequestOptions {
2133 &mut self.0.options
2134 }
2135 }
2136
2137 #[derive(Clone, Debug)]
2155 pub struct CreateProject(RequestBuilder<crate::model::CreateProjectRequest>);
2156
2157 impl CreateProject {
2158 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2159 Self(RequestBuilder::new(stub))
2160 }
2161
2162 pub fn with_request<V: Into<crate::model::CreateProjectRequest>>(mut self, v: V) -> Self {
2164 self.0.request = v.into();
2165 self
2166 }
2167
2168 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2170 self.0.options = v.into();
2171 self
2172 }
2173
2174 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2181 (*self.0.stub)
2182 .create_project(self.0.request, self.0.options)
2183 .await
2184 .map(crate::Response::into_body)
2185 }
2186
2187 pub fn poller(
2189 self,
2190 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::CreateProjectMetadata>
2191 {
2192 type Operation = google_cloud_lro::internal::Operation<
2193 crate::model::Project,
2194 crate::model::CreateProjectMetadata,
2195 >;
2196 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2197 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2198
2199 let stub = self.0.stub.clone();
2200 let mut options = self.0.options.clone();
2201 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2202 let query = move |name| {
2203 let stub = stub.clone();
2204 let options = options.clone();
2205 async {
2206 let op = GetOperation::new(stub)
2207 .set_name(name)
2208 .with_options(options)
2209 .send()
2210 .await?;
2211 Ok(Operation::new(op))
2212 }
2213 };
2214
2215 let start = move || async {
2216 let op = self.send().await?;
2217 Ok(Operation::new(op))
2218 };
2219
2220 google_cloud_lro::internal::new_poller(
2221 polling_error_policy,
2222 polling_backoff_policy,
2223 start,
2224 query,
2225 )
2226 }
2227
2228 pub fn set_project<T>(mut self, v: T) -> Self
2232 where
2233 T: std::convert::Into<crate::model::Project>,
2234 {
2235 self.0.request.project = std::option::Option::Some(v.into());
2236 self
2237 }
2238
2239 pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
2243 where
2244 T: std::convert::Into<crate::model::Project>,
2245 {
2246 self.0.request.project = v.map(|x| x.into());
2247 self
2248 }
2249 }
2250
2251 #[doc(hidden)]
2252 impl crate::RequestBuilder for CreateProject {
2253 fn request_options(&mut self) -> &mut crate::RequestOptions {
2254 &mut self.0.options
2255 }
2256 }
2257
2258 #[derive(Clone, Debug)]
2276 pub struct UpdateProject(RequestBuilder<crate::model::UpdateProjectRequest>);
2277
2278 impl UpdateProject {
2279 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2280 Self(RequestBuilder::new(stub))
2281 }
2282
2283 pub fn with_request<V: Into<crate::model::UpdateProjectRequest>>(mut self, v: V) -> Self {
2285 self.0.request = v.into();
2286 self
2287 }
2288
2289 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2291 self.0.options = v.into();
2292 self
2293 }
2294
2295 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2302 (*self.0.stub)
2303 .update_project(self.0.request, self.0.options)
2304 .await
2305 .map(crate::Response::into_body)
2306 }
2307
2308 pub fn poller(
2310 self,
2311 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::UpdateProjectMetadata>
2312 {
2313 type Operation = google_cloud_lro::internal::Operation<
2314 crate::model::Project,
2315 crate::model::UpdateProjectMetadata,
2316 >;
2317 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2318 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2319
2320 let stub = self.0.stub.clone();
2321 let mut options = self.0.options.clone();
2322 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2323 let query = move |name| {
2324 let stub = stub.clone();
2325 let options = options.clone();
2326 async {
2327 let op = GetOperation::new(stub)
2328 .set_name(name)
2329 .with_options(options)
2330 .send()
2331 .await?;
2332 Ok(Operation::new(op))
2333 }
2334 };
2335
2336 let start = move || async {
2337 let op = self.send().await?;
2338 Ok(Operation::new(op))
2339 };
2340
2341 google_cloud_lro::internal::new_poller(
2342 polling_error_policy,
2343 polling_backoff_policy,
2344 start,
2345 query,
2346 )
2347 }
2348
2349 pub fn set_project<T>(mut self, v: T) -> Self
2353 where
2354 T: std::convert::Into<crate::model::Project>,
2355 {
2356 self.0.request.project = std::option::Option::Some(v.into());
2357 self
2358 }
2359
2360 pub fn set_or_clear_project<T>(mut self, v: std::option::Option<T>) -> Self
2364 where
2365 T: std::convert::Into<crate::model::Project>,
2366 {
2367 self.0.request.project = v.map(|x| x.into());
2368 self
2369 }
2370
2371 pub fn set_update_mask<T>(mut self, v: T) -> Self
2373 where
2374 T: std::convert::Into<wkt::FieldMask>,
2375 {
2376 self.0.request.update_mask = std::option::Option::Some(v.into());
2377 self
2378 }
2379
2380 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2382 where
2383 T: std::convert::Into<wkt::FieldMask>,
2384 {
2385 self.0.request.update_mask = v.map(|x| x.into());
2386 self
2387 }
2388 }
2389
2390 #[doc(hidden)]
2391 impl crate::RequestBuilder for UpdateProject {
2392 fn request_options(&mut self) -> &mut crate::RequestOptions {
2393 &mut self.0.options
2394 }
2395 }
2396
2397 #[derive(Clone, Debug)]
2415 pub struct MoveProject(RequestBuilder<crate::model::MoveProjectRequest>);
2416
2417 impl MoveProject {
2418 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2419 Self(RequestBuilder::new(stub))
2420 }
2421
2422 pub fn with_request<V: Into<crate::model::MoveProjectRequest>>(mut self, v: V) -> Self {
2424 self.0.request = v.into();
2425 self
2426 }
2427
2428 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2430 self.0.options = v.into();
2431 self
2432 }
2433
2434 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2441 (*self.0.stub)
2442 .move_project(self.0.request, self.0.options)
2443 .await
2444 .map(crate::Response::into_body)
2445 }
2446
2447 pub fn poller(
2449 self,
2450 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::MoveProjectMetadata>
2451 {
2452 type Operation = google_cloud_lro::internal::Operation<
2453 crate::model::Project,
2454 crate::model::MoveProjectMetadata,
2455 >;
2456 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2457 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2458
2459 let stub = self.0.stub.clone();
2460 let mut options = self.0.options.clone();
2461 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2462 let query = move |name| {
2463 let stub = stub.clone();
2464 let options = options.clone();
2465 async {
2466 let op = GetOperation::new(stub)
2467 .set_name(name)
2468 .with_options(options)
2469 .send()
2470 .await?;
2471 Ok(Operation::new(op))
2472 }
2473 };
2474
2475 let start = move || async {
2476 let op = self.send().await?;
2477 Ok(Operation::new(op))
2478 };
2479
2480 google_cloud_lro::internal::new_poller(
2481 polling_error_policy,
2482 polling_backoff_policy,
2483 start,
2484 query,
2485 )
2486 }
2487
2488 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2492 self.0.request.name = v.into();
2493 self
2494 }
2495
2496 pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2500 self.0.request.destination_parent = v.into();
2501 self
2502 }
2503 }
2504
2505 #[doc(hidden)]
2506 impl crate::RequestBuilder for MoveProject {
2507 fn request_options(&mut self) -> &mut crate::RequestOptions {
2508 &mut self.0.options
2509 }
2510 }
2511
2512 #[derive(Clone, Debug)]
2530 pub struct DeleteProject(RequestBuilder<crate::model::DeleteProjectRequest>);
2531
2532 impl DeleteProject {
2533 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2534 Self(RequestBuilder::new(stub))
2535 }
2536
2537 pub fn with_request<V: Into<crate::model::DeleteProjectRequest>>(mut self, v: V) -> Self {
2539 self.0.request = v.into();
2540 self
2541 }
2542
2543 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2545 self.0.options = v.into();
2546 self
2547 }
2548
2549 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2556 (*self.0.stub)
2557 .delete_project(self.0.request, self.0.options)
2558 .await
2559 .map(crate::Response::into_body)
2560 }
2561
2562 pub fn poller(
2564 self,
2565 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::DeleteProjectMetadata>
2566 {
2567 type Operation = google_cloud_lro::internal::Operation<
2568 crate::model::Project,
2569 crate::model::DeleteProjectMetadata,
2570 >;
2571 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2572 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2573
2574 let stub = self.0.stub.clone();
2575 let mut options = self.0.options.clone();
2576 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2577 let query = move |name| {
2578 let stub = stub.clone();
2579 let options = options.clone();
2580 async {
2581 let op = GetOperation::new(stub)
2582 .set_name(name)
2583 .with_options(options)
2584 .send()
2585 .await?;
2586 Ok(Operation::new(op))
2587 }
2588 };
2589
2590 let start = move || async {
2591 let op = self.send().await?;
2592 Ok(Operation::new(op))
2593 };
2594
2595 google_cloud_lro::internal::new_poller(
2596 polling_error_policy,
2597 polling_backoff_policy,
2598 start,
2599 query,
2600 )
2601 }
2602
2603 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2607 self.0.request.name = v.into();
2608 self
2609 }
2610 }
2611
2612 #[doc(hidden)]
2613 impl crate::RequestBuilder for DeleteProject {
2614 fn request_options(&mut self) -> &mut crate::RequestOptions {
2615 &mut self.0.options
2616 }
2617 }
2618
2619 #[derive(Clone, Debug)]
2637 pub struct UndeleteProject(RequestBuilder<crate::model::UndeleteProjectRequest>);
2638
2639 impl UndeleteProject {
2640 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2641 Self(RequestBuilder::new(stub))
2642 }
2643
2644 pub fn with_request<V: Into<crate::model::UndeleteProjectRequest>>(mut self, v: V) -> Self {
2646 self.0.request = v.into();
2647 self
2648 }
2649
2650 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2652 self.0.options = v.into();
2653 self
2654 }
2655
2656 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2663 (*self.0.stub)
2664 .undelete_project(self.0.request, self.0.options)
2665 .await
2666 .map(crate::Response::into_body)
2667 }
2668
2669 pub fn poller(
2671 self,
2672 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::UndeleteProjectMetadata>
2673 {
2674 type Operation = google_cloud_lro::internal::Operation<
2675 crate::model::Project,
2676 crate::model::UndeleteProjectMetadata,
2677 >;
2678 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2679 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2680
2681 let stub = self.0.stub.clone();
2682 let mut options = self.0.options.clone();
2683 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2684 let query = move |name| {
2685 let stub = stub.clone();
2686 let options = options.clone();
2687 async {
2688 let op = GetOperation::new(stub)
2689 .set_name(name)
2690 .with_options(options)
2691 .send()
2692 .await?;
2693 Ok(Operation::new(op))
2694 }
2695 };
2696
2697 let start = move || async {
2698 let op = self.send().await?;
2699 Ok(Operation::new(op))
2700 };
2701
2702 google_cloud_lro::internal::new_poller(
2703 polling_error_policy,
2704 polling_backoff_policy,
2705 start,
2706 query,
2707 )
2708 }
2709
2710 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2714 self.0.request.name = v.into();
2715 self
2716 }
2717 }
2718
2719 #[doc(hidden)]
2720 impl crate::RequestBuilder for UndeleteProject {
2721 fn request_options(&mut self) -> &mut crate::RequestOptions {
2722 &mut self.0.options
2723 }
2724 }
2725
2726 #[derive(Clone, Debug)]
2743 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
2744
2745 impl GetIamPolicy {
2746 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2747 Self(RequestBuilder::new(stub))
2748 }
2749
2750 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
2752 mut self,
2753 v: V,
2754 ) -> Self {
2755 self.0.request = v.into();
2756 self
2757 }
2758
2759 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2761 self.0.options = v.into();
2762 self
2763 }
2764
2765 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2767 (*self.0.stub)
2768 .get_iam_policy(self.0.request, self.0.options)
2769 .await
2770 .map(crate::Response::into_body)
2771 }
2772
2773 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2777 self.0.request.resource = v.into();
2778 self
2779 }
2780
2781 pub fn set_options<T>(mut self, v: T) -> Self
2783 where
2784 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2785 {
2786 self.0.request.options = std::option::Option::Some(v.into());
2787 self
2788 }
2789
2790 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2792 where
2793 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2794 {
2795 self.0.request.options = v.map(|x| x.into());
2796 self
2797 }
2798 }
2799
2800 #[doc(hidden)]
2801 impl crate::RequestBuilder for GetIamPolicy {
2802 fn request_options(&mut self) -> &mut crate::RequestOptions {
2803 &mut self.0.options
2804 }
2805 }
2806
2807 #[derive(Clone, Debug)]
2824 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
2825
2826 impl SetIamPolicy {
2827 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2828 Self(RequestBuilder::new(stub))
2829 }
2830
2831 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
2833 mut self,
2834 v: V,
2835 ) -> Self {
2836 self.0.request = v.into();
2837 self
2838 }
2839
2840 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2842 self.0.options = v.into();
2843 self
2844 }
2845
2846 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2848 (*self.0.stub)
2849 .set_iam_policy(self.0.request, self.0.options)
2850 .await
2851 .map(crate::Response::into_body)
2852 }
2853
2854 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2858 self.0.request.resource = v.into();
2859 self
2860 }
2861
2862 pub fn set_policy<T>(mut self, v: T) -> Self
2866 where
2867 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2868 {
2869 self.0.request.policy = std::option::Option::Some(v.into());
2870 self
2871 }
2872
2873 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2877 where
2878 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2879 {
2880 self.0.request.policy = v.map(|x| x.into());
2881 self
2882 }
2883
2884 pub fn set_update_mask<T>(mut self, v: T) -> Self
2886 where
2887 T: std::convert::Into<wkt::FieldMask>,
2888 {
2889 self.0.request.update_mask = std::option::Option::Some(v.into());
2890 self
2891 }
2892
2893 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2895 where
2896 T: std::convert::Into<wkt::FieldMask>,
2897 {
2898 self.0.request.update_mask = v.map(|x| x.into());
2899 self
2900 }
2901 }
2902
2903 #[doc(hidden)]
2904 impl crate::RequestBuilder for SetIamPolicy {
2905 fn request_options(&mut self) -> &mut crate::RequestOptions {
2906 &mut self.0.options
2907 }
2908 }
2909
2910 #[derive(Clone, Debug)]
2927 pub struct TestIamPermissions(
2928 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
2929 );
2930
2931 impl TestIamPermissions {
2932 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
2933 Self(RequestBuilder::new(stub))
2934 }
2935
2936 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
2938 mut self,
2939 v: V,
2940 ) -> Self {
2941 self.0.request = v.into();
2942 self
2943 }
2944
2945 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2947 self.0.options = v.into();
2948 self
2949 }
2950
2951 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
2953 (*self.0.stub)
2954 .test_iam_permissions(self.0.request, self.0.options)
2955 .await
2956 .map(crate::Response::into_body)
2957 }
2958
2959 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2963 self.0.request.resource = v.into();
2964 self
2965 }
2966
2967 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2971 where
2972 T: std::iter::IntoIterator<Item = V>,
2973 V: std::convert::Into<std::string::String>,
2974 {
2975 use std::iter::Iterator;
2976 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2977 self
2978 }
2979 }
2980
2981 #[doc(hidden)]
2982 impl crate::RequestBuilder for TestIamPermissions {
2983 fn request_options(&mut self) -> &mut crate::RequestOptions {
2984 &mut self.0.options
2985 }
2986 }
2987
2988 #[derive(Clone, Debug)]
3005 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3006
3007 impl GetOperation {
3008 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Projects>) -> Self {
3009 Self(RequestBuilder::new(stub))
3010 }
3011
3012 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3014 mut self,
3015 v: V,
3016 ) -> Self {
3017 self.0.request = v.into();
3018 self
3019 }
3020
3021 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3023 self.0.options = v.into();
3024 self
3025 }
3026
3027 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3029 (*self.0.stub)
3030 .get_operation(self.0.request, self.0.options)
3031 .await
3032 .map(crate::Response::into_body)
3033 }
3034
3035 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3037 self.0.request.name = v.into();
3038 self
3039 }
3040 }
3041
3042 #[doc(hidden)]
3043 impl crate::RequestBuilder for GetOperation {
3044 fn request_options(&mut self) -> &mut crate::RequestOptions {
3045 &mut self.0.options
3046 }
3047 }
3048}
3049
3050pub mod tag_bindings {
3051 use crate::Result;
3052
3053 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3067
3068 pub(crate) mod client {
3069 use super::super::super::client::TagBindings;
3070 pub struct Factory;
3071 impl crate::ClientFactory for Factory {
3072 type Client = TagBindings;
3073 type Credentials = gaxi::options::Credentials;
3074 async fn build(
3075 self,
3076 config: gaxi::options::ClientConfig,
3077 ) -> crate::ClientBuilderResult<Self::Client> {
3078 Self::Client::new(config).await
3079 }
3080 }
3081 }
3082
3083 #[derive(Clone, Debug)]
3085 pub(crate) struct RequestBuilder<R: std::default::Default> {
3086 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3087 request: R,
3088 options: crate::RequestOptions,
3089 }
3090
3091 impl<R> RequestBuilder<R>
3092 where
3093 R: std::default::Default,
3094 {
3095 pub(crate) fn new(
3096 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3097 ) -> Self {
3098 Self {
3099 stub,
3100 request: R::default(),
3101 options: crate::RequestOptions::default(),
3102 }
3103 }
3104 }
3105
3106 #[derive(Clone, Debug)]
3127 pub struct ListTagBindings(RequestBuilder<crate::model::ListTagBindingsRequest>);
3128
3129 impl ListTagBindings {
3130 pub(crate) fn new(
3131 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3132 ) -> Self {
3133 Self(RequestBuilder::new(stub))
3134 }
3135
3136 pub fn with_request<V: Into<crate::model::ListTagBindingsRequest>>(mut self, v: V) -> Self {
3138 self.0.request = v.into();
3139 self
3140 }
3141
3142 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3144 self.0.options = v.into();
3145 self
3146 }
3147
3148 pub async fn send(self) -> Result<crate::model::ListTagBindingsResponse> {
3150 (*self.0.stub)
3151 .list_tag_bindings(self.0.request, self.0.options)
3152 .await
3153 .map(crate::Response::into_body)
3154 }
3155
3156 pub fn by_page(
3158 self,
3159 ) -> impl google_cloud_gax::paginator::Paginator<
3160 crate::model::ListTagBindingsResponse,
3161 crate::Error,
3162 > {
3163 use std::clone::Clone;
3164 let token = self.0.request.page_token.clone();
3165 let execute = move |token: String| {
3166 let mut builder = self.clone();
3167 builder.0.request = builder.0.request.set_page_token(token);
3168 builder.send()
3169 };
3170 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3171 }
3172
3173 pub fn by_item(
3175 self,
3176 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3177 crate::model::ListTagBindingsResponse,
3178 crate::Error,
3179 > {
3180 use google_cloud_gax::paginator::Paginator;
3181 self.by_page().items()
3182 }
3183
3184 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3188 self.0.request.parent = v.into();
3189 self
3190 }
3191
3192 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3194 self.0.request.page_size = v.into();
3195 self
3196 }
3197
3198 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3200 self.0.request.page_token = v.into();
3201 self
3202 }
3203 }
3204
3205 #[doc(hidden)]
3206 impl crate::RequestBuilder for ListTagBindings {
3207 fn request_options(&mut self) -> &mut crate::RequestOptions {
3208 &mut self.0.options
3209 }
3210 }
3211
3212 #[derive(Clone, Debug)]
3230 pub struct CreateTagBinding(RequestBuilder<crate::model::CreateTagBindingRequest>);
3231
3232 impl CreateTagBinding {
3233 pub(crate) fn new(
3234 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3235 ) -> Self {
3236 Self(RequestBuilder::new(stub))
3237 }
3238
3239 pub fn with_request<V: Into<crate::model::CreateTagBindingRequest>>(
3241 mut self,
3242 v: V,
3243 ) -> Self {
3244 self.0.request = v.into();
3245 self
3246 }
3247
3248 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3250 self.0.options = v.into();
3251 self
3252 }
3253
3254 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3261 (*self.0.stub)
3262 .create_tag_binding(self.0.request, self.0.options)
3263 .await
3264 .map(crate::Response::into_body)
3265 }
3266
3267 pub fn poller(
3269 self,
3270 ) -> impl google_cloud_lro::Poller<
3271 crate::model::TagBinding,
3272 crate::model::CreateTagBindingMetadata,
3273 > {
3274 type Operation = google_cloud_lro::internal::Operation<
3275 crate::model::TagBinding,
3276 crate::model::CreateTagBindingMetadata,
3277 >;
3278 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3279 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3280
3281 let stub = self.0.stub.clone();
3282 let mut options = self.0.options.clone();
3283 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3284 let query = move |name| {
3285 let stub = stub.clone();
3286 let options = options.clone();
3287 async {
3288 let op = GetOperation::new(stub)
3289 .set_name(name)
3290 .with_options(options)
3291 .send()
3292 .await?;
3293 Ok(Operation::new(op))
3294 }
3295 };
3296
3297 let start = move || async {
3298 let op = self.send().await?;
3299 Ok(Operation::new(op))
3300 };
3301
3302 google_cloud_lro::internal::new_poller(
3303 polling_error_policy,
3304 polling_backoff_policy,
3305 start,
3306 query,
3307 )
3308 }
3309
3310 pub fn set_tag_binding<T>(mut self, v: T) -> Self
3314 where
3315 T: std::convert::Into<crate::model::TagBinding>,
3316 {
3317 self.0.request.tag_binding = std::option::Option::Some(v.into());
3318 self
3319 }
3320
3321 pub fn set_or_clear_tag_binding<T>(mut self, v: std::option::Option<T>) -> Self
3325 where
3326 T: std::convert::Into<crate::model::TagBinding>,
3327 {
3328 self.0.request.tag_binding = v.map(|x| x.into());
3329 self
3330 }
3331
3332 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3334 self.0.request.validate_only = v.into();
3335 self
3336 }
3337 }
3338
3339 #[doc(hidden)]
3340 impl crate::RequestBuilder for CreateTagBinding {
3341 fn request_options(&mut self) -> &mut crate::RequestOptions {
3342 &mut self.0.options
3343 }
3344 }
3345
3346 #[derive(Clone, Debug)]
3364 pub struct DeleteTagBinding(RequestBuilder<crate::model::DeleteTagBindingRequest>);
3365
3366 impl DeleteTagBinding {
3367 pub(crate) fn new(
3368 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3369 ) -> Self {
3370 Self(RequestBuilder::new(stub))
3371 }
3372
3373 pub fn with_request<V: Into<crate::model::DeleteTagBindingRequest>>(
3375 mut self,
3376 v: V,
3377 ) -> Self {
3378 self.0.request = v.into();
3379 self
3380 }
3381
3382 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3384 self.0.options = v.into();
3385 self
3386 }
3387
3388 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3395 (*self.0.stub)
3396 .delete_tag_binding(self.0.request, self.0.options)
3397 .await
3398 .map(crate::Response::into_body)
3399 }
3400
3401 pub fn poller(
3403 self,
3404 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTagBindingMetadata> {
3405 type Operation = google_cloud_lro::internal::Operation<
3406 wkt::Empty,
3407 crate::model::DeleteTagBindingMetadata,
3408 >;
3409 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3410 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3411
3412 let stub = self.0.stub.clone();
3413 let mut options = self.0.options.clone();
3414 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3415 let query = move |name| {
3416 let stub = stub.clone();
3417 let options = options.clone();
3418 async {
3419 let op = GetOperation::new(stub)
3420 .set_name(name)
3421 .with_options(options)
3422 .send()
3423 .await?;
3424 Ok(Operation::new(op))
3425 }
3426 };
3427
3428 let start = move || async {
3429 let op = self.send().await?;
3430 Ok(Operation::new(op))
3431 };
3432
3433 google_cloud_lro::internal::new_unit_response_poller(
3434 polling_error_policy,
3435 polling_backoff_policy,
3436 start,
3437 query,
3438 )
3439 }
3440
3441 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3445 self.0.request.name = v.into();
3446 self
3447 }
3448 }
3449
3450 #[doc(hidden)]
3451 impl crate::RequestBuilder for DeleteTagBinding {
3452 fn request_options(&mut self) -> &mut crate::RequestOptions {
3453 &mut self.0.options
3454 }
3455 }
3456
3457 #[derive(Clone, Debug)]
3478 pub struct ListEffectiveTags(RequestBuilder<crate::model::ListEffectiveTagsRequest>);
3479
3480 impl ListEffectiveTags {
3481 pub(crate) fn new(
3482 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3483 ) -> Self {
3484 Self(RequestBuilder::new(stub))
3485 }
3486
3487 pub fn with_request<V: Into<crate::model::ListEffectiveTagsRequest>>(
3489 mut self,
3490 v: V,
3491 ) -> Self {
3492 self.0.request = v.into();
3493 self
3494 }
3495
3496 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3498 self.0.options = v.into();
3499 self
3500 }
3501
3502 pub async fn send(self) -> Result<crate::model::ListEffectiveTagsResponse> {
3504 (*self.0.stub)
3505 .list_effective_tags(self.0.request, self.0.options)
3506 .await
3507 .map(crate::Response::into_body)
3508 }
3509
3510 pub fn by_page(
3512 self,
3513 ) -> impl google_cloud_gax::paginator::Paginator<
3514 crate::model::ListEffectiveTagsResponse,
3515 crate::Error,
3516 > {
3517 use std::clone::Clone;
3518 let token = self.0.request.page_token.clone();
3519 let execute = move |token: String| {
3520 let mut builder = self.clone();
3521 builder.0.request = builder.0.request.set_page_token(token);
3522 builder.send()
3523 };
3524 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3525 }
3526
3527 pub fn by_item(
3529 self,
3530 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3531 crate::model::ListEffectiveTagsResponse,
3532 crate::Error,
3533 > {
3534 use google_cloud_gax::paginator::Paginator;
3535 self.by_page().items()
3536 }
3537
3538 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3542 self.0.request.parent = v.into();
3543 self
3544 }
3545
3546 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3548 self.0.request.page_size = v.into();
3549 self
3550 }
3551
3552 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3554 self.0.request.page_token = v.into();
3555 self
3556 }
3557 }
3558
3559 #[doc(hidden)]
3560 impl crate::RequestBuilder for ListEffectiveTags {
3561 fn request_options(&mut self) -> &mut crate::RequestOptions {
3562 &mut self.0.options
3563 }
3564 }
3565
3566 #[derive(Clone, Debug)]
3583 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3584
3585 impl GetOperation {
3586 pub(crate) fn new(
3587 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagBindings>,
3588 ) -> Self {
3589 Self(RequestBuilder::new(stub))
3590 }
3591
3592 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3594 mut self,
3595 v: V,
3596 ) -> Self {
3597 self.0.request = v.into();
3598 self
3599 }
3600
3601 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3603 self.0.options = v.into();
3604 self
3605 }
3606
3607 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3609 (*self.0.stub)
3610 .get_operation(self.0.request, self.0.options)
3611 .await
3612 .map(crate::Response::into_body)
3613 }
3614
3615 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3617 self.0.request.name = v.into();
3618 self
3619 }
3620 }
3621
3622 #[doc(hidden)]
3623 impl crate::RequestBuilder for GetOperation {
3624 fn request_options(&mut self) -> &mut crate::RequestOptions {
3625 &mut self.0.options
3626 }
3627 }
3628}
3629
3630pub mod tag_holds {
3631 use crate::Result;
3632
3633 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3647
3648 pub(crate) mod client {
3649 use super::super::super::client::TagHolds;
3650 pub struct Factory;
3651 impl crate::ClientFactory for Factory {
3652 type Client = TagHolds;
3653 type Credentials = gaxi::options::Credentials;
3654 async fn build(
3655 self,
3656 config: gaxi::options::ClientConfig,
3657 ) -> crate::ClientBuilderResult<Self::Client> {
3658 Self::Client::new(config).await
3659 }
3660 }
3661 }
3662
3663 #[derive(Clone, Debug)]
3665 pub(crate) struct RequestBuilder<R: std::default::Default> {
3666 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>,
3667 request: R,
3668 options: crate::RequestOptions,
3669 }
3670
3671 impl<R> RequestBuilder<R>
3672 where
3673 R: std::default::Default,
3674 {
3675 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3676 Self {
3677 stub,
3678 request: R::default(),
3679 options: crate::RequestOptions::default(),
3680 }
3681 }
3682 }
3683
3684 #[derive(Clone, Debug)]
3702 pub struct CreateTagHold(RequestBuilder<crate::model::CreateTagHoldRequest>);
3703
3704 impl CreateTagHold {
3705 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3706 Self(RequestBuilder::new(stub))
3707 }
3708
3709 pub fn with_request<V: Into<crate::model::CreateTagHoldRequest>>(mut self, v: V) -> Self {
3711 self.0.request = v.into();
3712 self
3713 }
3714
3715 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3717 self.0.options = v.into();
3718 self
3719 }
3720
3721 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3728 (*self.0.stub)
3729 .create_tag_hold(self.0.request, self.0.options)
3730 .await
3731 .map(crate::Response::into_body)
3732 }
3733
3734 pub fn poller(
3736 self,
3737 ) -> impl google_cloud_lro::Poller<crate::model::TagHold, crate::model::CreateTagHoldMetadata>
3738 {
3739 type Operation = google_cloud_lro::internal::Operation<
3740 crate::model::TagHold,
3741 crate::model::CreateTagHoldMetadata,
3742 >;
3743 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3744 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3745
3746 let stub = self.0.stub.clone();
3747 let mut options = self.0.options.clone();
3748 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3749 let query = move |name| {
3750 let stub = stub.clone();
3751 let options = options.clone();
3752 async {
3753 let op = GetOperation::new(stub)
3754 .set_name(name)
3755 .with_options(options)
3756 .send()
3757 .await?;
3758 Ok(Operation::new(op))
3759 }
3760 };
3761
3762 let start = move || async {
3763 let op = self.send().await?;
3764 Ok(Operation::new(op))
3765 };
3766
3767 google_cloud_lro::internal::new_poller(
3768 polling_error_policy,
3769 polling_backoff_policy,
3770 start,
3771 query,
3772 )
3773 }
3774
3775 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3779 self.0.request.parent = v.into();
3780 self
3781 }
3782
3783 pub fn set_tag_hold<T>(mut self, v: T) -> Self
3787 where
3788 T: std::convert::Into<crate::model::TagHold>,
3789 {
3790 self.0.request.tag_hold = std::option::Option::Some(v.into());
3791 self
3792 }
3793
3794 pub fn set_or_clear_tag_hold<T>(mut self, v: std::option::Option<T>) -> Self
3798 where
3799 T: std::convert::Into<crate::model::TagHold>,
3800 {
3801 self.0.request.tag_hold = v.map(|x| x.into());
3802 self
3803 }
3804
3805 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3807 self.0.request.validate_only = v.into();
3808 self
3809 }
3810 }
3811
3812 #[doc(hidden)]
3813 impl crate::RequestBuilder for CreateTagHold {
3814 fn request_options(&mut self) -> &mut crate::RequestOptions {
3815 &mut self.0.options
3816 }
3817 }
3818
3819 #[derive(Clone, Debug)]
3837 pub struct DeleteTagHold(RequestBuilder<crate::model::DeleteTagHoldRequest>);
3838
3839 impl DeleteTagHold {
3840 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3841 Self(RequestBuilder::new(stub))
3842 }
3843
3844 pub fn with_request<V: Into<crate::model::DeleteTagHoldRequest>>(mut self, v: V) -> Self {
3846 self.0.request = v.into();
3847 self
3848 }
3849
3850 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3852 self.0.options = v.into();
3853 self
3854 }
3855
3856 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3863 (*self.0.stub)
3864 .delete_tag_hold(self.0.request, self.0.options)
3865 .await
3866 .map(crate::Response::into_body)
3867 }
3868
3869 pub fn poller(
3871 self,
3872 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTagHoldMetadata> {
3873 type Operation = google_cloud_lro::internal::Operation<
3874 wkt::Empty,
3875 crate::model::DeleteTagHoldMetadata,
3876 >;
3877 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3878 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3879
3880 let stub = self.0.stub.clone();
3881 let mut options = self.0.options.clone();
3882 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3883 let query = move |name| {
3884 let stub = stub.clone();
3885 let options = options.clone();
3886 async {
3887 let op = GetOperation::new(stub)
3888 .set_name(name)
3889 .with_options(options)
3890 .send()
3891 .await?;
3892 Ok(Operation::new(op))
3893 }
3894 };
3895
3896 let start = move || async {
3897 let op = self.send().await?;
3898 Ok(Operation::new(op))
3899 };
3900
3901 google_cloud_lro::internal::new_unit_response_poller(
3902 polling_error_policy,
3903 polling_backoff_policy,
3904 start,
3905 query,
3906 )
3907 }
3908
3909 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3913 self.0.request.name = v.into();
3914 self
3915 }
3916
3917 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
3919 self.0.request.validate_only = v.into();
3920 self
3921 }
3922 }
3923
3924 #[doc(hidden)]
3925 impl crate::RequestBuilder for DeleteTagHold {
3926 fn request_options(&mut self) -> &mut crate::RequestOptions {
3927 &mut self.0.options
3928 }
3929 }
3930
3931 #[derive(Clone, Debug)]
3952 pub struct ListTagHolds(RequestBuilder<crate::model::ListTagHoldsRequest>);
3953
3954 impl ListTagHolds {
3955 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
3956 Self(RequestBuilder::new(stub))
3957 }
3958
3959 pub fn with_request<V: Into<crate::model::ListTagHoldsRequest>>(mut self, v: V) -> Self {
3961 self.0.request = v.into();
3962 self
3963 }
3964
3965 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3967 self.0.options = v.into();
3968 self
3969 }
3970
3971 pub async fn send(self) -> Result<crate::model::ListTagHoldsResponse> {
3973 (*self.0.stub)
3974 .list_tag_holds(self.0.request, self.0.options)
3975 .await
3976 .map(crate::Response::into_body)
3977 }
3978
3979 pub fn by_page(
3981 self,
3982 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTagHoldsResponse, crate::Error>
3983 {
3984 use std::clone::Clone;
3985 let token = self.0.request.page_token.clone();
3986 let execute = move |token: String| {
3987 let mut builder = self.clone();
3988 builder.0.request = builder.0.request.set_page_token(token);
3989 builder.send()
3990 };
3991 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3992 }
3993
3994 pub fn by_item(
3996 self,
3997 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3998 crate::model::ListTagHoldsResponse,
3999 crate::Error,
4000 > {
4001 use google_cloud_gax::paginator::Paginator;
4002 self.by_page().items()
4003 }
4004
4005 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4009 self.0.request.parent = v.into();
4010 self
4011 }
4012
4013 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4015 self.0.request.page_size = v.into();
4016 self
4017 }
4018
4019 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4021 self.0.request.page_token = v.into();
4022 self
4023 }
4024
4025 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4027 self.0.request.filter = v.into();
4028 self
4029 }
4030 }
4031
4032 #[doc(hidden)]
4033 impl crate::RequestBuilder for ListTagHolds {
4034 fn request_options(&mut self) -> &mut crate::RequestOptions {
4035 &mut self.0.options
4036 }
4037 }
4038
4039 #[derive(Clone, Debug)]
4056 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4057
4058 impl GetOperation {
4059 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagHolds>) -> Self {
4060 Self(RequestBuilder::new(stub))
4061 }
4062
4063 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4065 mut self,
4066 v: V,
4067 ) -> Self {
4068 self.0.request = v.into();
4069 self
4070 }
4071
4072 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4074 self.0.options = v.into();
4075 self
4076 }
4077
4078 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4080 (*self.0.stub)
4081 .get_operation(self.0.request, self.0.options)
4082 .await
4083 .map(crate::Response::into_body)
4084 }
4085
4086 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4088 self.0.request.name = v.into();
4089 self
4090 }
4091 }
4092
4093 #[doc(hidden)]
4094 impl crate::RequestBuilder for GetOperation {
4095 fn request_options(&mut self) -> &mut crate::RequestOptions {
4096 &mut self.0.options
4097 }
4098 }
4099}
4100
4101pub mod tag_keys {
4102 use crate::Result;
4103
4104 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4118
4119 pub(crate) mod client {
4120 use super::super::super::client::TagKeys;
4121 pub struct Factory;
4122 impl crate::ClientFactory for Factory {
4123 type Client = TagKeys;
4124 type Credentials = gaxi::options::Credentials;
4125 async fn build(
4126 self,
4127 config: gaxi::options::ClientConfig,
4128 ) -> crate::ClientBuilderResult<Self::Client> {
4129 Self::Client::new(config).await
4130 }
4131 }
4132 }
4133
4134 #[derive(Clone, Debug)]
4136 pub(crate) struct RequestBuilder<R: std::default::Default> {
4137 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>,
4138 request: R,
4139 options: crate::RequestOptions,
4140 }
4141
4142 impl<R> RequestBuilder<R>
4143 where
4144 R: std::default::Default,
4145 {
4146 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4147 Self {
4148 stub,
4149 request: R::default(),
4150 options: crate::RequestOptions::default(),
4151 }
4152 }
4153 }
4154
4155 #[derive(Clone, Debug)]
4176 pub struct ListTagKeys(RequestBuilder<crate::model::ListTagKeysRequest>);
4177
4178 impl ListTagKeys {
4179 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4180 Self(RequestBuilder::new(stub))
4181 }
4182
4183 pub fn with_request<V: Into<crate::model::ListTagKeysRequest>>(mut self, v: V) -> Self {
4185 self.0.request = v.into();
4186 self
4187 }
4188
4189 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4191 self.0.options = v.into();
4192 self
4193 }
4194
4195 pub async fn send(self) -> Result<crate::model::ListTagKeysResponse> {
4197 (*self.0.stub)
4198 .list_tag_keys(self.0.request, self.0.options)
4199 .await
4200 .map(crate::Response::into_body)
4201 }
4202
4203 pub fn by_page(
4205 self,
4206 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTagKeysResponse, crate::Error>
4207 {
4208 use std::clone::Clone;
4209 let token = self.0.request.page_token.clone();
4210 let execute = move |token: String| {
4211 let mut builder = self.clone();
4212 builder.0.request = builder.0.request.set_page_token(token);
4213 builder.send()
4214 };
4215 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4216 }
4217
4218 pub fn by_item(
4220 self,
4221 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4222 crate::model::ListTagKeysResponse,
4223 crate::Error,
4224 > {
4225 use google_cloud_gax::paginator::Paginator;
4226 self.by_page().items()
4227 }
4228
4229 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4233 self.0.request.parent = v.into();
4234 self
4235 }
4236
4237 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4239 self.0.request.page_size = v.into();
4240 self
4241 }
4242
4243 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4245 self.0.request.page_token = v.into();
4246 self
4247 }
4248 }
4249
4250 #[doc(hidden)]
4251 impl crate::RequestBuilder for ListTagKeys {
4252 fn request_options(&mut self) -> &mut crate::RequestOptions {
4253 &mut self.0.options
4254 }
4255 }
4256
4257 #[derive(Clone, Debug)]
4274 pub struct GetTagKey(RequestBuilder<crate::model::GetTagKeyRequest>);
4275
4276 impl GetTagKey {
4277 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4278 Self(RequestBuilder::new(stub))
4279 }
4280
4281 pub fn with_request<V: Into<crate::model::GetTagKeyRequest>>(mut self, v: V) -> Self {
4283 self.0.request = v.into();
4284 self
4285 }
4286
4287 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4289 self.0.options = v.into();
4290 self
4291 }
4292
4293 pub async fn send(self) -> Result<crate::model::TagKey> {
4295 (*self.0.stub)
4296 .get_tag_key(self.0.request, self.0.options)
4297 .await
4298 .map(crate::Response::into_body)
4299 }
4300
4301 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4305 self.0.request.name = v.into();
4306 self
4307 }
4308 }
4309
4310 #[doc(hidden)]
4311 impl crate::RequestBuilder for GetTagKey {
4312 fn request_options(&mut self) -> &mut crate::RequestOptions {
4313 &mut self.0.options
4314 }
4315 }
4316
4317 #[derive(Clone, Debug)]
4334 pub struct GetNamespacedTagKey(RequestBuilder<crate::model::GetNamespacedTagKeyRequest>);
4335
4336 impl GetNamespacedTagKey {
4337 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4338 Self(RequestBuilder::new(stub))
4339 }
4340
4341 pub fn with_request<V: Into<crate::model::GetNamespacedTagKeyRequest>>(
4343 mut self,
4344 v: V,
4345 ) -> Self {
4346 self.0.request = v.into();
4347 self
4348 }
4349
4350 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4352 self.0.options = v.into();
4353 self
4354 }
4355
4356 pub async fn send(self) -> Result<crate::model::TagKey> {
4358 (*self.0.stub)
4359 .get_namespaced_tag_key(self.0.request, self.0.options)
4360 .await
4361 .map(crate::Response::into_body)
4362 }
4363
4364 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4368 self.0.request.name = v.into();
4369 self
4370 }
4371 }
4372
4373 #[doc(hidden)]
4374 impl crate::RequestBuilder for GetNamespacedTagKey {
4375 fn request_options(&mut self) -> &mut crate::RequestOptions {
4376 &mut self.0.options
4377 }
4378 }
4379
4380 #[derive(Clone, Debug)]
4398 pub struct CreateTagKey(RequestBuilder<crate::model::CreateTagKeyRequest>);
4399
4400 impl CreateTagKey {
4401 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4402 Self(RequestBuilder::new(stub))
4403 }
4404
4405 pub fn with_request<V: Into<crate::model::CreateTagKeyRequest>>(mut self, v: V) -> Self {
4407 self.0.request = v.into();
4408 self
4409 }
4410
4411 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4413 self.0.options = v.into();
4414 self
4415 }
4416
4417 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4424 (*self.0.stub)
4425 .create_tag_key(self.0.request, self.0.options)
4426 .await
4427 .map(crate::Response::into_body)
4428 }
4429
4430 pub fn poller(
4432 self,
4433 ) -> impl google_cloud_lro::Poller<crate::model::TagKey, crate::model::CreateTagKeyMetadata>
4434 {
4435 type Operation = google_cloud_lro::internal::Operation<
4436 crate::model::TagKey,
4437 crate::model::CreateTagKeyMetadata,
4438 >;
4439 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4440 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4441
4442 let stub = self.0.stub.clone();
4443 let mut options = self.0.options.clone();
4444 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4445 let query = move |name| {
4446 let stub = stub.clone();
4447 let options = options.clone();
4448 async {
4449 let op = GetOperation::new(stub)
4450 .set_name(name)
4451 .with_options(options)
4452 .send()
4453 .await?;
4454 Ok(Operation::new(op))
4455 }
4456 };
4457
4458 let start = move || async {
4459 let op = self.send().await?;
4460 Ok(Operation::new(op))
4461 };
4462
4463 google_cloud_lro::internal::new_poller(
4464 polling_error_policy,
4465 polling_backoff_policy,
4466 start,
4467 query,
4468 )
4469 }
4470
4471 pub fn set_tag_key<T>(mut self, v: T) -> Self
4475 where
4476 T: std::convert::Into<crate::model::TagKey>,
4477 {
4478 self.0.request.tag_key = std::option::Option::Some(v.into());
4479 self
4480 }
4481
4482 pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
4486 where
4487 T: std::convert::Into<crate::model::TagKey>,
4488 {
4489 self.0.request.tag_key = v.map(|x| x.into());
4490 self
4491 }
4492
4493 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4495 self.0.request.validate_only = v.into();
4496 self
4497 }
4498 }
4499
4500 #[doc(hidden)]
4501 impl crate::RequestBuilder for CreateTagKey {
4502 fn request_options(&mut self) -> &mut crate::RequestOptions {
4503 &mut self.0.options
4504 }
4505 }
4506
4507 #[derive(Clone, Debug)]
4525 pub struct UpdateTagKey(RequestBuilder<crate::model::UpdateTagKeyRequest>);
4526
4527 impl UpdateTagKey {
4528 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4529 Self(RequestBuilder::new(stub))
4530 }
4531
4532 pub fn with_request<V: Into<crate::model::UpdateTagKeyRequest>>(mut self, v: V) -> Self {
4534 self.0.request = v.into();
4535 self
4536 }
4537
4538 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4540 self.0.options = v.into();
4541 self
4542 }
4543
4544 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4551 (*self.0.stub)
4552 .update_tag_key(self.0.request, self.0.options)
4553 .await
4554 .map(crate::Response::into_body)
4555 }
4556
4557 pub fn poller(
4559 self,
4560 ) -> impl google_cloud_lro::Poller<crate::model::TagKey, crate::model::UpdateTagKeyMetadata>
4561 {
4562 type Operation = google_cloud_lro::internal::Operation<
4563 crate::model::TagKey,
4564 crate::model::UpdateTagKeyMetadata,
4565 >;
4566 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4567 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4568
4569 let stub = self.0.stub.clone();
4570 let mut options = self.0.options.clone();
4571 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4572 let query = move |name| {
4573 let stub = stub.clone();
4574 let options = options.clone();
4575 async {
4576 let op = GetOperation::new(stub)
4577 .set_name(name)
4578 .with_options(options)
4579 .send()
4580 .await?;
4581 Ok(Operation::new(op))
4582 }
4583 };
4584
4585 let start = move || async {
4586 let op = self.send().await?;
4587 Ok(Operation::new(op))
4588 };
4589
4590 google_cloud_lro::internal::new_poller(
4591 polling_error_policy,
4592 polling_backoff_policy,
4593 start,
4594 query,
4595 )
4596 }
4597
4598 pub fn set_tag_key<T>(mut self, v: T) -> Self
4602 where
4603 T: std::convert::Into<crate::model::TagKey>,
4604 {
4605 self.0.request.tag_key = std::option::Option::Some(v.into());
4606 self
4607 }
4608
4609 pub fn set_or_clear_tag_key<T>(mut self, v: std::option::Option<T>) -> Self
4613 where
4614 T: std::convert::Into<crate::model::TagKey>,
4615 {
4616 self.0.request.tag_key = v.map(|x| x.into());
4617 self
4618 }
4619
4620 pub fn set_update_mask<T>(mut self, v: T) -> Self
4622 where
4623 T: std::convert::Into<wkt::FieldMask>,
4624 {
4625 self.0.request.update_mask = std::option::Option::Some(v.into());
4626 self
4627 }
4628
4629 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4631 where
4632 T: std::convert::Into<wkt::FieldMask>,
4633 {
4634 self.0.request.update_mask = v.map(|x| x.into());
4635 self
4636 }
4637
4638 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4640 self.0.request.validate_only = v.into();
4641 self
4642 }
4643 }
4644
4645 #[doc(hidden)]
4646 impl crate::RequestBuilder for UpdateTagKey {
4647 fn request_options(&mut self) -> &mut crate::RequestOptions {
4648 &mut self.0.options
4649 }
4650 }
4651
4652 #[derive(Clone, Debug)]
4670 pub struct DeleteTagKey(RequestBuilder<crate::model::DeleteTagKeyRequest>);
4671
4672 impl DeleteTagKey {
4673 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4674 Self(RequestBuilder::new(stub))
4675 }
4676
4677 pub fn with_request<V: Into<crate::model::DeleteTagKeyRequest>>(mut self, v: V) -> Self {
4679 self.0.request = v.into();
4680 self
4681 }
4682
4683 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4685 self.0.options = v.into();
4686 self
4687 }
4688
4689 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4696 (*self.0.stub)
4697 .delete_tag_key(self.0.request, self.0.options)
4698 .await
4699 .map(crate::Response::into_body)
4700 }
4701
4702 pub fn poller(
4704 self,
4705 ) -> impl google_cloud_lro::Poller<crate::model::TagKey, crate::model::DeleteTagKeyMetadata>
4706 {
4707 type Operation = google_cloud_lro::internal::Operation<
4708 crate::model::TagKey,
4709 crate::model::DeleteTagKeyMetadata,
4710 >;
4711 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4712 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4713
4714 let stub = self.0.stub.clone();
4715 let mut options = self.0.options.clone();
4716 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4717 let query = move |name| {
4718 let stub = stub.clone();
4719 let options = options.clone();
4720 async {
4721 let op = GetOperation::new(stub)
4722 .set_name(name)
4723 .with_options(options)
4724 .send()
4725 .await?;
4726 Ok(Operation::new(op))
4727 }
4728 };
4729
4730 let start = move || async {
4731 let op = self.send().await?;
4732 Ok(Operation::new(op))
4733 };
4734
4735 google_cloud_lro::internal::new_poller(
4736 polling_error_policy,
4737 polling_backoff_policy,
4738 start,
4739 query,
4740 )
4741 }
4742
4743 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4747 self.0.request.name = v.into();
4748 self
4749 }
4750
4751 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4753 self.0.request.validate_only = v.into();
4754 self
4755 }
4756
4757 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
4759 self.0.request.etag = v.into();
4760 self
4761 }
4762 }
4763
4764 #[doc(hidden)]
4765 impl crate::RequestBuilder for DeleteTagKey {
4766 fn request_options(&mut self) -> &mut crate::RequestOptions {
4767 &mut self.0.options
4768 }
4769 }
4770
4771 #[derive(Clone, Debug)]
4788 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
4789
4790 impl GetIamPolicy {
4791 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4792 Self(RequestBuilder::new(stub))
4793 }
4794
4795 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
4797 mut self,
4798 v: V,
4799 ) -> Self {
4800 self.0.request = v.into();
4801 self
4802 }
4803
4804 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4806 self.0.options = v.into();
4807 self
4808 }
4809
4810 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4812 (*self.0.stub)
4813 .get_iam_policy(self.0.request, self.0.options)
4814 .await
4815 .map(crate::Response::into_body)
4816 }
4817
4818 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4822 self.0.request.resource = v.into();
4823 self
4824 }
4825
4826 pub fn set_options<T>(mut self, v: T) -> Self
4828 where
4829 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4830 {
4831 self.0.request.options = std::option::Option::Some(v.into());
4832 self
4833 }
4834
4835 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
4837 where
4838 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
4839 {
4840 self.0.request.options = v.map(|x| x.into());
4841 self
4842 }
4843 }
4844
4845 #[doc(hidden)]
4846 impl crate::RequestBuilder for GetIamPolicy {
4847 fn request_options(&mut self) -> &mut crate::RequestOptions {
4848 &mut self.0.options
4849 }
4850 }
4851
4852 #[derive(Clone, Debug)]
4869 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
4870
4871 impl SetIamPolicy {
4872 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4873 Self(RequestBuilder::new(stub))
4874 }
4875
4876 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
4878 mut self,
4879 v: V,
4880 ) -> Self {
4881 self.0.request = v.into();
4882 self
4883 }
4884
4885 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4887 self.0.options = v.into();
4888 self
4889 }
4890
4891 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
4893 (*self.0.stub)
4894 .set_iam_policy(self.0.request, self.0.options)
4895 .await
4896 .map(crate::Response::into_body)
4897 }
4898
4899 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
4903 self.0.request.resource = v.into();
4904 self
4905 }
4906
4907 pub fn set_policy<T>(mut self, v: T) -> Self
4911 where
4912 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4913 {
4914 self.0.request.policy = std::option::Option::Some(v.into());
4915 self
4916 }
4917
4918 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
4922 where
4923 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
4924 {
4925 self.0.request.policy = v.map(|x| x.into());
4926 self
4927 }
4928
4929 pub fn set_update_mask<T>(mut self, v: T) -> Self
4931 where
4932 T: std::convert::Into<wkt::FieldMask>,
4933 {
4934 self.0.request.update_mask = std::option::Option::Some(v.into());
4935 self
4936 }
4937
4938 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4940 where
4941 T: std::convert::Into<wkt::FieldMask>,
4942 {
4943 self.0.request.update_mask = v.map(|x| x.into());
4944 self
4945 }
4946 }
4947
4948 #[doc(hidden)]
4949 impl crate::RequestBuilder for SetIamPolicy {
4950 fn request_options(&mut self) -> &mut crate::RequestOptions {
4951 &mut self.0.options
4952 }
4953 }
4954
4955 #[derive(Clone, Debug)]
4972 pub struct TestIamPermissions(
4973 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
4974 );
4975
4976 impl TestIamPermissions {
4977 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
4978 Self(RequestBuilder::new(stub))
4979 }
4980
4981 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
4983 mut self,
4984 v: V,
4985 ) -> Self {
4986 self.0.request = v.into();
4987 self
4988 }
4989
4990 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4992 self.0.options = v.into();
4993 self
4994 }
4995
4996 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
4998 (*self.0.stub)
4999 .test_iam_permissions(self.0.request, self.0.options)
5000 .await
5001 .map(crate::Response::into_body)
5002 }
5003
5004 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5008 self.0.request.resource = v.into();
5009 self
5010 }
5011
5012 pub fn set_permissions<T, V>(mut self, v: T) -> Self
5016 where
5017 T: std::iter::IntoIterator<Item = V>,
5018 V: std::convert::Into<std::string::String>,
5019 {
5020 use std::iter::Iterator;
5021 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
5022 self
5023 }
5024 }
5025
5026 #[doc(hidden)]
5027 impl crate::RequestBuilder for TestIamPermissions {
5028 fn request_options(&mut self) -> &mut crate::RequestOptions {
5029 &mut self.0.options
5030 }
5031 }
5032
5033 #[derive(Clone, Debug)]
5050 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5051
5052 impl GetOperation {
5053 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::TagKeys>) -> Self {
5054 Self(RequestBuilder::new(stub))
5055 }
5056
5057 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5059 mut self,
5060 v: V,
5061 ) -> Self {
5062 self.0.request = v.into();
5063 self
5064 }
5065
5066 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5068 self.0.options = v.into();
5069 self
5070 }
5071
5072 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5074 (*self.0.stub)
5075 .get_operation(self.0.request, self.0.options)
5076 .await
5077 .map(crate::Response::into_body)
5078 }
5079
5080 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5082 self.0.request.name = v.into();
5083 self
5084 }
5085 }
5086
5087 #[doc(hidden)]
5088 impl crate::RequestBuilder for GetOperation {
5089 fn request_options(&mut self) -> &mut crate::RequestOptions {
5090 &mut self.0.options
5091 }
5092 }
5093}
5094
5095pub mod tag_values {
5096 use crate::Result;
5097
5098 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5112
5113 pub(crate) mod client {
5114 use super::super::super::client::TagValues;
5115 pub struct Factory;
5116 impl crate::ClientFactory for Factory {
5117 type Client = TagValues;
5118 type Credentials = gaxi::options::Credentials;
5119 async fn build(
5120 self,
5121 config: gaxi::options::ClientConfig,
5122 ) -> crate::ClientBuilderResult<Self::Client> {
5123 Self::Client::new(config).await
5124 }
5125 }
5126 }
5127
5128 #[derive(Clone, Debug)]
5130 pub(crate) struct RequestBuilder<R: std::default::Default> {
5131 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5132 request: R,
5133 options: crate::RequestOptions,
5134 }
5135
5136 impl<R> RequestBuilder<R>
5137 where
5138 R: std::default::Default,
5139 {
5140 pub(crate) fn new(
5141 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5142 ) -> Self {
5143 Self {
5144 stub,
5145 request: R::default(),
5146 options: crate::RequestOptions::default(),
5147 }
5148 }
5149 }
5150
5151 #[derive(Clone, Debug)]
5172 pub struct ListTagValues(RequestBuilder<crate::model::ListTagValuesRequest>);
5173
5174 impl ListTagValues {
5175 pub(crate) fn new(
5176 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5177 ) -> Self {
5178 Self(RequestBuilder::new(stub))
5179 }
5180
5181 pub fn with_request<V: Into<crate::model::ListTagValuesRequest>>(mut self, v: V) -> Self {
5183 self.0.request = v.into();
5184 self
5185 }
5186
5187 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5189 self.0.options = v.into();
5190 self
5191 }
5192
5193 pub async fn send(self) -> Result<crate::model::ListTagValuesResponse> {
5195 (*self.0.stub)
5196 .list_tag_values(self.0.request, self.0.options)
5197 .await
5198 .map(crate::Response::into_body)
5199 }
5200
5201 pub fn by_page(
5203 self,
5204 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTagValuesResponse, crate::Error>
5205 {
5206 use std::clone::Clone;
5207 let token = self.0.request.page_token.clone();
5208 let execute = move |token: String| {
5209 let mut builder = self.clone();
5210 builder.0.request = builder.0.request.set_page_token(token);
5211 builder.send()
5212 };
5213 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5214 }
5215
5216 pub fn by_item(
5218 self,
5219 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5220 crate::model::ListTagValuesResponse,
5221 crate::Error,
5222 > {
5223 use google_cloud_gax::paginator::Paginator;
5224 self.by_page().items()
5225 }
5226
5227 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5231 self.0.request.parent = v.into();
5232 self
5233 }
5234
5235 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5237 self.0.request.page_size = v.into();
5238 self
5239 }
5240
5241 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5243 self.0.request.page_token = v.into();
5244 self
5245 }
5246 }
5247
5248 #[doc(hidden)]
5249 impl crate::RequestBuilder for ListTagValues {
5250 fn request_options(&mut self) -> &mut crate::RequestOptions {
5251 &mut self.0.options
5252 }
5253 }
5254
5255 #[derive(Clone, Debug)]
5272 pub struct GetTagValue(RequestBuilder<crate::model::GetTagValueRequest>);
5273
5274 impl GetTagValue {
5275 pub(crate) fn new(
5276 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5277 ) -> Self {
5278 Self(RequestBuilder::new(stub))
5279 }
5280
5281 pub fn with_request<V: Into<crate::model::GetTagValueRequest>>(mut self, v: V) -> Self {
5283 self.0.request = v.into();
5284 self
5285 }
5286
5287 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5289 self.0.options = v.into();
5290 self
5291 }
5292
5293 pub async fn send(self) -> Result<crate::model::TagValue> {
5295 (*self.0.stub)
5296 .get_tag_value(self.0.request, self.0.options)
5297 .await
5298 .map(crate::Response::into_body)
5299 }
5300
5301 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5305 self.0.request.name = v.into();
5306 self
5307 }
5308 }
5309
5310 #[doc(hidden)]
5311 impl crate::RequestBuilder for GetTagValue {
5312 fn request_options(&mut self) -> &mut crate::RequestOptions {
5313 &mut self.0.options
5314 }
5315 }
5316
5317 #[derive(Clone, Debug)]
5334 pub struct GetNamespacedTagValue(RequestBuilder<crate::model::GetNamespacedTagValueRequest>);
5335
5336 impl GetNamespacedTagValue {
5337 pub(crate) fn new(
5338 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5339 ) -> Self {
5340 Self(RequestBuilder::new(stub))
5341 }
5342
5343 pub fn with_request<V: Into<crate::model::GetNamespacedTagValueRequest>>(
5345 mut self,
5346 v: V,
5347 ) -> Self {
5348 self.0.request = v.into();
5349 self
5350 }
5351
5352 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5354 self.0.options = v.into();
5355 self
5356 }
5357
5358 pub async fn send(self) -> Result<crate::model::TagValue> {
5360 (*self.0.stub)
5361 .get_namespaced_tag_value(self.0.request, self.0.options)
5362 .await
5363 .map(crate::Response::into_body)
5364 }
5365
5366 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5370 self.0.request.name = v.into();
5371 self
5372 }
5373 }
5374
5375 #[doc(hidden)]
5376 impl crate::RequestBuilder for GetNamespacedTagValue {
5377 fn request_options(&mut self) -> &mut crate::RequestOptions {
5378 &mut self.0.options
5379 }
5380 }
5381
5382 #[derive(Clone, Debug)]
5400 pub struct CreateTagValue(RequestBuilder<crate::model::CreateTagValueRequest>);
5401
5402 impl CreateTagValue {
5403 pub(crate) fn new(
5404 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5405 ) -> Self {
5406 Self(RequestBuilder::new(stub))
5407 }
5408
5409 pub fn with_request<V: Into<crate::model::CreateTagValueRequest>>(mut self, v: V) -> Self {
5411 self.0.request = v.into();
5412 self
5413 }
5414
5415 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5417 self.0.options = v.into();
5418 self
5419 }
5420
5421 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5428 (*self.0.stub)
5429 .create_tag_value(self.0.request, self.0.options)
5430 .await
5431 .map(crate::Response::into_body)
5432 }
5433
5434 pub fn poller(
5436 self,
5437 ) -> impl google_cloud_lro::Poller<crate::model::TagValue, crate::model::CreateTagValueMetadata>
5438 {
5439 type Operation = google_cloud_lro::internal::Operation<
5440 crate::model::TagValue,
5441 crate::model::CreateTagValueMetadata,
5442 >;
5443 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5444 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5445
5446 let stub = self.0.stub.clone();
5447 let mut options = self.0.options.clone();
5448 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5449 let query = move |name| {
5450 let stub = stub.clone();
5451 let options = options.clone();
5452 async {
5453 let op = GetOperation::new(stub)
5454 .set_name(name)
5455 .with_options(options)
5456 .send()
5457 .await?;
5458 Ok(Operation::new(op))
5459 }
5460 };
5461
5462 let start = move || async {
5463 let op = self.send().await?;
5464 Ok(Operation::new(op))
5465 };
5466
5467 google_cloud_lro::internal::new_poller(
5468 polling_error_policy,
5469 polling_backoff_policy,
5470 start,
5471 query,
5472 )
5473 }
5474
5475 pub fn set_tag_value<T>(mut self, v: T) -> Self
5479 where
5480 T: std::convert::Into<crate::model::TagValue>,
5481 {
5482 self.0.request.tag_value = std::option::Option::Some(v.into());
5483 self
5484 }
5485
5486 pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
5490 where
5491 T: std::convert::Into<crate::model::TagValue>,
5492 {
5493 self.0.request.tag_value = v.map(|x| x.into());
5494 self
5495 }
5496
5497 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5499 self.0.request.validate_only = v.into();
5500 self
5501 }
5502 }
5503
5504 #[doc(hidden)]
5505 impl crate::RequestBuilder for CreateTagValue {
5506 fn request_options(&mut self) -> &mut crate::RequestOptions {
5507 &mut self.0.options
5508 }
5509 }
5510
5511 #[derive(Clone, Debug)]
5529 pub struct UpdateTagValue(RequestBuilder<crate::model::UpdateTagValueRequest>);
5530
5531 impl UpdateTagValue {
5532 pub(crate) fn new(
5533 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5534 ) -> Self {
5535 Self(RequestBuilder::new(stub))
5536 }
5537
5538 pub fn with_request<V: Into<crate::model::UpdateTagValueRequest>>(mut self, v: V) -> Self {
5540 self.0.request = v.into();
5541 self
5542 }
5543
5544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5546 self.0.options = v.into();
5547 self
5548 }
5549
5550 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5557 (*self.0.stub)
5558 .update_tag_value(self.0.request, self.0.options)
5559 .await
5560 .map(crate::Response::into_body)
5561 }
5562
5563 pub fn poller(
5565 self,
5566 ) -> impl google_cloud_lro::Poller<crate::model::TagValue, crate::model::UpdateTagValueMetadata>
5567 {
5568 type Operation = google_cloud_lro::internal::Operation<
5569 crate::model::TagValue,
5570 crate::model::UpdateTagValueMetadata,
5571 >;
5572 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5573 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5574
5575 let stub = self.0.stub.clone();
5576 let mut options = self.0.options.clone();
5577 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5578 let query = move |name| {
5579 let stub = stub.clone();
5580 let options = options.clone();
5581 async {
5582 let op = GetOperation::new(stub)
5583 .set_name(name)
5584 .with_options(options)
5585 .send()
5586 .await?;
5587 Ok(Operation::new(op))
5588 }
5589 };
5590
5591 let start = move || async {
5592 let op = self.send().await?;
5593 Ok(Operation::new(op))
5594 };
5595
5596 google_cloud_lro::internal::new_poller(
5597 polling_error_policy,
5598 polling_backoff_policy,
5599 start,
5600 query,
5601 )
5602 }
5603
5604 pub fn set_tag_value<T>(mut self, v: T) -> Self
5608 where
5609 T: std::convert::Into<crate::model::TagValue>,
5610 {
5611 self.0.request.tag_value = std::option::Option::Some(v.into());
5612 self
5613 }
5614
5615 pub fn set_or_clear_tag_value<T>(mut self, v: std::option::Option<T>) -> Self
5619 where
5620 T: std::convert::Into<crate::model::TagValue>,
5621 {
5622 self.0.request.tag_value = v.map(|x| x.into());
5623 self
5624 }
5625
5626 pub fn set_update_mask<T>(mut self, v: T) -> Self
5628 where
5629 T: std::convert::Into<wkt::FieldMask>,
5630 {
5631 self.0.request.update_mask = std::option::Option::Some(v.into());
5632 self
5633 }
5634
5635 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5637 where
5638 T: std::convert::Into<wkt::FieldMask>,
5639 {
5640 self.0.request.update_mask = v.map(|x| x.into());
5641 self
5642 }
5643
5644 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5646 self.0.request.validate_only = v.into();
5647 self
5648 }
5649 }
5650
5651 #[doc(hidden)]
5652 impl crate::RequestBuilder for UpdateTagValue {
5653 fn request_options(&mut self) -> &mut crate::RequestOptions {
5654 &mut self.0.options
5655 }
5656 }
5657
5658 #[derive(Clone, Debug)]
5676 pub struct DeleteTagValue(RequestBuilder<crate::model::DeleteTagValueRequest>);
5677
5678 impl DeleteTagValue {
5679 pub(crate) fn new(
5680 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5681 ) -> Self {
5682 Self(RequestBuilder::new(stub))
5683 }
5684
5685 pub fn with_request<V: Into<crate::model::DeleteTagValueRequest>>(mut self, v: V) -> Self {
5687 self.0.request = v.into();
5688 self
5689 }
5690
5691 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5693 self.0.options = v.into();
5694 self
5695 }
5696
5697 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5704 (*self.0.stub)
5705 .delete_tag_value(self.0.request, self.0.options)
5706 .await
5707 .map(crate::Response::into_body)
5708 }
5709
5710 pub fn poller(
5712 self,
5713 ) -> impl google_cloud_lro::Poller<crate::model::TagValue, crate::model::DeleteTagValueMetadata>
5714 {
5715 type Operation = google_cloud_lro::internal::Operation<
5716 crate::model::TagValue,
5717 crate::model::DeleteTagValueMetadata,
5718 >;
5719 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5720 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5721
5722 let stub = self.0.stub.clone();
5723 let mut options = self.0.options.clone();
5724 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5725 let query = move |name| {
5726 let stub = stub.clone();
5727 let options = options.clone();
5728 async {
5729 let op = GetOperation::new(stub)
5730 .set_name(name)
5731 .with_options(options)
5732 .send()
5733 .await?;
5734 Ok(Operation::new(op))
5735 }
5736 };
5737
5738 let start = move || async {
5739 let op = self.send().await?;
5740 Ok(Operation::new(op))
5741 };
5742
5743 google_cloud_lro::internal::new_poller(
5744 polling_error_policy,
5745 polling_backoff_policy,
5746 start,
5747 query,
5748 )
5749 }
5750
5751 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5755 self.0.request.name = v.into();
5756 self
5757 }
5758
5759 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
5761 self.0.request.validate_only = v.into();
5762 self
5763 }
5764
5765 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
5767 self.0.request.etag = v.into();
5768 self
5769 }
5770 }
5771
5772 #[doc(hidden)]
5773 impl crate::RequestBuilder for DeleteTagValue {
5774 fn request_options(&mut self) -> &mut crate::RequestOptions {
5775 &mut self.0.options
5776 }
5777 }
5778
5779 #[derive(Clone, Debug)]
5796 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
5797
5798 impl GetIamPolicy {
5799 pub(crate) fn new(
5800 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5801 ) -> Self {
5802 Self(RequestBuilder::new(stub))
5803 }
5804
5805 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
5807 mut self,
5808 v: V,
5809 ) -> Self {
5810 self.0.request = v.into();
5811 self
5812 }
5813
5814 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5816 self.0.options = v.into();
5817 self
5818 }
5819
5820 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5822 (*self.0.stub)
5823 .get_iam_policy(self.0.request, self.0.options)
5824 .await
5825 .map(crate::Response::into_body)
5826 }
5827
5828 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5832 self.0.request.resource = v.into();
5833 self
5834 }
5835
5836 pub fn set_options<T>(mut self, v: T) -> Self
5838 where
5839 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5840 {
5841 self.0.request.options = std::option::Option::Some(v.into());
5842 self
5843 }
5844
5845 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
5847 where
5848 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
5849 {
5850 self.0.request.options = v.map(|x| x.into());
5851 self
5852 }
5853 }
5854
5855 #[doc(hidden)]
5856 impl crate::RequestBuilder for GetIamPolicy {
5857 fn request_options(&mut self) -> &mut crate::RequestOptions {
5858 &mut self.0.options
5859 }
5860 }
5861
5862 #[derive(Clone, Debug)]
5879 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
5880
5881 impl SetIamPolicy {
5882 pub(crate) fn new(
5883 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5884 ) -> Self {
5885 Self(RequestBuilder::new(stub))
5886 }
5887
5888 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
5890 mut self,
5891 v: V,
5892 ) -> Self {
5893 self.0.request = v.into();
5894 self
5895 }
5896
5897 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5899 self.0.options = v.into();
5900 self
5901 }
5902
5903 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
5905 (*self.0.stub)
5906 .set_iam_policy(self.0.request, self.0.options)
5907 .await
5908 .map(crate::Response::into_body)
5909 }
5910
5911 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
5915 self.0.request.resource = v.into();
5916 self
5917 }
5918
5919 pub fn set_policy<T>(mut self, v: T) -> Self
5923 where
5924 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5925 {
5926 self.0.request.policy = std::option::Option::Some(v.into());
5927 self
5928 }
5929
5930 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
5934 where
5935 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
5936 {
5937 self.0.request.policy = v.map(|x| x.into());
5938 self
5939 }
5940
5941 pub fn set_update_mask<T>(mut self, v: T) -> Self
5943 where
5944 T: std::convert::Into<wkt::FieldMask>,
5945 {
5946 self.0.request.update_mask = std::option::Option::Some(v.into());
5947 self
5948 }
5949
5950 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5952 where
5953 T: std::convert::Into<wkt::FieldMask>,
5954 {
5955 self.0.request.update_mask = v.map(|x| x.into());
5956 self
5957 }
5958 }
5959
5960 #[doc(hidden)]
5961 impl crate::RequestBuilder for SetIamPolicy {
5962 fn request_options(&mut self) -> &mut crate::RequestOptions {
5963 &mut self.0.options
5964 }
5965 }
5966
5967 #[derive(Clone, Debug)]
5984 pub struct TestIamPermissions(
5985 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
5986 );
5987
5988 impl TestIamPermissions {
5989 pub(crate) fn new(
5990 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
5991 ) -> Self {
5992 Self(RequestBuilder::new(stub))
5993 }
5994
5995 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
5997 mut self,
5998 v: V,
5999 ) -> Self {
6000 self.0.request = v.into();
6001 self
6002 }
6003
6004 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6006 self.0.options = v.into();
6007 self
6008 }
6009
6010 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
6012 (*self.0.stub)
6013 .test_iam_permissions(self.0.request, self.0.options)
6014 .await
6015 .map(crate::Response::into_body)
6016 }
6017
6018 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
6022 self.0.request.resource = v.into();
6023 self
6024 }
6025
6026 pub fn set_permissions<T, V>(mut self, v: T) -> Self
6030 where
6031 T: std::iter::IntoIterator<Item = V>,
6032 V: std::convert::Into<std::string::String>,
6033 {
6034 use std::iter::Iterator;
6035 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
6036 self
6037 }
6038 }
6039
6040 #[doc(hidden)]
6041 impl crate::RequestBuilder for TestIamPermissions {
6042 fn request_options(&mut self) -> &mut crate::RequestOptions {
6043 &mut self.0.options
6044 }
6045 }
6046
6047 #[derive(Clone, Debug)]
6064 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6065
6066 impl GetOperation {
6067 pub(crate) fn new(
6068 stub: std::sync::Arc<dyn super::super::stub::dynamic::TagValues>,
6069 ) -> Self {
6070 Self(RequestBuilder::new(stub))
6071 }
6072
6073 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6075 mut self,
6076 v: V,
6077 ) -> Self {
6078 self.0.request = v.into();
6079 self
6080 }
6081
6082 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6084 self.0.options = v.into();
6085 self
6086 }
6087
6088 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6090 (*self.0.stub)
6091 .get_operation(self.0.request, self.0.options)
6092 .await
6093 .map(crate::Response::into_body)
6094 }
6095
6096 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6098 self.0.request.name = v.into();
6099 self
6100 }
6101 }
6102
6103 #[doc(hidden)]
6104 impl crate::RequestBuilder for GetOperation {
6105 fn request_options(&mut self) -> &mut crate::RequestOptions {
6106 &mut self.0.options
6107 }
6108 }
6109}