1pub mod instance_admin {
19 use crate::Result;
20
21 pub type ClientBuilder = crate::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 crate::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 ) -> crate::ClientBuilderResult<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: crate::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: crate::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<crate::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(crate::Response::into_body)
125 }
126
127 pub fn by_page(
129 self,
130 ) -> impl google_cloud_gax::paginator::Paginator<
131 crate::model::ListInstanceConfigsResponse,
132 crate::Error,
133 > {
134 use std::clone::Clone;
135 let token = self.0.request.page_token.clone();
136 let execute = move |token: String| {
137 let mut builder = self.clone();
138 builder.0.request = builder.0.request.set_page_token(token);
139 builder.send()
140 };
141 google_cloud_gax::paginator::internal::new_paginator(token, execute)
142 }
143
144 pub fn by_item(
146 self,
147 ) -> impl google_cloud_gax::paginator::ItemPaginator<
148 crate::model::ListInstanceConfigsResponse,
149 crate::Error,
150 > {
151 use google_cloud_gax::paginator::Paginator;
152 self.by_page().items()
153 }
154
155 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
159 self.0.request.parent = v.into();
160 self
161 }
162
163 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
165 self.0.request.page_size = v.into();
166 self
167 }
168
169 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
171 self.0.request.page_token = v.into();
172 self
173 }
174 }
175
176 #[doc(hidden)]
177 impl crate::RequestBuilder for ListInstanceConfigs {
178 fn request_options(&mut self) -> &mut crate::RequestOptions {
179 &mut self.0.options
180 }
181 }
182
183 #[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<crate::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(crate::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 crate::RequestBuilder for GetInstanceConfig {
243 fn request_options(&mut self) -> &mut crate::RequestOptions {
244 &mut self.0.options
245 }
246 }
247
248 #[derive(Clone, Debug)]
266 pub struct CreateInstanceConfig(RequestBuilder<crate::model::CreateInstanceConfigRequest>);
267
268 impl CreateInstanceConfig {
269 pub(crate) fn new(
270 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
271 ) -> Self {
272 Self(RequestBuilder::new(stub))
273 }
274
275 pub fn with_request<V: Into<crate::model::CreateInstanceConfigRequest>>(
277 mut self,
278 v: V,
279 ) -> Self {
280 self.0.request = v.into();
281 self
282 }
283
284 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
286 self.0.options = v.into();
287 self
288 }
289
290 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
297 (*self.0.stub)
298 .create_instance_config(self.0.request, self.0.options)
299 .await
300 .map(crate::Response::into_body)
301 }
302
303 pub fn poller(
305 self,
306 ) -> impl google_cloud_lro::Poller<
307 crate::model::InstanceConfig,
308 crate::model::CreateInstanceConfigMetadata,
309 > {
310 type Operation = google_cloud_lro::internal::Operation<
311 crate::model::InstanceConfig,
312 crate::model::CreateInstanceConfigMetadata,
313 >;
314 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
315 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
316 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
317 if let Some(ref mut details) = poller_options.tracing {
318 details.method_name = "google_cloud_spanner_admin_instance_v1::client::InstanceAdmin::create_instance_config::until_done";
319 }
320
321 let stub = self.0.stub.clone();
322 let mut options = self.0.options.clone();
323 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
324 let query = move |name| {
325 let stub = stub.clone();
326 let options = options.clone();
327 async {
328 let op = GetOperation::new(stub)
329 .set_name(name)
330 .with_options(options)
331 .send()
332 .await?;
333 Ok(Operation::new(op))
334 }
335 };
336
337 let start = move || async {
338 let op = self.send().await?;
339 Ok(Operation::new(op))
340 };
341
342 use google_cloud_lro::internal::PollerExt;
343 {
344 google_cloud_lro::internal::new_poller(
345 polling_error_policy,
346 polling_backoff_policy,
347 start,
348 query,
349 )
350 }
351 .with_options(poller_options)
352 }
353
354 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
358 self.0.request.parent = v.into();
359 self
360 }
361
362 pub fn set_instance_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
366 self.0.request.instance_config_id = v.into();
367 self
368 }
369
370 pub fn set_instance_config<T>(mut self, v: T) -> Self
374 where
375 T: std::convert::Into<crate::model::InstanceConfig>,
376 {
377 self.0.request.instance_config = std::option::Option::Some(v.into());
378 self
379 }
380
381 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
385 where
386 T: std::convert::Into<crate::model::InstanceConfig>,
387 {
388 self.0.request.instance_config = v.map(|x| x.into());
389 self
390 }
391
392 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
394 self.0.request.validate_only = v.into();
395 self
396 }
397 }
398
399 #[doc(hidden)]
400 impl crate::RequestBuilder for CreateInstanceConfig {
401 fn request_options(&mut self) -> &mut crate::RequestOptions {
402 &mut self.0.options
403 }
404 }
405
406 #[derive(Clone, Debug)]
424 pub struct UpdateInstanceConfig(RequestBuilder<crate::model::UpdateInstanceConfigRequest>);
425
426 impl UpdateInstanceConfig {
427 pub(crate) fn new(
428 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
429 ) -> Self {
430 Self(RequestBuilder::new(stub))
431 }
432
433 pub fn with_request<V: Into<crate::model::UpdateInstanceConfigRequest>>(
435 mut self,
436 v: V,
437 ) -> Self {
438 self.0.request = v.into();
439 self
440 }
441
442 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
444 self.0.options = v.into();
445 self
446 }
447
448 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
455 (*self.0.stub)
456 .update_instance_config(self.0.request, self.0.options)
457 .await
458 .map(crate::Response::into_body)
459 }
460
461 pub fn poller(
463 self,
464 ) -> impl google_cloud_lro::Poller<
465 crate::model::InstanceConfig,
466 crate::model::UpdateInstanceConfigMetadata,
467 > {
468 type Operation = google_cloud_lro::internal::Operation<
469 crate::model::InstanceConfig,
470 crate::model::UpdateInstanceConfigMetadata,
471 >;
472 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
473 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
474 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
475 if let Some(ref mut details) = poller_options.tracing {
476 details.method_name = "google_cloud_spanner_admin_instance_v1::client::InstanceAdmin::update_instance_config::until_done";
477 }
478
479 let stub = self.0.stub.clone();
480 let mut options = self.0.options.clone();
481 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
482 let query = move |name| {
483 let stub = stub.clone();
484 let options = options.clone();
485 async {
486 let op = GetOperation::new(stub)
487 .set_name(name)
488 .with_options(options)
489 .send()
490 .await?;
491 Ok(Operation::new(op))
492 }
493 };
494
495 let start = move || async {
496 let op = self.send().await?;
497 Ok(Operation::new(op))
498 };
499
500 use google_cloud_lro::internal::PollerExt;
501 {
502 google_cloud_lro::internal::new_poller(
503 polling_error_policy,
504 polling_backoff_policy,
505 start,
506 query,
507 )
508 }
509 .with_options(poller_options)
510 }
511
512 pub fn set_instance_config<T>(mut self, v: T) -> Self
516 where
517 T: std::convert::Into<crate::model::InstanceConfig>,
518 {
519 self.0.request.instance_config = std::option::Option::Some(v.into());
520 self
521 }
522
523 pub fn set_or_clear_instance_config<T>(mut self, v: std::option::Option<T>) -> Self
527 where
528 T: std::convert::Into<crate::model::InstanceConfig>,
529 {
530 self.0.request.instance_config = v.map(|x| x.into());
531 self
532 }
533
534 pub fn set_update_mask<T>(mut self, v: T) -> Self
538 where
539 T: std::convert::Into<wkt::FieldMask>,
540 {
541 self.0.request.update_mask = std::option::Option::Some(v.into());
542 self
543 }
544
545 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
549 where
550 T: std::convert::Into<wkt::FieldMask>,
551 {
552 self.0.request.update_mask = v.map(|x| x.into());
553 self
554 }
555
556 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
558 self.0.request.validate_only = v.into();
559 self
560 }
561 }
562
563 #[doc(hidden)]
564 impl crate::RequestBuilder for UpdateInstanceConfig {
565 fn request_options(&mut self) -> &mut crate::RequestOptions {
566 &mut self.0.options
567 }
568 }
569
570 #[derive(Clone, Debug)]
587 pub struct DeleteInstanceConfig(RequestBuilder<crate::model::DeleteInstanceConfigRequest>);
588
589 impl DeleteInstanceConfig {
590 pub(crate) fn new(
591 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
592 ) -> Self {
593 Self(RequestBuilder::new(stub))
594 }
595
596 pub fn with_request<V: Into<crate::model::DeleteInstanceConfigRequest>>(
598 mut self,
599 v: V,
600 ) -> Self {
601 self.0.request = v.into();
602 self
603 }
604
605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
607 self.0.options = v.into();
608 self
609 }
610
611 pub async fn send(self) -> Result<()> {
613 (*self.0.stub)
614 .delete_instance_config(self.0.request, self.0.options)
615 .await
616 .map(crate::Response::into_body)
617 }
618
619 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
623 self.0.request.name = v.into();
624 self
625 }
626
627 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
629 self.0.request.etag = v.into();
630 self
631 }
632
633 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
635 self.0.request.validate_only = v.into();
636 self
637 }
638 }
639
640 #[doc(hidden)]
641 impl crate::RequestBuilder for DeleteInstanceConfig {
642 fn request_options(&mut self) -> &mut crate::RequestOptions {
643 &mut self.0.options
644 }
645 }
646
647 #[derive(Clone, Debug)]
668 pub struct ListInstanceConfigOperations(
669 RequestBuilder<crate::model::ListInstanceConfigOperationsRequest>,
670 );
671
672 impl ListInstanceConfigOperations {
673 pub(crate) fn new(
674 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
675 ) -> Self {
676 Self(RequestBuilder::new(stub))
677 }
678
679 pub fn with_request<V: Into<crate::model::ListInstanceConfigOperationsRequest>>(
681 mut self,
682 v: V,
683 ) -> Self {
684 self.0.request = v.into();
685 self
686 }
687
688 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
690 self.0.options = v.into();
691 self
692 }
693
694 pub async fn send(self) -> Result<crate::model::ListInstanceConfigOperationsResponse> {
696 (*self.0.stub)
697 .list_instance_config_operations(self.0.request, self.0.options)
698 .await
699 .map(crate::Response::into_body)
700 }
701
702 pub fn by_page(
704 self,
705 ) -> impl google_cloud_gax::paginator::Paginator<
706 crate::model::ListInstanceConfigOperationsResponse,
707 crate::Error,
708 > {
709 use std::clone::Clone;
710 let token = self.0.request.page_token.clone();
711 let execute = move |token: String| {
712 let mut builder = self.clone();
713 builder.0.request = builder.0.request.set_page_token(token);
714 builder.send()
715 };
716 google_cloud_gax::paginator::internal::new_paginator(token, execute)
717 }
718
719 pub fn by_item(
721 self,
722 ) -> impl google_cloud_gax::paginator::ItemPaginator<
723 crate::model::ListInstanceConfigOperationsResponse,
724 crate::Error,
725 > {
726 use google_cloud_gax::paginator::Paginator;
727 self.by_page().items()
728 }
729
730 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
734 self.0.request.parent = v.into();
735 self
736 }
737
738 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
740 self.0.request.filter = v.into();
741 self
742 }
743
744 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
746 self.0.request.page_size = v.into();
747 self
748 }
749
750 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
752 self.0.request.page_token = v.into();
753 self
754 }
755 }
756
757 #[doc(hidden)]
758 impl crate::RequestBuilder for ListInstanceConfigOperations {
759 fn request_options(&mut self) -> &mut crate::RequestOptions {
760 &mut self.0.options
761 }
762 }
763
764 #[derive(Clone, Debug)]
785 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
786
787 impl ListInstances {
788 pub(crate) fn new(
789 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
790 ) -> Self {
791 Self(RequestBuilder::new(stub))
792 }
793
794 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
796 self.0.request = v.into();
797 self
798 }
799
800 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
802 self.0.options = v.into();
803 self
804 }
805
806 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
808 (*self.0.stub)
809 .list_instances(self.0.request, self.0.options)
810 .await
811 .map(crate::Response::into_body)
812 }
813
814 pub fn by_page(
816 self,
817 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
818 {
819 use std::clone::Clone;
820 let token = self.0.request.page_token.clone();
821 let execute = move |token: String| {
822 let mut builder = self.clone();
823 builder.0.request = builder.0.request.set_page_token(token);
824 builder.send()
825 };
826 google_cloud_gax::paginator::internal::new_paginator(token, execute)
827 }
828
829 pub fn by_item(
831 self,
832 ) -> impl google_cloud_gax::paginator::ItemPaginator<
833 crate::model::ListInstancesResponse,
834 crate::Error,
835 > {
836 use google_cloud_gax::paginator::Paginator;
837 self.by_page().items()
838 }
839
840 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
844 self.0.request.parent = v.into();
845 self
846 }
847
848 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
850 self.0.request.page_size = v.into();
851 self
852 }
853
854 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
856 self.0.request.page_token = v.into();
857 self
858 }
859
860 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
862 self.0.request.filter = v.into();
863 self
864 }
865
866 pub fn set_instance_deadline<T>(mut self, v: T) -> Self
868 where
869 T: std::convert::Into<wkt::Timestamp>,
870 {
871 self.0.request.instance_deadline = std::option::Option::Some(v.into());
872 self
873 }
874
875 pub fn set_or_clear_instance_deadline<T>(mut self, v: std::option::Option<T>) -> Self
877 where
878 T: std::convert::Into<wkt::Timestamp>,
879 {
880 self.0.request.instance_deadline = v.map(|x| x.into());
881 self
882 }
883 }
884
885 #[doc(hidden)]
886 impl crate::RequestBuilder for ListInstances {
887 fn request_options(&mut self) -> &mut crate::RequestOptions {
888 &mut self.0.options
889 }
890 }
891
892 #[derive(Clone, Debug)]
913 pub struct ListInstancePartitions(RequestBuilder<crate::model::ListInstancePartitionsRequest>);
914
915 impl ListInstancePartitions {
916 pub(crate) fn new(
917 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
918 ) -> Self {
919 Self(RequestBuilder::new(stub))
920 }
921
922 pub fn with_request<V: Into<crate::model::ListInstancePartitionsRequest>>(
924 mut self,
925 v: V,
926 ) -> Self {
927 self.0.request = v.into();
928 self
929 }
930
931 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
933 self.0.options = v.into();
934 self
935 }
936
937 pub async fn send(self) -> Result<crate::model::ListInstancePartitionsResponse> {
939 (*self.0.stub)
940 .list_instance_partitions(self.0.request, self.0.options)
941 .await
942 .map(crate::Response::into_body)
943 }
944
945 pub fn by_page(
947 self,
948 ) -> impl google_cloud_gax::paginator::Paginator<
949 crate::model::ListInstancePartitionsResponse,
950 crate::Error,
951 > {
952 use std::clone::Clone;
953 let token = self.0.request.page_token.clone();
954 let execute = move |token: String| {
955 let mut builder = self.clone();
956 builder.0.request = builder.0.request.set_page_token(token);
957 builder.send()
958 };
959 google_cloud_gax::paginator::internal::new_paginator(token, execute)
960 }
961
962 pub fn by_item(
964 self,
965 ) -> impl google_cloud_gax::paginator::ItemPaginator<
966 crate::model::ListInstancePartitionsResponse,
967 crate::Error,
968 > {
969 use google_cloud_gax::paginator::Paginator;
970 self.by_page().items()
971 }
972
973 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
977 self.0.request.parent = v.into();
978 self
979 }
980
981 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
983 self.0.request.page_size = v.into();
984 self
985 }
986
987 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
989 self.0.request.page_token = v.into();
990 self
991 }
992
993 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
995 where
996 T: std::convert::Into<wkt::Timestamp>,
997 {
998 self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
999 self
1000 }
1001
1002 pub fn set_or_clear_instance_partition_deadline<T>(
1004 mut self,
1005 v: std::option::Option<T>,
1006 ) -> Self
1007 where
1008 T: std::convert::Into<wkt::Timestamp>,
1009 {
1010 self.0.request.instance_partition_deadline = v.map(|x| x.into());
1011 self
1012 }
1013 }
1014
1015 #[doc(hidden)]
1016 impl crate::RequestBuilder for ListInstancePartitions {
1017 fn request_options(&mut self) -> &mut crate::RequestOptions {
1018 &mut self.0.options
1019 }
1020 }
1021
1022 #[derive(Clone, Debug)]
1039 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
1040
1041 impl GetInstance {
1042 pub(crate) fn new(
1043 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1044 ) -> Self {
1045 Self(RequestBuilder::new(stub))
1046 }
1047
1048 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
1050 self.0.request = v.into();
1051 self
1052 }
1053
1054 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1056 self.0.options = v.into();
1057 self
1058 }
1059
1060 pub async fn send(self) -> Result<crate::model::Instance> {
1062 (*self.0.stub)
1063 .get_instance(self.0.request, self.0.options)
1064 .await
1065 .map(crate::Response::into_body)
1066 }
1067
1068 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1072 self.0.request.name = v.into();
1073 self
1074 }
1075
1076 pub fn set_field_mask<T>(mut self, v: T) -> Self
1078 where
1079 T: std::convert::Into<wkt::FieldMask>,
1080 {
1081 self.0.request.field_mask = std::option::Option::Some(v.into());
1082 self
1083 }
1084
1085 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1087 where
1088 T: std::convert::Into<wkt::FieldMask>,
1089 {
1090 self.0.request.field_mask = v.map(|x| x.into());
1091 self
1092 }
1093 }
1094
1095 #[doc(hidden)]
1096 impl crate::RequestBuilder for GetInstance {
1097 fn request_options(&mut self) -> &mut crate::RequestOptions {
1098 &mut self.0.options
1099 }
1100 }
1101
1102 #[derive(Clone, Debug)]
1120 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
1121
1122 impl CreateInstance {
1123 pub(crate) fn new(
1124 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1125 ) -> Self {
1126 Self(RequestBuilder::new(stub))
1127 }
1128
1129 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
1131 self.0.request = v.into();
1132 self
1133 }
1134
1135 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1137 self.0.options = v.into();
1138 self
1139 }
1140
1141 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1148 (*self.0.stub)
1149 .create_instance(self.0.request, self.0.options)
1150 .await
1151 .map(crate::Response::into_body)
1152 }
1153
1154 pub fn poller(
1156 self,
1157 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::CreateInstanceMetadata>
1158 {
1159 type Operation = google_cloud_lro::internal::Operation<
1160 crate::model::Instance,
1161 crate::model::CreateInstanceMetadata,
1162 >;
1163 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1164 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1165 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1166 if let Some(ref mut details) = poller_options.tracing {
1167 details.method_name = "google_cloud_spanner_admin_instance_v1::client::InstanceAdmin::create_instance::until_done";
1168 }
1169
1170 let stub = self.0.stub.clone();
1171 let mut options = self.0.options.clone();
1172 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1173 let query = move |name| {
1174 let stub = stub.clone();
1175 let options = options.clone();
1176 async {
1177 let op = GetOperation::new(stub)
1178 .set_name(name)
1179 .with_options(options)
1180 .send()
1181 .await?;
1182 Ok(Operation::new(op))
1183 }
1184 };
1185
1186 let start = move || async {
1187 let op = self.send().await?;
1188 Ok(Operation::new(op))
1189 };
1190
1191 use google_cloud_lro::internal::PollerExt;
1192 {
1193 google_cloud_lro::internal::new_poller(
1194 polling_error_policy,
1195 polling_backoff_policy,
1196 start,
1197 query,
1198 )
1199 }
1200 .with_options(poller_options)
1201 }
1202
1203 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1207 self.0.request.parent = v.into();
1208 self
1209 }
1210
1211 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1215 self.0.request.instance_id = v.into();
1216 self
1217 }
1218
1219 pub fn set_instance<T>(mut self, v: T) -> Self
1223 where
1224 T: std::convert::Into<crate::model::Instance>,
1225 {
1226 self.0.request.instance = std::option::Option::Some(v.into());
1227 self
1228 }
1229
1230 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1234 where
1235 T: std::convert::Into<crate::model::Instance>,
1236 {
1237 self.0.request.instance = v.map(|x| x.into());
1238 self
1239 }
1240 }
1241
1242 #[doc(hidden)]
1243 impl crate::RequestBuilder for CreateInstance {
1244 fn request_options(&mut self) -> &mut crate::RequestOptions {
1245 &mut self.0.options
1246 }
1247 }
1248
1249 #[derive(Clone, Debug)]
1267 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
1268
1269 impl UpdateInstance {
1270 pub(crate) fn new(
1271 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1272 ) -> Self {
1273 Self(RequestBuilder::new(stub))
1274 }
1275
1276 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
1278 self.0.request = v.into();
1279 self
1280 }
1281
1282 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1284 self.0.options = v.into();
1285 self
1286 }
1287
1288 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1295 (*self.0.stub)
1296 .update_instance(self.0.request, self.0.options)
1297 .await
1298 .map(crate::Response::into_body)
1299 }
1300
1301 pub fn poller(
1303 self,
1304 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::UpdateInstanceMetadata>
1305 {
1306 type Operation = google_cloud_lro::internal::Operation<
1307 crate::model::Instance,
1308 crate::model::UpdateInstanceMetadata,
1309 >;
1310 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1311 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1312 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1313 if let Some(ref mut details) = poller_options.tracing {
1314 details.method_name = "google_cloud_spanner_admin_instance_v1::client::InstanceAdmin::update_instance::until_done";
1315 }
1316
1317 let stub = self.0.stub.clone();
1318 let mut options = self.0.options.clone();
1319 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1320 let query = move |name| {
1321 let stub = stub.clone();
1322 let options = options.clone();
1323 async {
1324 let op = GetOperation::new(stub)
1325 .set_name(name)
1326 .with_options(options)
1327 .send()
1328 .await?;
1329 Ok(Operation::new(op))
1330 }
1331 };
1332
1333 let start = move || async {
1334 let op = self.send().await?;
1335 Ok(Operation::new(op))
1336 };
1337
1338 use google_cloud_lro::internal::PollerExt;
1339 {
1340 google_cloud_lro::internal::new_poller(
1341 polling_error_policy,
1342 polling_backoff_policy,
1343 start,
1344 query,
1345 )
1346 }
1347 .with_options(poller_options)
1348 }
1349
1350 pub fn set_instance<T>(mut self, v: T) -> Self
1354 where
1355 T: std::convert::Into<crate::model::Instance>,
1356 {
1357 self.0.request.instance = std::option::Option::Some(v.into());
1358 self
1359 }
1360
1361 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
1365 where
1366 T: std::convert::Into<crate::model::Instance>,
1367 {
1368 self.0.request.instance = v.map(|x| x.into());
1369 self
1370 }
1371
1372 pub fn set_field_mask<T>(mut self, v: T) -> Self
1376 where
1377 T: std::convert::Into<wkt::FieldMask>,
1378 {
1379 self.0.request.field_mask = std::option::Option::Some(v.into());
1380 self
1381 }
1382
1383 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
1387 where
1388 T: std::convert::Into<wkt::FieldMask>,
1389 {
1390 self.0.request.field_mask = v.map(|x| x.into());
1391 self
1392 }
1393 }
1394
1395 #[doc(hidden)]
1396 impl crate::RequestBuilder for UpdateInstance {
1397 fn request_options(&mut self) -> &mut crate::RequestOptions {
1398 &mut self.0.options
1399 }
1400 }
1401
1402 #[derive(Clone, Debug)]
1419 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
1420
1421 impl DeleteInstance {
1422 pub(crate) fn new(
1423 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1424 ) -> Self {
1425 Self(RequestBuilder::new(stub))
1426 }
1427
1428 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
1430 self.0.request = v.into();
1431 self
1432 }
1433
1434 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1436 self.0.options = v.into();
1437 self
1438 }
1439
1440 pub async fn send(self) -> Result<()> {
1442 (*self.0.stub)
1443 .delete_instance(self.0.request, self.0.options)
1444 .await
1445 .map(crate::Response::into_body)
1446 }
1447
1448 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1452 self.0.request.name = v.into();
1453 self
1454 }
1455 }
1456
1457 #[doc(hidden)]
1458 impl crate::RequestBuilder for DeleteInstance {
1459 fn request_options(&mut self) -> &mut crate::RequestOptions {
1460 &mut self.0.options
1461 }
1462 }
1463
1464 #[derive(Clone, Debug)]
1481 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1482
1483 impl SetIamPolicy {
1484 pub(crate) fn new(
1485 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1486 ) -> Self {
1487 Self(RequestBuilder::new(stub))
1488 }
1489
1490 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1492 mut self,
1493 v: V,
1494 ) -> Self {
1495 self.0.request = v.into();
1496 self
1497 }
1498
1499 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1501 self.0.options = v.into();
1502 self
1503 }
1504
1505 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1507 (*self.0.stub)
1508 .set_iam_policy(self.0.request, self.0.options)
1509 .await
1510 .map(crate::Response::into_body)
1511 }
1512
1513 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1517 self.0.request.resource = v.into();
1518 self
1519 }
1520
1521 pub fn set_policy<T>(mut self, v: T) -> Self
1525 where
1526 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1527 {
1528 self.0.request.policy = std::option::Option::Some(v.into());
1529 self
1530 }
1531
1532 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1536 where
1537 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1538 {
1539 self.0.request.policy = v.map(|x| x.into());
1540 self
1541 }
1542
1543 pub fn set_update_mask<T>(mut self, v: T) -> Self
1545 where
1546 T: std::convert::Into<wkt::FieldMask>,
1547 {
1548 self.0.request.update_mask = std::option::Option::Some(v.into());
1549 self
1550 }
1551
1552 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1554 where
1555 T: std::convert::Into<wkt::FieldMask>,
1556 {
1557 self.0.request.update_mask = v.map(|x| x.into());
1558 self
1559 }
1560 }
1561
1562 #[doc(hidden)]
1563 impl crate::RequestBuilder for SetIamPolicy {
1564 fn request_options(&mut self) -> &mut crate::RequestOptions {
1565 &mut self.0.options
1566 }
1567 }
1568
1569 #[derive(Clone, Debug)]
1586 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1587
1588 impl GetIamPolicy {
1589 pub(crate) fn new(
1590 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1591 ) -> Self {
1592 Self(RequestBuilder::new(stub))
1593 }
1594
1595 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1597 mut self,
1598 v: V,
1599 ) -> Self {
1600 self.0.request = v.into();
1601 self
1602 }
1603
1604 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1606 self.0.options = v.into();
1607 self
1608 }
1609
1610 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1612 (*self.0.stub)
1613 .get_iam_policy(self.0.request, self.0.options)
1614 .await
1615 .map(crate::Response::into_body)
1616 }
1617
1618 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1622 self.0.request.resource = v.into();
1623 self
1624 }
1625
1626 pub fn set_options<T>(mut self, v: T) -> Self
1628 where
1629 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1630 {
1631 self.0.request.options = std::option::Option::Some(v.into());
1632 self
1633 }
1634
1635 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1637 where
1638 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1639 {
1640 self.0.request.options = v.map(|x| x.into());
1641 self
1642 }
1643 }
1644
1645 #[doc(hidden)]
1646 impl crate::RequestBuilder for GetIamPolicy {
1647 fn request_options(&mut self) -> &mut crate::RequestOptions {
1648 &mut self.0.options
1649 }
1650 }
1651
1652 #[derive(Clone, Debug)]
1669 pub struct TestIamPermissions(
1670 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1671 );
1672
1673 impl TestIamPermissions {
1674 pub(crate) fn new(
1675 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1676 ) -> Self {
1677 Self(RequestBuilder::new(stub))
1678 }
1679
1680 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1682 mut self,
1683 v: V,
1684 ) -> Self {
1685 self.0.request = v.into();
1686 self
1687 }
1688
1689 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1691 self.0.options = v.into();
1692 self
1693 }
1694
1695 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1697 (*self.0.stub)
1698 .test_iam_permissions(self.0.request, self.0.options)
1699 .await
1700 .map(crate::Response::into_body)
1701 }
1702
1703 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1707 self.0.request.resource = v.into();
1708 self
1709 }
1710
1711 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1715 where
1716 T: std::iter::IntoIterator<Item = V>,
1717 V: std::convert::Into<std::string::String>,
1718 {
1719 use std::iter::Iterator;
1720 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1721 self
1722 }
1723 }
1724
1725 #[doc(hidden)]
1726 impl crate::RequestBuilder for TestIamPermissions {
1727 fn request_options(&mut self) -> &mut crate::RequestOptions {
1728 &mut self.0.options
1729 }
1730 }
1731
1732 #[derive(Clone, Debug)]
1749 pub struct GetInstancePartition(RequestBuilder<crate::model::GetInstancePartitionRequest>);
1750
1751 impl GetInstancePartition {
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::GetInstancePartitionRequest>>(
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<crate::RequestOptions>>(mut self, v: V) -> Self {
1769 self.0.options = v.into();
1770 self
1771 }
1772
1773 pub async fn send(self) -> Result<crate::model::InstancePartition> {
1775 (*self.0.stub)
1776 .get_instance_partition(self.0.request, self.0.options)
1777 .await
1778 .map(crate::Response::into_body)
1779 }
1780
1781 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1785 self.0.request.name = v.into();
1786 self
1787 }
1788 }
1789
1790 #[doc(hidden)]
1791 impl crate::RequestBuilder for GetInstancePartition {
1792 fn request_options(&mut self) -> &mut crate::RequestOptions {
1793 &mut self.0.options
1794 }
1795 }
1796
1797 #[derive(Clone, Debug)]
1815 pub struct CreateInstancePartition(
1816 RequestBuilder<crate::model::CreateInstancePartitionRequest>,
1817 );
1818
1819 impl CreateInstancePartition {
1820 pub(crate) fn new(
1821 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1822 ) -> Self {
1823 Self(RequestBuilder::new(stub))
1824 }
1825
1826 pub fn with_request<V: Into<crate::model::CreateInstancePartitionRequest>>(
1828 mut self,
1829 v: V,
1830 ) -> Self {
1831 self.0.request = v.into();
1832 self
1833 }
1834
1835 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1837 self.0.options = v.into();
1838 self
1839 }
1840
1841 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1848 (*self.0.stub)
1849 .create_instance_partition(self.0.request, self.0.options)
1850 .await
1851 .map(crate::Response::into_body)
1852 }
1853
1854 pub fn poller(
1856 self,
1857 ) -> impl google_cloud_lro::Poller<
1858 crate::model::InstancePartition,
1859 crate::model::CreateInstancePartitionMetadata,
1860 > {
1861 type Operation = google_cloud_lro::internal::Operation<
1862 crate::model::InstancePartition,
1863 crate::model::CreateInstancePartitionMetadata,
1864 >;
1865 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1866 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1867 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1868 if let Some(ref mut details) = poller_options.tracing {
1869 details.method_name = "google_cloud_spanner_admin_instance_v1::client::InstanceAdmin::create_instance_partition::until_done";
1870 }
1871
1872 let stub = self.0.stub.clone();
1873 let mut options = self.0.options.clone();
1874 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1875 let query = move |name| {
1876 let stub = stub.clone();
1877 let options = options.clone();
1878 async {
1879 let op = GetOperation::new(stub)
1880 .set_name(name)
1881 .with_options(options)
1882 .send()
1883 .await?;
1884 Ok(Operation::new(op))
1885 }
1886 };
1887
1888 let start = move || async {
1889 let op = self.send().await?;
1890 Ok(Operation::new(op))
1891 };
1892
1893 use google_cloud_lro::internal::PollerExt;
1894 {
1895 google_cloud_lro::internal::new_poller(
1896 polling_error_policy,
1897 polling_backoff_policy,
1898 start,
1899 query,
1900 )
1901 }
1902 .with_options(poller_options)
1903 }
1904
1905 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1909 self.0.request.parent = v.into();
1910 self
1911 }
1912
1913 pub fn set_instance_partition_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1917 self.0.request.instance_partition_id = v.into();
1918 self
1919 }
1920
1921 pub fn set_instance_partition<T>(mut self, v: T) -> Self
1925 where
1926 T: std::convert::Into<crate::model::InstancePartition>,
1927 {
1928 self.0.request.instance_partition = std::option::Option::Some(v.into());
1929 self
1930 }
1931
1932 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
1936 where
1937 T: std::convert::Into<crate::model::InstancePartition>,
1938 {
1939 self.0.request.instance_partition = v.map(|x| x.into());
1940 self
1941 }
1942 }
1943
1944 #[doc(hidden)]
1945 impl crate::RequestBuilder for CreateInstancePartition {
1946 fn request_options(&mut self) -> &mut crate::RequestOptions {
1947 &mut self.0.options
1948 }
1949 }
1950
1951 #[derive(Clone, Debug)]
1968 pub struct DeleteInstancePartition(
1969 RequestBuilder<crate::model::DeleteInstancePartitionRequest>,
1970 );
1971
1972 impl DeleteInstancePartition {
1973 pub(crate) fn new(
1974 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
1975 ) -> Self {
1976 Self(RequestBuilder::new(stub))
1977 }
1978
1979 pub fn with_request<V: Into<crate::model::DeleteInstancePartitionRequest>>(
1981 mut self,
1982 v: V,
1983 ) -> Self {
1984 self.0.request = v.into();
1985 self
1986 }
1987
1988 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1990 self.0.options = v.into();
1991 self
1992 }
1993
1994 pub async fn send(self) -> Result<()> {
1996 (*self.0.stub)
1997 .delete_instance_partition(self.0.request, self.0.options)
1998 .await
1999 .map(crate::Response::into_body)
2000 }
2001
2002 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2006 self.0.request.name = v.into();
2007 self
2008 }
2009
2010 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2012 self.0.request.etag = v.into();
2013 self
2014 }
2015 }
2016
2017 #[doc(hidden)]
2018 impl crate::RequestBuilder for DeleteInstancePartition {
2019 fn request_options(&mut self) -> &mut crate::RequestOptions {
2020 &mut self.0.options
2021 }
2022 }
2023
2024 #[derive(Clone, Debug)]
2042 pub struct UpdateInstancePartition(
2043 RequestBuilder<crate::model::UpdateInstancePartitionRequest>,
2044 );
2045
2046 impl UpdateInstancePartition {
2047 pub(crate) fn new(
2048 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2049 ) -> Self {
2050 Self(RequestBuilder::new(stub))
2051 }
2052
2053 pub fn with_request<V: Into<crate::model::UpdateInstancePartitionRequest>>(
2055 mut self,
2056 v: V,
2057 ) -> Self {
2058 self.0.request = v.into();
2059 self
2060 }
2061
2062 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2064 self.0.options = v.into();
2065 self
2066 }
2067
2068 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2075 (*self.0.stub)
2076 .update_instance_partition(self.0.request, self.0.options)
2077 .await
2078 .map(crate::Response::into_body)
2079 }
2080
2081 pub fn poller(
2083 self,
2084 ) -> impl google_cloud_lro::Poller<
2085 crate::model::InstancePartition,
2086 crate::model::UpdateInstancePartitionMetadata,
2087 > {
2088 type Operation = google_cloud_lro::internal::Operation<
2089 crate::model::InstancePartition,
2090 crate::model::UpdateInstancePartitionMetadata,
2091 >;
2092 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2093 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2094 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2095 if let Some(ref mut details) = poller_options.tracing {
2096 details.method_name = "google_cloud_spanner_admin_instance_v1::client::InstanceAdmin::update_instance_partition::until_done";
2097 }
2098
2099 let stub = self.0.stub.clone();
2100 let mut options = self.0.options.clone();
2101 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2102 let query = move |name| {
2103 let stub = stub.clone();
2104 let options = options.clone();
2105 async {
2106 let op = GetOperation::new(stub)
2107 .set_name(name)
2108 .with_options(options)
2109 .send()
2110 .await?;
2111 Ok(Operation::new(op))
2112 }
2113 };
2114
2115 let start = move || async {
2116 let op = self.send().await?;
2117 Ok(Operation::new(op))
2118 };
2119
2120 use google_cloud_lro::internal::PollerExt;
2121 {
2122 google_cloud_lro::internal::new_poller(
2123 polling_error_policy,
2124 polling_backoff_policy,
2125 start,
2126 query,
2127 )
2128 }
2129 .with_options(poller_options)
2130 }
2131
2132 pub fn set_instance_partition<T>(mut self, v: T) -> Self
2136 where
2137 T: std::convert::Into<crate::model::InstancePartition>,
2138 {
2139 self.0.request.instance_partition = std::option::Option::Some(v.into());
2140 self
2141 }
2142
2143 pub fn set_or_clear_instance_partition<T>(mut self, v: std::option::Option<T>) -> Self
2147 where
2148 T: std::convert::Into<crate::model::InstancePartition>,
2149 {
2150 self.0.request.instance_partition = v.map(|x| x.into());
2151 self
2152 }
2153
2154 pub fn set_field_mask<T>(mut self, v: T) -> Self
2158 where
2159 T: std::convert::Into<wkt::FieldMask>,
2160 {
2161 self.0.request.field_mask = std::option::Option::Some(v.into());
2162 self
2163 }
2164
2165 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
2169 where
2170 T: std::convert::Into<wkt::FieldMask>,
2171 {
2172 self.0.request.field_mask = v.map(|x| x.into());
2173 self
2174 }
2175 }
2176
2177 #[doc(hidden)]
2178 impl crate::RequestBuilder for UpdateInstancePartition {
2179 fn request_options(&mut self) -> &mut crate::RequestOptions {
2180 &mut self.0.options
2181 }
2182 }
2183
2184 #[derive(Clone, Debug)]
2205 pub struct ListInstancePartitionOperations(
2206 RequestBuilder<crate::model::ListInstancePartitionOperationsRequest>,
2207 );
2208
2209 impl ListInstancePartitionOperations {
2210 pub(crate) fn new(
2211 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2212 ) -> Self {
2213 Self(RequestBuilder::new(stub))
2214 }
2215
2216 pub fn with_request<V: Into<crate::model::ListInstancePartitionOperationsRequest>>(
2218 mut self,
2219 v: V,
2220 ) -> Self {
2221 self.0.request = v.into();
2222 self
2223 }
2224
2225 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2227 self.0.options = v.into();
2228 self
2229 }
2230
2231 pub async fn send(self) -> Result<crate::model::ListInstancePartitionOperationsResponse> {
2233 (*self.0.stub)
2234 .list_instance_partition_operations(self.0.request, self.0.options)
2235 .await
2236 .map(crate::Response::into_body)
2237 }
2238
2239 pub fn by_page(
2241 self,
2242 ) -> impl google_cloud_gax::paginator::Paginator<
2243 crate::model::ListInstancePartitionOperationsResponse,
2244 crate::Error,
2245 > {
2246 use std::clone::Clone;
2247 let token = self.0.request.page_token.clone();
2248 let execute = move |token: String| {
2249 let mut builder = self.clone();
2250 builder.0.request = builder.0.request.set_page_token(token);
2251 builder.send()
2252 };
2253 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2254 }
2255
2256 pub fn by_item(
2258 self,
2259 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2260 crate::model::ListInstancePartitionOperationsResponse,
2261 crate::Error,
2262 > {
2263 use google_cloud_gax::paginator::Paginator;
2264 self.by_page().items()
2265 }
2266
2267 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2271 self.0.request.parent = v.into();
2272 self
2273 }
2274
2275 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2277 self.0.request.filter = v.into();
2278 self
2279 }
2280
2281 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2283 self.0.request.page_size = v.into();
2284 self
2285 }
2286
2287 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2289 self.0.request.page_token = v.into();
2290 self
2291 }
2292
2293 pub fn set_instance_partition_deadline<T>(mut self, v: T) -> Self
2295 where
2296 T: std::convert::Into<wkt::Timestamp>,
2297 {
2298 self.0.request.instance_partition_deadline = std::option::Option::Some(v.into());
2299 self
2300 }
2301
2302 pub fn set_or_clear_instance_partition_deadline<T>(
2304 mut self,
2305 v: std::option::Option<T>,
2306 ) -> Self
2307 where
2308 T: std::convert::Into<wkt::Timestamp>,
2309 {
2310 self.0.request.instance_partition_deadline = v.map(|x| x.into());
2311 self
2312 }
2313 }
2314
2315 #[doc(hidden)]
2316 impl crate::RequestBuilder for ListInstancePartitionOperations {
2317 fn request_options(&mut self) -> &mut crate::RequestOptions {
2318 &mut self.0.options
2319 }
2320 }
2321
2322 #[derive(Clone, Debug)]
2340 pub struct MoveInstance(RequestBuilder<crate::model::MoveInstanceRequest>);
2341
2342 impl MoveInstance {
2343 pub(crate) fn new(
2344 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2345 ) -> Self {
2346 Self(RequestBuilder::new(stub))
2347 }
2348
2349 pub fn with_request<V: Into<crate::model::MoveInstanceRequest>>(mut self, v: V) -> Self {
2351 self.0.request = v.into();
2352 self
2353 }
2354
2355 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2357 self.0.options = v.into();
2358 self
2359 }
2360
2361 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2368 (*self.0.stub)
2369 .move_instance(self.0.request, self.0.options)
2370 .await
2371 .map(crate::Response::into_body)
2372 }
2373
2374 pub fn poller(
2376 self,
2377 ) -> impl google_cloud_lro::Poller<
2378 crate::model::MoveInstanceResponse,
2379 crate::model::MoveInstanceMetadata,
2380 > {
2381 type Operation = google_cloud_lro::internal::Operation<
2382 crate::model::MoveInstanceResponse,
2383 crate::model::MoveInstanceMetadata,
2384 >;
2385 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2386 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2387 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2388 if let Some(ref mut details) = poller_options.tracing {
2389 details.method_name = "google_cloud_spanner_admin_instance_v1::client::InstanceAdmin::move_instance::until_done";
2390 }
2391
2392 let stub = self.0.stub.clone();
2393 let mut options = self.0.options.clone();
2394 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2395 let query = move |name| {
2396 let stub = stub.clone();
2397 let options = options.clone();
2398 async {
2399 let op = GetOperation::new(stub)
2400 .set_name(name)
2401 .with_options(options)
2402 .send()
2403 .await?;
2404 Ok(Operation::new(op))
2405 }
2406 };
2407
2408 let start = move || async {
2409 let op = self.send().await?;
2410 Ok(Operation::new(op))
2411 };
2412
2413 use google_cloud_lro::internal::PollerExt;
2414 {
2415 google_cloud_lro::internal::new_poller(
2416 polling_error_policy,
2417 polling_backoff_policy,
2418 start,
2419 query,
2420 )
2421 }
2422 .with_options(poller_options)
2423 }
2424
2425 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2429 self.0.request.name = v.into();
2430 self
2431 }
2432
2433 pub fn set_target_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2437 self.0.request.target_config = v.into();
2438 self
2439 }
2440 }
2441
2442 #[doc(hidden)]
2443 impl crate::RequestBuilder for MoveInstance {
2444 fn request_options(&mut self) -> &mut crate::RequestOptions {
2445 &mut self.0.options
2446 }
2447 }
2448
2449 #[derive(Clone, Debug)]
2470 pub struct ListOperations(
2471 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2472 );
2473
2474 impl ListOperations {
2475 pub(crate) fn new(
2476 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2477 ) -> Self {
2478 Self(RequestBuilder::new(stub))
2479 }
2480
2481 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2483 mut self,
2484 v: V,
2485 ) -> Self {
2486 self.0.request = v.into();
2487 self
2488 }
2489
2490 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2492 self.0.options = v.into();
2493 self
2494 }
2495
2496 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2498 (*self.0.stub)
2499 .list_operations(self.0.request, self.0.options)
2500 .await
2501 .map(crate::Response::into_body)
2502 }
2503
2504 pub fn by_page(
2506 self,
2507 ) -> impl google_cloud_gax::paginator::Paginator<
2508 google_cloud_longrunning::model::ListOperationsResponse,
2509 crate::Error,
2510 > {
2511 use std::clone::Clone;
2512 let token = self.0.request.page_token.clone();
2513 let execute = move |token: String| {
2514 let mut builder = self.clone();
2515 builder.0.request = builder.0.request.set_page_token(token);
2516 builder.send()
2517 };
2518 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2519 }
2520
2521 pub fn by_item(
2523 self,
2524 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2525 google_cloud_longrunning::model::ListOperationsResponse,
2526 crate::Error,
2527 > {
2528 use google_cloud_gax::paginator::Paginator;
2529 self.by_page().items()
2530 }
2531
2532 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2534 self.0.request.name = v.into();
2535 self
2536 }
2537
2538 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2540 self.0.request.filter = v.into();
2541 self
2542 }
2543
2544 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2546 self.0.request.page_size = v.into();
2547 self
2548 }
2549
2550 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2552 self.0.request.page_token = v.into();
2553 self
2554 }
2555
2556 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2558 self.0.request.return_partial_success = v.into();
2559 self
2560 }
2561 }
2562
2563 #[doc(hidden)]
2564 impl crate::RequestBuilder for ListOperations {
2565 fn request_options(&mut self) -> &mut crate::RequestOptions {
2566 &mut self.0.options
2567 }
2568 }
2569
2570 #[derive(Clone, Debug)]
2587 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2588
2589 impl GetOperation {
2590 pub(crate) fn new(
2591 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2592 ) -> Self {
2593 Self(RequestBuilder::new(stub))
2594 }
2595
2596 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2598 mut self,
2599 v: V,
2600 ) -> Self {
2601 self.0.request = v.into();
2602 self
2603 }
2604
2605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2607 self.0.options = v.into();
2608 self
2609 }
2610
2611 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2613 (*self.0.stub)
2614 .get_operation(self.0.request, self.0.options)
2615 .await
2616 .map(crate::Response::into_body)
2617 }
2618
2619 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2621 self.0.request.name = v.into();
2622 self
2623 }
2624 }
2625
2626 #[doc(hidden)]
2627 impl crate::RequestBuilder for GetOperation {
2628 fn request_options(&mut self) -> &mut crate::RequestOptions {
2629 &mut self.0.options
2630 }
2631 }
2632
2633 #[derive(Clone, Debug)]
2650 pub struct DeleteOperation(
2651 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2652 );
2653
2654 impl DeleteOperation {
2655 pub(crate) fn new(
2656 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2657 ) -> Self {
2658 Self(RequestBuilder::new(stub))
2659 }
2660
2661 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2663 mut self,
2664 v: V,
2665 ) -> Self {
2666 self.0.request = v.into();
2667 self
2668 }
2669
2670 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2672 self.0.options = v.into();
2673 self
2674 }
2675
2676 pub async fn send(self) -> Result<()> {
2678 (*self.0.stub)
2679 .delete_operation(self.0.request, self.0.options)
2680 .await
2681 .map(crate::Response::into_body)
2682 }
2683
2684 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2686 self.0.request.name = v.into();
2687 self
2688 }
2689 }
2690
2691 #[doc(hidden)]
2692 impl crate::RequestBuilder for DeleteOperation {
2693 fn request_options(&mut self) -> &mut crate::RequestOptions {
2694 &mut self.0.options
2695 }
2696 }
2697
2698 #[derive(Clone, Debug)]
2715 pub struct CancelOperation(
2716 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2717 );
2718
2719 impl CancelOperation {
2720 pub(crate) fn new(
2721 stub: std::sync::Arc<dyn super::super::stub::dynamic::InstanceAdmin>,
2722 ) -> Self {
2723 Self(RequestBuilder::new(stub))
2724 }
2725
2726 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2728 mut self,
2729 v: V,
2730 ) -> Self {
2731 self.0.request = v.into();
2732 self
2733 }
2734
2735 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2737 self.0.options = v.into();
2738 self
2739 }
2740
2741 pub async fn send(self) -> Result<()> {
2743 (*self.0.stub)
2744 .cancel_operation(self.0.request, self.0.options)
2745 .await
2746 .map(crate::Response::into_body)
2747 }
2748
2749 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2751 self.0.request.name = v.into();
2752 self
2753 }
2754 }
2755
2756 #[doc(hidden)]
2757 impl crate::RequestBuilder for CancelOperation {
2758 fn request_options(&mut self) -> &mut crate::RequestOptions {
2759 &mut self.0.options
2760 }
2761 }
2762}