1pub mod notebook_service {
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::NotebookService;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = NotebookService;
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::NotebookService>,
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::NotebookService>,
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 ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
96
97 impl ListInstances {
98 pub(crate) fn new(
99 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
100 ) -> Self {
101 Self(RequestBuilder::new(stub))
102 }
103
104 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
118 (*self.0.stub)
119 .list_instances(self.0.request, self.0.options)
120 .await
121 .map(crate::Response::into_body)
122 }
123
124 pub fn by_page(
126 self,
127 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
128 {
129 use std::clone::Clone;
130 let token = self.0.request.page_token.clone();
131 let execute = move |token: String| {
132 let mut builder = self.clone();
133 builder.0.request = builder.0.request.set_page_token(token);
134 builder.send()
135 };
136 google_cloud_gax::paginator::internal::new_paginator(token, execute)
137 }
138
139 pub fn by_item(
141 self,
142 ) -> impl google_cloud_gax::paginator::ItemPaginator<
143 crate::model::ListInstancesResponse,
144 crate::Error,
145 > {
146 use google_cloud_gax::paginator::Paginator;
147 self.by_page().items()
148 }
149
150 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
154 self.0.request.parent = v.into();
155 self
156 }
157
158 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
160 self.0.request.page_size = v.into();
161 self
162 }
163
164 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
166 self.0.request.page_token = v.into();
167 self
168 }
169
170 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
172 self.0.request.order_by = v.into();
173 self
174 }
175
176 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
178 self.0.request.filter = v.into();
179 self
180 }
181 }
182
183 #[doc(hidden)]
184 impl crate::RequestBuilder for ListInstances {
185 fn request_options(&mut self) -> &mut crate::RequestOptions {
186 &mut self.0.options
187 }
188 }
189
190 #[derive(Clone, Debug)]
207 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
208
209 impl GetInstance {
210 pub(crate) fn new(
211 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
212 ) -> Self {
213 Self(RequestBuilder::new(stub))
214 }
215
216 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
218 self.0.request = v.into();
219 self
220 }
221
222 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
224 self.0.options = v.into();
225 self
226 }
227
228 pub async fn send(self) -> Result<crate::model::Instance> {
230 (*self.0.stub)
231 .get_instance(self.0.request, self.0.options)
232 .await
233 .map(crate::Response::into_body)
234 }
235
236 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
240 self.0.request.name = v.into();
241 self
242 }
243 }
244
245 #[doc(hidden)]
246 impl crate::RequestBuilder for GetInstance {
247 fn request_options(&mut self) -> &mut crate::RequestOptions {
248 &mut self.0.options
249 }
250 }
251
252 #[derive(Clone, Debug)]
270 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
271
272 impl CreateInstance {
273 pub(crate) fn new(
274 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
275 ) -> Self {
276 Self(RequestBuilder::new(stub))
277 }
278
279 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
281 self.0.request = v.into();
282 self
283 }
284
285 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
287 self.0.options = v.into();
288 self
289 }
290
291 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
298 (*self.0.stub)
299 .create_instance(self.0.request, self.0.options)
300 .await
301 .map(crate::Response::into_body)
302 }
303
304 pub fn poller(
306 self,
307 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
308 {
309 type Operation = google_cloud_lro::internal::Operation<
310 crate::model::Instance,
311 crate::model::OperationMetadata,
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(google_cloud_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 google_cloud_lro::internal::new_poller(
338 polling_error_policy,
339 polling_backoff_policy,
340 start,
341 query,
342 )
343 }
344
345 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
349 self.0.request.parent = v.into();
350 self
351 }
352
353 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
357 self.0.request.instance_id = v.into();
358 self
359 }
360
361 pub fn set_instance<T>(mut self, v: T) -> Self
365 where
366 T: std::convert::Into<crate::model::Instance>,
367 {
368 self.0.request.instance = std::option::Option::Some(v.into());
369 self
370 }
371
372 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
376 where
377 T: std::convert::Into<crate::model::Instance>,
378 {
379 self.0.request.instance = v.map(|x| x.into());
380 self
381 }
382
383 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
385 self.0.request.request_id = v.into();
386 self
387 }
388 }
389
390 #[doc(hidden)]
391 impl crate::RequestBuilder for CreateInstance {
392 fn request_options(&mut self) -> &mut crate::RequestOptions {
393 &mut self.0.options
394 }
395 }
396
397 #[derive(Clone, Debug)]
415 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
416
417 impl UpdateInstance {
418 pub(crate) fn new(
419 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
420 ) -> Self {
421 Self(RequestBuilder::new(stub))
422 }
423
424 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
426 self.0.request = v.into();
427 self
428 }
429
430 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
432 self.0.options = v.into();
433 self
434 }
435
436 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
443 (*self.0.stub)
444 .update_instance(self.0.request, self.0.options)
445 .await
446 .map(crate::Response::into_body)
447 }
448
449 pub fn poller(
451 self,
452 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
453 {
454 type Operation = google_cloud_lro::internal::Operation<
455 crate::model::Instance,
456 crate::model::OperationMetadata,
457 >;
458 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
459 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
460
461 let stub = self.0.stub.clone();
462 let mut options = self.0.options.clone();
463 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
464 let query = move |name| {
465 let stub = stub.clone();
466 let options = options.clone();
467 async {
468 let op = GetOperation::new(stub)
469 .set_name(name)
470 .with_options(options)
471 .send()
472 .await?;
473 Ok(Operation::new(op))
474 }
475 };
476
477 let start = move || async {
478 let op = self.send().await?;
479 Ok(Operation::new(op))
480 };
481
482 google_cloud_lro::internal::new_poller(
483 polling_error_policy,
484 polling_backoff_policy,
485 start,
486 query,
487 )
488 }
489
490 pub fn set_instance<T>(mut self, v: T) -> Self
494 where
495 T: std::convert::Into<crate::model::Instance>,
496 {
497 self.0.request.instance = std::option::Option::Some(v.into());
498 self
499 }
500
501 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
505 where
506 T: std::convert::Into<crate::model::Instance>,
507 {
508 self.0.request.instance = v.map(|x| x.into());
509 self
510 }
511
512 pub fn set_update_mask<T>(mut self, v: T) -> Self
516 where
517 T: std::convert::Into<wkt::FieldMask>,
518 {
519 self.0.request.update_mask = std::option::Option::Some(v.into());
520 self
521 }
522
523 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
527 where
528 T: std::convert::Into<wkt::FieldMask>,
529 {
530 self.0.request.update_mask = v.map(|x| x.into());
531 self
532 }
533
534 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
536 self.0.request.request_id = v.into();
537 self
538 }
539 }
540
541 #[doc(hidden)]
542 impl crate::RequestBuilder for UpdateInstance {
543 fn request_options(&mut self) -> &mut crate::RequestOptions {
544 &mut self.0.options
545 }
546 }
547
548 #[derive(Clone, Debug)]
566 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
567
568 impl DeleteInstance {
569 pub(crate) fn new(
570 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
571 ) -> Self {
572 Self(RequestBuilder::new(stub))
573 }
574
575 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
577 self.0.request = v.into();
578 self
579 }
580
581 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
583 self.0.options = v.into();
584 self
585 }
586
587 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
594 (*self.0.stub)
595 .delete_instance(self.0.request, self.0.options)
596 .await
597 .map(crate::Response::into_body)
598 }
599
600 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
602 type Operation =
603 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
604 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
605 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
606
607 let stub = self.0.stub.clone();
608 let mut options = self.0.options.clone();
609 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
610 let query = move |name| {
611 let stub = stub.clone();
612 let options = options.clone();
613 async {
614 let op = GetOperation::new(stub)
615 .set_name(name)
616 .with_options(options)
617 .send()
618 .await?;
619 Ok(Operation::new(op))
620 }
621 };
622
623 let start = move || async {
624 let op = self.send().await?;
625 Ok(Operation::new(op))
626 };
627
628 google_cloud_lro::internal::new_unit_response_poller(
629 polling_error_policy,
630 polling_backoff_policy,
631 start,
632 query,
633 )
634 }
635
636 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
640 self.0.request.name = v.into();
641 self
642 }
643
644 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
646 self.0.request.request_id = v.into();
647 self
648 }
649 }
650
651 #[doc(hidden)]
652 impl crate::RequestBuilder for DeleteInstance {
653 fn request_options(&mut self) -> &mut crate::RequestOptions {
654 &mut self.0.options
655 }
656 }
657
658 #[derive(Clone, Debug)]
676 pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
677
678 impl StartInstance {
679 pub(crate) fn new(
680 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
681 ) -> Self {
682 Self(RequestBuilder::new(stub))
683 }
684
685 pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
687 self.0.request = v.into();
688 self
689 }
690
691 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
693 self.0.options = v.into();
694 self
695 }
696
697 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
704 (*self.0.stub)
705 .start_instance(self.0.request, self.0.options)
706 .await
707 .map(crate::Response::into_body)
708 }
709
710 pub fn poller(
712 self,
713 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
714 {
715 type Operation = google_cloud_lro::internal::Operation<
716 crate::model::Instance,
717 crate::model::OperationMetadata,
718 >;
719 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
720 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
721
722 let stub = self.0.stub.clone();
723 let mut options = self.0.options.clone();
724 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
725 let query = move |name| {
726 let stub = stub.clone();
727 let options = options.clone();
728 async {
729 let op = GetOperation::new(stub)
730 .set_name(name)
731 .with_options(options)
732 .send()
733 .await?;
734 Ok(Operation::new(op))
735 }
736 };
737
738 let start = move || async {
739 let op = self.send().await?;
740 Ok(Operation::new(op))
741 };
742
743 google_cloud_lro::internal::new_poller(
744 polling_error_policy,
745 polling_backoff_policy,
746 start,
747 query,
748 )
749 }
750
751 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
755 self.0.request.name = v.into();
756 self
757 }
758 }
759
760 #[doc(hidden)]
761 impl crate::RequestBuilder for StartInstance {
762 fn request_options(&mut self) -> &mut crate::RequestOptions {
763 &mut self.0.options
764 }
765 }
766
767 #[derive(Clone, Debug)]
785 pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
786
787 impl StopInstance {
788 pub(crate) fn new(
789 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
790 ) -> Self {
791 Self(RequestBuilder::new(stub))
792 }
793
794 pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(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<google_cloud_longrunning::model::Operation> {
813 (*self.0.stub)
814 .stop_instance(self.0.request, self.0.options)
815 .await
816 .map(crate::Response::into_body)
817 }
818
819 pub fn poller(
821 self,
822 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
823 {
824 type Operation = google_cloud_lro::internal::Operation<
825 crate::model::Instance,
826 crate::model::OperationMetadata,
827 >;
828 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
829 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
830
831 let stub = self.0.stub.clone();
832 let mut options = self.0.options.clone();
833 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
834 let query = move |name| {
835 let stub = stub.clone();
836 let options = options.clone();
837 async {
838 let op = GetOperation::new(stub)
839 .set_name(name)
840 .with_options(options)
841 .send()
842 .await?;
843 Ok(Operation::new(op))
844 }
845 };
846
847 let start = move || async {
848 let op = self.send().await?;
849 Ok(Operation::new(op))
850 };
851
852 google_cloud_lro::internal::new_poller(
853 polling_error_policy,
854 polling_backoff_policy,
855 start,
856 query,
857 )
858 }
859
860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
864 self.0.request.name = v.into();
865 self
866 }
867 }
868
869 #[doc(hidden)]
870 impl crate::RequestBuilder for StopInstance {
871 fn request_options(&mut self) -> &mut crate::RequestOptions {
872 &mut self.0.options
873 }
874 }
875
876 #[derive(Clone, Debug)]
894 pub struct ResetInstance(RequestBuilder<crate::model::ResetInstanceRequest>);
895
896 impl ResetInstance {
897 pub(crate) fn new(
898 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
899 ) -> Self {
900 Self(RequestBuilder::new(stub))
901 }
902
903 pub fn with_request<V: Into<crate::model::ResetInstanceRequest>>(mut self, v: V) -> Self {
905 self.0.request = v.into();
906 self
907 }
908
909 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
911 self.0.options = v.into();
912 self
913 }
914
915 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
922 (*self.0.stub)
923 .reset_instance(self.0.request, self.0.options)
924 .await
925 .map(crate::Response::into_body)
926 }
927
928 pub fn poller(
930 self,
931 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
932 {
933 type Operation = google_cloud_lro::internal::Operation<
934 crate::model::Instance,
935 crate::model::OperationMetadata,
936 >;
937 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
938 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
939
940 let stub = self.0.stub.clone();
941 let mut options = self.0.options.clone();
942 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
943 let query = move |name| {
944 let stub = stub.clone();
945 let options = options.clone();
946 async {
947 let op = GetOperation::new(stub)
948 .set_name(name)
949 .with_options(options)
950 .send()
951 .await?;
952 Ok(Operation::new(op))
953 }
954 };
955
956 let start = move || async {
957 let op = self.send().await?;
958 Ok(Operation::new(op))
959 };
960
961 google_cloud_lro::internal::new_poller(
962 polling_error_policy,
963 polling_backoff_policy,
964 start,
965 query,
966 )
967 }
968
969 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
973 self.0.request.name = v.into();
974 self
975 }
976 }
977
978 #[doc(hidden)]
979 impl crate::RequestBuilder for ResetInstance {
980 fn request_options(&mut self) -> &mut crate::RequestOptions {
981 &mut self.0.options
982 }
983 }
984
985 #[derive(Clone, Debug)]
1002 pub struct CheckInstanceUpgradability(
1003 RequestBuilder<crate::model::CheckInstanceUpgradabilityRequest>,
1004 );
1005
1006 impl CheckInstanceUpgradability {
1007 pub(crate) fn new(
1008 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1009 ) -> Self {
1010 Self(RequestBuilder::new(stub))
1011 }
1012
1013 pub fn with_request<V: Into<crate::model::CheckInstanceUpgradabilityRequest>>(
1015 mut self,
1016 v: V,
1017 ) -> Self {
1018 self.0.request = v.into();
1019 self
1020 }
1021
1022 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1024 self.0.options = v.into();
1025 self
1026 }
1027
1028 pub async fn send(self) -> Result<crate::model::CheckInstanceUpgradabilityResponse> {
1030 (*self.0.stub)
1031 .check_instance_upgradability(self.0.request, self.0.options)
1032 .await
1033 .map(crate::Response::into_body)
1034 }
1035
1036 pub fn set_notebook_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
1040 self.0.request.notebook_instance = v.into();
1041 self
1042 }
1043 }
1044
1045 #[doc(hidden)]
1046 impl crate::RequestBuilder for CheckInstanceUpgradability {
1047 fn request_options(&mut self) -> &mut crate::RequestOptions {
1048 &mut self.0.options
1049 }
1050 }
1051
1052 #[derive(Clone, Debug)]
1070 pub struct UpgradeInstance(RequestBuilder<crate::model::UpgradeInstanceRequest>);
1071
1072 impl UpgradeInstance {
1073 pub(crate) fn new(
1074 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1075 ) -> Self {
1076 Self(RequestBuilder::new(stub))
1077 }
1078
1079 pub fn with_request<V: Into<crate::model::UpgradeInstanceRequest>>(mut self, v: V) -> Self {
1081 self.0.request = v.into();
1082 self
1083 }
1084
1085 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1087 self.0.options = v.into();
1088 self
1089 }
1090
1091 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1098 (*self.0.stub)
1099 .upgrade_instance(self.0.request, self.0.options)
1100 .await
1101 .map(crate::Response::into_body)
1102 }
1103
1104 pub fn poller(
1106 self,
1107 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1108 {
1109 type Operation = google_cloud_lro::internal::Operation<
1110 crate::model::Instance,
1111 crate::model::OperationMetadata,
1112 >;
1113 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1114 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1115
1116 let stub = self.0.stub.clone();
1117 let mut options = self.0.options.clone();
1118 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1119 let query = move |name| {
1120 let stub = stub.clone();
1121 let options = options.clone();
1122 async {
1123 let op = GetOperation::new(stub)
1124 .set_name(name)
1125 .with_options(options)
1126 .send()
1127 .await?;
1128 Ok(Operation::new(op))
1129 }
1130 };
1131
1132 let start = move || async {
1133 let op = self.send().await?;
1134 Ok(Operation::new(op))
1135 };
1136
1137 google_cloud_lro::internal::new_poller(
1138 polling_error_policy,
1139 polling_backoff_policy,
1140 start,
1141 query,
1142 )
1143 }
1144
1145 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1149 self.0.request.name = v.into();
1150 self
1151 }
1152 }
1153
1154 #[doc(hidden)]
1155 impl crate::RequestBuilder for UpgradeInstance {
1156 fn request_options(&mut self) -> &mut crate::RequestOptions {
1157 &mut self.0.options
1158 }
1159 }
1160
1161 #[derive(Clone, Debug)]
1179 pub struct RollbackInstance(RequestBuilder<crate::model::RollbackInstanceRequest>);
1180
1181 impl RollbackInstance {
1182 pub(crate) fn new(
1183 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1184 ) -> Self {
1185 Self(RequestBuilder::new(stub))
1186 }
1187
1188 pub fn with_request<V: Into<crate::model::RollbackInstanceRequest>>(
1190 mut self,
1191 v: V,
1192 ) -> Self {
1193 self.0.request = v.into();
1194 self
1195 }
1196
1197 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1199 self.0.options = v.into();
1200 self
1201 }
1202
1203 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1210 (*self.0.stub)
1211 .rollback_instance(self.0.request, self.0.options)
1212 .await
1213 .map(crate::Response::into_body)
1214 }
1215
1216 pub fn poller(
1218 self,
1219 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1220 {
1221 type Operation = google_cloud_lro::internal::Operation<
1222 crate::model::Instance,
1223 crate::model::OperationMetadata,
1224 >;
1225 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1226 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1227
1228 let stub = self.0.stub.clone();
1229 let mut options = self.0.options.clone();
1230 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1231 let query = move |name| {
1232 let stub = stub.clone();
1233 let options = options.clone();
1234 async {
1235 let op = GetOperation::new(stub)
1236 .set_name(name)
1237 .with_options(options)
1238 .send()
1239 .await?;
1240 Ok(Operation::new(op))
1241 }
1242 };
1243
1244 let start = move || async {
1245 let op = self.send().await?;
1246 Ok(Operation::new(op))
1247 };
1248
1249 google_cloud_lro::internal::new_poller(
1250 polling_error_policy,
1251 polling_backoff_policy,
1252 start,
1253 query,
1254 )
1255 }
1256
1257 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1261 self.0.request.name = v.into();
1262 self
1263 }
1264
1265 pub fn set_target_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
1269 self.0.request.target_snapshot = v.into();
1270 self
1271 }
1272
1273 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1277 self.0.request.revision_id = v.into();
1278 self
1279 }
1280 }
1281
1282 #[doc(hidden)]
1283 impl crate::RequestBuilder for RollbackInstance {
1284 fn request_options(&mut self) -> &mut crate::RequestOptions {
1285 &mut self.0.options
1286 }
1287 }
1288
1289 #[derive(Clone, Debug)]
1307 pub struct DiagnoseInstance(RequestBuilder<crate::model::DiagnoseInstanceRequest>);
1308
1309 impl DiagnoseInstance {
1310 pub(crate) fn new(
1311 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1312 ) -> Self {
1313 Self(RequestBuilder::new(stub))
1314 }
1315
1316 pub fn with_request<V: Into<crate::model::DiagnoseInstanceRequest>>(
1318 mut self,
1319 v: V,
1320 ) -> Self {
1321 self.0.request = v.into();
1322 self
1323 }
1324
1325 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1327 self.0.options = v.into();
1328 self
1329 }
1330
1331 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1338 (*self.0.stub)
1339 .diagnose_instance(self.0.request, self.0.options)
1340 .await
1341 .map(crate::Response::into_body)
1342 }
1343
1344 pub fn poller(
1346 self,
1347 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1348 {
1349 type Operation = google_cloud_lro::internal::Operation<
1350 crate::model::Instance,
1351 crate::model::OperationMetadata,
1352 >;
1353 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1354 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1355
1356 let stub = self.0.stub.clone();
1357 let mut options = self.0.options.clone();
1358 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1359 let query = move |name| {
1360 let stub = stub.clone();
1361 let options = options.clone();
1362 async {
1363 let op = GetOperation::new(stub)
1364 .set_name(name)
1365 .with_options(options)
1366 .send()
1367 .await?;
1368 Ok(Operation::new(op))
1369 }
1370 };
1371
1372 let start = move || async {
1373 let op = self.send().await?;
1374 Ok(Operation::new(op))
1375 };
1376
1377 google_cloud_lro::internal::new_poller(
1378 polling_error_policy,
1379 polling_backoff_policy,
1380 start,
1381 query,
1382 )
1383 }
1384
1385 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1389 self.0.request.name = v.into();
1390 self
1391 }
1392
1393 pub fn set_diagnostic_config<T>(mut self, v: T) -> Self
1397 where
1398 T: std::convert::Into<crate::model::DiagnosticConfig>,
1399 {
1400 self.0.request.diagnostic_config = std::option::Option::Some(v.into());
1401 self
1402 }
1403
1404 pub fn set_or_clear_diagnostic_config<T>(mut self, v: std::option::Option<T>) -> Self
1408 where
1409 T: std::convert::Into<crate::model::DiagnosticConfig>,
1410 {
1411 self.0.request.diagnostic_config = v.map(|x| x.into());
1412 self
1413 }
1414
1415 pub fn set_timeout_minutes<T: Into<i32>>(mut self, v: T) -> Self {
1417 self.0.request.timeout_minutes = v.into();
1418 self
1419 }
1420 }
1421
1422 #[doc(hidden)]
1423 impl crate::RequestBuilder for DiagnoseInstance {
1424 fn request_options(&mut self) -> &mut crate::RequestOptions {
1425 &mut self.0.options
1426 }
1427 }
1428
1429 #[derive(Clone, Debug)]
1450 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1451
1452 impl ListLocations {
1453 pub(crate) fn new(
1454 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1455 ) -> Self {
1456 Self(RequestBuilder::new(stub))
1457 }
1458
1459 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1461 mut self,
1462 v: V,
1463 ) -> Self {
1464 self.0.request = v.into();
1465 self
1466 }
1467
1468 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1470 self.0.options = v.into();
1471 self
1472 }
1473
1474 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1476 (*self.0.stub)
1477 .list_locations(self.0.request, self.0.options)
1478 .await
1479 .map(crate::Response::into_body)
1480 }
1481
1482 pub fn by_page(
1484 self,
1485 ) -> impl google_cloud_gax::paginator::Paginator<
1486 google_cloud_location::model::ListLocationsResponse,
1487 crate::Error,
1488 > {
1489 use std::clone::Clone;
1490 let token = self.0.request.page_token.clone();
1491 let execute = move |token: String| {
1492 let mut builder = self.clone();
1493 builder.0.request = builder.0.request.set_page_token(token);
1494 builder.send()
1495 };
1496 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1497 }
1498
1499 pub fn by_item(
1501 self,
1502 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1503 google_cloud_location::model::ListLocationsResponse,
1504 crate::Error,
1505 > {
1506 use google_cloud_gax::paginator::Paginator;
1507 self.by_page().items()
1508 }
1509
1510 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1512 self.0.request.name = v.into();
1513 self
1514 }
1515
1516 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1518 self.0.request.filter = v.into();
1519 self
1520 }
1521
1522 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1524 self.0.request.page_size = v.into();
1525 self
1526 }
1527
1528 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1530 self.0.request.page_token = v.into();
1531 self
1532 }
1533 }
1534
1535 #[doc(hidden)]
1536 impl crate::RequestBuilder for ListLocations {
1537 fn request_options(&mut self) -> &mut crate::RequestOptions {
1538 &mut self.0.options
1539 }
1540 }
1541
1542 #[derive(Clone, Debug)]
1559 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1560
1561 impl GetLocation {
1562 pub(crate) fn new(
1563 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1564 ) -> Self {
1565 Self(RequestBuilder::new(stub))
1566 }
1567
1568 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1570 mut self,
1571 v: V,
1572 ) -> Self {
1573 self.0.request = v.into();
1574 self
1575 }
1576
1577 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1579 self.0.options = v.into();
1580 self
1581 }
1582
1583 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1585 (*self.0.stub)
1586 .get_location(self.0.request, self.0.options)
1587 .await
1588 .map(crate::Response::into_body)
1589 }
1590
1591 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1593 self.0.request.name = v.into();
1594 self
1595 }
1596 }
1597
1598 #[doc(hidden)]
1599 impl crate::RequestBuilder for GetLocation {
1600 fn request_options(&mut self) -> &mut crate::RequestOptions {
1601 &mut self.0.options
1602 }
1603 }
1604
1605 #[derive(Clone, Debug)]
1622 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1623
1624 impl SetIamPolicy {
1625 pub(crate) fn new(
1626 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1627 ) -> Self {
1628 Self(RequestBuilder::new(stub))
1629 }
1630
1631 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1633 mut self,
1634 v: V,
1635 ) -> Self {
1636 self.0.request = v.into();
1637 self
1638 }
1639
1640 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1642 self.0.options = v.into();
1643 self
1644 }
1645
1646 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1648 (*self.0.stub)
1649 .set_iam_policy(self.0.request, self.0.options)
1650 .await
1651 .map(crate::Response::into_body)
1652 }
1653
1654 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1658 self.0.request.resource = v.into();
1659 self
1660 }
1661
1662 pub fn set_policy<T>(mut self, v: T) -> Self
1666 where
1667 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1668 {
1669 self.0.request.policy = std::option::Option::Some(v.into());
1670 self
1671 }
1672
1673 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1677 where
1678 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1679 {
1680 self.0.request.policy = v.map(|x| x.into());
1681 self
1682 }
1683
1684 pub fn set_update_mask<T>(mut self, v: T) -> Self
1686 where
1687 T: std::convert::Into<wkt::FieldMask>,
1688 {
1689 self.0.request.update_mask = std::option::Option::Some(v.into());
1690 self
1691 }
1692
1693 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1695 where
1696 T: std::convert::Into<wkt::FieldMask>,
1697 {
1698 self.0.request.update_mask = v.map(|x| x.into());
1699 self
1700 }
1701 }
1702
1703 #[doc(hidden)]
1704 impl crate::RequestBuilder for SetIamPolicy {
1705 fn request_options(&mut self) -> &mut crate::RequestOptions {
1706 &mut self.0.options
1707 }
1708 }
1709
1710 #[derive(Clone, Debug)]
1727 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1728
1729 impl GetIamPolicy {
1730 pub(crate) fn new(
1731 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1732 ) -> Self {
1733 Self(RequestBuilder::new(stub))
1734 }
1735
1736 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1738 mut self,
1739 v: V,
1740 ) -> Self {
1741 self.0.request = v.into();
1742 self
1743 }
1744
1745 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1747 self.0.options = v.into();
1748 self
1749 }
1750
1751 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1753 (*self.0.stub)
1754 .get_iam_policy(self.0.request, self.0.options)
1755 .await
1756 .map(crate::Response::into_body)
1757 }
1758
1759 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1763 self.0.request.resource = v.into();
1764 self
1765 }
1766
1767 pub fn set_options<T>(mut self, v: T) -> Self
1769 where
1770 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1771 {
1772 self.0.request.options = std::option::Option::Some(v.into());
1773 self
1774 }
1775
1776 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1778 where
1779 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1780 {
1781 self.0.request.options = v.map(|x| x.into());
1782 self
1783 }
1784 }
1785
1786 #[doc(hidden)]
1787 impl crate::RequestBuilder for GetIamPolicy {
1788 fn request_options(&mut self) -> &mut crate::RequestOptions {
1789 &mut self.0.options
1790 }
1791 }
1792
1793 #[derive(Clone, Debug)]
1810 pub struct TestIamPermissions(
1811 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1812 );
1813
1814 impl TestIamPermissions {
1815 pub(crate) fn new(
1816 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1817 ) -> Self {
1818 Self(RequestBuilder::new(stub))
1819 }
1820
1821 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1823 mut self,
1824 v: V,
1825 ) -> Self {
1826 self.0.request = v.into();
1827 self
1828 }
1829
1830 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1832 self.0.options = v.into();
1833 self
1834 }
1835
1836 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1838 (*self.0.stub)
1839 .test_iam_permissions(self.0.request, self.0.options)
1840 .await
1841 .map(crate::Response::into_body)
1842 }
1843
1844 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1848 self.0.request.resource = v.into();
1849 self
1850 }
1851
1852 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1856 where
1857 T: std::iter::IntoIterator<Item = V>,
1858 V: std::convert::Into<std::string::String>,
1859 {
1860 use std::iter::Iterator;
1861 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1862 self
1863 }
1864 }
1865
1866 #[doc(hidden)]
1867 impl crate::RequestBuilder for TestIamPermissions {
1868 fn request_options(&mut self) -> &mut crate::RequestOptions {
1869 &mut self.0.options
1870 }
1871 }
1872
1873 #[derive(Clone, Debug)]
1894 pub struct ListOperations(
1895 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1896 );
1897
1898 impl ListOperations {
1899 pub(crate) fn new(
1900 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1901 ) -> Self {
1902 Self(RequestBuilder::new(stub))
1903 }
1904
1905 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1907 mut self,
1908 v: V,
1909 ) -> Self {
1910 self.0.request = v.into();
1911 self
1912 }
1913
1914 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1916 self.0.options = v.into();
1917 self
1918 }
1919
1920 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1922 (*self.0.stub)
1923 .list_operations(self.0.request, self.0.options)
1924 .await
1925 .map(crate::Response::into_body)
1926 }
1927
1928 pub fn by_page(
1930 self,
1931 ) -> impl google_cloud_gax::paginator::Paginator<
1932 google_cloud_longrunning::model::ListOperationsResponse,
1933 crate::Error,
1934 > {
1935 use std::clone::Clone;
1936 let token = self.0.request.page_token.clone();
1937 let execute = move |token: String| {
1938 let mut builder = self.clone();
1939 builder.0.request = builder.0.request.set_page_token(token);
1940 builder.send()
1941 };
1942 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1943 }
1944
1945 pub fn by_item(
1947 self,
1948 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1949 google_cloud_longrunning::model::ListOperationsResponse,
1950 crate::Error,
1951 > {
1952 use google_cloud_gax::paginator::Paginator;
1953 self.by_page().items()
1954 }
1955
1956 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1958 self.0.request.name = v.into();
1959 self
1960 }
1961
1962 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1964 self.0.request.filter = v.into();
1965 self
1966 }
1967
1968 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1970 self.0.request.page_size = v.into();
1971 self
1972 }
1973
1974 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1976 self.0.request.page_token = v.into();
1977 self
1978 }
1979
1980 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1982 self.0.request.return_partial_success = v.into();
1983 self
1984 }
1985 }
1986
1987 #[doc(hidden)]
1988 impl crate::RequestBuilder for ListOperations {
1989 fn request_options(&mut self) -> &mut crate::RequestOptions {
1990 &mut self.0.options
1991 }
1992 }
1993
1994 #[derive(Clone, Debug)]
2011 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2012
2013 impl GetOperation {
2014 pub(crate) fn new(
2015 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
2016 ) -> Self {
2017 Self(RequestBuilder::new(stub))
2018 }
2019
2020 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2022 mut self,
2023 v: V,
2024 ) -> Self {
2025 self.0.request = v.into();
2026 self
2027 }
2028
2029 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2031 self.0.options = v.into();
2032 self
2033 }
2034
2035 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2037 (*self.0.stub)
2038 .get_operation(self.0.request, self.0.options)
2039 .await
2040 .map(crate::Response::into_body)
2041 }
2042
2043 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2045 self.0.request.name = v.into();
2046 self
2047 }
2048 }
2049
2050 #[doc(hidden)]
2051 impl crate::RequestBuilder for GetOperation {
2052 fn request_options(&mut self) -> &mut crate::RequestOptions {
2053 &mut self.0.options
2054 }
2055 }
2056
2057 #[derive(Clone, Debug)]
2074 pub struct DeleteOperation(
2075 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2076 );
2077
2078 impl DeleteOperation {
2079 pub(crate) fn new(
2080 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
2081 ) -> Self {
2082 Self(RequestBuilder::new(stub))
2083 }
2084
2085 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2087 mut self,
2088 v: V,
2089 ) -> Self {
2090 self.0.request = v.into();
2091 self
2092 }
2093
2094 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2096 self.0.options = v.into();
2097 self
2098 }
2099
2100 pub async fn send(self) -> Result<()> {
2102 (*self.0.stub)
2103 .delete_operation(self.0.request, self.0.options)
2104 .await
2105 .map(crate::Response::into_body)
2106 }
2107
2108 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2110 self.0.request.name = v.into();
2111 self
2112 }
2113 }
2114
2115 #[doc(hidden)]
2116 impl crate::RequestBuilder for DeleteOperation {
2117 fn request_options(&mut self) -> &mut crate::RequestOptions {
2118 &mut self.0.options
2119 }
2120 }
2121
2122 #[derive(Clone, Debug)]
2139 pub struct CancelOperation(
2140 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2141 );
2142
2143 impl CancelOperation {
2144 pub(crate) fn new(
2145 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
2146 ) -> Self {
2147 Self(RequestBuilder::new(stub))
2148 }
2149
2150 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2152 mut self,
2153 v: V,
2154 ) -> Self {
2155 self.0.request = v.into();
2156 self
2157 }
2158
2159 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2161 self.0.options = v.into();
2162 self
2163 }
2164
2165 pub async fn send(self) -> Result<()> {
2167 (*self.0.stub)
2168 .cancel_operation(self.0.request, self.0.options)
2169 .await
2170 .map(crate::Response::into_body)
2171 }
2172
2173 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2175 self.0.request.name = v.into();
2176 self
2177 }
2178 }
2179
2180 #[doc(hidden)]
2181 impl crate::RequestBuilder for CancelOperation {
2182 fn request_options(&mut self) -> &mut crate::RequestOptions {
2183 &mut self.0.options
2184 }
2185 }
2186}