1pub mod workstations {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::Workstations;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = Workstations;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
91 pub struct GetWorkstationCluster(RequestBuilder<crate::model::GetWorkstationClusterRequest>);
92
93 impl GetWorkstationCluster {
94 pub(crate) fn new(
95 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
96 ) -> Self {
97 Self(RequestBuilder::new(stub))
98 }
99
100 pub fn with_request<V: Into<crate::model::GetWorkstationClusterRequest>>(
102 mut self,
103 v: V,
104 ) -> Self {
105 self.0.request = v.into();
106 self
107 }
108
109 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 pub async fn send(self) -> Result<crate::model::WorkstationCluster> {
117 (*self.0.stub)
118 .get_workstation_cluster(self.0.request, self.0.options)
119 .await
120 .map(gax::response::Response::into_body)
121 }
122
123 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
127 self.0.request.name = v.into();
128 self
129 }
130 }
131
132 #[doc(hidden)]
133 impl gax::options::internal::RequestBuilder for GetWorkstationCluster {
134 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
135 &mut self.0.options
136 }
137 }
138
139 #[derive(Clone, Debug)]
160 pub struct ListWorkstationClusters(
161 RequestBuilder<crate::model::ListWorkstationClustersRequest>,
162 );
163
164 impl ListWorkstationClusters {
165 pub(crate) fn new(
166 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
167 ) -> Self {
168 Self(RequestBuilder::new(stub))
169 }
170
171 pub fn with_request<V: Into<crate::model::ListWorkstationClustersRequest>>(
173 mut self,
174 v: V,
175 ) -> Self {
176 self.0.request = v.into();
177 self
178 }
179
180 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
182 self.0.options = v.into();
183 self
184 }
185
186 pub async fn send(self) -> Result<crate::model::ListWorkstationClustersResponse> {
188 (*self.0.stub)
189 .list_workstation_clusters(self.0.request, self.0.options)
190 .await
191 .map(gax::response::Response::into_body)
192 }
193
194 pub fn by_page(
196 self,
197 ) -> impl gax::paginator::Paginator<
198 crate::model::ListWorkstationClustersResponse,
199 gax::error::Error,
200 > {
201 use std::clone::Clone;
202 let token = self.0.request.page_token.clone();
203 let execute = move |token: String| {
204 let mut builder = self.clone();
205 builder.0.request = builder.0.request.set_page_token(token);
206 builder.send()
207 };
208 gax::paginator::internal::new_paginator(token, execute)
209 }
210
211 pub fn by_item(
213 self,
214 ) -> impl gax::paginator::ItemPaginator<
215 crate::model::ListWorkstationClustersResponse,
216 gax::error::Error,
217 > {
218 use gax::paginator::Paginator;
219 self.by_page().items()
220 }
221
222 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
226 self.0.request.parent = v.into();
227 self
228 }
229
230 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
232 self.0.request.page_size = v.into();
233 self
234 }
235
236 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
238 self.0.request.page_token = v.into();
239 self
240 }
241 }
242
243 #[doc(hidden)]
244 impl gax::options::internal::RequestBuilder for ListWorkstationClusters {
245 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
246 &mut self.0.options
247 }
248 }
249
250 #[derive(Clone, Debug)]
268 pub struct CreateWorkstationCluster(
269 RequestBuilder<crate::model::CreateWorkstationClusterRequest>,
270 );
271
272 impl CreateWorkstationCluster {
273 pub(crate) fn new(
274 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
275 ) -> Self {
276 Self(RequestBuilder::new(stub))
277 }
278
279 pub fn with_request<V: Into<crate::model::CreateWorkstationClusterRequest>>(
281 mut self,
282 v: V,
283 ) -> Self {
284 self.0.request = v.into();
285 self
286 }
287
288 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
290 self.0.options = v.into();
291 self
292 }
293
294 pub async fn send(self) -> Result<longrunning::model::Operation> {
301 (*self.0.stub)
302 .create_workstation_cluster(self.0.request, self.0.options)
303 .await
304 .map(gax::response::Response::into_body)
305 }
306
307 pub fn poller(
309 self,
310 ) -> impl lro::Poller<crate::model::WorkstationCluster, crate::model::OperationMetadata>
311 {
312 type Operation = lro::internal::Operation<
313 crate::model::WorkstationCluster,
314 crate::model::OperationMetadata,
315 >;
316 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
317 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
318
319 let stub = self.0.stub.clone();
320 let mut options = self.0.options.clone();
321 options.set_retry_policy(gax::retry_policy::NeverRetry);
322 let query = move |name| {
323 let stub = stub.clone();
324 let options = options.clone();
325 async {
326 let op = GetOperation::new(stub)
327 .set_name(name)
328 .with_options(options)
329 .send()
330 .await?;
331 Ok(Operation::new(op))
332 }
333 };
334
335 let start = move || async {
336 let op = self.send().await?;
337 Ok(Operation::new(op))
338 };
339
340 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
341 }
342
343 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
347 self.0.request.parent = v.into();
348 self
349 }
350
351 pub fn set_workstation_cluster_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
355 self.0.request.workstation_cluster_id = v.into();
356 self
357 }
358
359 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
363 where
364 T: std::convert::Into<crate::model::WorkstationCluster>,
365 {
366 self.0.request.workstation_cluster = std::option::Option::Some(v.into());
367 self
368 }
369
370 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
374 where
375 T: std::convert::Into<crate::model::WorkstationCluster>,
376 {
377 self.0.request.workstation_cluster = v.map(|x| x.into());
378 self
379 }
380
381 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
383 self.0.request.validate_only = v.into();
384 self
385 }
386 }
387
388 #[doc(hidden)]
389 impl gax::options::internal::RequestBuilder for CreateWorkstationCluster {
390 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
391 &mut self.0.options
392 }
393 }
394
395 #[derive(Clone, Debug)]
413 pub struct UpdateWorkstationCluster(
414 RequestBuilder<crate::model::UpdateWorkstationClusterRequest>,
415 );
416
417 impl UpdateWorkstationCluster {
418 pub(crate) fn new(
419 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
420 ) -> Self {
421 Self(RequestBuilder::new(stub))
422 }
423
424 pub fn with_request<V: Into<crate::model::UpdateWorkstationClusterRequest>>(
426 mut self,
427 v: V,
428 ) -> Self {
429 self.0.request = v.into();
430 self
431 }
432
433 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
435 self.0.options = v.into();
436 self
437 }
438
439 pub async fn send(self) -> Result<longrunning::model::Operation> {
446 (*self.0.stub)
447 .update_workstation_cluster(self.0.request, self.0.options)
448 .await
449 .map(gax::response::Response::into_body)
450 }
451
452 pub fn poller(
454 self,
455 ) -> impl lro::Poller<crate::model::WorkstationCluster, crate::model::OperationMetadata>
456 {
457 type Operation = lro::internal::Operation<
458 crate::model::WorkstationCluster,
459 crate::model::OperationMetadata,
460 >;
461 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
462 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
463
464 let stub = self.0.stub.clone();
465 let mut options = self.0.options.clone();
466 options.set_retry_policy(gax::retry_policy::NeverRetry);
467 let query = move |name| {
468 let stub = stub.clone();
469 let options = options.clone();
470 async {
471 let op = GetOperation::new(stub)
472 .set_name(name)
473 .with_options(options)
474 .send()
475 .await?;
476 Ok(Operation::new(op))
477 }
478 };
479
480 let start = move || async {
481 let op = self.send().await?;
482 Ok(Operation::new(op))
483 };
484
485 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
486 }
487
488 pub fn set_workstation_cluster<T>(mut self, v: T) -> Self
492 where
493 T: std::convert::Into<crate::model::WorkstationCluster>,
494 {
495 self.0.request.workstation_cluster = std::option::Option::Some(v.into());
496 self
497 }
498
499 pub fn set_or_clear_workstation_cluster<T>(mut self, v: std::option::Option<T>) -> Self
503 where
504 T: std::convert::Into<crate::model::WorkstationCluster>,
505 {
506 self.0.request.workstation_cluster = v.map(|x| x.into());
507 self
508 }
509
510 pub fn set_update_mask<T>(mut self, v: T) -> Self
514 where
515 T: std::convert::Into<wkt::FieldMask>,
516 {
517 self.0.request.update_mask = std::option::Option::Some(v.into());
518 self
519 }
520
521 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
525 where
526 T: std::convert::Into<wkt::FieldMask>,
527 {
528 self.0.request.update_mask = v.map(|x| x.into());
529 self
530 }
531
532 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
534 self.0.request.validate_only = v.into();
535 self
536 }
537
538 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
540 self.0.request.allow_missing = v.into();
541 self
542 }
543 }
544
545 #[doc(hidden)]
546 impl gax::options::internal::RequestBuilder for UpdateWorkstationCluster {
547 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
548 &mut self.0.options
549 }
550 }
551
552 #[derive(Clone, Debug)]
570 pub struct DeleteWorkstationCluster(
571 RequestBuilder<crate::model::DeleteWorkstationClusterRequest>,
572 );
573
574 impl DeleteWorkstationCluster {
575 pub(crate) fn new(
576 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
577 ) -> Self {
578 Self(RequestBuilder::new(stub))
579 }
580
581 pub fn with_request<V: Into<crate::model::DeleteWorkstationClusterRequest>>(
583 mut self,
584 v: V,
585 ) -> Self {
586 self.0.request = v.into();
587 self
588 }
589
590 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
592 self.0.options = v.into();
593 self
594 }
595
596 pub async fn send(self) -> Result<longrunning::model::Operation> {
603 (*self.0.stub)
604 .delete_workstation_cluster(self.0.request, self.0.options)
605 .await
606 .map(gax::response::Response::into_body)
607 }
608
609 pub fn poller(
611 self,
612 ) -> impl lro::Poller<crate::model::WorkstationCluster, crate::model::OperationMetadata>
613 {
614 type Operation = lro::internal::Operation<
615 crate::model::WorkstationCluster,
616 crate::model::OperationMetadata,
617 >;
618 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
619 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
620
621 let stub = self.0.stub.clone();
622 let mut options = self.0.options.clone();
623 options.set_retry_policy(gax::retry_policy::NeverRetry);
624 let query = move |name| {
625 let stub = stub.clone();
626 let options = options.clone();
627 async {
628 let op = GetOperation::new(stub)
629 .set_name(name)
630 .with_options(options)
631 .send()
632 .await?;
633 Ok(Operation::new(op))
634 }
635 };
636
637 let start = move || async {
638 let op = self.send().await?;
639 Ok(Operation::new(op))
640 };
641
642 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
643 }
644
645 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
649 self.0.request.name = v.into();
650 self
651 }
652
653 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
655 self.0.request.validate_only = v.into();
656 self
657 }
658
659 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
661 self.0.request.etag = v.into();
662 self
663 }
664
665 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
667 self.0.request.force = v.into();
668 self
669 }
670 }
671
672 #[doc(hidden)]
673 impl gax::options::internal::RequestBuilder for DeleteWorkstationCluster {
674 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
675 &mut self.0.options
676 }
677 }
678
679 #[derive(Clone, Debug)]
696 pub struct GetWorkstationConfig(RequestBuilder<crate::model::GetWorkstationConfigRequest>);
697
698 impl GetWorkstationConfig {
699 pub(crate) fn new(
700 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
701 ) -> Self {
702 Self(RequestBuilder::new(stub))
703 }
704
705 pub fn with_request<V: Into<crate::model::GetWorkstationConfigRequest>>(
707 mut self,
708 v: V,
709 ) -> Self {
710 self.0.request = v.into();
711 self
712 }
713
714 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
716 self.0.options = v.into();
717 self
718 }
719
720 pub async fn send(self) -> Result<crate::model::WorkstationConfig> {
722 (*self.0.stub)
723 .get_workstation_config(self.0.request, self.0.options)
724 .await
725 .map(gax::response::Response::into_body)
726 }
727
728 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
732 self.0.request.name = v.into();
733 self
734 }
735 }
736
737 #[doc(hidden)]
738 impl gax::options::internal::RequestBuilder for GetWorkstationConfig {
739 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
740 &mut self.0.options
741 }
742 }
743
744 #[derive(Clone, Debug)]
765 pub struct ListWorkstationConfigs(RequestBuilder<crate::model::ListWorkstationConfigsRequest>);
766
767 impl ListWorkstationConfigs {
768 pub(crate) fn new(
769 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
770 ) -> Self {
771 Self(RequestBuilder::new(stub))
772 }
773
774 pub fn with_request<V: Into<crate::model::ListWorkstationConfigsRequest>>(
776 mut self,
777 v: V,
778 ) -> Self {
779 self.0.request = v.into();
780 self
781 }
782
783 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
785 self.0.options = v.into();
786 self
787 }
788
789 pub async fn send(self) -> Result<crate::model::ListWorkstationConfigsResponse> {
791 (*self.0.stub)
792 .list_workstation_configs(self.0.request, self.0.options)
793 .await
794 .map(gax::response::Response::into_body)
795 }
796
797 pub fn by_page(
799 self,
800 ) -> impl gax::paginator::Paginator<
801 crate::model::ListWorkstationConfigsResponse,
802 gax::error::Error,
803 > {
804 use std::clone::Clone;
805 let token = self.0.request.page_token.clone();
806 let execute = move |token: String| {
807 let mut builder = self.clone();
808 builder.0.request = builder.0.request.set_page_token(token);
809 builder.send()
810 };
811 gax::paginator::internal::new_paginator(token, execute)
812 }
813
814 pub fn by_item(
816 self,
817 ) -> impl gax::paginator::ItemPaginator<
818 crate::model::ListWorkstationConfigsResponse,
819 gax::error::Error,
820 > {
821 use gax::paginator::Paginator;
822 self.by_page().items()
823 }
824
825 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
829 self.0.request.parent = v.into();
830 self
831 }
832
833 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
835 self.0.request.page_size = v.into();
836 self
837 }
838
839 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
841 self.0.request.page_token = v.into();
842 self
843 }
844 }
845
846 #[doc(hidden)]
847 impl gax::options::internal::RequestBuilder for ListWorkstationConfigs {
848 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
849 &mut self.0.options
850 }
851 }
852
853 #[derive(Clone, Debug)]
874 pub struct ListUsableWorkstationConfigs(
875 RequestBuilder<crate::model::ListUsableWorkstationConfigsRequest>,
876 );
877
878 impl ListUsableWorkstationConfigs {
879 pub(crate) fn new(
880 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
881 ) -> Self {
882 Self(RequestBuilder::new(stub))
883 }
884
885 pub fn with_request<V: Into<crate::model::ListUsableWorkstationConfigsRequest>>(
887 mut self,
888 v: V,
889 ) -> Self {
890 self.0.request = v.into();
891 self
892 }
893
894 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
896 self.0.options = v.into();
897 self
898 }
899
900 pub async fn send(self) -> Result<crate::model::ListUsableWorkstationConfigsResponse> {
902 (*self.0.stub)
903 .list_usable_workstation_configs(self.0.request, self.0.options)
904 .await
905 .map(gax::response::Response::into_body)
906 }
907
908 pub fn by_page(
910 self,
911 ) -> impl gax::paginator::Paginator<
912 crate::model::ListUsableWorkstationConfigsResponse,
913 gax::error::Error,
914 > {
915 use std::clone::Clone;
916 let token = self.0.request.page_token.clone();
917 let execute = move |token: String| {
918 let mut builder = self.clone();
919 builder.0.request = builder.0.request.set_page_token(token);
920 builder.send()
921 };
922 gax::paginator::internal::new_paginator(token, execute)
923 }
924
925 pub fn by_item(
927 self,
928 ) -> impl gax::paginator::ItemPaginator<
929 crate::model::ListUsableWorkstationConfigsResponse,
930 gax::error::Error,
931 > {
932 use gax::paginator::Paginator;
933 self.by_page().items()
934 }
935
936 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
940 self.0.request.parent = v.into();
941 self
942 }
943
944 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
946 self.0.request.page_size = v.into();
947 self
948 }
949
950 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
952 self.0.request.page_token = v.into();
953 self
954 }
955 }
956
957 #[doc(hidden)]
958 impl gax::options::internal::RequestBuilder for ListUsableWorkstationConfigs {
959 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
960 &mut self.0.options
961 }
962 }
963
964 #[derive(Clone, Debug)]
982 pub struct CreateWorkstationConfig(
983 RequestBuilder<crate::model::CreateWorkstationConfigRequest>,
984 );
985
986 impl CreateWorkstationConfig {
987 pub(crate) fn new(
988 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
989 ) -> Self {
990 Self(RequestBuilder::new(stub))
991 }
992
993 pub fn with_request<V: Into<crate::model::CreateWorkstationConfigRequest>>(
995 mut self,
996 v: V,
997 ) -> Self {
998 self.0.request = v.into();
999 self
1000 }
1001
1002 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1004 self.0.options = v.into();
1005 self
1006 }
1007
1008 pub async fn send(self) -> Result<longrunning::model::Operation> {
1015 (*self.0.stub)
1016 .create_workstation_config(self.0.request, self.0.options)
1017 .await
1018 .map(gax::response::Response::into_body)
1019 }
1020
1021 pub fn poller(
1023 self,
1024 ) -> impl lro::Poller<crate::model::WorkstationConfig, crate::model::OperationMetadata>
1025 {
1026 type Operation = lro::internal::Operation<
1027 crate::model::WorkstationConfig,
1028 crate::model::OperationMetadata,
1029 >;
1030 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1031 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1032
1033 let stub = self.0.stub.clone();
1034 let mut options = self.0.options.clone();
1035 options.set_retry_policy(gax::retry_policy::NeverRetry);
1036 let query = move |name| {
1037 let stub = stub.clone();
1038 let options = options.clone();
1039 async {
1040 let op = GetOperation::new(stub)
1041 .set_name(name)
1042 .with_options(options)
1043 .send()
1044 .await?;
1045 Ok(Operation::new(op))
1046 }
1047 };
1048
1049 let start = move || async {
1050 let op = self.send().await?;
1051 Ok(Operation::new(op))
1052 };
1053
1054 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1055 }
1056
1057 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1061 self.0.request.parent = v.into();
1062 self
1063 }
1064
1065 pub fn set_workstation_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1069 self.0.request.workstation_config_id = v.into();
1070 self
1071 }
1072
1073 pub fn set_workstation_config<T>(mut self, v: T) -> Self
1077 where
1078 T: std::convert::Into<crate::model::WorkstationConfig>,
1079 {
1080 self.0.request.workstation_config = std::option::Option::Some(v.into());
1081 self
1082 }
1083
1084 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
1088 where
1089 T: std::convert::Into<crate::model::WorkstationConfig>,
1090 {
1091 self.0.request.workstation_config = v.map(|x| x.into());
1092 self
1093 }
1094
1095 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1097 self.0.request.validate_only = v.into();
1098 self
1099 }
1100 }
1101
1102 #[doc(hidden)]
1103 impl gax::options::internal::RequestBuilder for CreateWorkstationConfig {
1104 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1105 &mut self.0.options
1106 }
1107 }
1108
1109 #[derive(Clone, Debug)]
1127 pub struct UpdateWorkstationConfig(
1128 RequestBuilder<crate::model::UpdateWorkstationConfigRequest>,
1129 );
1130
1131 impl UpdateWorkstationConfig {
1132 pub(crate) fn new(
1133 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1134 ) -> Self {
1135 Self(RequestBuilder::new(stub))
1136 }
1137
1138 pub fn with_request<V: Into<crate::model::UpdateWorkstationConfigRequest>>(
1140 mut self,
1141 v: V,
1142 ) -> Self {
1143 self.0.request = v.into();
1144 self
1145 }
1146
1147 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1149 self.0.options = v.into();
1150 self
1151 }
1152
1153 pub async fn send(self) -> Result<longrunning::model::Operation> {
1160 (*self.0.stub)
1161 .update_workstation_config(self.0.request, self.0.options)
1162 .await
1163 .map(gax::response::Response::into_body)
1164 }
1165
1166 pub fn poller(
1168 self,
1169 ) -> impl lro::Poller<crate::model::WorkstationConfig, crate::model::OperationMetadata>
1170 {
1171 type Operation = lro::internal::Operation<
1172 crate::model::WorkstationConfig,
1173 crate::model::OperationMetadata,
1174 >;
1175 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1176 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1177
1178 let stub = self.0.stub.clone();
1179 let mut options = self.0.options.clone();
1180 options.set_retry_policy(gax::retry_policy::NeverRetry);
1181 let query = move |name| {
1182 let stub = stub.clone();
1183 let options = options.clone();
1184 async {
1185 let op = GetOperation::new(stub)
1186 .set_name(name)
1187 .with_options(options)
1188 .send()
1189 .await?;
1190 Ok(Operation::new(op))
1191 }
1192 };
1193
1194 let start = move || async {
1195 let op = self.send().await?;
1196 Ok(Operation::new(op))
1197 };
1198
1199 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1200 }
1201
1202 pub fn set_workstation_config<T>(mut self, v: T) -> Self
1206 where
1207 T: std::convert::Into<crate::model::WorkstationConfig>,
1208 {
1209 self.0.request.workstation_config = std::option::Option::Some(v.into());
1210 self
1211 }
1212
1213 pub fn set_or_clear_workstation_config<T>(mut self, v: std::option::Option<T>) -> Self
1217 where
1218 T: std::convert::Into<crate::model::WorkstationConfig>,
1219 {
1220 self.0.request.workstation_config = v.map(|x| x.into());
1221 self
1222 }
1223
1224 pub fn set_update_mask<T>(mut self, v: T) -> Self
1228 where
1229 T: std::convert::Into<wkt::FieldMask>,
1230 {
1231 self.0.request.update_mask = std::option::Option::Some(v.into());
1232 self
1233 }
1234
1235 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1239 where
1240 T: std::convert::Into<wkt::FieldMask>,
1241 {
1242 self.0.request.update_mask = v.map(|x| x.into());
1243 self
1244 }
1245
1246 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1248 self.0.request.validate_only = v.into();
1249 self
1250 }
1251
1252 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1254 self.0.request.allow_missing = v.into();
1255 self
1256 }
1257 }
1258
1259 #[doc(hidden)]
1260 impl gax::options::internal::RequestBuilder for UpdateWorkstationConfig {
1261 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1262 &mut self.0.options
1263 }
1264 }
1265
1266 #[derive(Clone, Debug)]
1284 pub struct DeleteWorkstationConfig(
1285 RequestBuilder<crate::model::DeleteWorkstationConfigRequest>,
1286 );
1287
1288 impl DeleteWorkstationConfig {
1289 pub(crate) fn new(
1290 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1291 ) -> Self {
1292 Self(RequestBuilder::new(stub))
1293 }
1294
1295 pub fn with_request<V: Into<crate::model::DeleteWorkstationConfigRequest>>(
1297 mut self,
1298 v: V,
1299 ) -> Self {
1300 self.0.request = v.into();
1301 self
1302 }
1303
1304 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1306 self.0.options = v.into();
1307 self
1308 }
1309
1310 pub async fn send(self) -> Result<longrunning::model::Operation> {
1317 (*self.0.stub)
1318 .delete_workstation_config(self.0.request, self.0.options)
1319 .await
1320 .map(gax::response::Response::into_body)
1321 }
1322
1323 pub fn poller(
1325 self,
1326 ) -> impl lro::Poller<crate::model::WorkstationConfig, crate::model::OperationMetadata>
1327 {
1328 type Operation = lro::internal::Operation<
1329 crate::model::WorkstationConfig,
1330 crate::model::OperationMetadata,
1331 >;
1332 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1333 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1334
1335 let stub = self.0.stub.clone();
1336 let mut options = self.0.options.clone();
1337 options.set_retry_policy(gax::retry_policy::NeverRetry);
1338 let query = move |name| {
1339 let stub = stub.clone();
1340 let options = options.clone();
1341 async {
1342 let op = GetOperation::new(stub)
1343 .set_name(name)
1344 .with_options(options)
1345 .send()
1346 .await?;
1347 Ok(Operation::new(op))
1348 }
1349 };
1350
1351 let start = move || async {
1352 let op = self.send().await?;
1353 Ok(Operation::new(op))
1354 };
1355
1356 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1357 }
1358
1359 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1363 self.0.request.name = v.into();
1364 self
1365 }
1366
1367 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1369 self.0.request.validate_only = v.into();
1370 self
1371 }
1372
1373 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1375 self.0.request.etag = v.into();
1376 self
1377 }
1378
1379 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1381 self.0.request.force = v.into();
1382 self
1383 }
1384 }
1385
1386 #[doc(hidden)]
1387 impl gax::options::internal::RequestBuilder for DeleteWorkstationConfig {
1388 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1389 &mut self.0.options
1390 }
1391 }
1392
1393 #[derive(Clone, Debug)]
1410 pub struct GetWorkstation(RequestBuilder<crate::model::GetWorkstationRequest>);
1411
1412 impl GetWorkstation {
1413 pub(crate) fn new(
1414 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1415 ) -> Self {
1416 Self(RequestBuilder::new(stub))
1417 }
1418
1419 pub fn with_request<V: Into<crate::model::GetWorkstationRequest>>(mut self, v: V) -> Self {
1421 self.0.request = v.into();
1422 self
1423 }
1424
1425 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1427 self.0.options = v.into();
1428 self
1429 }
1430
1431 pub async fn send(self) -> Result<crate::model::Workstation> {
1433 (*self.0.stub)
1434 .get_workstation(self.0.request, self.0.options)
1435 .await
1436 .map(gax::response::Response::into_body)
1437 }
1438
1439 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1443 self.0.request.name = v.into();
1444 self
1445 }
1446 }
1447
1448 #[doc(hidden)]
1449 impl gax::options::internal::RequestBuilder for GetWorkstation {
1450 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1451 &mut self.0.options
1452 }
1453 }
1454
1455 #[derive(Clone, Debug)]
1476 pub struct ListWorkstations(RequestBuilder<crate::model::ListWorkstationsRequest>);
1477
1478 impl ListWorkstations {
1479 pub(crate) fn new(
1480 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1481 ) -> Self {
1482 Self(RequestBuilder::new(stub))
1483 }
1484
1485 pub fn with_request<V: Into<crate::model::ListWorkstationsRequest>>(
1487 mut self,
1488 v: V,
1489 ) -> Self {
1490 self.0.request = v.into();
1491 self
1492 }
1493
1494 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1496 self.0.options = v.into();
1497 self
1498 }
1499
1500 pub async fn send(self) -> Result<crate::model::ListWorkstationsResponse> {
1502 (*self.0.stub)
1503 .list_workstations(self.0.request, self.0.options)
1504 .await
1505 .map(gax::response::Response::into_body)
1506 }
1507
1508 pub fn by_page(
1510 self,
1511 ) -> impl gax::paginator::Paginator<crate::model::ListWorkstationsResponse, gax::error::Error>
1512 {
1513 use std::clone::Clone;
1514 let token = self.0.request.page_token.clone();
1515 let execute = move |token: String| {
1516 let mut builder = self.clone();
1517 builder.0.request = builder.0.request.set_page_token(token);
1518 builder.send()
1519 };
1520 gax::paginator::internal::new_paginator(token, execute)
1521 }
1522
1523 pub fn by_item(
1525 self,
1526 ) -> impl gax::paginator::ItemPaginator<crate::model::ListWorkstationsResponse, gax::error::Error>
1527 {
1528 use gax::paginator::Paginator;
1529 self.by_page().items()
1530 }
1531
1532 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1536 self.0.request.parent = v.into();
1537 self
1538 }
1539
1540 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1542 self.0.request.page_size = v.into();
1543 self
1544 }
1545
1546 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1548 self.0.request.page_token = v.into();
1549 self
1550 }
1551 }
1552
1553 #[doc(hidden)]
1554 impl gax::options::internal::RequestBuilder for ListWorkstations {
1555 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1556 &mut self.0.options
1557 }
1558 }
1559
1560 #[derive(Clone, Debug)]
1581 pub struct ListUsableWorkstations(RequestBuilder<crate::model::ListUsableWorkstationsRequest>);
1582
1583 impl ListUsableWorkstations {
1584 pub(crate) fn new(
1585 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1586 ) -> Self {
1587 Self(RequestBuilder::new(stub))
1588 }
1589
1590 pub fn with_request<V: Into<crate::model::ListUsableWorkstationsRequest>>(
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<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1601 self.0.options = v.into();
1602 self
1603 }
1604
1605 pub async fn send(self) -> Result<crate::model::ListUsableWorkstationsResponse> {
1607 (*self.0.stub)
1608 .list_usable_workstations(self.0.request, self.0.options)
1609 .await
1610 .map(gax::response::Response::into_body)
1611 }
1612
1613 pub fn by_page(
1615 self,
1616 ) -> impl gax::paginator::Paginator<
1617 crate::model::ListUsableWorkstationsResponse,
1618 gax::error::Error,
1619 > {
1620 use std::clone::Clone;
1621 let token = self.0.request.page_token.clone();
1622 let execute = move |token: String| {
1623 let mut builder = self.clone();
1624 builder.0.request = builder.0.request.set_page_token(token);
1625 builder.send()
1626 };
1627 gax::paginator::internal::new_paginator(token, execute)
1628 }
1629
1630 pub fn by_item(
1632 self,
1633 ) -> impl gax::paginator::ItemPaginator<
1634 crate::model::ListUsableWorkstationsResponse,
1635 gax::error::Error,
1636 > {
1637 use gax::paginator::Paginator;
1638 self.by_page().items()
1639 }
1640
1641 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1645 self.0.request.parent = v.into();
1646 self
1647 }
1648
1649 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1651 self.0.request.page_size = v.into();
1652 self
1653 }
1654
1655 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1657 self.0.request.page_token = v.into();
1658 self
1659 }
1660 }
1661
1662 #[doc(hidden)]
1663 impl gax::options::internal::RequestBuilder for ListUsableWorkstations {
1664 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1665 &mut self.0.options
1666 }
1667 }
1668
1669 #[derive(Clone, Debug)]
1687 pub struct CreateWorkstation(RequestBuilder<crate::model::CreateWorkstationRequest>);
1688
1689 impl CreateWorkstation {
1690 pub(crate) fn new(
1691 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1692 ) -> Self {
1693 Self(RequestBuilder::new(stub))
1694 }
1695
1696 pub fn with_request<V: Into<crate::model::CreateWorkstationRequest>>(
1698 mut self,
1699 v: V,
1700 ) -> Self {
1701 self.0.request = v.into();
1702 self
1703 }
1704
1705 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1707 self.0.options = v.into();
1708 self
1709 }
1710
1711 pub async fn send(self) -> Result<longrunning::model::Operation> {
1718 (*self.0.stub)
1719 .create_workstation(self.0.request, self.0.options)
1720 .await
1721 .map(gax::response::Response::into_body)
1722 }
1723
1724 pub fn poller(
1726 self,
1727 ) -> impl lro::Poller<crate::model::Workstation, crate::model::OperationMetadata> {
1728 type Operation = lro::internal::Operation<
1729 crate::model::Workstation,
1730 crate::model::OperationMetadata,
1731 >;
1732 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1733 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1734
1735 let stub = self.0.stub.clone();
1736 let mut options = self.0.options.clone();
1737 options.set_retry_policy(gax::retry_policy::NeverRetry);
1738 let query = move |name| {
1739 let stub = stub.clone();
1740 let options = options.clone();
1741 async {
1742 let op = GetOperation::new(stub)
1743 .set_name(name)
1744 .with_options(options)
1745 .send()
1746 .await?;
1747 Ok(Operation::new(op))
1748 }
1749 };
1750
1751 let start = move || async {
1752 let op = self.send().await?;
1753 Ok(Operation::new(op))
1754 };
1755
1756 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1757 }
1758
1759 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1763 self.0.request.parent = v.into();
1764 self
1765 }
1766
1767 pub fn set_workstation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1771 self.0.request.workstation_id = v.into();
1772 self
1773 }
1774
1775 pub fn set_workstation<T>(mut self, v: T) -> Self
1779 where
1780 T: std::convert::Into<crate::model::Workstation>,
1781 {
1782 self.0.request.workstation = std::option::Option::Some(v.into());
1783 self
1784 }
1785
1786 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
1790 where
1791 T: std::convert::Into<crate::model::Workstation>,
1792 {
1793 self.0.request.workstation = v.map(|x| x.into());
1794 self
1795 }
1796
1797 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1799 self.0.request.validate_only = v.into();
1800 self
1801 }
1802 }
1803
1804 #[doc(hidden)]
1805 impl gax::options::internal::RequestBuilder for CreateWorkstation {
1806 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1807 &mut self.0.options
1808 }
1809 }
1810
1811 #[derive(Clone, Debug)]
1829 pub struct UpdateWorkstation(RequestBuilder<crate::model::UpdateWorkstationRequest>);
1830
1831 impl UpdateWorkstation {
1832 pub(crate) fn new(
1833 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1834 ) -> Self {
1835 Self(RequestBuilder::new(stub))
1836 }
1837
1838 pub fn with_request<V: Into<crate::model::UpdateWorkstationRequest>>(
1840 mut self,
1841 v: V,
1842 ) -> Self {
1843 self.0.request = v.into();
1844 self
1845 }
1846
1847 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1849 self.0.options = v.into();
1850 self
1851 }
1852
1853 pub async fn send(self) -> Result<longrunning::model::Operation> {
1860 (*self.0.stub)
1861 .update_workstation(self.0.request, self.0.options)
1862 .await
1863 .map(gax::response::Response::into_body)
1864 }
1865
1866 pub fn poller(
1868 self,
1869 ) -> impl lro::Poller<crate::model::Workstation, crate::model::OperationMetadata> {
1870 type Operation = lro::internal::Operation<
1871 crate::model::Workstation,
1872 crate::model::OperationMetadata,
1873 >;
1874 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1875 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1876
1877 let stub = self.0.stub.clone();
1878 let mut options = self.0.options.clone();
1879 options.set_retry_policy(gax::retry_policy::NeverRetry);
1880 let query = move |name| {
1881 let stub = stub.clone();
1882 let options = options.clone();
1883 async {
1884 let op = GetOperation::new(stub)
1885 .set_name(name)
1886 .with_options(options)
1887 .send()
1888 .await?;
1889 Ok(Operation::new(op))
1890 }
1891 };
1892
1893 let start = move || async {
1894 let op = self.send().await?;
1895 Ok(Operation::new(op))
1896 };
1897
1898 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1899 }
1900
1901 pub fn set_workstation<T>(mut self, v: T) -> Self
1905 where
1906 T: std::convert::Into<crate::model::Workstation>,
1907 {
1908 self.0.request.workstation = std::option::Option::Some(v.into());
1909 self
1910 }
1911
1912 pub fn set_or_clear_workstation<T>(mut self, v: std::option::Option<T>) -> Self
1916 where
1917 T: std::convert::Into<crate::model::Workstation>,
1918 {
1919 self.0.request.workstation = v.map(|x| x.into());
1920 self
1921 }
1922
1923 pub fn set_update_mask<T>(mut self, v: T) -> Self
1927 where
1928 T: std::convert::Into<wkt::FieldMask>,
1929 {
1930 self.0.request.update_mask = std::option::Option::Some(v.into());
1931 self
1932 }
1933
1934 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1938 where
1939 T: std::convert::Into<wkt::FieldMask>,
1940 {
1941 self.0.request.update_mask = v.map(|x| x.into());
1942 self
1943 }
1944
1945 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1947 self.0.request.validate_only = v.into();
1948 self
1949 }
1950
1951 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1953 self.0.request.allow_missing = v.into();
1954 self
1955 }
1956 }
1957
1958 #[doc(hidden)]
1959 impl gax::options::internal::RequestBuilder for UpdateWorkstation {
1960 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1961 &mut self.0.options
1962 }
1963 }
1964
1965 #[derive(Clone, Debug)]
1983 pub struct DeleteWorkstation(RequestBuilder<crate::model::DeleteWorkstationRequest>);
1984
1985 impl DeleteWorkstation {
1986 pub(crate) fn new(
1987 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
1988 ) -> Self {
1989 Self(RequestBuilder::new(stub))
1990 }
1991
1992 pub fn with_request<V: Into<crate::model::DeleteWorkstationRequest>>(
1994 mut self,
1995 v: V,
1996 ) -> Self {
1997 self.0.request = v.into();
1998 self
1999 }
2000
2001 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2003 self.0.options = v.into();
2004 self
2005 }
2006
2007 pub async fn send(self) -> Result<longrunning::model::Operation> {
2014 (*self.0.stub)
2015 .delete_workstation(self.0.request, self.0.options)
2016 .await
2017 .map(gax::response::Response::into_body)
2018 }
2019
2020 pub fn poller(
2022 self,
2023 ) -> impl lro::Poller<crate::model::Workstation, crate::model::OperationMetadata> {
2024 type Operation = lro::internal::Operation<
2025 crate::model::Workstation,
2026 crate::model::OperationMetadata,
2027 >;
2028 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2029 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2030
2031 let stub = self.0.stub.clone();
2032 let mut options = self.0.options.clone();
2033 options.set_retry_policy(gax::retry_policy::NeverRetry);
2034 let query = move |name| {
2035 let stub = stub.clone();
2036 let options = options.clone();
2037 async {
2038 let op = GetOperation::new(stub)
2039 .set_name(name)
2040 .with_options(options)
2041 .send()
2042 .await?;
2043 Ok(Operation::new(op))
2044 }
2045 };
2046
2047 let start = move || async {
2048 let op = self.send().await?;
2049 Ok(Operation::new(op))
2050 };
2051
2052 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2053 }
2054
2055 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2059 self.0.request.name = v.into();
2060 self
2061 }
2062
2063 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2065 self.0.request.validate_only = v.into();
2066 self
2067 }
2068
2069 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2071 self.0.request.etag = v.into();
2072 self
2073 }
2074 }
2075
2076 #[doc(hidden)]
2077 impl gax::options::internal::RequestBuilder for DeleteWorkstation {
2078 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2079 &mut self.0.options
2080 }
2081 }
2082
2083 #[derive(Clone, Debug)]
2101 pub struct StartWorkstation(RequestBuilder<crate::model::StartWorkstationRequest>);
2102
2103 impl StartWorkstation {
2104 pub(crate) fn new(
2105 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2106 ) -> Self {
2107 Self(RequestBuilder::new(stub))
2108 }
2109
2110 pub fn with_request<V: Into<crate::model::StartWorkstationRequest>>(
2112 mut self,
2113 v: V,
2114 ) -> Self {
2115 self.0.request = v.into();
2116 self
2117 }
2118
2119 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2121 self.0.options = v.into();
2122 self
2123 }
2124
2125 pub async fn send(self) -> Result<longrunning::model::Operation> {
2132 (*self.0.stub)
2133 .start_workstation(self.0.request, self.0.options)
2134 .await
2135 .map(gax::response::Response::into_body)
2136 }
2137
2138 pub fn poller(
2140 self,
2141 ) -> impl lro::Poller<crate::model::Workstation, crate::model::OperationMetadata> {
2142 type Operation = lro::internal::Operation<
2143 crate::model::Workstation,
2144 crate::model::OperationMetadata,
2145 >;
2146 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2147 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2148
2149 let stub = self.0.stub.clone();
2150 let mut options = self.0.options.clone();
2151 options.set_retry_policy(gax::retry_policy::NeverRetry);
2152 let query = move |name| {
2153 let stub = stub.clone();
2154 let options = options.clone();
2155 async {
2156 let op = GetOperation::new(stub)
2157 .set_name(name)
2158 .with_options(options)
2159 .send()
2160 .await?;
2161 Ok(Operation::new(op))
2162 }
2163 };
2164
2165 let start = move || async {
2166 let op = self.send().await?;
2167 Ok(Operation::new(op))
2168 };
2169
2170 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2171 }
2172
2173 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2177 self.0.request.name = v.into();
2178 self
2179 }
2180
2181 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2183 self.0.request.validate_only = v.into();
2184 self
2185 }
2186
2187 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2189 self.0.request.etag = v.into();
2190 self
2191 }
2192 }
2193
2194 #[doc(hidden)]
2195 impl gax::options::internal::RequestBuilder for StartWorkstation {
2196 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2197 &mut self.0.options
2198 }
2199 }
2200
2201 #[derive(Clone, Debug)]
2219 pub struct StopWorkstation(RequestBuilder<crate::model::StopWorkstationRequest>);
2220
2221 impl StopWorkstation {
2222 pub(crate) fn new(
2223 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2224 ) -> Self {
2225 Self(RequestBuilder::new(stub))
2226 }
2227
2228 pub fn with_request<V: Into<crate::model::StopWorkstationRequest>>(mut self, v: V) -> Self {
2230 self.0.request = v.into();
2231 self
2232 }
2233
2234 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2236 self.0.options = v.into();
2237 self
2238 }
2239
2240 pub async fn send(self) -> Result<longrunning::model::Operation> {
2247 (*self.0.stub)
2248 .stop_workstation(self.0.request, self.0.options)
2249 .await
2250 .map(gax::response::Response::into_body)
2251 }
2252
2253 pub fn poller(
2255 self,
2256 ) -> impl lro::Poller<crate::model::Workstation, crate::model::OperationMetadata> {
2257 type Operation = lro::internal::Operation<
2258 crate::model::Workstation,
2259 crate::model::OperationMetadata,
2260 >;
2261 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2262 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2263
2264 let stub = self.0.stub.clone();
2265 let mut options = self.0.options.clone();
2266 options.set_retry_policy(gax::retry_policy::NeverRetry);
2267 let query = move |name| {
2268 let stub = stub.clone();
2269 let options = options.clone();
2270 async {
2271 let op = GetOperation::new(stub)
2272 .set_name(name)
2273 .with_options(options)
2274 .send()
2275 .await?;
2276 Ok(Operation::new(op))
2277 }
2278 };
2279
2280 let start = move || async {
2281 let op = self.send().await?;
2282 Ok(Operation::new(op))
2283 };
2284
2285 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2286 }
2287
2288 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2292 self.0.request.name = v.into();
2293 self
2294 }
2295
2296 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2298 self.0.request.validate_only = v.into();
2299 self
2300 }
2301
2302 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2304 self.0.request.etag = v.into();
2305 self
2306 }
2307 }
2308
2309 #[doc(hidden)]
2310 impl gax::options::internal::RequestBuilder for StopWorkstation {
2311 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2312 &mut self.0.options
2313 }
2314 }
2315
2316 #[derive(Clone, Debug)]
2333 pub struct GenerateAccessToken(RequestBuilder<crate::model::GenerateAccessTokenRequest>);
2334
2335 impl GenerateAccessToken {
2336 pub(crate) fn new(
2337 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2338 ) -> Self {
2339 Self(RequestBuilder::new(stub))
2340 }
2341
2342 pub fn with_request<V: Into<crate::model::GenerateAccessTokenRequest>>(
2344 mut self,
2345 v: V,
2346 ) -> Self {
2347 self.0.request = v.into();
2348 self
2349 }
2350
2351 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2353 self.0.options = v.into();
2354 self
2355 }
2356
2357 pub async fn send(self) -> Result<crate::model::GenerateAccessTokenResponse> {
2359 (*self.0.stub)
2360 .generate_access_token(self.0.request, self.0.options)
2361 .await
2362 .map(gax::response::Response::into_body)
2363 }
2364
2365 pub fn set_workstation<T: Into<std::string::String>>(mut self, v: T) -> Self {
2369 self.0.request.workstation = v.into();
2370 self
2371 }
2372
2373 pub fn set_expiration<
2378 T: Into<Option<crate::model::generate_access_token_request::Expiration>>,
2379 >(
2380 mut self,
2381 v: T,
2382 ) -> Self {
2383 self.0.request.expiration = v.into();
2384 self
2385 }
2386
2387 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
2393 mut self,
2394 v: T,
2395 ) -> Self {
2396 self.0.request = self.0.request.set_expire_time(v);
2397 self
2398 }
2399
2400 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
2406 mut self,
2407 v: T,
2408 ) -> Self {
2409 self.0.request = self.0.request.set_ttl(v);
2410 self
2411 }
2412 }
2413
2414 #[doc(hidden)]
2415 impl gax::options::internal::RequestBuilder for GenerateAccessToken {
2416 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2417 &mut self.0.options
2418 }
2419 }
2420
2421 #[derive(Clone, Debug)]
2438 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
2439
2440 impl SetIamPolicy {
2441 pub(crate) fn new(
2442 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2443 ) -> Self {
2444 Self(RequestBuilder::new(stub))
2445 }
2446
2447 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
2449 self.0.request = v.into();
2450 self
2451 }
2452
2453 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2455 self.0.options = v.into();
2456 self
2457 }
2458
2459 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2461 (*self.0.stub)
2462 .set_iam_policy(self.0.request, self.0.options)
2463 .await
2464 .map(gax::response::Response::into_body)
2465 }
2466
2467 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2471 self.0.request.resource = v.into();
2472 self
2473 }
2474
2475 pub fn set_policy<T>(mut self, v: T) -> Self
2479 where
2480 T: std::convert::Into<iam_v1::model::Policy>,
2481 {
2482 self.0.request.policy = std::option::Option::Some(v.into());
2483 self
2484 }
2485
2486 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
2490 where
2491 T: std::convert::Into<iam_v1::model::Policy>,
2492 {
2493 self.0.request.policy = v.map(|x| x.into());
2494 self
2495 }
2496
2497 pub fn set_update_mask<T>(mut self, v: T) -> Self
2499 where
2500 T: std::convert::Into<wkt::FieldMask>,
2501 {
2502 self.0.request.update_mask = std::option::Option::Some(v.into());
2503 self
2504 }
2505
2506 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2508 where
2509 T: std::convert::Into<wkt::FieldMask>,
2510 {
2511 self.0.request.update_mask = v.map(|x| x.into());
2512 self
2513 }
2514 }
2515
2516 #[doc(hidden)]
2517 impl gax::options::internal::RequestBuilder for SetIamPolicy {
2518 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2519 &mut self.0.options
2520 }
2521 }
2522
2523 #[derive(Clone, Debug)]
2540 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
2541
2542 impl GetIamPolicy {
2543 pub(crate) fn new(
2544 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2545 ) -> Self {
2546 Self(RequestBuilder::new(stub))
2547 }
2548
2549 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
2551 self.0.request = v.into();
2552 self
2553 }
2554
2555 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2557 self.0.options = v.into();
2558 self
2559 }
2560
2561 pub async fn send(self) -> Result<iam_v1::model::Policy> {
2563 (*self.0.stub)
2564 .get_iam_policy(self.0.request, self.0.options)
2565 .await
2566 .map(gax::response::Response::into_body)
2567 }
2568
2569 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2573 self.0.request.resource = v.into();
2574 self
2575 }
2576
2577 pub fn set_options<T>(mut self, v: T) -> Self
2579 where
2580 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2581 {
2582 self.0.request.options = std::option::Option::Some(v.into());
2583 self
2584 }
2585
2586 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
2588 where
2589 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
2590 {
2591 self.0.request.options = v.map(|x| x.into());
2592 self
2593 }
2594 }
2595
2596 #[doc(hidden)]
2597 impl gax::options::internal::RequestBuilder for GetIamPolicy {
2598 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2599 &mut self.0.options
2600 }
2601 }
2602
2603 #[derive(Clone, Debug)]
2620 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
2621
2622 impl TestIamPermissions {
2623 pub(crate) fn new(
2624 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2625 ) -> Self {
2626 Self(RequestBuilder::new(stub))
2627 }
2628
2629 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
2631 mut self,
2632 v: V,
2633 ) -> Self {
2634 self.0.request = v.into();
2635 self
2636 }
2637
2638 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2640 self.0.options = v.into();
2641 self
2642 }
2643
2644 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
2646 (*self.0.stub)
2647 .test_iam_permissions(self.0.request, self.0.options)
2648 .await
2649 .map(gax::response::Response::into_body)
2650 }
2651
2652 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
2656 self.0.request.resource = v.into();
2657 self
2658 }
2659
2660 pub fn set_permissions<T, V>(mut self, v: T) -> Self
2664 where
2665 T: std::iter::IntoIterator<Item = V>,
2666 V: std::convert::Into<std::string::String>,
2667 {
2668 use std::iter::Iterator;
2669 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
2670 self
2671 }
2672 }
2673
2674 #[doc(hidden)]
2675 impl gax::options::internal::RequestBuilder for TestIamPermissions {
2676 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2677 &mut self.0.options
2678 }
2679 }
2680
2681 #[derive(Clone, Debug)]
2702 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2703
2704 impl ListOperations {
2705 pub(crate) fn new(
2706 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2707 ) -> Self {
2708 Self(RequestBuilder::new(stub))
2709 }
2710
2711 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2713 mut self,
2714 v: V,
2715 ) -> Self {
2716 self.0.request = v.into();
2717 self
2718 }
2719
2720 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2722 self.0.options = v.into();
2723 self
2724 }
2725
2726 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2728 (*self.0.stub)
2729 .list_operations(self.0.request, self.0.options)
2730 .await
2731 .map(gax::response::Response::into_body)
2732 }
2733
2734 pub fn by_page(
2736 self,
2737 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2738 {
2739 use std::clone::Clone;
2740 let token = self.0.request.page_token.clone();
2741 let execute = move |token: String| {
2742 let mut builder = self.clone();
2743 builder.0.request = builder.0.request.set_page_token(token);
2744 builder.send()
2745 };
2746 gax::paginator::internal::new_paginator(token, execute)
2747 }
2748
2749 pub fn by_item(
2751 self,
2752 ) -> impl gax::paginator::ItemPaginator<
2753 longrunning::model::ListOperationsResponse,
2754 gax::error::Error,
2755 > {
2756 use gax::paginator::Paginator;
2757 self.by_page().items()
2758 }
2759
2760 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2762 self.0.request.name = v.into();
2763 self
2764 }
2765
2766 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2768 self.0.request.filter = v.into();
2769 self
2770 }
2771
2772 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2774 self.0.request.page_size = v.into();
2775 self
2776 }
2777
2778 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2780 self.0.request.page_token = v.into();
2781 self
2782 }
2783
2784 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2786 self.0.request.return_partial_success = v.into();
2787 self
2788 }
2789 }
2790
2791 #[doc(hidden)]
2792 impl gax::options::internal::RequestBuilder for ListOperations {
2793 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2794 &mut self.0.options
2795 }
2796 }
2797
2798 #[derive(Clone, Debug)]
2815 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2816
2817 impl GetOperation {
2818 pub(crate) fn new(
2819 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2820 ) -> Self {
2821 Self(RequestBuilder::new(stub))
2822 }
2823
2824 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2826 mut self,
2827 v: V,
2828 ) -> Self {
2829 self.0.request = v.into();
2830 self
2831 }
2832
2833 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2835 self.0.options = v.into();
2836 self
2837 }
2838
2839 pub async fn send(self) -> Result<longrunning::model::Operation> {
2841 (*self.0.stub)
2842 .get_operation(self.0.request, self.0.options)
2843 .await
2844 .map(gax::response::Response::into_body)
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
2854 #[doc(hidden)]
2855 impl gax::options::internal::RequestBuilder for GetOperation {
2856 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2857 &mut self.0.options
2858 }
2859 }
2860
2861 #[derive(Clone, Debug)]
2878 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2879
2880 impl DeleteOperation {
2881 pub(crate) fn new(
2882 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2883 ) -> Self {
2884 Self(RequestBuilder::new(stub))
2885 }
2886
2887 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2889 mut self,
2890 v: V,
2891 ) -> Self {
2892 self.0.request = v.into();
2893 self
2894 }
2895
2896 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2898 self.0.options = v.into();
2899 self
2900 }
2901
2902 pub async fn send(self) -> Result<()> {
2904 (*self.0.stub)
2905 .delete_operation(self.0.request, self.0.options)
2906 .await
2907 .map(gax::response::Response::into_body)
2908 }
2909
2910 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2912 self.0.request.name = v.into();
2913 self
2914 }
2915 }
2916
2917 #[doc(hidden)]
2918 impl gax::options::internal::RequestBuilder for DeleteOperation {
2919 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2920 &mut self.0.options
2921 }
2922 }
2923
2924 #[derive(Clone, Debug)]
2941 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2942
2943 impl CancelOperation {
2944 pub(crate) fn new(
2945 stub: std::sync::Arc<dyn super::super::stub::dynamic::Workstations>,
2946 ) -> Self {
2947 Self(RequestBuilder::new(stub))
2948 }
2949
2950 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2952 mut self,
2953 v: V,
2954 ) -> Self {
2955 self.0.request = v.into();
2956 self
2957 }
2958
2959 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2961 self.0.options = v.into();
2962 self
2963 }
2964
2965 pub async fn send(self) -> Result<()> {
2967 (*self.0.stub)
2968 .cancel_operation(self.0.request, self.0.options)
2969 .await
2970 .map(gax::response::Response::into_body)
2971 }
2972
2973 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2975 self.0.request.name = v.into();
2976 self
2977 }
2978 }
2979
2980 #[doc(hidden)]
2981 impl gax::options::internal::RequestBuilder for CancelOperation {
2982 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2983 &mut self.0.options
2984 }
2985 }
2986}