1pub mod instance_admin {
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::InstanceAdmin;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = InstanceAdmin;
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::InstanceAdmin>,
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::InstanceAdmin>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
95 pub struct ListInstanceConfigs(RequestBuilder<crate::model::ListInstanceConfigsRequest>);
96
97 impl ListInstanceConfigs {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 pub fn with_request<V: Into<crate::model::ListInstanceConfigsRequest>>(
106 mut self,
107 v: V,
108 ) -> Self {
109 self.0.request = v.into();
110 self
111 }
112
113 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
115 self.0.options = v.into();
116 self
117 }
118
119 pub async fn send(self) -> Result<crate::model::ListInstanceConfigsResponse> {
121 (*self.0.stub)
122 .list_instance_configs(self.0.request, self.0.options)
123 .await
124 .map(gax::response::Response::into_body)
125 }
126
127 pub fn by_page(
129 self,
130 ) -> impl gax::paginator::Paginator<crate::model::ListInstanceConfigsResponse, gax::error::Error>
131 {
132 use std::clone::Clone;
133 let token = self.0.request.page_token.clone();
134 let execute = move |token: String| {
135 let mut builder = self.clone();
136 builder.0.request = builder.0.request.set_page_token(token);
137 builder.send()
138 };
139 gax::paginator::internal::new_paginator(token, execute)
140 }
141
142 pub fn by_item(
144 self,
145 ) -> impl gax::paginator::ItemPaginator<
146 crate::model::ListInstanceConfigsResponse,
147 gax::error::Error,
148 > {
149 use gax::paginator::Paginator;
150 self.by_page().items()
151 }
152
153 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
157 self.0.request.parent = v.into();
158 self
159 }
160
161 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
163 self.0.request.page_size = v.into();
164 self
165 }
166
167 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
169 self.0.request.page_token = v.into();
170 self
171 }
172 }
173
174 #[doc(hidden)]
175 impl gax::options::internal::RequestBuilder for ListInstanceConfigs {
176 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
177 &mut self.0.options
178 }
179 }
180
181 #[derive(Clone, Debug)]
198 pub struct GetInstanceConfig(RequestBuilder<crate::model::GetInstanceConfigRequest>);
199
200 impl GetInstanceConfig {
201 pub(crate) fn new(
202 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
203 ) -> Self {
204 Self(RequestBuilder::new(stub))
205 }
206
207 pub fn with_request<V: Into<crate::model::GetInstanceConfigRequest>>(
209 mut self,
210 v: V,
211 ) -> Self {
212 self.0.request = v.into();
213 self
214 }
215
216 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
218 self.0.options = v.into();
219 self
220 }
221
222 pub async fn send(self) -> Result<crate::model::InstanceConfig> {
224 (*self.0.stub)
225 .get_instance_config(self.0.request, self.0.options)
226 .await
227 .map(gax::response::Response::into_body)
228 }
229
230 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
234 self.0.request.name = v.into();
235 self
236 }
237 }
238
239 #[doc(hidden)]
240 impl gax::options::internal::RequestBuilder for GetInstanceConfig {
241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
242 &mut self.0.options
243 }
244 }
245
246 #[derive(Clone, Debug)]
264 pub struct CreateInstanceConfig(RequestBuilder<crate::model::CreateInstanceConfigRequest>);
265
266 impl CreateInstanceConfig {
267 pub(crate) fn new(
268 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
269 ) -> Self {
270 Self(RequestBuilder::new(stub))
271 }
272
273 pub fn with_request<V: Into<crate::model::CreateInstanceConfigRequest>>(
275 mut self,
276 v: V,
277 ) -> Self {
278 self.0.request = v.into();
279 self
280 }
281
282 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
284 self.0.options = v.into();
285 self
286 }
287
288 pub async fn send(self) -> Result<longrunning::model::Operation> {
295 (*self.0.stub)
296 .create_instance_config(self.0.request, self.0.options)
297 .await
298 .map(gax::response::Response::into_body)
299 }
300
301 pub fn poller(
303 self,
304 ) -> impl lro::Poller<crate::model::InstanceConfig, crate::model::CreateInstanceConfigMetadata>
305 {
306 type Operation = lro::internal::Operation<
307 crate::model::InstanceConfig,
308 crate::model::CreateInstanceConfigMetadata,
309 >;
310 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
311 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
312
313 let stub = self.0.stub.clone();
314 let mut options = self.0.options.clone();
315 options.set_retry_policy(gax::retry_policy::NeverRetry);
316 let query = move |name| {
317 let stub = stub.clone();
318 let options = options.clone();
319 async {
320 let op = GetOperation::new(stub)
321 .set_name(name)
322 .with_options(options)
323 .send()
324 .await?;
325 Ok(Operation::new(op))
326 }
327 };
328
329 let start = move || async {
330 let op = self.send().await?;
331 Ok(Operation::new(op))
332 };
333
334 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
335 }
336
337 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
341 self.0.request.parent = v.into();
342 self
343 }
344
345 pub fn set_instance_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
349 self.0.request.instance_config_id = v.into();
350 self
351 }
352
353 pub fn set_instance_config<T>(mut self, v: T) -> Self
357 where
358 T: std::convert::Into<crate::model::InstanceConfig>,
359 {
360 self.0.request.instance_config = std::option::Option::Some(v.into());
361 self
362 }
363
364 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
368 where
369 T: std::convert::Into<crate::model::InstanceConfig>,
370 {
371 self.0.request.instance_config = v.map(|x| x.into());
372 self
373 }
374
375 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
377 self.0.request.validate_only = v.into();
378 self
379 }
380 }
381
382 #[doc(hidden)]
383 impl gax::options::internal::RequestBuilder for CreateInstanceConfig {
384 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
385 &mut self.0.options
386 }
387 }
388
389 #[derive(Clone, Debug)]
407 pub struct UpdateInstanceConfig(RequestBuilder<crate::model::UpdateInstanceConfigRequest>);
408
409 impl UpdateInstanceConfig {
410 pub(crate) fn new(
411 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
412 ) -> Self {
413 Self(RequestBuilder::new(stub))
414 }
415
416 pub fn with_request<V: Into<crate::model::UpdateInstanceConfigRequest>>(
418 mut self,
419 v: V,
420 ) -> Self {
421 self.0.request = v.into();
422 self
423 }
424
425 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
427 self.0.options = v.into();
428 self
429 }
430
431 pub async fn send(self) -> Result<longrunning::model::Operation> {
438 (*self.0.stub)
439 .update_instance_config(self.0.request, self.0.options)
440 .await
441 .map(gax::response::Response::into_body)
442 }
443
444 pub fn poller(
446 self,
447 ) -> impl lro::Poller<crate::model::InstanceConfig, crate::model::UpdateInstanceConfigMetadata>
448 {
449 type Operation = lro::internal::Operation<
450 crate::model::InstanceConfig,
451 crate::model::UpdateInstanceConfigMetadata,
452 >;
453 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
454 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
455
456 let stub = self.0.stub.clone();
457 let mut options = self.0.options.clone();
458 options.set_retry_policy(gax::retry_policy::NeverRetry);
459 let query = move |name| {
460 let stub = stub.clone();
461 let options = options.clone();
462 async {
463 let op = GetOperation::new(stub)
464 .set_name(name)
465 .with_options(options)
466 .send()
467 .await?;
468 Ok(Operation::new(op))
469 }
470 };
471
472 let start = move || async {
473 let op = self.send().await?;
474 Ok(Operation::new(op))
475 };
476
477 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
478 }
479
480 pub fn set_instance_config<T>(mut self, v: T) -> Self
484 where
485 T: std::convert::Into<crate::model::InstanceConfig>,
486 {
487 self.0.request.instance_config = std::option::Option::Some(v.into());
488 self
489 }
490
491 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
495 where
496 T: std::convert::Into<crate::model::InstanceConfig>,
497 {
498 self.0.request.instance_config = v.map(|x| x.into());
499 self
500 }
501
502 pub fn set_update_mask<T>(mut self, v: T) -> Self
506 where
507 T: std::convert::Into<wkt::FieldMask>,
508 {
509 self.0.request.update_mask = std::option::Option::Some(v.into());
510 self
511 }
512
513 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
517 where
518 T: std::convert::Into<wkt::FieldMask>,
519 {
520 self.0.request.update_mask = v.map(|x| x.into());
521 self
522 }
523
524 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
526 self.0.request.validate_only = v.into();
527 self
528 }
529 }
530
531 #[doc(hidden)]
532 impl gax::options::internal::RequestBuilder for UpdateInstanceConfig {
533 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
534 &mut self.0.options
535 }
536 }
537
538 #[derive(Clone, Debug)]
555 pub struct DeleteInstanceConfig(RequestBuilder<crate::model::DeleteInstanceConfigRequest>);
556
557 impl DeleteInstanceConfig {
558 pub(crate) fn new(
559 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
560 ) -> Self {
561 Self(RequestBuilder::new(stub))
562 }
563
564 pub fn with_request<V: Into<crate::model::DeleteInstanceConfigRequest>>(
566 mut self,
567 v: V,
568 ) -> Self {
569 self.0.request = v.into();
570 self
571 }
572
573 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
575 self.0.options = v.into();
576 self
577 }
578
579 pub async fn send(self) -> Result<()> {
581 (*self.0.stub)
582 .delete_instance_config(self.0.request, self.0.options)
583 .await
584 .map(gax::response::Response::into_body)
585 }
586
587 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
591 self.0.request.name = v.into();
592 self
593 }
594
595 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
597 self.0.request.etag = v.into();
598 self
599 }
600
601 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
603 self.0.request.validate_only = v.into();
604 self
605 }
606 }
607
608 #[doc(hidden)]
609 impl gax::options::internal::RequestBuilder for DeleteInstanceConfig {
610 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
611 &mut self.0.options
612 }
613 }
614
615 #[derive(Clone, Debug)]
636 pub struct ListInstanceConfigOperations(
637 RequestBuilder<crate::model::ListInstanceConfigOperationsRequest>,
638 );
639
640 impl ListInstanceConfigOperations {
641 pub(crate) fn new(
642 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
643 ) -> Self {
644 Self(RequestBuilder::new(stub))
645 }
646
647 pub fn with_request<V: Into<crate::model::ListInstanceConfigOperationsRequest>>(
649 mut self,
650 v: V,
651 ) -> Self {
652 self.0.request = v.into();
653 self
654 }
655
656 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
658 self.0.options = v.into();
659 self
660 }
661
662 pub async fn send(self) -> Result<crate::model::ListInstanceConfigOperationsResponse> {
664 (*self.0.stub)
665 .list_instance_config_operations(self.0.request, self.0.options)
666 .await
667 .map(gax::response::Response::into_body)
668 }
669
670 pub fn by_page(
672 self,
673 ) -> impl gax::paginator::Paginator<
674 crate::model::ListInstanceConfigOperationsResponse,
675 gax::error::Error,
676 > {
677 use std::clone::Clone;
678 let token = self.0.request.page_token.clone();
679 let execute = move |token: String| {
680 let mut builder = self.clone();
681 builder.0.request = builder.0.request.set_page_token(token);
682 builder.send()
683 };
684 gax::paginator::internal::new_paginator(token, execute)
685 }
686
687 pub fn by_item(
689 self,
690 ) -> impl gax::paginator::ItemPaginator<
691 crate::model::ListInstanceConfigOperationsResponse,
692 gax::error::Error,
693 > {
694 use gax::paginator::Paginator;
695 self.by_page().items()
696 }
697
698 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
702 self.0.request.parent = v.into();
703 self
704 }
705
706 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
708 self.0.request.filter = v.into();
709 self
710 }
711
712 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
714 self.0.request.page_size = v.into();
715 self
716 }
717
718 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
720 self.0.request.page_token = v.into();
721 self
722 }
723 }
724
725 #[doc(hidden)]
726 impl gax::options::internal::RequestBuilder for ListInstanceConfigOperations {
727 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
728 &mut self.0.options
729 }
730 }
731
732 #[derive(Clone, Debug)]
753 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
754
755 impl ListInstances {
756 pub(crate) fn new(
757 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
758 ) -> Self {
759 Self(RequestBuilder::new(stub))
760 }
761
762 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
764 self.0.request = v.into();
765 self
766 }
767
768 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
770 self.0.options = v.into();
771 self
772 }
773
774 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
776 (*self.0.stub)
777 .list_instances(self.0.request, self.0.options)
778 .await
779 .map(gax::response::Response::into_body)
780 }
781
782 pub fn by_page(
784 self,
785 ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
786 {
787 use std::clone::Clone;
788 let token = self.0.request.page_token.clone();
789 let execute = move |token: String| {
790 let mut builder = self.clone();
791 builder.0.request = builder.0.request.set_page_token(token);
792 builder.send()
793 };
794 gax::paginator::internal::new_paginator(token, execute)
795 }
796
797 pub fn by_item(
799 self,
800 ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
801 {
802 use gax::paginator::Paginator;
803 self.by_page().items()
804 }
805
806 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
810 self.0.request.parent = v.into();
811 self
812 }
813
814 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
816 self.0.request.page_size = v.into();
817 self
818 }
819
820 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
822 self.0.request.page_token = v.into();
823 self
824 }
825
826 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
828 self.0.request.filter = v.into();
829 self
830 }
831
832 pub fn set_instance_deadline<T>(mut self, v: T) -> Self
834 where
835 T: std::convert::Into<wkt::Timestamp>,
836 {
837 self.0.request.instance_deadline = std::option::Option::Some(v.into());
838 self
839 }
840
841 pub fn set_or_clear_instance_deadline<T>(mut self, v: std::option::Option<T>) -> Self
843 where
844 T: std::convert::Into<wkt::Timestamp>,
845 {
846 self.0.request.instance_deadline = v.map(|x| x.into());
847 self
848 }
849 }
850
851 #[doc(hidden)]
852 impl gax::options::internal::RequestBuilder for ListInstances {
853 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
854 &mut self.0.options
855 }
856 }
857
858 #[derive(Clone, Debug)]
879 pub struct ListInstancePartitions(RequestBuilder<crate::model::ListInstancePartitionsRequest>);
880
881 impl ListInstancePartitions {
882 pub(crate) fn new(
883 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
884 ) -> Self {
885 Self(RequestBuilder::new(stub))
886 }
887
888 pub fn with_request<V: Into<crate::model::ListInstancePartitionsRequest>>(
890 mut self,
891 v: V,
892 ) -> Self {
893 self.0.request = v.into();
894 self
895 }
896
897 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
899 self.0.options = v.into();
900 self
901 }
902
903 pub async fn send(self) -> Result<crate::model::ListInstancePartitionsResponse> {
905 (*self.0.stub)
906 .list_instance_partitions(self.0.request, self.0.options)
907 .await
908 .map(gax::response::Response::into_body)
909 }
910
911 pub fn by_page(
913 self,
914 ) -> impl gax::paginator::Paginator<
915 crate::model::ListInstancePartitionsResponse,
916 gax::error::Error,
917 > {
918 use std::clone::Clone;
919 let token = self.0.request.page_token.clone();
920 let execute = move |token: String| {
921 let mut builder = self.clone();
922 builder.0.request = builder.0.request.set_page_token(token);
923 builder.send()
924 };
925 gax::paginator::internal::new_paginator(token, execute)
926 }
927
928 pub fn by_item(
930 self,
931 ) -> impl gax::paginator::ItemPaginator<
932 crate::model::ListInstancePartitionsResponse,
933 gax::error::Error,
934 > {
935 use gax::paginator::Paginator;
936 self.by_page().items()
937 }
938
939 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
943 self.0.request.parent = v.into();
944 self
945 }
946
947 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
949 self.0.request.page_size = v.into();
950 self
951 }
952
953 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
955 self.0.request.page_token = v.into();
956 self
957 }
958
959 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
961 where
962 T: std::convert::Into<wkt::Timestamp>,
963 {
964 self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
965 self
966 }
967
968 pub fn set_or_clear_instance_partition_deadline<T>(
970 mut self,
971 v: std::option::Option<T>,
972 ) -> Self
973 where
974 T: std::convert::Into<wkt::Timestamp>,
975 {
976 self.0.request.instance_partition_deadline = v.map(|x| x.into());
977 self
978 }
979 }
980
981 #[doc(hidden)]
982 impl gax::options::internal::RequestBuilder for ListInstancePartitions {
983 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
984 &mut self.0.options
985 }
986 }
987
988 #[derive(Clone, Debug)]
1005 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1006
1007 impl GetInstance {
1008 pub(crate) fn new(
1009 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1010 ) -> Self {
1011 Self(RequestBuilder::new(stub))
1012 }
1013
1014 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1016 self.0.request = v.into();
1017 self
1018 }
1019
1020 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1022 self.0.options = v.into();
1023 self
1024 }
1025
1026 pub async fn send(self) -> Result<crate::model::Instance> {
1028 (*self.0.stub)
1029 .get_instance(self.0.request, self.0.options)
1030 .await
1031 .map(gax::response::Response::into_body)
1032 }
1033
1034 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1038 self.0.request.name = v.into();
1039 self
1040 }
1041
1042 pub fn set_field_mask<T>(mut self, v: T) -> Self
1044 where
1045 T: std::convert::Into<wkt::FieldMask>,
1046 {
1047 self.0.request.field_mask = std::option::Option::Some(v.into());
1048 self
1049 }
1050
1051 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1053 where
1054 T: std::convert::Into<wkt::FieldMask>,
1055 {
1056 self.0.request.field_mask = v.map(|x| x.into());
1057 self
1058 }
1059 }
1060
1061 #[doc(hidden)]
1062 impl gax::options::internal::RequestBuilder for GetInstance {
1063 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1064 &mut self.0.options
1065 }
1066 }
1067
1068 #[derive(Clone, Debug)]
1086 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1087
1088 impl CreateInstance {
1089 pub(crate) fn new(
1090 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1091 ) -> Self {
1092 Self(RequestBuilder::new(stub))
1093 }
1094
1095 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1097 self.0.request = v.into();
1098 self
1099 }
1100
1101 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1103 self.0.options = v.into();
1104 self
1105 }
1106
1107 pub async fn send(self) -> Result<longrunning::model::Operation> {
1114 (*self.0.stub)
1115 .create_instance(self.0.request, self.0.options)
1116 .await
1117 .map(gax::response::Response::into_body)
1118 }
1119
1120 pub fn poller(
1122 self,
1123 ) -> impl lro::Poller<crate::model::Instance, crate::model::CreateInstanceMetadata>
1124 {
1125 type Operation = lro::internal::Operation<
1126 crate::model::Instance,
1127 crate::model::CreateInstanceMetadata,
1128 >;
1129 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1130 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1131
1132 let stub = self.0.stub.clone();
1133 let mut options = self.0.options.clone();
1134 options.set_retry_policy(gax::retry_policy::NeverRetry);
1135 let query = move |name| {
1136 let stub = stub.clone();
1137 let options = options.clone();
1138 async {
1139 let op = GetOperation::new(stub)
1140 .set_name(name)
1141 .with_options(options)
1142 .send()
1143 .await?;
1144 Ok(Operation::new(op))
1145 }
1146 };
1147
1148 let start = move || async {
1149 let op = self.send().await?;
1150 Ok(Operation::new(op))
1151 };
1152
1153 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1154 }
1155
1156 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1160 self.0.request.parent = v.into();
1161 self
1162 }
1163
1164 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1168 self.0.request.instance_id = v.into();
1169 self
1170 }
1171
1172 pub fn set_instance<T>(mut self, v: T) -> Self
1176 where
1177 T: std::convert::Into<crate::model::Instance>,
1178 {
1179 self.0.request.instance = std::option::Option::Some(v.into());
1180 self
1181 }
1182
1183 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1187 where
1188 T: std::convert::Into<crate::model::Instance>,
1189 {
1190 self.0.request.instance = v.map(|x| x.into());
1191 self
1192 }
1193 }
1194
1195 #[doc(hidden)]
1196 impl gax::options::internal::RequestBuilder for CreateInstance {
1197 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1198 &mut self.0.options
1199 }
1200 }
1201
1202 #[derive(Clone, Debug)]
1220 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
1221
1222 impl UpdateInstance {
1223 pub(crate) fn new(
1224 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1225 ) -> Self {
1226 Self(RequestBuilder::new(stub))
1227 }
1228
1229 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
1231 self.0.request = v.into();
1232 self
1233 }
1234
1235 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1237 self.0.options = v.into();
1238 self
1239 }
1240
1241 pub async fn send(self) -> Result<longrunning::model::Operation> {
1248 (*self.0.stub)
1249 .update_instance(self.0.request, self.0.options)
1250 .await
1251 .map(gax::response::Response::into_body)
1252 }
1253
1254 pub fn poller(
1256 self,
1257 ) -> impl lro::Poller<crate::model::Instance, crate::model::UpdateInstanceMetadata>
1258 {
1259 type Operation = lro::internal::Operation<
1260 crate::model::Instance,
1261 crate::model::UpdateInstanceMetadata,
1262 >;
1263 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1264 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1265
1266 let stub = self.0.stub.clone();
1267 let mut options = self.0.options.clone();
1268 options.set_retry_policy(gax::retry_policy::NeverRetry);
1269 let query = move |name| {
1270 let stub = stub.clone();
1271 let options = options.clone();
1272 async {
1273 let op = GetOperation::new(stub)
1274 .set_name(name)
1275 .with_options(options)
1276 .send()
1277 .await?;
1278 Ok(Operation::new(op))
1279 }
1280 };
1281
1282 let start = move || async {
1283 let op = self.send().await?;
1284 Ok(Operation::new(op))
1285 };
1286
1287 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1288 }
1289
1290 pub fn set_instance<T>(mut self, v: T) -> Self
1294 where
1295 T: std::convert::Into<crate::model::Instance>,
1296 {
1297 self.0.request.instance = std::option::Option::Some(v.into());
1298 self
1299 }
1300
1301 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1305 where
1306 T: std::convert::Into<crate::model::Instance>,
1307 {
1308 self.0.request.instance = v.map(|x| x.into());
1309 self
1310 }
1311
1312 pub fn set_field_mask<T>(mut self, v: T) -> Self
1316 where
1317 T: std::convert::Into<wkt::FieldMask>,
1318 {
1319 self.0.request.field_mask = std::option::Option::Some(v.into());
1320 self
1321 }
1322
1323 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1327 where
1328 T: std::convert::Into<wkt::FieldMask>,
1329 {
1330 self.0.request.field_mask = v.map(|x| x.into());
1331 self
1332 }
1333 }
1334
1335 #[doc(hidden)]
1336 impl gax::options::internal::RequestBuilder for UpdateInstance {
1337 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1338 &mut self.0.options
1339 }
1340 }
1341
1342 #[derive(Clone, Debug)]
1359 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1360
1361 impl DeleteInstance {
1362 pub(crate) fn new(
1363 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1364 ) -> Self {
1365 Self(RequestBuilder::new(stub))
1366 }
1367
1368 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1370 self.0.request = v.into();
1371 self
1372 }
1373
1374 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1376 self.0.options = v.into();
1377 self
1378 }
1379
1380 pub async fn send(self) -> Result<()> {
1382 (*self.0.stub)
1383 .delete_instance(self.0.request, self.0.options)
1384 .await
1385 .map(gax::response::Response::into_body)
1386 }
1387
1388 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1392 self.0.request.name = v.into();
1393 self
1394 }
1395 }
1396
1397 #[doc(hidden)]
1398 impl gax::options::internal::RequestBuilder for DeleteInstance {
1399 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1400 &mut self.0.options
1401 }
1402 }
1403
1404 #[derive(Clone, Debug)]
1421 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1422
1423 impl SetIamPolicy {
1424 pub(crate) fn new(
1425 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1426 ) -> Self {
1427 Self(RequestBuilder::new(stub))
1428 }
1429
1430 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1432 self.0.request = v.into();
1433 self
1434 }
1435
1436 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1438 self.0.options = v.into();
1439 self
1440 }
1441
1442 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1444 (*self.0.stub)
1445 .set_iam_policy(self.0.request, self.0.options)
1446 .await
1447 .map(gax::response::Response::into_body)
1448 }
1449
1450 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1454 self.0.request.resource = v.into();
1455 self
1456 }
1457
1458 pub fn set_policy<T>(mut self, v: T) -> Self
1462 where
1463 T: std::convert::Into<iam_v1::model::Policy>,
1464 {
1465 self.0.request.policy = std::option::Option::Some(v.into());
1466 self
1467 }
1468
1469 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1473 where
1474 T: std::convert::Into<iam_v1::model::Policy>,
1475 {
1476 self.0.request.policy = v.map(|x| x.into());
1477 self
1478 }
1479
1480 pub fn set_update_mask<T>(mut self, v: T) -> Self
1482 where
1483 T: std::convert::Into<wkt::FieldMask>,
1484 {
1485 self.0.request.update_mask = std::option::Option::Some(v.into());
1486 self
1487 }
1488
1489 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1491 where
1492 T: std::convert::Into<wkt::FieldMask>,
1493 {
1494 self.0.request.update_mask = v.map(|x| x.into());
1495 self
1496 }
1497 }
1498
1499 #[doc(hidden)]
1500 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1501 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1502 &mut self.0.options
1503 }
1504 }
1505
1506 #[derive(Clone, Debug)]
1523 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1524
1525 impl GetIamPolicy {
1526 pub(crate) fn new(
1527 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1528 ) -> Self {
1529 Self(RequestBuilder::new(stub))
1530 }
1531
1532 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1534 self.0.request = v.into();
1535 self
1536 }
1537
1538 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1540 self.0.options = v.into();
1541 self
1542 }
1543
1544 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1546 (*self.0.stub)
1547 .get_iam_policy(self.0.request, self.0.options)
1548 .await
1549 .map(gax::response::Response::into_body)
1550 }
1551
1552 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1556 self.0.request.resource = v.into();
1557 self
1558 }
1559
1560 pub fn set_options<T>(mut self, v: T) -> Self
1562 where
1563 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1564 {
1565 self.0.request.options = std::option::Option::Some(v.into());
1566 self
1567 }
1568
1569 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1571 where
1572 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1573 {
1574 self.0.request.options = v.map(|x| x.into());
1575 self
1576 }
1577 }
1578
1579 #[doc(hidden)]
1580 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1581 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1582 &mut self.0.options
1583 }
1584 }
1585
1586 #[derive(Clone, Debug)]
1603 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1604
1605 impl TestIamPermissions {
1606 pub(crate) fn new(
1607 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1608 ) -> Self {
1609 Self(RequestBuilder::new(stub))
1610 }
1611
1612 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1614 mut self,
1615 v: V,
1616 ) -> Self {
1617 self.0.request = v.into();
1618 self
1619 }
1620
1621 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1623 self.0.options = v.into();
1624 self
1625 }
1626
1627 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1629 (*self.0.stub)
1630 .test_iam_permissions(self.0.request, self.0.options)
1631 .await
1632 .map(gax::response::Response::into_body)
1633 }
1634
1635 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1639 self.0.request.resource = v.into();
1640 self
1641 }
1642
1643 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1647 where
1648 T: std::iter::IntoIterator<Item = V>,
1649 V: std::convert::Into<std::string::String>,
1650 {
1651 use std::iter::Iterator;
1652 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1653 self
1654 }
1655 }
1656
1657 #[doc(hidden)]
1658 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1659 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1660 &mut self.0.options
1661 }
1662 }
1663
1664 #[derive(Clone, Debug)]
1681 pub struct GetInstancePartition(RequestBuilder<crate::model::GetInstancePartitionRequest>);
1682
1683 impl GetInstancePartition {
1684 pub(crate) fn new(
1685 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1686 ) -> Self {
1687 Self(RequestBuilder::new(stub))
1688 }
1689
1690 pub fn with_request<V: Into<crate::model::GetInstancePartitionRequest>>(
1692 mut self,
1693 v: V,
1694 ) -> Self {
1695 self.0.request = v.into();
1696 self
1697 }
1698
1699 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1701 self.0.options = v.into();
1702 self
1703 }
1704
1705 pub async fn send(self) -> Result<crate::model::InstancePartition> {
1707 (*self.0.stub)
1708 .get_instance_partition(self.0.request, self.0.options)
1709 .await
1710 .map(gax::response::Response::into_body)
1711 }
1712
1713 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1717 self.0.request.name = v.into();
1718 self
1719 }
1720 }
1721
1722 #[doc(hidden)]
1723 impl gax::options::internal::RequestBuilder for GetInstancePartition {
1724 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1725 &mut self.0.options
1726 }
1727 }
1728
1729 #[derive(Clone, Debug)]
1747 pub struct CreateInstancePartition(
1748 RequestBuilder<crate::model::CreateInstancePartitionRequest>,
1749 );
1750
1751 impl CreateInstancePartition {
1752 pub(crate) fn new(
1753 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1754 ) -> Self {
1755 Self(RequestBuilder::new(stub))
1756 }
1757
1758 pub fn with_request<V: Into<crate::model::CreateInstancePartitionRequest>>(
1760 mut self,
1761 v: V,
1762 ) -> Self {
1763 self.0.request = v.into();
1764 self
1765 }
1766
1767 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1769 self.0.options = v.into();
1770 self
1771 }
1772
1773 pub async fn send(self) -> Result<longrunning::model::Operation> {
1780 (*self.0.stub)
1781 .create_instance_partition(self.0.request, self.0.options)
1782 .await
1783 .map(gax::response::Response::into_body)
1784 }
1785
1786 pub fn poller(
1788 self,
1789 ) -> impl lro::Poller<
1790 crate::model::InstancePartition,
1791 crate::model::CreateInstancePartitionMetadata,
1792 > {
1793 type Operation = lro::internal::Operation<
1794 crate::model::InstancePartition,
1795 crate::model::CreateInstancePartitionMetadata,
1796 >;
1797 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1798 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1799
1800 let stub = self.0.stub.clone();
1801 let mut options = self.0.options.clone();
1802 options.set_retry_policy(gax::retry_policy::NeverRetry);
1803 let query = move |name| {
1804 let stub = stub.clone();
1805 let options = options.clone();
1806 async {
1807 let op = GetOperation::new(stub)
1808 .set_name(name)
1809 .with_options(options)
1810 .send()
1811 .await?;
1812 Ok(Operation::new(op))
1813 }
1814 };
1815
1816 let start = move || async {
1817 let op = self.send().await?;
1818 Ok(Operation::new(op))
1819 };
1820
1821 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1822 }
1823
1824 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1828 self.0.request.parent = v.into();
1829 self
1830 }
1831
1832 pub fn set_instance_partition_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1836 self.0.request.instance_partition_id = v.into();
1837 self
1838 }
1839
1840 pub fn set_instance_partition<T>(mut self, v: T) -> Self
1844 where
1845 T: std::convert::Into<crate::model::InstancePartition>,
1846 {
1847 self.0.request.instance_partition = std::option::Option::Some(v.into());
1848 self
1849 }
1850
1851 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
1855 where
1856 T: std::convert::Into<crate::model::InstancePartition>,
1857 {
1858 self.0.request.instance_partition = v.map(|x| x.into());
1859 self
1860 }
1861 }
1862
1863 #[doc(hidden)]
1864 impl gax::options::internal::RequestBuilder for CreateInstancePartition {
1865 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1866 &mut self.0.options
1867 }
1868 }
1869
1870 #[derive(Clone, Debug)]
1887 pub struct DeleteInstancePartition(
1888 RequestBuilder<crate::model::DeleteInstancePartitionRequest>,
1889 );
1890
1891 impl DeleteInstancePartition {
1892 pub(crate) fn new(
1893 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1894 ) -> Self {
1895 Self(RequestBuilder::new(stub))
1896 }
1897
1898 pub fn with_request<V: Into<crate::model::DeleteInstancePartitionRequest>>(
1900 mut self,
1901 v: V,
1902 ) -> Self {
1903 self.0.request = v.into();
1904 self
1905 }
1906
1907 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1909 self.0.options = v.into();
1910 self
1911 }
1912
1913 pub async fn send(self) -> Result<()> {
1915 (*self.0.stub)
1916 .delete_instance_partition(self.0.request, self.0.options)
1917 .await
1918 .map(gax::response::Response::into_body)
1919 }
1920
1921 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1925 self.0.request.name = v.into();
1926 self
1927 }
1928
1929 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1931 self.0.request.etag = v.into();
1932 self
1933 }
1934 }
1935
1936 #[doc(hidden)]
1937 impl gax::options::internal::RequestBuilder for DeleteInstancePartition {
1938 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1939 &mut self.0.options
1940 }
1941 }
1942
1943 #[derive(Clone, Debug)]
1961 pub struct UpdateInstancePartition(
1962 RequestBuilder<crate::model::UpdateInstancePartitionRequest>,
1963 );
1964
1965 impl UpdateInstancePartition {
1966 pub(crate) fn new(
1967 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1968 ) -> Self {
1969 Self(RequestBuilder::new(stub))
1970 }
1971
1972 pub fn with_request<V: Into<crate::model::UpdateInstancePartitionRequest>>(
1974 mut self,
1975 v: V,
1976 ) -> Self {
1977 self.0.request = v.into();
1978 self
1979 }
1980
1981 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1983 self.0.options = v.into();
1984 self
1985 }
1986
1987 pub async fn send(self) -> Result<longrunning::model::Operation> {
1994 (*self.0.stub)
1995 .update_instance_partition(self.0.request, self.0.options)
1996 .await
1997 .map(gax::response::Response::into_body)
1998 }
1999
2000 pub fn poller(
2002 self,
2003 ) -> impl lro::Poller<
2004 crate::model::InstancePartition,
2005 crate::model::UpdateInstancePartitionMetadata,
2006 > {
2007 type Operation = lro::internal::Operation<
2008 crate::model::InstancePartition,
2009 crate::model::UpdateInstancePartitionMetadata,
2010 >;
2011 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2012 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2013
2014 let stub = self.0.stub.clone();
2015 let mut options = self.0.options.clone();
2016 options.set_retry_policy(gax::retry_policy::NeverRetry);
2017 let query = move |name| {
2018 let stub = stub.clone();
2019 let options = options.clone();
2020 async {
2021 let op = GetOperation::new(stub)
2022 .set_name(name)
2023 .with_options(options)
2024 .send()
2025 .await?;
2026 Ok(Operation::new(op))
2027 }
2028 };
2029
2030 let start = move || async {
2031 let op = self.send().await?;
2032 Ok(Operation::new(op))
2033 };
2034
2035 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2036 }
2037
2038 pub fn set_instance_partition<T>(mut self, v: T) -> Self
2042 where
2043 T: std::convert::Into<crate::model::InstancePartition>,
2044 {
2045 self.0.request.instance_partition = std::option::Option::Some(v.into());
2046 self
2047 }
2048
2049 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
2053 where
2054 T: std::convert::Into<crate::model::InstancePartition>,
2055 {
2056 self.0.request.instance_partition = v.map(|x| x.into());
2057 self
2058 }
2059
2060 pub fn set_field_mask<T>(mut self, v: T) -> Self
2064 where
2065 T: std::convert::Into<wkt::FieldMask>,
2066 {
2067 self.0.request.field_mask = std::option::Option::Some(v.into());
2068 self
2069 }
2070
2071 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
2075 where
2076 T: std::convert::Into<wkt::FieldMask>,
2077 {
2078 self.0.request.field_mask = v.map(|x| x.into());
2079 self
2080 }
2081 }
2082
2083 #[doc(hidden)]
2084 impl gax::options::internal::RequestBuilder for UpdateInstancePartition {
2085 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2086 &mut self.0.options
2087 }
2088 }
2089
2090 #[derive(Clone, Debug)]
2111 pub struct ListInstancePartitionOperations(
2112 RequestBuilder<crate::model::ListInstancePartitionOperationsRequest>,
2113 );
2114
2115 impl ListInstancePartitionOperations {
2116 pub(crate) fn new(
2117 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2118 ) -> Self {
2119 Self(RequestBuilder::new(stub))
2120 }
2121
2122 pub fn with_request<V: Into<crate::model::ListInstancePartitionOperationsRequest>>(
2124 mut self,
2125 v: V,
2126 ) -> Self {
2127 self.0.request = v.into();
2128 self
2129 }
2130
2131 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2133 self.0.options = v.into();
2134 self
2135 }
2136
2137 pub async fn send(self) -> Result<crate::model::ListInstancePartitionOperationsResponse> {
2139 (*self.0.stub)
2140 .list_instance_partition_operations(self.0.request, self.0.options)
2141 .await
2142 .map(gax::response::Response::into_body)
2143 }
2144
2145 pub fn by_page(
2147 self,
2148 ) -> impl gax::paginator::Paginator<
2149 crate::model::ListInstancePartitionOperationsResponse,
2150 gax::error::Error,
2151 > {
2152 use std::clone::Clone;
2153 let token = self.0.request.page_token.clone();
2154 let execute = move |token: String| {
2155 let mut builder = self.clone();
2156 builder.0.request = builder.0.request.set_page_token(token);
2157 builder.send()
2158 };
2159 gax::paginator::internal::new_paginator(token, execute)
2160 }
2161
2162 pub fn by_item(
2164 self,
2165 ) -> impl gax::paginator::ItemPaginator<
2166 crate::model::ListInstancePartitionOperationsResponse,
2167 gax::error::Error,
2168 > {
2169 use gax::paginator::Paginator;
2170 self.by_page().items()
2171 }
2172
2173 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2177 self.0.request.parent = v.into();
2178 self
2179 }
2180
2181 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2183 self.0.request.filter = v.into();
2184 self
2185 }
2186
2187 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2189 self.0.request.page_size = v.into();
2190 self
2191 }
2192
2193 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2195 self.0.request.page_token = v.into();
2196 self
2197 }
2198
2199 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
2201 where
2202 T: std::convert::Into<wkt::Timestamp>,
2203 {
2204 self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
2205 self
2206 }
2207
2208 pub fn set_or_clear_instance_partition_deadline<T>(
2210 mut self,
2211 v: std::option::Option<T>,
2212 ) -> Self
2213 where
2214 T: std::convert::Into<wkt::Timestamp>,
2215 {
2216 self.0.request.instance_partition_deadline = v.map(|x| x.into());
2217 self
2218 }
2219 }
2220
2221 #[doc(hidden)]
2222 impl gax::options::internal::RequestBuilder for ListInstancePartitionOperations {
2223 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2224 &mut self.0.options
2225 }
2226 }
2227
2228 #[derive(Clone, Debug)]
2246 pub struct MoveInstance(RequestBuilder<crate::model::MoveInstanceRequest>);
2247
2248 impl MoveInstance {
2249 pub(crate) fn new(
2250 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2251 ) -> Self {
2252 Self(RequestBuilder::new(stub))
2253 }
2254
2255 pub fn with_request<V: Into<crate::model::MoveInstanceRequest>>(mut self, v: V) -> Self {
2257 self.0.request = v.into();
2258 self
2259 }
2260
2261 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2263 self.0.options = v.into();
2264 self
2265 }
2266
2267 pub async fn send(self) -> Result<longrunning::model::Operation> {
2274 (*self.0.stub)
2275 .move_instance(self.0.request, self.0.options)
2276 .await
2277 .map(gax::response::Response::into_body)
2278 }
2279
2280 pub fn poller(
2282 self,
2283 ) -> impl lro::Poller<crate::model::MoveInstanceResponse, crate::model::MoveInstanceMetadata>
2284 {
2285 type Operation = lro::internal::Operation<
2286 crate::model::MoveInstanceResponse,
2287 crate::model::MoveInstanceMetadata,
2288 >;
2289 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2290 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2291
2292 let stub = self.0.stub.clone();
2293 let mut options = self.0.options.clone();
2294 options.set_retry_policy(gax::retry_policy::NeverRetry);
2295 let query = move |name| {
2296 let stub = stub.clone();
2297 let options = options.clone();
2298 async {
2299 let op = GetOperation::new(stub)
2300 .set_name(name)
2301 .with_options(options)
2302 .send()
2303 .await?;
2304 Ok(Operation::new(op))
2305 }
2306 };
2307
2308 let start = move || async {
2309 let op = self.send().await?;
2310 Ok(Operation::new(op))
2311 };
2312
2313 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2314 }
2315
2316 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2320 self.0.request.name = v.into();
2321 self
2322 }
2323
2324 pub fn set_target_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2328 self.0.request.target_config = v.into();
2329 self
2330 }
2331 }
2332
2333 #[doc(hidden)]
2334 impl gax::options::internal::RequestBuilder for MoveInstance {
2335 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2336 &mut self.0.options
2337 }
2338 }
2339
2340 #[derive(Clone, Debug)]
2361 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2362
2363 impl ListOperations {
2364 pub(crate) fn new(
2365 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2366 ) -> Self {
2367 Self(RequestBuilder::new(stub))
2368 }
2369
2370 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2372 mut self,
2373 v: V,
2374 ) -> Self {
2375 self.0.request = v.into();
2376 self
2377 }
2378
2379 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2381 self.0.options = v.into();
2382 self
2383 }
2384
2385 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2387 (*self.0.stub)
2388 .list_operations(self.0.request, self.0.options)
2389 .await
2390 .map(gax::response::Response::into_body)
2391 }
2392
2393 pub fn by_page(
2395 self,
2396 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2397 {
2398 use std::clone::Clone;
2399 let token = self.0.request.page_token.clone();
2400 let execute = move |token: String| {
2401 let mut builder = self.clone();
2402 builder.0.request = builder.0.request.set_page_token(token);
2403 builder.send()
2404 };
2405 gax::paginator::internal::new_paginator(token, execute)
2406 }
2407
2408 pub fn by_item(
2410 self,
2411 ) -> impl gax::paginator::ItemPaginator<
2412 longrunning::model::ListOperationsResponse,
2413 gax::error::Error,
2414 > {
2415 use gax::paginator::Paginator;
2416 self.by_page().items()
2417 }
2418
2419 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2421 self.0.request.name = v.into();
2422 self
2423 }
2424
2425 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2427 self.0.request.filter = v.into();
2428 self
2429 }
2430
2431 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2433 self.0.request.page_size = v.into();
2434 self
2435 }
2436
2437 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2439 self.0.request.page_token = v.into();
2440 self
2441 }
2442
2443 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2445 self.0.request.return_partial_success = v.into();
2446 self
2447 }
2448 }
2449
2450 #[doc(hidden)]
2451 impl gax::options::internal::RequestBuilder for ListOperations {
2452 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2453 &mut self.0.options
2454 }
2455 }
2456
2457 #[derive(Clone, Debug)]
2474 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2475
2476 impl GetOperation {
2477 pub(crate) fn new(
2478 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2479 ) -> Self {
2480 Self(RequestBuilder::new(stub))
2481 }
2482
2483 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2485 mut self,
2486 v: V,
2487 ) -> Self {
2488 self.0.request = v.into();
2489 self
2490 }
2491
2492 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2494 self.0.options = v.into();
2495 self
2496 }
2497
2498 pub async fn send(self) -> Result<longrunning::model::Operation> {
2500 (*self.0.stub)
2501 .get_operation(self.0.request, self.0.options)
2502 .await
2503 .map(gax::response::Response::into_body)
2504 }
2505
2506 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2508 self.0.request.name = v.into();
2509 self
2510 }
2511 }
2512
2513 #[doc(hidden)]
2514 impl gax::options::internal::RequestBuilder for GetOperation {
2515 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2516 &mut self.0.options
2517 }
2518 }
2519
2520 #[derive(Clone, Debug)]
2537 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2538
2539 impl DeleteOperation {
2540 pub(crate) fn new(
2541 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2542 ) -> Self {
2543 Self(RequestBuilder::new(stub))
2544 }
2545
2546 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2548 mut self,
2549 v: V,
2550 ) -> 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<()> {
2563 (*self.0.stub)
2564 .delete_operation(self.0.request, self.0.options)
2565 .await
2566 .map(gax::response::Response::into_body)
2567 }
2568
2569 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2571 self.0.request.name = v.into();
2572 self
2573 }
2574 }
2575
2576 #[doc(hidden)]
2577 impl gax::options::internal::RequestBuilder for DeleteOperation {
2578 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2579 &mut self.0.options
2580 }
2581 }
2582
2583 #[derive(Clone, Debug)]
2600 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2601
2602 impl CancelOperation {
2603 pub(crate) fn new(
2604 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2605 ) -> Self {
2606 Self(RequestBuilder::new(stub))
2607 }
2608
2609 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2611 mut self,
2612 v: V,
2613 ) -> Self {
2614 self.0.request = v.into();
2615 self
2616 }
2617
2618 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2620 self.0.options = v.into();
2621 self
2622 }
2623
2624 pub async fn send(self) -> Result<()> {
2626 (*self.0.stub)
2627 .cancel_operation(self.0.request, self.0.options)
2628 .await
2629 .map(gax::response::Response::into_body)
2630 }
2631
2632 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2634 self.0.request.name = v.into();
2635 self
2636 }
2637 }
2638
2639 #[doc(hidden)]
2640 impl gax::options::internal::RequestBuilder for CancelOperation {
2641 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2642 &mut self.0.options
2643 }
2644 }
2645}