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)]
96 pub struct ListInstanceConfigs(RequestBuilder<crate::model::ListInstanceConfigsRequest>);
97
98 impl ListInstanceConfigs {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 pub fn with_request<V: Into<crate::model::ListInstanceConfigsRequest>>(
107 mut self,
108 v: V,
109 ) -> Self {
110 self.0.request = v.into();
111 self
112 }
113
114 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
116 self.0.options = v.into();
117 self
118 }
119
120 pub async fn send(self) -> Result<crate::model::ListInstanceConfigsResponse> {
122 (*self.0.stub)
123 .list_instance_configs(self.0.request, self.0.options)
124 .await
125 .map(gax::response::Response::into_body)
126 }
127
128 pub fn by_page(
130 self,
131 ) -> impl gax::paginator::Paginator<crate::model::ListInstanceConfigsResponse, gax::error::Error>
132 {
133 use std::clone::Clone;
134 let token = self.0.request.page_token.clone();
135 let execute = move |token: String| {
136 let mut builder = self.clone();
137 builder.0.request = builder.0.request.set_page_token(token);
138 builder.send()
139 };
140 gax::paginator::internal::new_paginator(token, execute)
141 }
142
143 pub fn by_item(
145 self,
146 ) -> impl gax::paginator::ItemPaginator<
147 crate::model::ListInstanceConfigsResponse,
148 gax::error::Error,
149 > {
150 use gax::paginator::Paginator;
151 self.by_page().items()
152 }
153
154 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
158 self.0.request.parent = v.into();
159 self
160 }
161
162 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
164 self.0.request.page_size = v.into();
165 self
166 }
167
168 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
170 self.0.request.page_token = v.into();
171 self
172 }
173 }
174
175 #[doc(hidden)]
176 impl gax::options::internal::RequestBuilder for ListInstanceConfigs {
177 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
178 &mut self.0.options
179 }
180 }
181
182 #[derive(Clone, Debug)]
200 pub struct GetInstanceConfig(RequestBuilder<crate::model::GetInstanceConfigRequest>);
201
202 impl GetInstanceConfig {
203 pub(crate) fn new(
204 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
205 ) -> Self {
206 Self(RequestBuilder::new(stub))
207 }
208
209 pub fn with_request<V: Into<crate::model::GetInstanceConfigRequest>>(
211 mut self,
212 v: V,
213 ) -> Self {
214 self.0.request = v.into();
215 self
216 }
217
218 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
220 self.0.options = v.into();
221 self
222 }
223
224 pub async fn send(self) -> Result<crate::model::InstanceConfig> {
226 (*self.0.stub)
227 .get_instance_config(self.0.request, self.0.options)
228 .await
229 .map(gax::response::Response::into_body)
230 }
231
232 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
236 self.0.request.name = v.into();
237 self
238 }
239 }
240
241 #[doc(hidden)]
242 impl gax::options::internal::RequestBuilder for GetInstanceConfig {
243 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
244 &mut self.0.options
245 }
246 }
247
248 #[derive(Clone, Debug)]
267 pub struct CreateInstanceConfig(RequestBuilder<crate::model::CreateInstanceConfigRequest>);
268
269 impl CreateInstanceConfig {
270 pub(crate) fn new(
271 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
272 ) -> Self {
273 Self(RequestBuilder::new(stub))
274 }
275
276 pub fn with_request<V: Into<crate::model::CreateInstanceConfigRequest>>(
278 mut self,
279 v: V,
280 ) -> Self {
281 self.0.request = v.into();
282 self
283 }
284
285 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
287 self.0.options = v.into();
288 self
289 }
290
291 pub async fn send(self) -> Result<longrunning::model::Operation> {
298 (*self.0.stub)
299 .create_instance_config(self.0.request, self.0.options)
300 .await
301 .map(gax::response::Response::into_body)
302 }
303
304 pub fn poller(
306 self,
307 ) -> impl lro::Poller<crate::model::InstanceConfig, crate::model::CreateInstanceConfigMetadata>
308 {
309 type Operation = lro::internal::Operation<
310 crate::model::InstanceConfig,
311 crate::model::CreateInstanceConfigMetadata,
312 >;
313 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
314 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
315
316 let stub = self.0.stub.clone();
317 let mut options = self.0.options.clone();
318 options.set_retry_policy(gax::retry_policy::NeverRetry);
319 let query = move |name| {
320 let stub = stub.clone();
321 let options = options.clone();
322 async {
323 let op = GetOperation::new(stub)
324 .set_name(name)
325 .with_options(options)
326 .send()
327 .await?;
328 Ok(Operation::new(op))
329 }
330 };
331
332 let start = move || async {
333 let op = self.send().await?;
334 Ok(Operation::new(op))
335 };
336
337 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
338 }
339
340 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
344 self.0.request.parent = v.into();
345 self
346 }
347
348 pub fn set_instance_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
352 self.0.request.instance_config_id = v.into();
353 self
354 }
355
356 pub fn set_instance_config<T>(mut self, v: T) -> Self
360 where
361 T: std::convert::Into<crate::model::InstanceConfig>,
362 {
363 self.0.request.instance_config = std::option::Option::Some(v.into());
364 self
365 }
366
367 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
371 where
372 T: std::convert::Into<crate::model::InstanceConfig>,
373 {
374 self.0.request.instance_config = v.map(|x| x.into());
375 self
376 }
377
378 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
380 self.0.request.validate_only = v.into();
381 self
382 }
383 }
384
385 #[doc(hidden)]
386 impl gax::options::internal::RequestBuilder for CreateInstanceConfig {
387 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
388 &mut self.0.options
389 }
390 }
391
392 #[derive(Clone, Debug)]
411 pub struct UpdateInstanceConfig(RequestBuilder<crate::model::UpdateInstanceConfigRequest>);
412
413 impl UpdateInstanceConfig {
414 pub(crate) fn new(
415 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
416 ) -> Self {
417 Self(RequestBuilder::new(stub))
418 }
419
420 pub fn with_request<V: Into<crate::model::UpdateInstanceConfigRequest>>(
422 mut self,
423 v: V,
424 ) -> Self {
425 self.0.request = v.into();
426 self
427 }
428
429 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
431 self.0.options = v.into();
432 self
433 }
434
435 pub async fn send(self) -> Result<longrunning::model::Operation> {
442 (*self.0.stub)
443 .update_instance_config(self.0.request, self.0.options)
444 .await
445 .map(gax::response::Response::into_body)
446 }
447
448 pub fn poller(
450 self,
451 ) -> impl lro::Poller<crate::model::InstanceConfig, crate::model::UpdateInstanceConfigMetadata>
452 {
453 type Operation = lro::internal::Operation<
454 crate::model::InstanceConfig,
455 crate::model::UpdateInstanceConfigMetadata,
456 >;
457 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
458 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
459
460 let stub = self.0.stub.clone();
461 let mut options = self.0.options.clone();
462 options.set_retry_policy(gax::retry_policy::NeverRetry);
463 let query = move |name| {
464 let stub = stub.clone();
465 let options = options.clone();
466 async {
467 let op = GetOperation::new(stub)
468 .set_name(name)
469 .with_options(options)
470 .send()
471 .await?;
472 Ok(Operation::new(op))
473 }
474 };
475
476 let start = move || async {
477 let op = self.send().await?;
478 Ok(Operation::new(op))
479 };
480
481 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
482 }
483
484 pub fn set_instance_config<T>(mut self, v: T) -> Self
488 where
489 T: std::convert::Into<crate::model::InstanceConfig>,
490 {
491 self.0.request.instance_config = std::option::Option::Some(v.into());
492 self
493 }
494
495 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
499 where
500 T: std::convert::Into<crate::model::InstanceConfig>,
501 {
502 self.0.request.instance_config = v.map(|x| x.into());
503 self
504 }
505
506 pub fn set_update_mask<T>(mut self, v: T) -> Self
510 where
511 T: std::convert::Into<wkt::FieldMask>,
512 {
513 self.0.request.update_mask = std::option::Option::Some(v.into());
514 self
515 }
516
517 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
521 where
522 T: std::convert::Into<wkt::FieldMask>,
523 {
524 self.0.request.update_mask = v.map(|x| x.into());
525 self
526 }
527
528 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
530 self.0.request.validate_only = v.into();
531 self
532 }
533 }
534
535 #[doc(hidden)]
536 impl gax::options::internal::RequestBuilder for UpdateInstanceConfig {
537 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
538 &mut self.0.options
539 }
540 }
541
542 #[derive(Clone, Debug)]
560 pub struct DeleteInstanceConfig(RequestBuilder<crate::model::DeleteInstanceConfigRequest>);
561
562 impl DeleteInstanceConfig {
563 pub(crate) fn new(
564 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
565 ) -> Self {
566 Self(RequestBuilder::new(stub))
567 }
568
569 pub fn with_request<V: Into<crate::model::DeleteInstanceConfigRequest>>(
571 mut self,
572 v: V,
573 ) -> Self {
574 self.0.request = v.into();
575 self
576 }
577
578 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
580 self.0.options = v.into();
581 self
582 }
583
584 pub async fn send(self) -> Result<()> {
586 (*self.0.stub)
587 .delete_instance_config(self.0.request, self.0.options)
588 .await
589 .map(gax::response::Response::into_body)
590 }
591
592 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
596 self.0.request.name = v.into();
597 self
598 }
599
600 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
602 self.0.request.etag = v.into();
603 self
604 }
605
606 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
608 self.0.request.validate_only = v.into();
609 self
610 }
611 }
612
613 #[doc(hidden)]
614 impl gax::options::internal::RequestBuilder for DeleteInstanceConfig {
615 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
616 &mut self.0.options
617 }
618 }
619
620 #[derive(Clone, Debug)]
642 pub struct ListInstanceConfigOperations(
643 RequestBuilder<crate::model::ListInstanceConfigOperationsRequest>,
644 );
645
646 impl ListInstanceConfigOperations {
647 pub(crate) fn new(
648 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
649 ) -> Self {
650 Self(RequestBuilder::new(stub))
651 }
652
653 pub fn with_request<V: Into<crate::model::ListInstanceConfigOperationsRequest>>(
655 mut self,
656 v: V,
657 ) -> Self {
658 self.0.request = v.into();
659 self
660 }
661
662 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
664 self.0.options = v.into();
665 self
666 }
667
668 pub async fn send(self) -> Result<crate::model::ListInstanceConfigOperationsResponse> {
670 (*self.0.stub)
671 .list_instance_config_operations(self.0.request, self.0.options)
672 .await
673 .map(gax::response::Response::into_body)
674 }
675
676 pub fn by_page(
678 self,
679 ) -> impl gax::paginator::Paginator<
680 crate::model::ListInstanceConfigOperationsResponse,
681 gax::error::Error,
682 > {
683 use std::clone::Clone;
684 let token = self.0.request.page_token.clone();
685 let execute = move |token: String| {
686 let mut builder = self.clone();
687 builder.0.request = builder.0.request.set_page_token(token);
688 builder.send()
689 };
690 gax::paginator::internal::new_paginator(token, execute)
691 }
692
693 pub fn by_item(
695 self,
696 ) -> impl gax::paginator::ItemPaginator<
697 crate::model::ListInstanceConfigOperationsResponse,
698 gax::error::Error,
699 > {
700 use gax::paginator::Paginator;
701 self.by_page().items()
702 }
703
704 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
708 self.0.request.parent = v.into();
709 self
710 }
711
712 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
714 self.0.request.filter = v.into();
715 self
716 }
717
718 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
720 self.0.request.page_size = v.into();
721 self
722 }
723
724 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
726 self.0.request.page_token = v.into();
727 self
728 }
729 }
730
731 #[doc(hidden)]
732 impl gax::options::internal::RequestBuilder for ListInstanceConfigOperations {
733 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
734 &mut self.0.options
735 }
736 }
737
738 #[derive(Clone, Debug)]
760 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
761
762 impl ListInstances {
763 pub(crate) fn new(
764 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
765 ) -> Self {
766 Self(RequestBuilder::new(stub))
767 }
768
769 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
771 self.0.request = v.into();
772 self
773 }
774
775 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
777 self.0.options = v.into();
778 self
779 }
780
781 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
783 (*self.0.stub)
784 .list_instances(self.0.request, self.0.options)
785 .await
786 .map(gax::response::Response::into_body)
787 }
788
789 pub fn by_page(
791 self,
792 ) -> impl gax::paginator::Paginator<crate::model::ListInstancesResponse, gax::error::Error>
793 {
794 use std::clone::Clone;
795 let token = self.0.request.page_token.clone();
796 let execute = move |token: String| {
797 let mut builder = self.clone();
798 builder.0.request = builder.0.request.set_page_token(token);
799 builder.send()
800 };
801 gax::paginator::internal::new_paginator(token, execute)
802 }
803
804 pub fn by_item(
806 self,
807 ) -> impl gax::paginator::ItemPaginator<crate::model::ListInstancesResponse, gax::error::Error>
808 {
809 use gax::paginator::Paginator;
810 self.by_page().items()
811 }
812
813 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
817 self.0.request.parent = v.into();
818 self
819 }
820
821 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
823 self.0.request.page_size = v.into();
824 self
825 }
826
827 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
829 self.0.request.page_token = v.into();
830 self
831 }
832
833 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
835 self.0.request.filter = v.into();
836 self
837 }
838
839 pub fn set_instance_deadline<T>(mut self, v: T) -> Self
841 where
842 T: std::convert::Into<wkt::Timestamp>,
843 {
844 self.0.request.instance_deadline = std::option::Option::Some(v.into());
845 self
846 }
847
848 pub fn set_or_clear_instance_deadline<T>(mut self, v: std::option::Option<T>) -> Self
850 where
851 T: std::convert::Into<wkt::Timestamp>,
852 {
853 self.0.request.instance_deadline = v.map(|x| x.into());
854 self
855 }
856 }
857
858 #[doc(hidden)]
859 impl gax::options::internal::RequestBuilder for ListInstances {
860 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
861 &mut self.0.options
862 }
863 }
864
865 #[derive(Clone, Debug)]
887 pub struct ListInstancePartitions(RequestBuilder<crate::model::ListInstancePartitionsRequest>);
888
889 impl ListInstancePartitions {
890 pub(crate) fn new(
891 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
892 ) -> Self {
893 Self(RequestBuilder::new(stub))
894 }
895
896 pub fn with_request<V: Into<crate::model::ListInstancePartitionsRequest>>(
898 mut self,
899 v: V,
900 ) -> Self {
901 self.0.request = v.into();
902 self
903 }
904
905 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
907 self.0.options = v.into();
908 self
909 }
910
911 pub async fn send(self) -> Result<crate::model::ListInstancePartitionsResponse> {
913 (*self.0.stub)
914 .list_instance_partitions(self.0.request, self.0.options)
915 .await
916 .map(gax::response::Response::into_body)
917 }
918
919 pub fn by_page(
921 self,
922 ) -> impl gax::paginator::Paginator<
923 crate::model::ListInstancePartitionsResponse,
924 gax::error::Error,
925 > {
926 use std::clone::Clone;
927 let token = self.0.request.page_token.clone();
928 let execute = move |token: String| {
929 let mut builder = self.clone();
930 builder.0.request = builder.0.request.set_page_token(token);
931 builder.send()
932 };
933 gax::paginator::internal::new_paginator(token, execute)
934 }
935
936 pub fn by_item(
938 self,
939 ) -> impl gax::paginator::ItemPaginator<
940 crate::model::ListInstancePartitionsResponse,
941 gax::error::Error,
942 > {
943 use gax::paginator::Paginator;
944 self.by_page().items()
945 }
946
947 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
951 self.0.request.parent = v.into();
952 self
953 }
954
955 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
957 self.0.request.page_size = v.into();
958 self
959 }
960
961 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
963 self.0.request.page_token = v.into();
964 self
965 }
966
967 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
969 where
970 T: std::convert::Into<wkt::Timestamp>,
971 {
972 self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
973 self
974 }
975
976 pub fn set_or_clear_instance_partition_deadline<T>(
978 mut self,
979 v: std::option::Option<T>,
980 ) -> Self
981 where
982 T: std::convert::Into<wkt::Timestamp>,
983 {
984 self.0.request.instance_partition_deadline = v.map(|x| x.into());
985 self
986 }
987 }
988
989 #[doc(hidden)]
990 impl gax::options::internal::RequestBuilder for ListInstancePartitions {
991 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
992 &mut self.0.options
993 }
994 }
995
996 #[derive(Clone, Debug)]
1014 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1015
1016 impl GetInstance {
1017 pub(crate) fn new(
1018 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1019 ) -> Self {
1020 Self(RequestBuilder::new(stub))
1021 }
1022
1023 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1025 self.0.request = v.into();
1026 self
1027 }
1028
1029 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1031 self.0.options = v.into();
1032 self
1033 }
1034
1035 pub async fn send(self) -> Result<crate::model::Instance> {
1037 (*self.0.stub)
1038 .get_instance(self.0.request, self.0.options)
1039 .await
1040 .map(gax::response::Response::into_body)
1041 }
1042
1043 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1047 self.0.request.name = v.into();
1048 self
1049 }
1050
1051 pub fn set_field_mask<T>(mut self, v: T) -> Self
1053 where
1054 T: std::convert::Into<wkt::FieldMask>,
1055 {
1056 self.0.request.field_mask = std::option::Option::Some(v.into());
1057 self
1058 }
1059
1060 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1062 where
1063 T: std::convert::Into<wkt::FieldMask>,
1064 {
1065 self.0.request.field_mask = v.map(|x| x.into());
1066 self
1067 }
1068 }
1069
1070 #[doc(hidden)]
1071 impl gax::options::internal::RequestBuilder for GetInstance {
1072 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1073 &mut self.0.options
1074 }
1075 }
1076
1077 #[derive(Clone, Debug)]
1096 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1097
1098 impl CreateInstance {
1099 pub(crate) fn new(
1100 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1101 ) -> Self {
1102 Self(RequestBuilder::new(stub))
1103 }
1104
1105 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1107 self.0.request = v.into();
1108 self
1109 }
1110
1111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1113 self.0.options = v.into();
1114 self
1115 }
1116
1117 pub async fn send(self) -> Result<longrunning::model::Operation> {
1124 (*self.0.stub)
1125 .create_instance(self.0.request, self.0.options)
1126 .await
1127 .map(gax::response::Response::into_body)
1128 }
1129
1130 pub fn poller(
1132 self,
1133 ) -> impl lro::Poller<crate::model::Instance, crate::model::CreateInstanceMetadata>
1134 {
1135 type Operation = lro::internal::Operation<
1136 crate::model::Instance,
1137 crate::model::CreateInstanceMetadata,
1138 >;
1139 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1140 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1141
1142 let stub = self.0.stub.clone();
1143 let mut options = self.0.options.clone();
1144 options.set_retry_policy(gax::retry_policy::NeverRetry);
1145 let query = move |name| {
1146 let stub = stub.clone();
1147 let options = options.clone();
1148 async {
1149 let op = GetOperation::new(stub)
1150 .set_name(name)
1151 .with_options(options)
1152 .send()
1153 .await?;
1154 Ok(Operation::new(op))
1155 }
1156 };
1157
1158 let start = move || async {
1159 let op = self.send().await?;
1160 Ok(Operation::new(op))
1161 };
1162
1163 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1164 }
1165
1166 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1170 self.0.request.parent = v.into();
1171 self
1172 }
1173
1174 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1178 self.0.request.instance_id = v.into();
1179 self
1180 }
1181
1182 pub fn set_instance<T>(mut self, v: T) -> Self
1186 where
1187 T: std::convert::Into<crate::model::Instance>,
1188 {
1189 self.0.request.instance = std::option::Option::Some(v.into());
1190 self
1191 }
1192
1193 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1197 where
1198 T: std::convert::Into<crate::model::Instance>,
1199 {
1200 self.0.request.instance = v.map(|x| x.into());
1201 self
1202 }
1203 }
1204
1205 #[doc(hidden)]
1206 impl gax::options::internal::RequestBuilder for CreateInstance {
1207 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1208 &mut self.0.options
1209 }
1210 }
1211
1212 #[derive(Clone, Debug)]
1231 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
1232
1233 impl UpdateInstance {
1234 pub(crate) fn new(
1235 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1236 ) -> Self {
1237 Self(RequestBuilder::new(stub))
1238 }
1239
1240 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
1242 self.0.request = v.into();
1243 self
1244 }
1245
1246 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1248 self.0.options = v.into();
1249 self
1250 }
1251
1252 pub async fn send(self) -> Result<longrunning::model::Operation> {
1259 (*self.0.stub)
1260 .update_instance(self.0.request, self.0.options)
1261 .await
1262 .map(gax::response::Response::into_body)
1263 }
1264
1265 pub fn poller(
1267 self,
1268 ) -> impl lro::Poller<crate::model::Instance, crate::model::UpdateInstanceMetadata>
1269 {
1270 type Operation = lro::internal::Operation<
1271 crate::model::Instance,
1272 crate::model::UpdateInstanceMetadata,
1273 >;
1274 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1275 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1276
1277 let stub = self.0.stub.clone();
1278 let mut options = self.0.options.clone();
1279 options.set_retry_policy(gax::retry_policy::NeverRetry);
1280 let query = move |name| {
1281 let stub = stub.clone();
1282 let options = options.clone();
1283 async {
1284 let op = GetOperation::new(stub)
1285 .set_name(name)
1286 .with_options(options)
1287 .send()
1288 .await?;
1289 Ok(Operation::new(op))
1290 }
1291 };
1292
1293 let start = move || async {
1294 let op = self.send().await?;
1295 Ok(Operation::new(op))
1296 };
1297
1298 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1299 }
1300
1301 pub fn set_instance<T>(mut self, v: T) -> Self
1305 where
1306 T: std::convert::Into<crate::model::Instance>,
1307 {
1308 self.0.request.instance = std::option::Option::Some(v.into());
1309 self
1310 }
1311
1312 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1316 where
1317 T: std::convert::Into<crate::model::Instance>,
1318 {
1319 self.0.request.instance = v.map(|x| x.into());
1320 self
1321 }
1322
1323 pub fn set_field_mask<T>(mut self, v: T) -> Self
1327 where
1328 T: std::convert::Into<wkt::FieldMask>,
1329 {
1330 self.0.request.field_mask = std::option::Option::Some(v.into());
1331 self
1332 }
1333
1334 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1338 where
1339 T: std::convert::Into<wkt::FieldMask>,
1340 {
1341 self.0.request.field_mask = v.map(|x| x.into());
1342 self
1343 }
1344 }
1345
1346 #[doc(hidden)]
1347 impl gax::options::internal::RequestBuilder for UpdateInstance {
1348 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1349 &mut self.0.options
1350 }
1351 }
1352
1353 #[derive(Clone, Debug)]
1371 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1372
1373 impl DeleteInstance {
1374 pub(crate) fn new(
1375 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1376 ) -> Self {
1377 Self(RequestBuilder::new(stub))
1378 }
1379
1380 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1382 self.0.request = v.into();
1383 self
1384 }
1385
1386 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1388 self.0.options = v.into();
1389 self
1390 }
1391
1392 pub async fn send(self) -> Result<()> {
1394 (*self.0.stub)
1395 .delete_instance(self.0.request, self.0.options)
1396 .await
1397 .map(gax::response::Response::into_body)
1398 }
1399
1400 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1404 self.0.request.name = v.into();
1405 self
1406 }
1407 }
1408
1409 #[doc(hidden)]
1410 impl gax::options::internal::RequestBuilder for DeleteInstance {
1411 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1412 &mut self.0.options
1413 }
1414 }
1415
1416 #[derive(Clone, Debug)]
1434 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1435
1436 impl SetIamPolicy {
1437 pub(crate) fn new(
1438 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1439 ) -> Self {
1440 Self(RequestBuilder::new(stub))
1441 }
1442
1443 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1445 self.0.request = v.into();
1446 self
1447 }
1448
1449 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1451 self.0.options = v.into();
1452 self
1453 }
1454
1455 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1457 (*self.0.stub)
1458 .set_iam_policy(self.0.request, self.0.options)
1459 .await
1460 .map(gax::response::Response::into_body)
1461 }
1462
1463 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1467 self.0.request.resource = v.into();
1468 self
1469 }
1470
1471 pub fn set_policy<T>(mut self, v: T) -> Self
1475 where
1476 T: std::convert::Into<iam_v1::model::Policy>,
1477 {
1478 self.0.request.policy = std::option::Option::Some(v.into());
1479 self
1480 }
1481
1482 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1486 where
1487 T: std::convert::Into<iam_v1::model::Policy>,
1488 {
1489 self.0.request.policy = v.map(|x| x.into());
1490 self
1491 }
1492
1493 pub fn set_update_mask<T>(mut self, v: T) -> Self
1495 where
1496 T: std::convert::Into<wkt::FieldMask>,
1497 {
1498 self.0.request.update_mask = std::option::Option::Some(v.into());
1499 self
1500 }
1501
1502 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1504 where
1505 T: std::convert::Into<wkt::FieldMask>,
1506 {
1507 self.0.request.update_mask = v.map(|x| x.into());
1508 self
1509 }
1510 }
1511
1512 #[doc(hidden)]
1513 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1514 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1515 &mut self.0.options
1516 }
1517 }
1518
1519 #[derive(Clone, Debug)]
1537 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1538
1539 impl GetIamPolicy {
1540 pub(crate) fn new(
1541 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1542 ) -> Self {
1543 Self(RequestBuilder::new(stub))
1544 }
1545
1546 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1548 self.0.request = v.into();
1549 self
1550 }
1551
1552 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1554 self.0.options = v.into();
1555 self
1556 }
1557
1558 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1560 (*self.0.stub)
1561 .get_iam_policy(self.0.request, self.0.options)
1562 .await
1563 .map(gax::response::Response::into_body)
1564 }
1565
1566 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1570 self.0.request.resource = v.into();
1571 self
1572 }
1573
1574 pub fn set_options<T>(mut self, v: T) -> Self
1576 where
1577 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1578 {
1579 self.0.request.options = std::option::Option::Some(v.into());
1580 self
1581 }
1582
1583 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1585 where
1586 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1587 {
1588 self.0.request.options = v.map(|x| x.into());
1589 self
1590 }
1591 }
1592
1593 #[doc(hidden)]
1594 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1595 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1596 &mut self.0.options
1597 }
1598 }
1599
1600 #[derive(Clone, Debug)]
1618 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1619
1620 impl TestIamPermissions {
1621 pub(crate) fn new(
1622 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1623 ) -> Self {
1624 Self(RequestBuilder::new(stub))
1625 }
1626
1627 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1629 mut self,
1630 v: V,
1631 ) -> Self {
1632 self.0.request = v.into();
1633 self
1634 }
1635
1636 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1638 self.0.options = v.into();
1639 self
1640 }
1641
1642 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1644 (*self.0.stub)
1645 .test_iam_permissions(self.0.request, self.0.options)
1646 .await
1647 .map(gax::response::Response::into_body)
1648 }
1649
1650 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.0.request.resource = v.into();
1655 self
1656 }
1657
1658 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1662 where
1663 T: std::iter::IntoIterator<Item = V>,
1664 V: std::convert::Into<std::string::String>,
1665 {
1666 use std::iter::Iterator;
1667 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1668 self
1669 }
1670 }
1671
1672 #[doc(hidden)]
1673 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1674 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1675 &mut self.0.options
1676 }
1677 }
1678
1679 #[derive(Clone, Debug)]
1697 pub struct GetInstancePartition(RequestBuilder<crate::model::GetInstancePartitionRequest>);
1698
1699 impl GetInstancePartition {
1700 pub(crate) fn new(
1701 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1702 ) -> Self {
1703 Self(RequestBuilder::new(stub))
1704 }
1705
1706 pub fn with_request<V: Into<crate::model::GetInstancePartitionRequest>>(
1708 mut self,
1709 v: V,
1710 ) -> Self {
1711 self.0.request = v.into();
1712 self
1713 }
1714
1715 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1717 self.0.options = v.into();
1718 self
1719 }
1720
1721 pub async fn send(self) -> Result<crate::model::InstancePartition> {
1723 (*self.0.stub)
1724 .get_instance_partition(self.0.request, self.0.options)
1725 .await
1726 .map(gax::response::Response::into_body)
1727 }
1728
1729 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1733 self.0.request.name = v.into();
1734 self
1735 }
1736 }
1737
1738 #[doc(hidden)]
1739 impl gax::options::internal::RequestBuilder for GetInstancePartition {
1740 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1741 &mut self.0.options
1742 }
1743 }
1744
1745 #[derive(Clone, Debug)]
1764 pub struct CreateInstancePartition(
1765 RequestBuilder<crate::model::CreateInstancePartitionRequest>,
1766 );
1767
1768 impl CreateInstancePartition {
1769 pub(crate) fn new(
1770 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1771 ) -> Self {
1772 Self(RequestBuilder::new(stub))
1773 }
1774
1775 pub fn with_request<V: Into<crate::model::CreateInstancePartitionRequest>>(
1777 mut self,
1778 v: V,
1779 ) -> Self {
1780 self.0.request = v.into();
1781 self
1782 }
1783
1784 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1786 self.0.options = v.into();
1787 self
1788 }
1789
1790 pub async fn send(self) -> Result<longrunning::model::Operation> {
1797 (*self.0.stub)
1798 .create_instance_partition(self.0.request, self.0.options)
1799 .await
1800 .map(gax::response::Response::into_body)
1801 }
1802
1803 pub fn poller(
1805 self,
1806 ) -> impl lro::Poller<
1807 crate::model::InstancePartition,
1808 crate::model::CreateInstancePartitionMetadata,
1809 > {
1810 type Operation = lro::internal::Operation<
1811 crate::model::InstancePartition,
1812 crate::model::CreateInstancePartitionMetadata,
1813 >;
1814 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1815 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1816
1817 let stub = self.0.stub.clone();
1818 let mut options = self.0.options.clone();
1819 options.set_retry_policy(gax::retry_policy::NeverRetry);
1820 let query = move |name| {
1821 let stub = stub.clone();
1822 let options = options.clone();
1823 async {
1824 let op = GetOperation::new(stub)
1825 .set_name(name)
1826 .with_options(options)
1827 .send()
1828 .await?;
1829 Ok(Operation::new(op))
1830 }
1831 };
1832
1833 let start = move || async {
1834 let op = self.send().await?;
1835 Ok(Operation::new(op))
1836 };
1837
1838 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1839 }
1840
1841 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1845 self.0.request.parent = v.into();
1846 self
1847 }
1848
1849 pub fn set_instance_partition_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1853 self.0.request.instance_partition_id = v.into();
1854 self
1855 }
1856
1857 pub fn set_instance_partition<T>(mut self, v: T) -> Self
1861 where
1862 T: std::convert::Into<crate::model::InstancePartition>,
1863 {
1864 self.0.request.instance_partition = std::option::Option::Some(v.into());
1865 self
1866 }
1867
1868 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
1872 where
1873 T: std::convert::Into<crate::model::InstancePartition>,
1874 {
1875 self.0.request.instance_partition = v.map(|x| x.into());
1876 self
1877 }
1878 }
1879
1880 #[doc(hidden)]
1881 impl gax::options::internal::RequestBuilder for CreateInstancePartition {
1882 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1883 &mut self.0.options
1884 }
1885 }
1886
1887 #[derive(Clone, Debug)]
1905 pub struct DeleteInstancePartition(
1906 RequestBuilder<crate::model::DeleteInstancePartitionRequest>,
1907 );
1908
1909 impl DeleteInstancePartition {
1910 pub(crate) fn new(
1911 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1912 ) -> Self {
1913 Self(RequestBuilder::new(stub))
1914 }
1915
1916 pub fn with_request<V: Into<crate::model::DeleteInstancePartitionRequest>>(
1918 mut self,
1919 v: V,
1920 ) -> Self {
1921 self.0.request = v.into();
1922 self
1923 }
1924
1925 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1927 self.0.options = v.into();
1928 self
1929 }
1930
1931 pub async fn send(self) -> Result<()> {
1933 (*self.0.stub)
1934 .delete_instance_partition(self.0.request, self.0.options)
1935 .await
1936 .map(gax::response::Response::into_body)
1937 }
1938
1939 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1943 self.0.request.name = v.into();
1944 self
1945 }
1946
1947 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1949 self.0.request.etag = v.into();
1950 self
1951 }
1952 }
1953
1954 #[doc(hidden)]
1955 impl gax::options::internal::RequestBuilder for DeleteInstancePartition {
1956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1957 &mut self.0.options
1958 }
1959 }
1960
1961 #[derive(Clone, Debug)]
1980 pub struct UpdateInstancePartition(
1981 RequestBuilder<crate::model::UpdateInstancePartitionRequest>,
1982 );
1983
1984 impl UpdateInstancePartition {
1985 pub(crate) fn new(
1986 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1987 ) -> Self {
1988 Self(RequestBuilder::new(stub))
1989 }
1990
1991 pub fn with_request<V: Into<crate::model::UpdateInstancePartitionRequest>>(
1993 mut self,
1994 v: V,
1995 ) -> Self {
1996 self.0.request = v.into();
1997 self
1998 }
1999
2000 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2002 self.0.options = v.into();
2003 self
2004 }
2005
2006 pub async fn send(self) -> Result<longrunning::model::Operation> {
2013 (*self.0.stub)
2014 .update_instance_partition(self.0.request, self.0.options)
2015 .await
2016 .map(gax::response::Response::into_body)
2017 }
2018
2019 pub fn poller(
2021 self,
2022 ) -> impl lro::Poller<
2023 crate::model::InstancePartition,
2024 crate::model::UpdateInstancePartitionMetadata,
2025 > {
2026 type Operation = lro::internal::Operation<
2027 crate::model::InstancePartition,
2028 crate::model::UpdateInstancePartitionMetadata,
2029 >;
2030 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2031 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2032
2033 let stub = self.0.stub.clone();
2034 let mut options = self.0.options.clone();
2035 options.set_retry_policy(gax::retry_policy::NeverRetry);
2036 let query = move |name| {
2037 let stub = stub.clone();
2038 let options = options.clone();
2039 async {
2040 let op = GetOperation::new(stub)
2041 .set_name(name)
2042 .with_options(options)
2043 .send()
2044 .await?;
2045 Ok(Operation::new(op))
2046 }
2047 };
2048
2049 let start = move || async {
2050 let op = self.send().await?;
2051 Ok(Operation::new(op))
2052 };
2053
2054 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2055 }
2056
2057 pub fn set_instance_partition<T>(mut self, v: T) -> Self
2061 where
2062 T: std::convert::Into<crate::model::InstancePartition>,
2063 {
2064 self.0.request.instance_partition = std::option::Option::Some(v.into());
2065 self
2066 }
2067
2068 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
2072 where
2073 T: std::convert::Into<crate::model::InstancePartition>,
2074 {
2075 self.0.request.instance_partition = v.map(|x| x.into());
2076 self
2077 }
2078
2079 pub fn set_field_mask<T>(mut self, v: T) -> Self
2083 where
2084 T: std::convert::Into<wkt::FieldMask>,
2085 {
2086 self.0.request.field_mask = std::option::Option::Some(v.into());
2087 self
2088 }
2089
2090 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
2094 where
2095 T: std::convert::Into<wkt::FieldMask>,
2096 {
2097 self.0.request.field_mask = v.map(|x| x.into());
2098 self
2099 }
2100 }
2101
2102 #[doc(hidden)]
2103 impl gax::options::internal::RequestBuilder for UpdateInstancePartition {
2104 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2105 &mut self.0.options
2106 }
2107 }
2108
2109 #[derive(Clone, Debug)]
2131 pub struct ListInstancePartitionOperations(
2132 RequestBuilder<crate::model::ListInstancePartitionOperationsRequest>,
2133 );
2134
2135 impl ListInstancePartitionOperations {
2136 pub(crate) fn new(
2137 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2138 ) -> Self {
2139 Self(RequestBuilder::new(stub))
2140 }
2141
2142 pub fn with_request<V: Into<crate::model::ListInstancePartitionOperationsRequest>>(
2144 mut self,
2145 v: V,
2146 ) -> Self {
2147 self.0.request = v.into();
2148 self
2149 }
2150
2151 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2153 self.0.options = v.into();
2154 self
2155 }
2156
2157 pub async fn send(self) -> Result<crate::model::ListInstancePartitionOperationsResponse> {
2159 (*self.0.stub)
2160 .list_instance_partition_operations(self.0.request, self.0.options)
2161 .await
2162 .map(gax::response::Response::into_body)
2163 }
2164
2165 pub fn by_page(
2167 self,
2168 ) -> impl gax::paginator::Paginator<
2169 crate::model::ListInstancePartitionOperationsResponse,
2170 gax::error::Error,
2171 > {
2172 use std::clone::Clone;
2173 let token = self.0.request.page_token.clone();
2174 let execute = move |token: String| {
2175 let mut builder = self.clone();
2176 builder.0.request = builder.0.request.set_page_token(token);
2177 builder.send()
2178 };
2179 gax::paginator::internal::new_paginator(token, execute)
2180 }
2181
2182 pub fn by_item(
2184 self,
2185 ) -> impl gax::paginator::ItemPaginator<
2186 crate::model::ListInstancePartitionOperationsResponse,
2187 gax::error::Error,
2188 > {
2189 use gax::paginator::Paginator;
2190 self.by_page().items()
2191 }
2192
2193 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2197 self.0.request.parent = v.into();
2198 self
2199 }
2200
2201 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2203 self.0.request.filter = v.into();
2204 self
2205 }
2206
2207 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2209 self.0.request.page_size = v.into();
2210 self
2211 }
2212
2213 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2215 self.0.request.page_token = v.into();
2216 self
2217 }
2218
2219 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
2221 where
2222 T: std::convert::Into<wkt::Timestamp>,
2223 {
2224 self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
2225 self
2226 }
2227
2228 pub fn set_or_clear_instance_partition_deadline<T>(
2230 mut self,
2231 v: std::option::Option<T>,
2232 ) -> Self
2233 where
2234 T: std::convert::Into<wkt::Timestamp>,
2235 {
2236 self.0.request.instance_partition_deadline = v.map(|x| x.into());
2237 self
2238 }
2239 }
2240
2241 #[doc(hidden)]
2242 impl gax::options::internal::RequestBuilder for ListInstancePartitionOperations {
2243 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2244 &mut self.0.options
2245 }
2246 }
2247
2248 #[derive(Clone, Debug)]
2267 pub struct MoveInstance(RequestBuilder<crate::model::MoveInstanceRequest>);
2268
2269 impl MoveInstance {
2270 pub(crate) fn new(
2271 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2272 ) -> Self {
2273 Self(RequestBuilder::new(stub))
2274 }
2275
2276 pub fn with_request<V: Into<crate::model::MoveInstanceRequest>>(mut self, v: V) -> Self {
2278 self.0.request = v.into();
2279 self
2280 }
2281
2282 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2284 self.0.options = v.into();
2285 self
2286 }
2287
2288 pub async fn send(self) -> Result<longrunning::model::Operation> {
2295 (*self.0.stub)
2296 .move_instance(self.0.request, self.0.options)
2297 .await
2298 .map(gax::response::Response::into_body)
2299 }
2300
2301 pub fn poller(
2303 self,
2304 ) -> impl lro::Poller<crate::model::MoveInstanceResponse, crate::model::MoveInstanceMetadata>
2305 {
2306 type Operation = lro::internal::Operation<
2307 crate::model::MoveInstanceResponse,
2308 crate::model::MoveInstanceMetadata,
2309 >;
2310 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2311 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2312
2313 let stub = self.0.stub.clone();
2314 let mut options = self.0.options.clone();
2315 options.set_retry_policy(gax::retry_policy::NeverRetry);
2316 let query = move |name| {
2317 let stub = stub.clone();
2318 let options = options.clone();
2319 async {
2320 let op = GetOperation::new(stub)
2321 .set_name(name)
2322 .with_options(options)
2323 .send()
2324 .await?;
2325 Ok(Operation::new(op))
2326 }
2327 };
2328
2329 let start = move || async {
2330 let op = self.send().await?;
2331 Ok(Operation::new(op))
2332 };
2333
2334 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2335 }
2336
2337 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2341 self.0.request.name = v.into();
2342 self
2343 }
2344
2345 pub fn set_target_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2349 self.0.request.target_config = v.into();
2350 self
2351 }
2352 }
2353
2354 #[doc(hidden)]
2355 impl gax::options::internal::RequestBuilder for MoveInstance {
2356 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2357 &mut self.0.options
2358 }
2359 }
2360
2361 #[derive(Clone, Debug)]
2383 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2384
2385 impl ListOperations {
2386 pub(crate) fn new(
2387 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2388 ) -> Self {
2389 Self(RequestBuilder::new(stub))
2390 }
2391
2392 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2394 mut self,
2395 v: V,
2396 ) -> Self {
2397 self.0.request = v.into();
2398 self
2399 }
2400
2401 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2403 self.0.options = v.into();
2404 self
2405 }
2406
2407 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2409 (*self.0.stub)
2410 .list_operations(self.0.request, self.0.options)
2411 .await
2412 .map(gax::response::Response::into_body)
2413 }
2414
2415 pub fn by_page(
2417 self,
2418 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2419 {
2420 use std::clone::Clone;
2421 let token = self.0.request.page_token.clone();
2422 let execute = move |token: String| {
2423 let mut builder = self.clone();
2424 builder.0.request = builder.0.request.set_page_token(token);
2425 builder.send()
2426 };
2427 gax::paginator::internal::new_paginator(token, execute)
2428 }
2429
2430 pub fn by_item(
2432 self,
2433 ) -> impl gax::paginator::ItemPaginator<
2434 longrunning::model::ListOperationsResponse,
2435 gax::error::Error,
2436 > {
2437 use gax::paginator::Paginator;
2438 self.by_page().items()
2439 }
2440
2441 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2443 self.0.request.name = v.into();
2444 self
2445 }
2446
2447 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2449 self.0.request.filter = v.into();
2450 self
2451 }
2452
2453 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2455 self.0.request.page_size = v.into();
2456 self
2457 }
2458
2459 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2461 self.0.request.page_token = v.into();
2462 self
2463 }
2464 }
2465
2466 #[doc(hidden)]
2467 impl gax::options::internal::RequestBuilder for ListOperations {
2468 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2469 &mut self.0.options
2470 }
2471 }
2472
2473 #[derive(Clone, Debug)]
2491 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2492
2493 impl GetOperation {
2494 pub(crate) fn new(
2495 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2496 ) -> Self {
2497 Self(RequestBuilder::new(stub))
2498 }
2499
2500 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2502 mut self,
2503 v: V,
2504 ) -> Self {
2505 self.0.request = v.into();
2506 self
2507 }
2508
2509 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2511 self.0.options = v.into();
2512 self
2513 }
2514
2515 pub async fn send(self) -> Result<longrunning::model::Operation> {
2517 (*self.0.stub)
2518 .get_operation(self.0.request, self.0.options)
2519 .await
2520 .map(gax::response::Response::into_body)
2521 }
2522
2523 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2525 self.0.request.name = v.into();
2526 self
2527 }
2528 }
2529
2530 #[doc(hidden)]
2531 impl gax::options::internal::RequestBuilder for GetOperation {
2532 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2533 &mut self.0.options
2534 }
2535 }
2536
2537 #[derive(Clone, Debug)]
2555 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2556
2557 impl DeleteOperation {
2558 pub(crate) fn new(
2559 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2560 ) -> Self {
2561 Self(RequestBuilder::new(stub))
2562 }
2563
2564 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2566 mut self,
2567 v: V,
2568 ) -> Self {
2569 self.0.request = v.into();
2570 self
2571 }
2572
2573 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2575 self.0.options = v.into();
2576 self
2577 }
2578
2579 pub async fn send(self) -> Result<()> {
2581 (*self.0.stub)
2582 .delete_operation(self.0.request, self.0.options)
2583 .await
2584 .map(gax::response::Response::into_body)
2585 }
2586
2587 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2589 self.0.request.name = v.into();
2590 self
2591 }
2592 }
2593
2594 #[doc(hidden)]
2595 impl gax::options::internal::RequestBuilder for DeleteOperation {
2596 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2597 &mut self.0.options
2598 }
2599 }
2600
2601 #[derive(Clone, Debug)]
2619 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2620
2621 impl CancelOperation {
2622 pub(crate) fn new(
2623 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2624 ) -> Self {
2625 Self(RequestBuilder::new(stub))
2626 }
2627
2628 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2630 mut self,
2631 v: V,
2632 ) -> Self {
2633 self.0.request = v.into();
2634 self
2635 }
2636
2637 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2639 self.0.options = v.into();
2640 self
2641 }
2642
2643 pub async fn send(self) -> Result<()> {
2645 (*self.0.stub)
2646 .cancel_operation(self.0.request, self.0.options)
2647 .await
2648 .map(gax::response::Response::into_body)
2649 }
2650
2651 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2653 self.0.request.name = v.into();
2654 self
2655 }
2656 }
2657
2658 #[doc(hidden)]
2659 impl gax::options::internal::RequestBuilder for CancelOperation {
2660 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2661 &mut self.0.options
2662 }
2663 }
2664}