1pub mod workstations {
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::Workstations;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = Workstations;
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::Workstations>,
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(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
90 pub struct GetWorkstationCluster(RequestBuilder<crate::model::GetWorkstationClusterRequest>);
91
92 impl GetWorkstationCluster {
93 pub(crate) fn new(
94 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
95 ) -> Self {
96 Self(RequestBuilder::new(stub))
97 }
98
99 pub fn with_request<V: Into<crate::model::GetWorkstationClusterRequest>>(
101 mut self,
102 v: V,
103 ) -> Self {
104 self.0.request = v.into();
105 self
106 }
107
108 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
110 self.0.options = v.into();
111 self
112 }
113
114 pub async fn send(self) -> Result<crate::model::WorkstationCluster> {
116 (*self.0.stub)
117 .get_workstation_cluster(self.0.request, self.0.options)
118 .await
119 .map(crate::Response::into_body)
120 }
121
122 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
126 self.0.request.name = v.into();
127 self
128 }
129 }
130
131 #[doc(hidden)]
132 impl crate::RequestBuilder for GetWorkstationCluster {
133 fn request_options(&mut self) -> &mut crate::RequestOptions {
134 &mut self.0.options
135 }
136 }
137
138 #[derive(Clone, Debug)]
159 pub struct ListWorkstationClusters(
160 RequestBuilder<crate::model::ListWorkstationClustersRequest>,
161 );
162
163 impl ListWorkstationClusters {
164 pub(crate) fn new(
165 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
166 ) -> Self {
167 Self(RequestBuilder::new(stub))
168 }
169
170 pub fn with_request<V: Into<crate::model::ListWorkstationClustersRequest>>(
172 mut self,
173 v: V,
174 ) -> Self {
175 self.0.request = v.into();
176 self
177 }
178
179 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
181 self.0.options = v.into();
182 self
183 }
184
185 pub async fn send(self) -> Result<crate::model::ListWorkstationClustersResponse> {
187 (*self.0.stub)
188 .list_workstation_clusters(self.0.request, self.0.options)
189 .await
190 .map(crate::Response::into_body)
191 }
192
193 pub fn by_page(
195 self,
196 ) -> impl google_cloud_gax::paginator::Paginator<
197 crate::model::ListWorkstationClustersResponse,
198 crate::Error,
199 > {
200 use std::clone::Clone;
201 let token = self.0.request.page_token.clone();
202 let execute = move |token: String| {
203 let mut builder = self.clone();
204 builder.0.request = builder.0.request.set_page_token(token);
205 builder.send()
206 };
207 google_cloud_gax::paginator::internal::new_paginator(token, execute)
208 }
209
210 pub fn by_item(
212 self,
213 ) -> impl google_cloud_gax::paginator::ItemPaginator<
214 crate::model::ListWorkstationClustersResponse,
215 crate::Error,
216 > {
217 use google_cloud_gax::paginator::Paginator;
218 self.by_page().items()
219 }
220
221 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
225 self.0.request.parent = v.into();
226 self
227 }
228
229 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
231 self.0.request.page_size = v.into();
232 self
233 }
234
235 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
237 self.0.request.page_token = v.into();
238 self
239 }
240 }
241
242 #[doc(hidden)]
243 impl crate::RequestBuilder for ListWorkstationClusters {
244 fn request_options(&mut self) -> &mut crate::RequestOptions {
245 &mut self.0.options
246 }
247 }
248
249 #[derive(Clone, Debug)]
267 pub struct CreateWorkstationCluster(
268 RequestBuilder<crate::model::CreateWorkstationClusterRequest>,
269 );
270
271 impl CreateWorkstationCluster {
272 pub(crate) fn new(
273 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
274 ) -> Self {
275 Self(RequestBuilder::new(stub))
276 }
277
278 pub fn with_request<V: Into<crate::model::CreateWorkstationClusterRequest>>(
280 mut self,
281 v: V,
282 ) -> Self {
283 self.0.request = v.into();
284 self
285 }
286
287 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
289 self.0.options = v.into();
290 self
291 }
292
293 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
300 (*self.0.stub)
301 .create_workstation_cluster(self.0.request, self.0.options)
302 .await
303 .map(crate::Response::into_body)
304 }
305
306 pub fn poller(
308 self,
309 ) -> impl google_cloud_lro::Poller<
310 crate::model::WorkstationCluster,
311 crate::model::OperationMetadata,
312 > {
313 type Operation = google_cloud_lro::internal::Operation<
314 crate::model::WorkstationCluster,
315 crate::model::OperationMetadata,
316 >;
317 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
318 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
319
320 let stub = self.0.stub.clone();
321 let mut options = self.0.options.clone();
322 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
323 let query = move |name| {
324 let stub = stub.clone();
325 let options = options.clone();
326 async {
327 let op = GetOperation::new(stub)
328 .set_name(name)
329 .with_options(options)
330 .send()
331 .await?;
332 Ok(Operation::new(op))
333 }
334 };
335
336 let start = move || async {
337 let op = self.send().await?;
338 Ok(Operation::new(op))
339 };
340
341 google_cloud_lro::internal::new_poller(
342 polling_error_policy,
343 polling_backoff_policy,
344 start,
345 query,
346 )
347 }
348
349 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
353 self.0.request.parent = v.into();
354 self
355 }
356
357 pub fn set_workstation_cluster_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
361 self.0.request.workstation_cluster_id = v.into();
362 self
363 }
364
365 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
369 where
370 T: std::convert::Into<crate::model::WorkstationCluster>,
371 {
372 self.0.request.workstation_cluster = std::option::Option::Some(v.into());
373 self
374 }
375
376 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
380 where
381 T: std::convert::Into<crate::model::WorkstationCluster>,
382 {
383 self.0.request.workstation_cluster = v.map(|x| x.into());
384 self
385 }
386
387 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
389 self.0.request.validate_only = v.into();
390 self
391 }
392 }
393
394 #[doc(hidden)]
395 impl crate::RequestBuilder for CreateWorkstationCluster {
396 fn request_options(&mut self) -> &mut crate::RequestOptions {
397 &mut self.0.options
398 }
399 }
400
401 #[derive(Clone, Debug)]
419 pub struct UpdateWorkstationCluster(
420 RequestBuilder<crate::model::UpdateWorkstationClusterRequest>,
421 );
422
423 impl UpdateWorkstationCluster {
424 pub(crate) fn new(
425 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
426 ) -> Self {
427 Self(RequestBuilder::new(stub))
428 }
429
430 pub fn with_request<V: Into<crate::model::UpdateWorkstationClusterRequest>>(
432 mut self,
433 v: V,
434 ) -> Self {
435 self.0.request = v.into();
436 self
437 }
438
439 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
441 self.0.options = v.into();
442 self
443 }
444
445 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
452 (*self.0.stub)
453 .update_workstation_cluster(self.0.request, self.0.options)
454 .await
455 .map(crate::Response::into_body)
456 }
457
458 pub fn poller(
460 self,
461 ) -> impl google_cloud_lro::Poller<
462 crate::model::WorkstationCluster,
463 crate::model::OperationMetadata,
464 > {
465 type Operation = google_cloud_lro::internal::Operation<
466 crate::model::WorkstationCluster,
467 crate::model::OperationMetadata,
468 >;
469 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
470 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
471
472 let stub = self.0.stub.clone();
473 let mut options = self.0.options.clone();
474 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
475 let query = move |name| {
476 let stub = stub.clone();
477 let options = options.clone();
478 async {
479 let op = GetOperation::new(stub)
480 .set_name(name)
481 .with_options(options)
482 .send()
483 .await?;
484 Ok(Operation::new(op))
485 }
486 };
487
488 let start = move || async {
489 let op = self.send().await?;
490 Ok(Operation::new(op))
491 };
492
493 google_cloud_lro::internal::new_poller(
494 polling_error_policy,
495 polling_backoff_policy,
496 start,
497 query,
498 )
499 }
500
501 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
505 where
506 T: std::convert::Into<crate::model::WorkstationCluster>,
507 {
508 self.0.request.workstation_cluster = std::option::Option::Some(v.into());
509 self
510 }
511
512 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
516 where
517 T: std::convert::Into<crate::model::WorkstationCluster>,
518 {
519 self.0.request.workstation_cluster = v.map(|x| x.into());
520 self
521 }
522
523 pub fn set_update_mask<T>(mut self, v: T) -> Self
527 where
528 T: std::convert::Into<wkt::FieldMask>,
529 {
530 self.0.request.update_mask = std::option::Option::Some(v.into());
531 self
532 }
533
534 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
538 where
539 T: std::convert::Into<wkt::FieldMask>,
540 {
541 self.0.request.update_mask = v.map(|x| x.into());
542 self
543 }
544
545 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
547 self.0.request.validate_only = v.into();
548 self
549 }
550
551 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
553 self.0.request.allow_missing = v.into();
554 self
555 }
556 }
557
558 #[doc(hidden)]
559 impl crate::RequestBuilder for UpdateWorkstationCluster {
560 fn request_options(&mut self) -> &mut crate::RequestOptions {
561 &mut self.0.options
562 }
563 }
564
565 #[derive(Clone, Debug)]
583 pub struct DeleteWorkstationCluster(
584 RequestBuilder<crate::model::DeleteWorkstationClusterRequest>,
585 );
586
587 impl DeleteWorkstationCluster {
588 pub(crate) fn new(
589 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
590 ) -> Self {
591 Self(RequestBuilder::new(stub))
592 }
593
594 pub fn with_request<V: Into<crate::model::DeleteWorkstationClusterRequest>>(
596 mut self,
597 v: V,
598 ) -> Self {
599 self.0.request = v.into();
600 self
601 }
602
603 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
605 self.0.options = v.into();
606 self
607 }
608
609 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
616 (*self.0.stub)
617 .delete_workstation_cluster(self.0.request, self.0.options)
618 .await
619 .map(crate::Response::into_body)
620 }
621
622 pub fn poller(
624 self,
625 ) -> impl google_cloud_lro::Poller<
626 crate::model::WorkstationCluster,
627 crate::model::OperationMetadata,
628 > {
629 type Operation = google_cloud_lro::internal::Operation<
630 crate::model::WorkstationCluster,
631 crate::model::OperationMetadata,
632 >;
633 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
634 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
635
636 let stub = self.0.stub.clone();
637 let mut options = self.0.options.clone();
638 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
639 let query = move |name| {
640 let stub = stub.clone();
641 let options = options.clone();
642 async {
643 let op = GetOperation::new(stub)
644 .set_name(name)
645 .with_options(options)
646 .send()
647 .await?;
648 Ok(Operation::new(op))
649 }
650 };
651
652 let start = move || async {
653 let op = self.send().await?;
654 Ok(Operation::new(op))
655 };
656
657 google_cloud_lro::internal::new_poller(
658 polling_error_policy,
659 polling_backoff_policy,
660 start,
661 query,
662 )
663 }
664
665 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
669 self.0.request.name = v.into();
670 self
671 }
672
673 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
675 self.0.request.validate_only = v.into();
676 self
677 }
678
679 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
681 self.0.request.etag = v.into();
682 self
683 }
684
685 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
687 self.0.request.force = v.into();
688 self
689 }
690 }
691
692 #[doc(hidden)]
693 impl crate::RequestBuilder for DeleteWorkstationCluster {
694 fn request_options(&mut self) -> &mut crate::RequestOptions {
695 &mut self.0.options
696 }
697 }
698
699 #[derive(Clone, Debug)]
716 pub struct GetWorkstationConfig(RequestBuilder<crate::model::GetWorkstationConfigRequest>);
717
718 impl GetWorkstationConfig {
719 pub(crate) fn new(
720 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
721 ) -> Self {
722 Self(RequestBuilder::new(stub))
723 }
724
725 pub fn with_request<V: Into<crate::model::GetWorkstationConfigRequest>>(
727 mut self,
728 v: V,
729 ) -> Self {
730 self.0.request = v.into();
731 self
732 }
733
734 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
736 self.0.options = v.into();
737 self
738 }
739
740 pub async fn send(self) -> Result<crate::model::WorkstationConfig> {
742 (*self.0.stub)
743 .get_workstation_config(self.0.request, self.0.options)
744 .await
745 .map(crate::Response::into_body)
746 }
747
748 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
752 self.0.request.name = v.into();
753 self
754 }
755 }
756
757 #[doc(hidden)]
758 impl crate::RequestBuilder for GetWorkstationConfig {
759 fn request_options(&mut self) -> &mut crate::RequestOptions {
760 &mut self.0.options
761 }
762 }
763
764 #[derive(Clone, Debug)]
785 pub struct ListWorkstationConfigs(RequestBuilder<crate::model::ListWorkstationConfigsRequest>);
786
787 impl ListWorkstationConfigs {
788 pub(crate) fn new(
789 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
790 ) -> Self {
791 Self(RequestBuilder::new(stub))
792 }
793
794 pub fn with_request<V: Into<crate::model::ListWorkstationConfigsRequest>>(
796 mut self,
797 v: V,
798 ) -> Self {
799 self.0.request = v.into();
800 self
801 }
802
803 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
805 self.0.options = v.into();
806 self
807 }
808
809 pub async fn send(self) -> Result<crate::model::ListWorkstationConfigsResponse> {
811 (*self.0.stub)
812 .list_workstation_configs(self.0.request, self.0.options)
813 .await
814 .map(crate::Response::into_body)
815 }
816
817 pub fn by_page(
819 self,
820 ) -> impl google_cloud_gax::paginator::Paginator<
821 crate::model::ListWorkstationConfigsResponse,
822 crate::Error,
823 > {
824 use std::clone::Clone;
825 let token = self.0.request.page_token.clone();
826 let execute = move |token: String| {
827 let mut builder = self.clone();
828 builder.0.request = builder.0.request.set_page_token(token);
829 builder.send()
830 };
831 google_cloud_gax::paginator::internal::new_paginator(token, execute)
832 }
833
834 pub fn by_item(
836 self,
837 ) -> impl google_cloud_gax::paginator::ItemPaginator<
838 crate::model::ListWorkstationConfigsResponse,
839 crate::Error,
840 > {
841 use google_cloud_gax::paginator::Paginator;
842 self.by_page().items()
843 }
844
845 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
849 self.0.request.parent = v.into();
850 self
851 }
852
853 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
855 self.0.request.page_size = v.into();
856 self
857 }
858
859 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
861 self.0.request.page_token = v.into();
862 self
863 }
864 }
865
866 #[doc(hidden)]
867 impl crate::RequestBuilder for ListWorkstationConfigs {
868 fn request_options(&mut self) -> &mut crate::RequestOptions {
869 &mut self.0.options
870 }
871 }
872
873 #[derive(Clone, Debug)]
894 pub struct ListUsableWorkstationConfigs(
895 RequestBuilder<crate::model::ListUsableWorkstationConfigsRequest>,
896 );
897
898 impl ListUsableWorkstationConfigs {
899 pub(crate) fn new(
900 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
901 ) -> Self {
902 Self(RequestBuilder::new(stub))
903 }
904
905 pub fn with_request<V: Into<crate::model::ListUsableWorkstationConfigsRequest>>(
907 mut self,
908 v: V,
909 ) -> Self {
910 self.0.request = v.into();
911 self
912 }
913
914 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
916 self.0.options = v.into();
917 self
918 }
919
920 pub async fn send(self) -> Result<crate::model::ListUsableWorkstationConfigsResponse> {
922 (*self.0.stub)
923 .list_usable_workstation_configs(self.0.request, self.0.options)
924 .await
925 .map(crate::Response::into_body)
926 }
927
928 pub fn by_page(
930 self,
931 ) -> impl google_cloud_gax::paginator::Paginator<
932 crate::model::ListUsableWorkstationConfigsResponse,
933 crate::Error,
934 > {
935 use std::clone::Clone;
936 let token = self.0.request.page_token.clone();
937 let execute = move |token: String| {
938 let mut builder = self.clone();
939 builder.0.request = builder.0.request.set_page_token(token);
940 builder.send()
941 };
942 google_cloud_gax::paginator::internal::new_paginator(token, execute)
943 }
944
945 pub fn by_item(
947 self,
948 ) -> impl google_cloud_gax::paginator::ItemPaginator<
949 crate::model::ListUsableWorkstationConfigsResponse,
950 crate::Error,
951 > {
952 use google_cloud_gax::paginator::Paginator;
953 self.by_page().items()
954 }
955
956 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
960 self.0.request.parent = v.into();
961 self
962 }
963
964 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
966 self.0.request.page_size = v.into();
967 self
968 }
969
970 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
972 self.0.request.page_token = v.into();
973 self
974 }
975 }
976
977 #[doc(hidden)]
978 impl crate::RequestBuilder for ListUsableWorkstationConfigs {
979 fn request_options(&mut self) -> &mut crate::RequestOptions {
980 &mut self.0.options
981 }
982 }
983
984 #[derive(Clone, Debug)]
1002 pub struct CreateWorkstationConfig(
1003 RequestBuilder<crate::model::CreateWorkstationConfigRequest>,
1004 );
1005
1006 impl CreateWorkstationConfig {
1007 pub(crate) fn new(
1008 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1009 ) -> Self {
1010 Self(RequestBuilder::new(stub))
1011 }
1012
1013 pub fn with_request<V: Into<crate::model::CreateWorkstationConfigRequest>>(
1015 mut self,
1016 v: V,
1017 ) -> Self {
1018 self.0.request = v.into();
1019 self
1020 }
1021
1022 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1024 self.0.options = v.into();
1025 self
1026 }
1027
1028 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1035 (*self.0.stub)
1036 .create_workstation_config(self.0.request, self.0.options)
1037 .await
1038 .map(crate::Response::into_body)
1039 }
1040
1041 pub fn poller(
1043 self,
1044 ) -> impl google_cloud_lro::Poller<
1045 crate::model::WorkstationConfig,
1046 crate::model::OperationMetadata,
1047 > {
1048 type Operation = google_cloud_lro::internal::Operation<
1049 crate::model::WorkstationConfig,
1050 crate::model::OperationMetadata,
1051 >;
1052 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1053 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1054
1055 let stub = self.0.stub.clone();
1056 let mut options = self.0.options.clone();
1057 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1058 let query = move |name| {
1059 let stub = stub.clone();
1060 let options = options.clone();
1061 async {
1062 let op = GetOperation::new(stub)
1063 .set_name(name)
1064 .with_options(options)
1065 .send()
1066 .await?;
1067 Ok(Operation::new(op))
1068 }
1069 };
1070
1071 let start = move || async {
1072 let op = self.send().await?;
1073 Ok(Operation::new(op))
1074 };
1075
1076 google_cloud_lro::internal::new_poller(
1077 polling_error_policy,
1078 polling_backoff_policy,
1079 start,
1080 query,
1081 )
1082 }
1083
1084 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1088 self.0.request.parent = v.into();
1089 self
1090 }
1091
1092 pub fn set_workstation_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1096 self.0.request.workstation_config_id = v.into();
1097 self
1098 }
1099
1100 pub fn set_workstation_config<T>(mut self, v: T) -> Self
1104 where
1105 T: std::convert::Into<crate::model::WorkstationConfig>,
1106 {
1107 self.0.request.workstation_config = std::option::Option::Some(v.into());
1108 self
1109 }
1110
1111 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
1115 where
1116 T: std::convert::Into<crate::model::WorkstationConfig>,
1117 {
1118 self.0.request.workstation_config = v.map(|x| x.into());
1119 self
1120 }
1121
1122 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1124 self.0.request.validate_only = v.into();
1125 self
1126 }
1127 }
1128
1129 #[doc(hidden)]
1130 impl crate::RequestBuilder for CreateWorkstationConfig {
1131 fn request_options(&mut self) -> &mut crate::RequestOptions {
1132 &mut self.0.options
1133 }
1134 }
1135
1136 #[derive(Clone, Debug)]
1154 pub struct UpdateWorkstationConfig(
1155 RequestBuilder<crate::model::UpdateWorkstationConfigRequest>,
1156 );
1157
1158 impl UpdateWorkstationConfig {
1159 pub(crate) fn new(
1160 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1161 ) -> Self {
1162 Self(RequestBuilder::new(stub))
1163 }
1164
1165 pub fn with_request<V: Into<crate::model::UpdateWorkstationConfigRequest>>(
1167 mut self,
1168 v: V,
1169 ) -> Self {
1170 self.0.request = v.into();
1171 self
1172 }
1173
1174 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1176 self.0.options = v.into();
1177 self
1178 }
1179
1180 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1187 (*self.0.stub)
1188 .update_workstation_config(self.0.request, self.0.options)
1189 .await
1190 .map(crate::Response::into_body)
1191 }
1192
1193 pub fn poller(
1195 self,
1196 ) -> impl google_cloud_lro::Poller<
1197 crate::model::WorkstationConfig,
1198 crate::model::OperationMetadata,
1199 > {
1200 type Operation = google_cloud_lro::internal::Operation<
1201 crate::model::WorkstationConfig,
1202 crate::model::OperationMetadata,
1203 >;
1204 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1205 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1206
1207 let stub = self.0.stub.clone();
1208 let mut options = self.0.options.clone();
1209 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1210 let query = move |name| {
1211 let stub = stub.clone();
1212 let options = options.clone();
1213 async {
1214 let op = GetOperation::new(stub)
1215 .set_name(name)
1216 .with_options(options)
1217 .send()
1218 .await?;
1219 Ok(Operation::new(op))
1220 }
1221 };
1222
1223 let start = move || async {
1224 let op = self.send().await?;
1225 Ok(Operation::new(op))
1226 };
1227
1228 google_cloud_lro::internal::new_poller(
1229 polling_error_policy,
1230 polling_backoff_policy,
1231 start,
1232 query,
1233 )
1234 }
1235
1236 pub fn set_workstation_config<T>(mut self, v: T) -> Self
1240 where
1241 T: std::convert::Into<crate::model::WorkstationConfig>,
1242 {
1243 self.0.request.workstation_config = std::option::Option::Some(v.into());
1244 self
1245 }
1246
1247 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
1251 where
1252 T: std::convert::Into<crate::model::WorkstationConfig>,
1253 {
1254 self.0.request.workstation_config = v.map(|x| x.into());
1255 self
1256 }
1257
1258 pub fn set_update_mask<T>(mut self, v: T) -> Self
1262 where
1263 T: std::convert::Into<wkt::FieldMask>,
1264 {
1265 self.0.request.update_mask = std::option::Option::Some(v.into());
1266 self
1267 }
1268
1269 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1273 where
1274 T: std::convert::Into<wkt::FieldMask>,
1275 {
1276 self.0.request.update_mask = v.map(|x| x.into());
1277 self
1278 }
1279
1280 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1282 self.0.request.validate_only = v.into();
1283 self
1284 }
1285
1286 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1288 self.0.request.allow_missing = v.into();
1289 self
1290 }
1291 }
1292
1293 #[doc(hidden)]
1294 impl crate::RequestBuilder for UpdateWorkstationConfig {
1295 fn request_options(&mut self) -> &mut crate::RequestOptions {
1296 &mut self.0.options
1297 }
1298 }
1299
1300 #[derive(Clone, Debug)]
1318 pub struct DeleteWorkstationConfig(
1319 RequestBuilder<crate::model::DeleteWorkstationConfigRequest>,
1320 );
1321
1322 impl DeleteWorkstationConfig {
1323 pub(crate) fn new(
1324 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1325 ) -> Self {
1326 Self(RequestBuilder::new(stub))
1327 }
1328
1329 pub fn with_request<V: Into<crate::model::DeleteWorkstationConfigRequest>>(
1331 mut self,
1332 v: V,
1333 ) -> Self {
1334 self.0.request = v.into();
1335 self
1336 }
1337
1338 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1340 self.0.options = v.into();
1341 self
1342 }
1343
1344 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1351 (*self.0.stub)
1352 .delete_workstation_config(self.0.request, self.0.options)
1353 .await
1354 .map(crate::Response::into_body)
1355 }
1356
1357 pub fn poller(
1359 self,
1360 ) -> impl google_cloud_lro::Poller<
1361 crate::model::WorkstationConfig,
1362 crate::model::OperationMetadata,
1363 > {
1364 type Operation = google_cloud_lro::internal::Operation<
1365 crate::model::WorkstationConfig,
1366 crate::model::OperationMetadata,
1367 >;
1368 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1369 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1370
1371 let stub = self.0.stub.clone();
1372 let mut options = self.0.options.clone();
1373 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1374 let query = move |name| {
1375 let stub = stub.clone();
1376 let options = options.clone();
1377 async {
1378 let op = GetOperation::new(stub)
1379 .set_name(name)
1380 .with_options(options)
1381 .send()
1382 .await?;
1383 Ok(Operation::new(op))
1384 }
1385 };
1386
1387 let start = move || async {
1388 let op = self.send().await?;
1389 Ok(Operation::new(op))
1390 };
1391
1392 google_cloud_lro::internal::new_poller(
1393 polling_error_policy,
1394 polling_backoff_policy,
1395 start,
1396 query,
1397 )
1398 }
1399
1400 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1404 self.0.request.name = v.into();
1405 self
1406 }
1407
1408 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1410 self.0.request.validate_only = v.into();
1411 self
1412 }
1413
1414 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1416 self.0.request.etag = v.into();
1417 self
1418 }
1419
1420 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1422 self.0.request.force = v.into();
1423 self
1424 }
1425 }
1426
1427 #[doc(hidden)]
1428 impl crate::RequestBuilder for DeleteWorkstationConfig {
1429 fn request_options(&mut self) -> &mut crate::RequestOptions {
1430 &mut self.0.options
1431 }
1432 }
1433
1434 #[derive(Clone, Debug)]
1451 pub struct GetWorkstation(RequestBuilder<crate::model::GetWorkstationRequest>);
1452
1453 impl GetWorkstation {
1454 pub(crate) fn new(
1455 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1456 ) -> Self {
1457 Self(RequestBuilder::new(stub))
1458 }
1459
1460 pub fn with_request<V: Into<crate::model::GetWorkstationRequest>>(mut self, v: V) -> Self {
1462 self.0.request = v.into();
1463 self
1464 }
1465
1466 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1468 self.0.options = v.into();
1469 self
1470 }
1471
1472 pub async fn send(self) -> Result<crate::model::Workstation> {
1474 (*self.0.stub)
1475 .get_workstation(self.0.request, self.0.options)
1476 .await
1477 .map(crate::Response::into_body)
1478 }
1479
1480 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1484 self.0.request.name = v.into();
1485 self
1486 }
1487 }
1488
1489 #[doc(hidden)]
1490 impl crate::RequestBuilder for GetWorkstation {
1491 fn request_options(&mut self) -> &mut crate::RequestOptions {
1492 &mut self.0.options
1493 }
1494 }
1495
1496 #[derive(Clone, Debug)]
1517 pub struct ListWorkstations(RequestBuilder<crate::model::ListWorkstationsRequest>);
1518
1519 impl ListWorkstations {
1520 pub(crate) fn new(
1521 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1522 ) -> Self {
1523 Self(RequestBuilder::new(stub))
1524 }
1525
1526 pub fn with_request<V: Into<crate::model::ListWorkstationsRequest>>(
1528 mut self,
1529 v: V,
1530 ) -> Self {
1531 self.0.request = v.into();
1532 self
1533 }
1534
1535 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1537 self.0.options = v.into();
1538 self
1539 }
1540
1541 pub async fn send(self) -> Result<crate::model::ListWorkstationsResponse> {
1543 (*self.0.stub)
1544 .list_workstations(self.0.request, self.0.options)
1545 .await
1546 .map(crate::Response::into_body)
1547 }
1548
1549 pub fn by_page(
1551 self,
1552 ) -> impl google_cloud_gax::paginator::Paginator<
1553 crate::model::ListWorkstationsResponse,
1554 crate::Error,
1555 > {
1556 use std::clone::Clone;
1557 let token = self.0.request.page_token.clone();
1558 let execute = move |token: String| {
1559 let mut builder = self.clone();
1560 builder.0.request = builder.0.request.set_page_token(token);
1561 builder.send()
1562 };
1563 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1564 }
1565
1566 pub fn by_item(
1568 self,
1569 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1570 crate::model::ListWorkstationsResponse,
1571 crate::Error,
1572 > {
1573 use google_cloud_gax::paginator::Paginator;
1574 self.by_page().items()
1575 }
1576
1577 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1581 self.0.request.parent = v.into();
1582 self
1583 }
1584
1585 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1587 self.0.request.page_size = v.into();
1588 self
1589 }
1590
1591 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1593 self.0.request.page_token = v.into();
1594 self
1595 }
1596 }
1597
1598 #[doc(hidden)]
1599 impl crate::RequestBuilder for ListWorkstations {
1600 fn request_options(&mut self) -> &mut crate::RequestOptions {
1601 &mut self.0.options
1602 }
1603 }
1604
1605 #[derive(Clone, Debug)]
1626 pub struct ListUsableWorkstations(RequestBuilder<crate::model::ListUsableWorkstationsRequest>);
1627
1628 impl ListUsableWorkstations {
1629 pub(crate) fn new(
1630 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1631 ) -> Self {
1632 Self(RequestBuilder::new(stub))
1633 }
1634
1635 pub fn with_request<V: Into<crate::model::ListUsableWorkstationsRequest>>(
1637 mut self,
1638 v: V,
1639 ) -> Self {
1640 self.0.request = v.into();
1641 self
1642 }
1643
1644 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1646 self.0.options = v.into();
1647 self
1648 }
1649
1650 pub async fn send(self) -> Result<crate::model::ListUsableWorkstationsResponse> {
1652 (*self.0.stub)
1653 .list_usable_workstations(self.0.request, self.0.options)
1654 .await
1655 .map(crate::Response::into_body)
1656 }
1657
1658 pub fn by_page(
1660 self,
1661 ) -> impl google_cloud_gax::paginator::Paginator<
1662 crate::model::ListUsableWorkstationsResponse,
1663 crate::Error,
1664 > {
1665 use std::clone::Clone;
1666 let token = self.0.request.page_token.clone();
1667 let execute = move |token: String| {
1668 let mut builder = self.clone();
1669 builder.0.request = builder.0.request.set_page_token(token);
1670 builder.send()
1671 };
1672 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1673 }
1674
1675 pub fn by_item(
1677 self,
1678 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1679 crate::model::ListUsableWorkstationsResponse,
1680 crate::Error,
1681 > {
1682 use google_cloud_gax::paginator::Paginator;
1683 self.by_page().items()
1684 }
1685
1686 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1690 self.0.request.parent = v.into();
1691 self
1692 }
1693
1694 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1696 self.0.request.page_size = v.into();
1697 self
1698 }
1699
1700 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1702 self.0.request.page_token = v.into();
1703 self
1704 }
1705 }
1706
1707 #[doc(hidden)]
1708 impl crate::RequestBuilder for ListUsableWorkstations {
1709 fn request_options(&mut self) -> &mut crate::RequestOptions {
1710 &mut self.0.options
1711 }
1712 }
1713
1714 #[derive(Clone, Debug)]
1732 pub struct CreateWorkstation(RequestBuilder<crate::model::CreateWorkstationRequest>);
1733
1734 impl CreateWorkstation {
1735 pub(crate) fn new(
1736 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1737 ) -> Self {
1738 Self(RequestBuilder::new(stub))
1739 }
1740
1741 pub fn with_request<V: Into<crate::model::CreateWorkstationRequest>>(
1743 mut self,
1744 v: V,
1745 ) -> Self {
1746 self.0.request = v.into();
1747 self
1748 }
1749
1750 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1752 self.0.options = v.into();
1753 self
1754 }
1755
1756 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1763 (*self.0.stub)
1764 .create_workstation(self.0.request, self.0.options)
1765 .await
1766 .map(crate::Response::into_body)
1767 }
1768
1769 pub fn poller(
1771 self,
1772 ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
1773 {
1774 type Operation = google_cloud_lro::internal::Operation<
1775 crate::model::Workstation,
1776 crate::model::OperationMetadata,
1777 >;
1778 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1779 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1780
1781 let stub = self.0.stub.clone();
1782 let mut options = self.0.options.clone();
1783 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1784 let query = move |name| {
1785 let stub = stub.clone();
1786 let options = options.clone();
1787 async {
1788 let op = GetOperation::new(stub)
1789 .set_name(name)
1790 .with_options(options)
1791 .send()
1792 .await?;
1793 Ok(Operation::new(op))
1794 }
1795 };
1796
1797 let start = move || async {
1798 let op = self.send().await?;
1799 Ok(Operation::new(op))
1800 };
1801
1802 google_cloud_lro::internal::new_poller(
1803 polling_error_policy,
1804 polling_backoff_policy,
1805 start,
1806 query,
1807 )
1808 }
1809
1810 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1814 self.0.request.parent = v.into();
1815 self
1816 }
1817
1818 pub fn set_workstation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1822 self.0.request.workstation_id = v.into();
1823 self
1824 }
1825
1826 pub fn set_workstation<T>(mut self, v: T) -> Self
1830 where
1831 T: std::convert::Into<crate::model::Workstation>,
1832 {
1833 self.0.request.workstation = std::option::Option::Some(v.into());
1834 self
1835 }
1836
1837 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
1841 where
1842 T: std::convert::Into<crate::model::Workstation>,
1843 {
1844 self.0.request.workstation = v.map(|x| x.into());
1845 self
1846 }
1847
1848 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1850 self.0.request.validate_only = v.into();
1851 self
1852 }
1853 }
1854
1855 #[doc(hidden)]
1856 impl crate::RequestBuilder for CreateWorkstation {
1857 fn request_options(&mut self) -> &mut crate::RequestOptions {
1858 &mut self.0.options
1859 }
1860 }
1861
1862 #[derive(Clone, Debug)]
1880 pub struct UpdateWorkstation(RequestBuilder<crate::model::UpdateWorkstationRequest>);
1881
1882 impl UpdateWorkstation {
1883 pub(crate) fn new(
1884 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1885 ) -> Self {
1886 Self(RequestBuilder::new(stub))
1887 }
1888
1889 pub fn with_request<V: Into<crate::model::UpdateWorkstationRequest>>(
1891 mut self,
1892 v: V,
1893 ) -> Self {
1894 self.0.request = v.into();
1895 self
1896 }
1897
1898 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1900 self.0.options = v.into();
1901 self
1902 }
1903
1904 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1911 (*self.0.stub)
1912 .update_workstation(self.0.request, self.0.options)
1913 .await
1914 .map(crate::Response::into_body)
1915 }
1916
1917 pub fn poller(
1919 self,
1920 ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
1921 {
1922 type Operation = google_cloud_lro::internal::Operation<
1923 crate::model::Workstation,
1924 crate::model::OperationMetadata,
1925 >;
1926 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1927 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1928
1929 let stub = self.0.stub.clone();
1930 let mut options = self.0.options.clone();
1931 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1932 let query = move |name| {
1933 let stub = stub.clone();
1934 let options = options.clone();
1935 async {
1936 let op = GetOperation::new(stub)
1937 .set_name(name)
1938 .with_options(options)
1939 .send()
1940 .await?;
1941 Ok(Operation::new(op))
1942 }
1943 };
1944
1945 let start = move || async {
1946 let op = self.send().await?;
1947 Ok(Operation::new(op))
1948 };
1949
1950 google_cloud_lro::internal::new_poller(
1951 polling_error_policy,
1952 polling_backoff_policy,
1953 start,
1954 query,
1955 )
1956 }
1957
1958 pub fn set_workstation<T>(mut self, v: T) -> Self
1962 where
1963 T: std::convert::Into<crate::model::Workstation>,
1964 {
1965 self.0.request.workstation = std::option::Option::Some(v.into());
1966 self
1967 }
1968
1969 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
1973 where
1974 T: std::convert::Into<crate::model::Workstation>,
1975 {
1976 self.0.request.workstation = v.map(|x| x.into());
1977 self
1978 }
1979
1980 pub fn set_update_mask<T>(mut self, v: T) -> Self
1984 where
1985 T: std::convert::Into<wkt::FieldMask>,
1986 {
1987 self.0.request.update_mask = std::option::Option::Some(v.into());
1988 self
1989 }
1990
1991 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1995 where
1996 T: std::convert::Into<wkt::FieldMask>,
1997 {
1998 self.0.request.update_mask = v.map(|x| x.into());
1999 self
2000 }
2001
2002 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2004 self.0.request.validate_only = v.into();
2005 self
2006 }
2007
2008 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2010 self.0.request.allow_missing = v.into();
2011 self
2012 }
2013 }
2014
2015 #[doc(hidden)]
2016 impl crate::RequestBuilder for UpdateWorkstation {
2017 fn request_options(&mut self) -> &mut crate::RequestOptions {
2018 &mut self.0.options
2019 }
2020 }
2021
2022 #[derive(Clone, Debug)]
2040 pub struct DeleteWorkstation(RequestBuilder<crate::model::DeleteWorkstationRequest>);
2041
2042 impl DeleteWorkstation {
2043 pub(crate) fn new(
2044 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2045 ) -> Self {
2046 Self(RequestBuilder::new(stub))
2047 }
2048
2049 pub fn with_request<V: Into<crate::model::DeleteWorkstationRequest>>(
2051 mut self,
2052 v: V,
2053 ) -> Self {
2054 self.0.request = v.into();
2055 self
2056 }
2057
2058 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2060 self.0.options = v.into();
2061 self
2062 }
2063
2064 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2071 (*self.0.stub)
2072 .delete_workstation(self.0.request, self.0.options)
2073 .await
2074 .map(crate::Response::into_body)
2075 }
2076
2077 pub fn poller(
2079 self,
2080 ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
2081 {
2082 type Operation = google_cloud_lro::internal::Operation<
2083 crate::model::Workstation,
2084 crate::model::OperationMetadata,
2085 >;
2086 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2087 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2088
2089 let stub = self.0.stub.clone();
2090 let mut options = self.0.options.clone();
2091 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2092 let query = move |name| {
2093 let stub = stub.clone();
2094 let options = options.clone();
2095 async {
2096 let op = GetOperation::new(stub)
2097 .set_name(name)
2098 .with_options(options)
2099 .send()
2100 .await?;
2101 Ok(Operation::new(op))
2102 }
2103 };
2104
2105 let start = move || async {
2106 let op = self.send().await?;
2107 Ok(Operation::new(op))
2108 };
2109
2110 google_cloud_lro::internal::new_poller(
2111 polling_error_policy,
2112 polling_backoff_policy,
2113 start,
2114 query,
2115 )
2116 }
2117
2118 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2122 self.0.request.name = v.into();
2123 self
2124 }
2125
2126 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2128 self.0.request.validate_only = v.into();
2129 self
2130 }
2131
2132 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2134 self.0.request.etag = v.into();
2135 self
2136 }
2137 }
2138
2139 #[doc(hidden)]
2140 impl crate::RequestBuilder for DeleteWorkstation {
2141 fn request_options(&mut self) -> &mut crate::RequestOptions {
2142 &mut self.0.options
2143 }
2144 }
2145
2146 #[derive(Clone, Debug)]
2164 pub struct StartWorkstation(RequestBuilder<crate::model::StartWorkstationRequest>);
2165
2166 impl StartWorkstation {
2167 pub(crate) fn new(
2168 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2169 ) -> Self {
2170 Self(RequestBuilder::new(stub))
2171 }
2172
2173 pub fn with_request<V: Into<crate::model::StartWorkstationRequest>>(
2175 mut self,
2176 v: V,
2177 ) -> Self {
2178 self.0.request = v.into();
2179 self
2180 }
2181
2182 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2184 self.0.options = v.into();
2185 self
2186 }
2187
2188 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2195 (*self.0.stub)
2196 .start_workstation(self.0.request, self.0.options)
2197 .await
2198 .map(crate::Response::into_body)
2199 }
2200
2201 pub fn poller(
2203 self,
2204 ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
2205 {
2206 type Operation = google_cloud_lro::internal::Operation<
2207 crate::model::Workstation,
2208 crate::model::OperationMetadata,
2209 >;
2210 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2211 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2212
2213 let stub = self.0.stub.clone();
2214 let mut options = self.0.options.clone();
2215 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2216 let query = move |name| {
2217 let stub = stub.clone();
2218 let options = options.clone();
2219 async {
2220 let op = GetOperation::new(stub)
2221 .set_name(name)
2222 .with_options(options)
2223 .send()
2224 .await?;
2225 Ok(Operation::new(op))
2226 }
2227 };
2228
2229 let start = move || async {
2230 let op = self.send().await?;
2231 Ok(Operation::new(op))
2232 };
2233
2234 google_cloud_lro::internal::new_poller(
2235 polling_error_policy,
2236 polling_backoff_policy,
2237 start,
2238 query,
2239 )
2240 }
2241
2242 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2246 self.0.request.name = v.into();
2247 self
2248 }
2249
2250 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2252 self.0.request.validate_only = v.into();
2253 self
2254 }
2255
2256 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2258 self.0.request.etag = v.into();
2259 self
2260 }
2261 }
2262
2263 #[doc(hidden)]
2264 impl crate::RequestBuilder for StartWorkstation {
2265 fn request_options(&mut self) -> &mut crate::RequestOptions {
2266 &mut self.0.options
2267 }
2268 }
2269
2270 #[derive(Clone, Debug)]
2288 pub struct StopWorkstation(RequestBuilder<crate::model::StopWorkstationRequest>);
2289
2290 impl StopWorkstation {
2291 pub(crate) fn new(
2292 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2293 ) -> Self {
2294 Self(RequestBuilder::new(stub))
2295 }
2296
2297 pub fn with_request<V: Into<crate::model::StopWorkstationRequest>>(mut self, v: V) -> Self {
2299 self.0.request = v.into();
2300 self
2301 }
2302
2303 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2305 self.0.options = v.into();
2306 self
2307 }
2308
2309 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2316 (*self.0.stub)
2317 .stop_workstation(self.0.request, self.0.options)
2318 .await
2319 .map(crate::Response::into_body)
2320 }
2321
2322 pub fn poller(
2324 self,
2325 ) -> impl google_cloud_lro::Poller<crate::model::Workstation, crate::model::OperationMetadata>
2326 {
2327 type Operation = google_cloud_lro::internal::Operation<
2328 crate::model::Workstation,
2329 crate::model::OperationMetadata,
2330 >;
2331 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2332 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2333
2334 let stub = self.0.stub.clone();
2335 let mut options = self.0.options.clone();
2336 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2337 let query = move |name| {
2338 let stub = stub.clone();
2339 let options = options.clone();
2340 async {
2341 let op = GetOperation::new(stub)
2342 .set_name(name)
2343 .with_options(options)
2344 .send()
2345 .await?;
2346 Ok(Operation::new(op))
2347 }
2348 };
2349
2350 let start = move || async {
2351 let op = self.send().await?;
2352 Ok(Operation::new(op))
2353 };
2354
2355 google_cloud_lro::internal::new_poller(
2356 polling_error_policy,
2357 polling_backoff_policy,
2358 start,
2359 query,
2360 )
2361 }
2362
2363 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2367 self.0.request.name = v.into();
2368 self
2369 }
2370
2371 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2373 self.0.request.validate_only = v.into();
2374 self
2375 }
2376
2377 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2379 self.0.request.etag = v.into();
2380 self
2381 }
2382 }
2383
2384 #[doc(hidden)]
2385 impl crate::RequestBuilder for StopWorkstation {
2386 fn request_options(&mut self) -> &mut crate::RequestOptions {
2387 &mut self.0.options
2388 }
2389 }
2390
2391 #[derive(Clone, Debug)]
2408 pub struct GenerateAccessToken(RequestBuilder<crate::model::GenerateAccessTokenRequest>);
2409
2410 impl GenerateAccessToken {
2411 pub(crate) fn new(
2412 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2413 ) -> Self {
2414 Self(RequestBuilder::new(stub))
2415 }
2416
2417 pub fn with_request<V: Into<crate::model::GenerateAccessTokenRequest>>(
2419 mut self,
2420 v: V,
2421 ) -> Self {
2422 self.0.request = v.into();
2423 self
2424 }
2425
2426 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2428 self.0.options = v.into();
2429 self
2430 }
2431
2432 pub async fn send(self) -> Result<crate::model::GenerateAccessTokenResponse> {
2434 (*self.0.stub)
2435 .generate_access_token(self.0.request, self.0.options)
2436 .await
2437 .map(crate::Response::into_body)
2438 }
2439
2440 pub fn set_workstation<T: Into<std::string::String>>(mut self, v: T) -> Self {
2444 self.0.request.workstation = v.into();
2445 self
2446 }
2447
2448 pub fn set_expiration<
2453 T: Into<Option<crate::model::generate_access_token_request::Expiration>>,
2454 >(
2455 mut self,
2456 v: T,
2457 ) -> Self {
2458 self.0.request.expiration = v.into();
2459 self
2460 }
2461
2462 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2468 mut self,
2469 v: T,
2470 ) -> Self {
2471 self.0.request = self.0.request.set_expire_time(v);
2472 self
2473 }
2474
2475 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
2481 mut self,
2482 v: T,
2483 ) -> Self {
2484 self.0.request = self.0.request.set_ttl(v);
2485 self
2486 }
2487 }
2488
2489 #[doc(hidden)]
2490 impl crate::RequestBuilder for GenerateAccessToken {
2491 fn request_options(&mut self) -> &mut crate::RequestOptions {
2492 &mut self.0.options
2493 }
2494 }
2495
2496 #[derive(Clone, Debug)]
2513 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
2514
2515 impl SetIamPolicy {
2516 pub(crate) fn new(
2517 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2518 ) -> Self {
2519 Self(RequestBuilder::new(stub))
2520 }
2521
2522 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
2524 mut self,
2525 v: V,
2526 ) -> Self {
2527 self.0.request = v.into();
2528 self
2529 }
2530
2531 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2533 self.0.options = v.into();
2534 self
2535 }
2536
2537 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2539 (*self.0.stub)
2540 .set_iam_policy(self.0.request, self.0.options)
2541 .await
2542 .map(crate::Response::into_body)
2543 }
2544
2545 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2549 self.0.request.resource = v.into();
2550 self
2551 }
2552
2553 pub fn set_policy<T>(mut self, v: T) -> Self
2557 where
2558 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2559 {
2560 self.0.request.policy = std::option::Option::Some(v.into());
2561 self
2562 }
2563
2564 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2568 where
2569 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
2570 {
2571 self.0.request.policy = v.map(|x| x.into());
2572 self
2573 }
2574
2575 pub fn set_update_mask<T>(mut self, v: T) -> Self
2577 where
2578 T: std::convert::Into<wkt::FieldMask>,
2579 {
2580 self.0.request.update_mask = std::option::Option::Some(v.into());
2581 self
2582 }
2583
2584 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2586 where
2587 T: std::convert::Into<wkt::FieldMask>,
2588 {
2589 self.0.request.update_mask = v.map(|x| x.into());
2590 self
2591 }
2592 }
2593
2594 #[doc(hidden)]
2595 impl crate::RequestBuilder for SetIamPolicy {
2596 fn request_options(&mut self) -> &mut crate::RequestOptions {
2597 &mut self.0.options
2598 }
2599 }
2600
2601 #[derive(Clone, Debug)]
2618 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
2619
2620 impl GetIamPolicy {
2621 pub(crate) fn new(
2622 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2623 ) -> Self {
2624 Self(RequestBuilder::new(stub))
2625 }
2626
2627 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
2629 mut self,
2630 v: V,
2631 ) -> Self {
2632 self.0.request = v.into();
2633 self
2634 }
2635
2636 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2638 self.0.options = v.into();
2639 self
2640 }
2641
2642 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
2644 (*self.0.stub)
2645 .get_iam_policy(self.0.request, self.0.options)
2646 .await
2647 .map(crate::Response::into_body)
2648 }
2649
2650 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2654 self.0.request.resource = v.into();
2655 self
2656 }
2657
2658 pub fn set_options<T>(mut self, v: T) -> Self
2660 where
2661 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2662 {
2663 self.0.request.options = std::option::Option::Some(v.into());
2664 self
2665 }
2666
2667 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2669 where
2670 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
2671 {
2672 self.0.request.options = v.map(|x| x.into());
2673 self
2674 }
2675 }
2676
2677 #[doc(hidden)]
2678 impl crate::RequestBuilder for GetIamPolicy {
2679 fn request_options(&mut self) -> &mut crate::RequestOptions {
2680 &mut self.0.options
2681 }
2682 }
2683
2684 #[derive(Clone, Debug)]
2701 pub struct TestIamPermissions(
2702 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
2703 );
2704
2705 impl TestIamPermissions {
2706 pub(crate) fn new(
2707 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2708 ) -> Self {
2709 Self(RequestBuilder::new(stub))
2710 }
2711
2712 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
2714 mut self,
2715 v: V,
2716 ) -> Self {
2717 self.0.request = v.into();
2718 self
2719 }
2720
2721 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2723 self.0.options = v.into();
2724 self
2725 }
2726
2727 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
2729 (*self.0.stub)
2730 .test_iam_permissions(self.0.request, self.0.options)
2731 .await
2732 .map(crate::Response::into_body)
2733 }
2734
2735 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2739 self.0.request.resource = v.into();
2740 self
2741 }
2742
2743 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2747 where
2748 T: std::iter::IntoIterator<Item = V>,
2749 V: std::convert::Into<std::string::String>,
2750 {
2751 use std::iter::Iterator;
2752 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2753 self
2754 }
2755 }
2756
2757 #[doc(hidden)]
2758 impl crate::RequestBuilder for TestIamPermissions {
2759 fn request_options(&mut self) -> &mut crate::RequestOptions {
2760 &mut self.0.options
2761 }
2762 }
2763
2764 #[derive(Clone, Debug)]
2785 pub struct ListOperations(
2786 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2787 );
2788
2789 impl ListOperations {
2790 pub(crate) fn new(
2791 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2792 ) -> Self {
2793 Self(RequestBuilder::new(stub))
2794 }
2795
2796 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2798 mut self,
2799 v: V,
2800 ) -> Self {
2801 self.0.request = v.into();
2802 self
2803 }
2804
2805 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2807 self.0.options = v.into();
2808 self
2809 }
2810
2811 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2813 (*self.0.stub)
2814 .list_operations(self.0.request, self.0.options)
2815 .await
2816 .map(crate::Response::into_body)
2817 }
2818
2819 pub fn by_page(
2821 self,
2822 ) -> impl google_cloud_gax::paginator::Paginator<
2823 google_cloud_longrunning::model::ListOperationsResponse,
2824 crate::Error,
2825 > {
2826 use std::clone::Clone;
2827 let token = self.0.request.page_token.clone();
2828 let execute = move |token: String| {
2829 let mut builder = self.clone();
2830 builder.0.request = builder.0.request.set_page_token(token);
2831 builder.send()
2832 };
2833 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2834 }
2835
2836 pub fn by_item(
2838 self,
2839 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2840 google_cloud_longrunning::model::ListOperationsResponse,
2841 crate::Error,
2842 > {
2843 use google_cloud_gax::paginator::Paginator;
2844 self.by_page().items()
2845 }
2846
2847 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2849 self.0.request.name = v.into();
2850 self
2851 }
2852
2853 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2855 self.0.request.filter = v.into();
2856 self
2857 }
2858
2859 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2861 self.0.request.page_size = v.into();
2862 self
2863 }
2864
2865 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2867 self.0.request.page_token = v.into();
2868 self
2869 }
2870
2871 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2873 self.0.request.return_partial_success = v.into();
2874 self
2875 }
2876 }
2877
2878 #[doc(hidden)]
2879 impl crate::RequestBuilder for ListOperations {
2880 fn request_options(&mut self) -> &mut crate::RequestOptions {
2881 &mut self.0.options
2882 }
2883 }
2884
2885 #[derive(Clone, Debug)]
2902 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2903
2904 impl GetOperation {
2905 pub(crate) fn new(
2906 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2907 ) -> Self {
2908 Self(RequestBuilder::new(stub))
2909 }
2910
2911 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2913 mut self,
2914 v: V,
2915 ) -> Self {
2916 self.0.request = v.into();
2917 self
2918 }
2919
2920 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2922 self.0.options = v.into();
2923 self
2924 }
2925
2926 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2928 (*self.0.stub)
2929 .get_operation(self.0.request, self.0.options)
2930 .await
2931 .map(crate::Response::into_body)
2932 }
2933
2934 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2936 self.0.request.name = v.into();
2937 self
2938 }
2939 }
2940
2941 #[doc(hidden)]
2942 impl crate::RequestBuilder for GetOperation {
2943 fn request_options(&mut self) -> &mut crate::RequestOptions {
2944 &mut self.0.options
2945 }
2946 }
2947
2948 #[derive(Clone, Debug)]
2965 pub struct DeleteOperation(
2966 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2967 );
2968
2969 impl DeleteOperation {
2970 pub(crate) fn new(
2971 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2972 ) -> Self {
2973 Self(RequestBuilder::new(stub))
2974 }
2975
2976 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2978 mut self,
2979 v: V,
2980 ) -> Self {
2981 self.0.request = v.into();
2982 self
2983 }
2984
2985 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2987 self.0.options = v.into();
2988 self
2989 }
2990
2991 pub async fn send(self) -> Result<()> {
2993 (*self.0.stub)
2994 .delete_operation(self.0.request, self.0.options)
2995 .await
2996 .map(crate::Response::into_body)
2997 }
2998
2999 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3001 self.0.request.name = v.into();
3002 self
3003 }
3004 }
3005
3006 #[doc(hidden)]
3007 impl crate::RequestBuilder for DeleteOperation {
3008 fn request_options(&mut self) -> &mut crate::RequestOptions {
3009 &mut self.0.options
3010 }
3011 }
3012
3013 #[derive(Clone, Debug)]
3030 pub struct CancelOperation(
3031 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3032 );
3033
3034 impl CancelOperation {
3035 pub(crate) fn new(
3036 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
3037 ) -> Self {
3038 Self(RequestBuilder::new(stub))
3039 }
3040
3041 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3043 mut self,
3044 v: V,
3045 ) -> Self {
3046 self.0.request = v.into();
3047 self
3048 }
3049
3050 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3052 self.0.options = v.into();
3053 self
3054 }
3055
3056 pub async fn send(self) -> Result<()> {
3058 (*self.0.stub)
3059 .cancel_operation(self.0.request, self.0.options)
3060 .await
3061 .map(crate::Response::into_body)
3062 }
3063
3064 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3066 self.0.request.name = v.into();
3067 self
3068 }
3069 }
3070
3071 #[doc(hidden)]
3072 impl crate::RequestBuilder for CancelOperation {
3073 fn request_options(&mut self) -> &mut crate::RequestOptions {
3074 &mut self.0.options
3075 }
3076 }
3077}