1pub mod notebook_service {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::NotebookService;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = NotebookService;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
94 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
95
96 impl ListInstances {
97 pub(crate) fn new(
98 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
99 ) -> Self {
100 Self(RequestBuilder::new(stub))
101 }
102
103 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
105 self.0.request = v.into();
106 self
107 }
108
109 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
117 (*self.0.stub)
118 .list_instances(self.0.request, self.0.options)
119 .await
120 .map(crate::Response::into_body)
121 }
122
123 pub fn by_page(
125 self,
126 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
127 {
128 use std::clone::Clone;
129 let token = self.0.request.page_token.clone();
130 let execute = move |token: String| {
131 let mut builder = self.clone();
132 builder.0.request = builder.0.request.set_page_token(token);
133 builder.send()
134 };
135 google_cloud_gax::paginator::internal::new_paginator(token, execute)
136 }
137
138 pub fn by_item(
140 self,
141 ) -> impl google_cloud_gax::paginator::ItemPaginator<
142 crate::model::ListInstancesResponse,
143 crate::Error,
144 > {
145 use google_cloud_gax::paginator::Paginator;
146 self.by_page().items()
147 }
148
149 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
153 self.0.request.parent = v.into();
154 self
155 }
156
157 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
159 self.0.request.page_size = v.into();
160 self
161 }
162
163 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
165 self.0.request.page_token = v.into();
166 self
167 }
168
169 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
171 self.0.request.order_by = v.into();
172 self
173 }
174
175 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
177 self.0.request.filter = v.into();
178 self
179 }
180 }
181
182 #[doc(hidden)]
183 impl crate::RequestBuilder for ListInstances {
184 fn request_options(&mut self) -> &mut crate::RequestOptions {
185 &mut self.0.options
186 }
187 }
188
189 #[derive(Clone, Debug)]
206 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
207
208 impl GetInstance {
209 pub(crate) fn new(
210 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
211 ) -> Self {
212 Self(RequestBuilder::new(stub))
213 }
214
215 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
217 self.0.request = v.into();
218 self
219 }
220
221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
223 self.0.options = v.into();
224 self
225 }
226
227 pub async fn send(self) -> Result<crate::model::Instance> {
229 (*self.0.stub)
230 .get_instance(self.0.request, self.0.options)
231 .await
232 .map(crate::Response::into_body)
233 }
234
235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
239 self.0.request.name = v.into();
240 self
241 }
242 }
243
244 #[doc(hidden)]
245 impl crate::RequestBuilder for GetInstance {
246 fn request_options(&mut self) -> &mut crate::RequestOptions {
247 &mut self.0.options
248 }
249 }
250
251 #[derive(Clone, Debug)]
269 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
270
271 impl CreateInstance {
272 pub(crate) fn new(
273 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
274 ) -> Self {
275 Self(RequestBuilder::new(stub))
276 }
277
278 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> 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(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<crate::model::Instance, crate::model::OperationMetadata>
307 {
308 type Operation = google_cloud_lro::internal::Operation<
309 crate::model::Instance,
310 crate::model::OperationMetadata,
311 >;
312 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
313 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
314
315 let stub = self.0.stub.clone();
316 let mut options = self.0.options.clone();
317 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
318 let query = move |name| {
319 let stub = stub.clone();
320 let options = options.clone();
321 async {
322 let op = GetOperation::new(stub)
323 .set_name(name)
324 .with_options(options)
325 .send()
326 .await?;
327 Ok(Operation::new(op))
328 }
329 };
330
331 let start = move || async {
332 let op = self.send().await?;
333 Ok(Operation::new(op))
334 };
335
336 google_cloud_lro::internal::new_poller(
337 polling_error_policy,
338 polling_backoff_policy,
339 start,
340 query,
341 )
342 }
343
344 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
348 self.0.request.parent = v.into();
349 self
350 }
351
352 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
356 self.0.request.instance_id = v.into();
357 self
358 }
359
360 pub fn set_instance<T>(mut self, v: T) -> Self
364 where
365 T: std::convert::Into<crate::model::Instance>,
366 {
367 self.0.request.instance = std::option::Option::Some(v.into());
368 self
369 }
370
371 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
375 where
376 T: std::convert::Into<crate::model::Instance>,
377 {
378 self.0.request.instance = v.map(|x| x.into());
379 self
380 }
381
382 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
384 self.0.request.request_id = v.into();
385 self
386 }
387 }
388
389 #[doc(hidden)]
390 impl crate::RequestBuilder for CreateInstance {
391 fn request_options(&mut self) -> &mut crate::RequestOptions {
392 &mut self.0.options
393 }
394 }
395
396 #[derive(Clone, Debug)]
414 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
415
416 impl UpdateInstance {
417 pub(crate) fn new(
418 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
419 ) -> Self {
420 Self(RequestBuilder::new(stub))
421 }
422
423 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
425 self.0.request = v.into();
426 self
427 }
428
429 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
431 self.0.options = v.into();
432 self
433 }
434
435 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
442 (*self.0.stub)
443 .update_instance(self.0.request, self.0.options)
444 .await
445 .map(crate::Response::into_body)
446 }
447
448 pub fn poller(
450 self,
451 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
452 {
453 type Operation = google_cloud_lro::internal::Operation<
454 crate::model::Instance,
455 crate::model::OperationMetadata,
456 >;
457 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
458 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
459
460 let stub = self.0.stub.clone();
461 let mut options = self.0.options.clone();
462 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
463 let query = move |name| {
464 let stub = stub.clone();
465 let options = options.clone();
466 async {
467 let op = GetOperation::new(stub)
468 .set_name(name)
469 .with_options(options)
470 .send()
471 .await?;
472 Ok(Operation::new(op))
473 }
474 };
475
476 let start = move || async {
477 let op = self.send().await?;
478 Ok(Operation::new(op))
479 };
480
481 google_cloud_lro::internal::new_poller(
482 polling_error_policy,
483 polling_backoff_policy,
484 start,
485 query,
486 )
487 }
488
489 pub fn set_instance<T>(mut self, v: T) -> Self
493 where
494 T: std::convert::Into<crate::model::Instance>,
495 {
496 self.0.request.instance = std::option::Option::Some(v.into());
497 self
498 }
499
500 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
504 where
505 T: std::convert::Into<crate::model::Instance>,
506 {
507 self.0.request.instance = v.map(|x| x.into());
508 self
509 }
510
511 pub fn set_update_mask<T>(mut self, v: T) -> Self
515 where
516 T: std::convert::Into<wkt::FieldMask>,
517 {
518 self.0.request.update_mask = std::option::Option::Some(v.into());
519 self
520 }
521
522 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
526 where
527 T: std::convert::Into<wkt::FieldMask>,
528 {
529 self.0.request.update_mask = v.map(|x| x.into());
530 self
531 }
532
533 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
535 self.0.request.request_id = v.into();
536 self
537 }
538 }
539
540 #[doc(hidden)]
541 impl crate::RequestBuilder for UpdateInstance {
542 fn request_options(&mut self) -> &mut crate::RequestOptions {
543 &mut self.0.options
544 }
545 }
546
547 #[derive(Clone, Debug)]
565 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
566
567 impl DeleteInstance {
568 pub(crate) fn new(
569 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
570 ) -> Self {
571 Self(RequestBuilder::new(stub))
572 }
573
574 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
576 self.0.request = v.into();
577 self
578 }
579
580 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
582 self.0.options = v.into();
583 self
584 }
585
586 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
593 (*self.0.stub)
594 .delete_instance(self.0.request, self.0.options)
595 .await
596 .map(crate::Response::into_body)
597 }
598
599 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
601 type Operation =
602 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
603 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
604 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
605
606 let stub = self.0.stub.clone();
607 let mut options = self.0.options.clone();
608 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
609 let query = move |name| {
610 let stub = stub.clone();
611 let options = options.clone();
612 async {
613 let op = GetOperation::new(stub)
614 .set_name(name)
615 .with_options(options)
616 .send()
617 .await?;
618 Ok(Operation::new(op))
619 }
620 };
621
622 let start = move || async {
623 let op = self.send().await?;
624 Ok(Operation::new(op))
625 };
626
627 google_cloud_lro::internal::new_unit_response_poller(
628 polling_error_policy,
629 polling_backoff_policy,
630 start,
631 query,
632 )
633 }
634
635 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
639 self.0.request.name = v.into();
640 self
641 }
642
643 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
645 self.0.request.request_id = v.into();
646 self
647 }
648 }
649
650 #[doc(hidden)]
651 impl crate::RequestBuilder for DeleteInstance {
652 fn request_options(&mut self) -> &mut crate::RequestOptions {
653 &mut self.0.options
654 }
655 }
656
657 #[derive(Clone, Debug)]
675 pub struct StartInstance(RequestBuilder<crate::model::StartInstanceRequest>);
676
677 impl StartInstance {
678 pub(crate) fn new(
679 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
680 ) -> Self {
681 Self(RequestBuilder::new(stub))
682 }
683
684 pub fn with_request<V: Into<crate::model::StartInstanceRequest>>(mut self, v: V) -> Self {
686 self.0.request = v.into();
687 self
688 }
689
690 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
692 self.0.options = v.into();
693 self
694 }
695
696 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
703 (*self.0.stub)
704 .start_instance(self.0.request, self.0.options)
705 .await
706 .map(crate::Response::into_body)
707 }
708
709 pub fn poller(
711 self,
712 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
713 {
714 type Operation = google_cloud_lro::internal::Operation<
715 crate::model::Instance,
716 crate::model::OperationMetadata,
717 >;
718 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
719 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
720
721 let stub = self.0.stub.clone();
722 let mut options = self.0.options.clone();
723 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
724 let query = move |name| {
725 let stub = stub.clone();
726 let options = options.clone();
727 async {
728 let op = GetOperation::new(stub)
729 .set_name(name)
730 .with_options(options)
731 .send()
732 .await?;
733 Ok(Operation::new(op))
734 }
735 };
736
737 let start = move || async {
738 let op = self.send().await?;
739 Ok(Operation::new(op))
740 };
741
742 google_cloud_lro::internal::new_poller(
743 polling_error_policy,
744 polling_backoff_policy,
745 start,
746 query,
747 )
748 }
749
750 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
754 self.0.request.name = v.into();
755 self
756 }
757 }
758
759 #[doc(hidden)]
760 impl crate::RequestBuilder for StartInstance {
761 fn request_options(&mut self) -> &mut crate::RequestOptions {
762 &mut self.0.options
763 }
764 }
765
766 #[derive(Clone, Debug)]
784 pub struct StopInstance(RequestBuilder<crate::model::StopInstanceRequest>);
785
786 impl StopInstance {
787 pub(crate) fn new(
788 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
789 ) -> Self {
790 Self(RequestBuilder::new(stub))
791 }
792
793 pub fn with_request<V: Into<crate::model::StopInstanceRequest>>(mut self, v: V) -> Self {
795 self.0.request = v.into();
796 self
797 }
798
799 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
801 self.0.options = v.into();
802 self
803 }
804
805 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
812 (*self.0.stub)
813 .stop_instance(self.0.request, self.0.options)
814 .await
815 .map(crate::Response::into_body)
816 }
817
818 pub fn poller(
820 self,
821 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
822 {
823 type Operation = google_cloud_lro::internal::Operation<
824 crate::model::Instance,
825 crate::model::OperationMetadata,
826 >;
827 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
828 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
829
830 let stub = self.0.stub.clone();
831 let mut options = self.0.options.clone();
832 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
833 let query = move |name| {
834 let stub = stub.clone();
835 let options = options.clone();
836 async {
837 let op = GetOperation::new(stub)
838 .set_name(name)
839 .with_options(options)
840 .send()
841 .await?;
842 Ok(Operation::new(op))
843 }
844 };
845
846 let start = move || async {
847 let op = self.send().await?;
848 Ok(Operation::new(op))
849 };
850
851 google_cloud_lro::internal::new_poller(
852 polling_error_policy,
853 polling_backoff_policy,
854 start,
855 query,
856 )
857 }
858
859 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
863 self.0.request.name = v.into();
864 self
865 }
866 }
867
868 #[doc(hidden)]
869 impl crate::RequestBuilder for StopInstance {
870 fn request_options(&mut self) -> &mut crate::RequestOptions {
871 &mut self.0.options
872 }
873 }
874
875 #[derive(Clone, Debug)]
893 pub struct ResetInstance(RequestBuilder<crate::model::ResetInstanceRequest>);
894
895 impl ResetInstance {
896 pub(crate) fn new(
897 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
898 ) -> Self {
899 Self(RequestBuilder::new(stub))
900 }
901
902 pub fn with_request<V: Into<crate::model::ResetInstanceRequest>>(mut self, v: V) -> Self {
904 self.0.request = v.into();
905 self
906 }
907
908 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
910 self.0.options = v.into();
911 self
912 }
913
914 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
921 (*self.0.stub)
922 .reset_instance(self.0.request, self.0.options)
923 .await
924 .map(crate::Response::into_body)
925 }
926
927 pub fn poller(
929 self,
930 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
931 {
932 type Operation = google_cloud_lro::internal::Operation<
933 crate::model::Instance,
934 crate::model::OperationMetadata,
935 >;
936 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
937 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
938
939 let stub = self.0.stub.clone();
940 let mut options = self.0.options.clone();
941 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
942 let query = move |name| {
943 let stub = stub.clone();
944 let options = options.clone();
945 async {
946 let op = GetOperation::new(stub)
947 .set_name(name)
948 .with_options(options)
949 .send()
950 .await?;
951 Ok(Operation::new(op))
952 }
953 };
954
955 let start = move || async {
956 let op = self.send().await?;
957 Ok(Operation::new(op))
958 };
959
960 google_cloud_lro::internal::new_poller(
961 polling_error_policy,
962 polling_backoff_policy,
963 start,
964 query,
965 )
966 }
967
968 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
972 self.0.request.name = v.into();
973 self
974 }
975 }
976
977 #[doc(hidden)]
978 impl crate::RequestBuilder for ResetInstance {
979 fn request_options(&mut self) -> &mut crate::RequestOptions {
980 &mut self.0.options
981 }
982 }
983
984 #[derive(Clone, Debug)]
1001 pub struct CheckInstanceUpgradability(
1002 RequestBuilder<crate::model::CheckInstanceUpgradabilityRequest>,
1003 );
1004
1005 impl CheckInstanceUpgradability {
1006 pub(crate) fn new(
1007 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1008 ) -> Self {
1009 Self(RequestBuilder::new(stub))
1010 }
1011
1012 pub fn with_request<V: Into<crate::model::CheckInstanceUpgradabilityRequest>>(
1014 mut self,
1015 v: V,
1016 ) -> Self {
1017 self.0.request = v.into();
1018 self
1019 }
1020
1021 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1023 self.0.options = v.into();
1024 self
1025 }
1026
1027 pub async fn send(self) -> Result<crate::model::CheckInstanceUpgradabilityResponse> {
1029 (*self.0.stub)
1030 .check_instance_upgradability(self.0.request, self.0.options)
1031 .await
1032 .map(crate::Response::into_body)
1033 }
1034
1035 pub fn set_notebook_instance<T: Into<std::string::String>>(mut self, v: T) -> Self {
1039 self.0.request.notebook_instance = v.into();
1040 self
1041 }
1042 }
1043
1044 #[doc(hidden)]
1045 impl crate::RequestBuilder for CheckInstanceUpgradability {
1046 fn request_options(&mut self) -> &mut crate::RequestOptions {
1047 &mut self.0.options
1048 }
1049 }
1050
1051 #[derive(Clone, Debug)]
1069 pub struct UpgradeInstance(RequestBuilder<crate::model::UpgradeInstanceRequest>);
1070
1071 impl UpgradeInstance {
1072 pub(crate) fn new(
1073 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1074 ) -> Self {
1075 Self(RequestBuilder::new(stub))
1076 }
1077
1078 pub fn with_request<V: Into<crate::model::UpgradeInstanceRequest>>(mut self, v: V) -> Self {
1080 self.0.request = v.into();
1081 self
1082 }
1083
1084 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1086 self.0.options = v.into();
1087 self
1088 }
1089
1090 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1097 (*self.0.stub)
1098 .upgrade_instance(self.0.request, self.0.options)
1099 .await
1100 .map(crate::Response::into_body)
1101 }
1102
1103 pub fn poller(
1105 self,
1106 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1107 {
1108 type Operation = google_cloud_lro::internal::Operation<
1109 crate::model::Instance,
1110 crate::model::OperationMetadata,
1111 >;
1112 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1113 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1114
1115 let stub = self.0.stub.clone();
1116 let mut options = self.0.options.clone();
1117 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1118 let query = move |name| {
1119 let stub = stub.clone();
1120 let options = options.clone();
1121 async {
1122 let op = GetOperation::new(stub)
1123 .set_name(name)
1124 .with_options(options)
1125 .send()
1126 .await?;
1127 Ok(Operation::new(op))
1128 }
1129 };
1130
1131 let start = move || async {
1132 let op = self.send().await?;
1133 Ok(Operation::new(op))
1134 };
1135
1136 google_cloud_lro::internal::new_poller(
1137 polling_error_policy,
1138 polling_backoff_policy,
1139 start,
1140 query,
1141 )
1142 }
1143
1144 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1148 self.0.request.name = v.into();
1149 self
1150 }
1151 }
1152
1153 #[doc(hidden)]
1154 impl crate::RequestBuilder for UpgradeInstance {
1155 fn request_options(&mut self) -> &mut crate::RequestOptions {
1156 &mut self.0.options
1157 }
1158 }
1159
1160 #[derive(Clone, Debug)]
1178 pub struct RollbackInstance(RequestBuilder<crate::model::RollbackInstanceRequest>);
1179
1180 impl RollbackInstance {
1181 pub(crate) fn new(
1182 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1183 ) -> Self {
1184 Self(RequestBuilder::new(stub))
1185 }
1186
1187 pub fn with_request<V: Into<crate::model::RollbackInstanceRequest>>(
1189 mut self,
1190 v: V,
1191 ) -> Self {
1192 self.0.request = v.into();
1193 self
1194 }
1195
1196 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1198 self.0.options = v.into();
1199 self
1200 }
1201
1202 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1209 (*self.0.stub)
1210 .rollback_instance(self.0.request, self.0.options)
1211 .await
1212 .map(crate::Response::into_body)
1213 }
1214
1215 pub fn poller(
1217 self,
1218 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1219 {
1220 type Operation = google_cloud_lro::internal::Operation<
1221 crate::model::Instance,
1222 crate::model::OperationMetadata,
1223 >;
1224 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1225 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1226
1227 let stub = self.0.stub.clone();
1228 let mut options = self.0.options.clone();
1229 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1230 let query = move |name| {
1231 let stub = stub.clone();
1232 let options = options.clone();
1233 async {
1234 let op = GetOperation::new(stub)
1235 .set_name(name)
1236 .with_options(options)
1237 .send()
1238 .await?;
1239 Ok(Operation::new(op))
1240 }
1241 };
1242
1243 let start = move || async {
1244 let op = self.send().await?;
1245 Ok(Operation::new(op))
1246 };
1247
1248 google_cloud_lro::internal::new_poller(
1249 polling_error_policy,
1250 polling_backoff_policy,
1251 start,
1252 query,
1253 )
1254 }
1255
1256 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1260 self.0.request.name = v.into();
1261 self
1262 }
1263
1264 pub fn set_target_snapshot<T: Into<std::string::String>>(mut self, v: T) -> Self {
1268 self.0.request.target_snapshot = v.into();
1269 self
1270 }
1271
1272 pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1276 self.0.request.revision_id = v.into();
1277 self
1278 }
1279 }
1280
1281 #[doc(hidden)]
1282 impl crate::RequestBuilder for RollbackInstance {
1283 fn request_options(&mut self) -> &mut crate::RequestOptions {
1284 &mut self.0.options
1285 }
1286 }
1287
1288 #[derive(Clone, Debug)]
1306 pub struct DiagnoseInstance(RequestBuilder<crate::model::DiagnoseInstanceRequest>);
1307
1308 impl DiagnoseInstance {
1309 pub(crate) fn new(
1310 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1311 ) -> Self {
1312 Self(RequestBuilder::new(stub))
1313 }
1314
1315 pub fn with_request<V: Into<crate::model::DiagnoseInstanceRequest>>(
1317 mut self,
1318 v: V,
1319 ) -> Self {
1320 self.0.request = v.into();
1321 self
1322 }
1323
1324 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1326 self.0.options = v.into();
1327 self
1328 }
1329
1330 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1337 (*self.0.stub)
1338 .diagnose_instance(self.0.request, self.0.options)
1339 .await
1340 .map(crate::Response::into_body)
1341 }
1342
1343 pub fn poller(
1345 self,
1346 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
1347 {
1348 type Operation = google_cloud_lro::internal::Operation<
1349 crate::model::Instance,
1350 crate::model::OperationMetadata,
1351 >;
1352 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1353 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1354
1355 let stub = self.0.stub.clone();
1356 let mut options = self.0.options.clone();
1357 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1358 let query = move |name| {
1359 let stub = stub.clone();
1360 let options = options.clone();
1361 async {
1362 let op = GetOperation::new(stub)
1363 .set_name(name)
1364 .with_options(options)
1365 .send()
1366 .await?;
1367 Ok(Operation::new(op))
1368 }
1369 };
1370
1371 let start = move || async {
1372 let op = self.send().await?;
1373 Ok(Operation::new(op))
1374 };
1375
1376 google_cloud_lro::internal::new_poller(
1377 polling_error_policy,
1378 polling_backoff_policy,
1379 start,
1380 query,
1381 )
1382 }
1383
1384 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1388 self.0.request.name = v.into();
1389 self
1390 }
1391
1392 pub fn set_diagnostic_config<T>(mut self, v: T) -> Self
1396 where
1397 T: std::convert::Into<crate::model::DiagnosticConfig>,
1398 {
1399 self.0.request.diagnostic_config = std::option::Option::Some(v.into());
1400 self
1401 }
1402
1403 pub fn set_or_clear_diagnostic_config<T>(mut self, v: std::option::Option<T>) -> Self
1407 where
1408 T: std::convert::Into<crate::model::DiagnosticConfig>,
1409 {
1410 self.0.request.diagnostic_config = v.map(|x| x.into());
1411 self
1412 }
1413
1414 pub fn set_timeout_minutes<T: Into<i32>>(mut self, v: T) -> Self {
1416 self.0.request.timeout_minutes = v.into();
1417 self
1418 }
1419 }
1420
1421 #[doc(hidden)]
1422 impl crate::RequestBuilder for DiagnoseInstance {
1423 fn request_options(&mut self) -> &mut crate::RequestOptions {
1424 &mut self.0.options
1425 }
1426 }
1427
1428 #[derive(Clone, Debug)]
1449 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1450
1451 impl ListLocations {
1452 pub(crate) fn new(
1453 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1454 ) -> Self {
1455 Self(RequestBuilder::new(stub))
1456 }
1457
1458 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1460 mut self,
1461 v: V,
1462 ) -> Self {
1463 self.0.request = v.into();
1464 self
1465 }
1466
1467 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1469 self.0.options = v.into();
1470 self
1471 }
1472
1473 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1475 (*self.0.stub)
1476 .list_locations(self.0.request, self.0.options)
1477 .await
1478 .map(crate::Response::into_body)
1479 }
1480
1481 pub fn by_page(
1483 self,
1484 ) -> impl google_cloud_gax::paginator::Paginator<
1485 google_cloud_location::model::ListLocationsResponse,
1486 crate::Error,
1487 > {
1488 use std::clone::Clone;
1489 let token = self.0.request.page_token.clone();
1490 let execute = move |token: String| {
1491 let mut builder = self.clone();
1492 builder.0.request = builder.0.request.set_page_token(token);
1493 builder.send()
1494 };
1495 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1496 }
1497
1498 pub fn by_item(
1500 self,
1501 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1502 google_cloud_location::model::ListLocationsResponse,
1503 crate::Error,
1504 > {
1505 use google_cloud_gax::paginator::Paginator;
1506 self.by_page().items()
1507 }
1508
1509 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1511 self.0.request.name = v.into();
1512 self
1513 }
1514
1515 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1517 self.0.request.filter = v.into();
1518 self
1519 }
1520
1521 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1523 self.0.request.page_size = v.into();
1524 self
1525 }
1526
1527 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1529 self.0.request.page_token = v.into();
1530 self
1531 }
1532 }
1533
1534 #[doc(hidden)]
1535 impl crate::RequestBuilder for ListLocations {
1536 fn request_options(&mut self) -> &mut crate::RequestOptions {
1537 &mut self.0.options
1538 }
1539 }
1540
1541 #[derive(Clone, Debug)]
1558 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1559
1560 impl GetLocation {
1561 pub(crate) fn new(
1562 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1563 ) -> Self {
1564 Self(RequestBuilder::new(stub))
1565 }
1566
1567 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1569 mut self,
1570 v: V,
1571 ) -> Self {
1572 self.0.request = v.into();
1573 self
1574 }
1575
1576 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1578 self.0.options = v.into();
1579 self
1580 }
1581
1582 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1584 (*self.0.stub)
1585 .get_location(self.0.request, self.0.options)
1586 .await
1587 .map(crate::Response::into_body)
1588 }
1589
1590 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1592 self.0.request.name = v.into();
1593 self
1594 }
1595 }
1596
1597 #[doc(hidden)]
1598 impl crate::RequestBuilder for GetLocation {
1599 fn request_options(&mut self) -> &mut crate::RequestOptions {
1600 &mut self.0.options
1601 }
1602 }
1603
1604 #[derive(Clone, Debug)]
1621 pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
1622
1623 impl SetIamPolicy {
1624 pub(crate) fn new(
1625 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1626 ) -> Self {
1627 Self(RequestBuilder::new(stub))
1628 }
1629
1630 pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
1632 mut self,
1633 v: V,
1634 ) -> Self {
1635 self.0.request = v.into();
1636 self
1637 }
1638
1639 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1641 self.0.options = v.into();
1642 self
1643 }
1644
1645 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1647 (*self.0.stub)
1648 .set_iam_policy(self.0.request, self.0.options)
1649 .await
1650 .map(crate::Response::into_body)
1651 }
1652
1653 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1657 self.0.request.resource = v.into();
1658 self
1659 }
1660
1661 pub fn set_policy<T>(mut self, v: T) -> Self
1665 where
1666 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1667 {
1668 self.0.request.policy = std::option::Option::Some(v.into());
1669 self
1670 }
1671
1672 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1676 where
1677 T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
1678 {
1679 self.0.request.policy = v.map(|x| x.into());
1680 self
1681 }
1682
1683 pub fn set_update_mask<T>(mut self, v: T) -> Self
1685 where
1686 T: std::convert::Into<wkt::FieldMask>,
1687 {
1688 self.0.request.update_mask = std::option::Option::Some(v.into());
1689 self
1690 }
1691
1692 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1694 where
1695 T: std::convert::Into<wkt::FieldMask>,
1696 {
1697 self.0.request.update_mask = v.map(|x| x.into());
1698 self
1699 }
1700 }
1701
1702 #[doc(hidden)]
1703 impl crate::RequestBuilder for SetIamPolicy {
1704 fn request_options(&mut self) -> &mut crate::RequestOptions {
1705 &mut self.0.options
1706 }
1707 }
1708
1709 #[derive(Clone, Debug)]
1726 pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
1727
1728 impl GetIamPolicy {
1729 pub(crate) fn new(
1730 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1731 ) -> Self {
1732 Self(RequestBuilder::new(stub))
1733 }
1734
1735 pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
1737 mut self,
1738 v: V,
1739 ) -> Self {
1740 self.0.request = v.into();
1741 self
1742 }
1743
1744 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1746 self.0.options = v.into();
1747 self
1748 }
1749
1750 pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
1752 (*self.0.stub)
1753 .get_iam_policy(self.0.request, self.0.options)
1754 .await
1755 .map(crate::Response::into_body)
1756 }
1757
1758 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1762 self.0.request.resource = v.into();
1763 self
1764 }
1765
1766 pub fn set_options<T>(mut self, v: T) -> Self
1768 where
1769 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1770 {
1771 self.0.request.options = std::option::Option::Some(v.into());
1772 self
1773 }
1774
1775 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1777 where
1778 T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
1779 {
1780 self.0.request.options = v.map(|x| x.into());
1781 self
1782 }
1783 }
1784
1785 #[doc(hidden)]
1786 impl crate::RequestBuilder for GetIamPolicy {
1787 fn request_options(&mut self) -> &mut crate::RequestOptions {
1788 &mut self.0.options
1789 }
1790 }
1791
1792 #[derive(Clone, Debug)]
1809 pub struct TestIamPermissions(
1810 RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
1811 );
1812
1813 impl TestIamPermissions {
1814 pub(crate) fn new(
1815 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1816 ) -> Self {
1817 Self(RequestBuilder::new(stub))
1818 }
1819
1820 pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
1822 mut self,
1823 v: V,
1824 ) -> Self {
1825 self.0.request = v.into();
1826 self
1827 }
1828
1829 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1831 self.0.options = v.into();
1832 self
1833 }
1834
1835 pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
1837 (*self.0.stub)
1838 .test_iam_permissions(self.0.request, self.0.options)
1839 .await
1840 .map(crate::Response::into_body)
1841 }
1842
1843 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1847 self.0.request.resource = v.into();
1848 self
1849 }
1850
1851 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1855 where
1856 T: std::iter::IntoIterator<Item = V>,
1857 V: std::convert::Into<std::string::String>,
1858 {
1859 use std::iter::Iterator;
1860 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1861 self
1862 }
1863 }
1864
1865 #[doc(hidden)]
1866 impl crate::RequestBuilder for TestIamPermissions {
1867 fn request_options(&mut self) -> &mut crate::RequestOptions {
1868 &mut self.0.options
1869 }
1870 }
1871
1872 #[derive(Clone, Debug)]
1893 pub struct ListOperations(
1894 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1895 );
1896
1897 impl ListOperations {
1898 pub(crate) fn new(
1899 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
1900 ) -> Self {
1901 Self(RequestBuilder::new(stub))
1902 }
1903
1904 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1906 mut self,
1907 v: V,
1908 ) -> Self {
1909 self.0.request = v.into();
1910 self
1911 }
1912
1913 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1915 self.0.options = v.into();
1916 self
1917 }
1918
1919 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1921 (*self.0.stub)
1922 .list_operations(self.0.request, self.0.options)
1923 .await
1924 .map(crate::Response::into_body)
1925 }
1926
1927 pub fn by_page(
1929 self,
1930 ) -> impl google_cloud_gax::paginator::Paginator<
1931 google_cloud_longrunning::model::ListOperationsResponse,
1932 crate::Error,
1933 > {
1934 use std::clone::Clone;
1935 let token = self.0.request.page_token.clone();
1936 let execute = move |token: String| {
1937 let mut builder = self.clone();
1938 builder.0.request = builder.0.request.set_page_token(token);
1939 builder.send()
1940 };
1941 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1942 }
1943
1944 pub fn by_item(
1946 self,
1947 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1948 google_cloud_longrunning::model::ListOperationsResponse,
1949 crate::Error,
1950 > {
1951 use google_cloud_gax::paginator::Paginator;
1952 self.by_page().items()
1953 }
1954
1955 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1957 self.0.request.name = v.into();
1958 self
1959 }
1960
1961 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1963 self.0.request.filter = v.into();
1964 self
1965 }
1966
1967 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1969 self.0.request.page_size = v.into();
1970 self
1971 }
1972
1973 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1975 self.0.request.page_token = v.into();
1976 self
1977 }
1978
1979 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1981 self.0.request.return_partial_success = v.into();
1982 self
1983 }
1984 }
1985
1986 #[doc(hidden)]
1987 impl crate::RequestBuilder for ListOperations {
1988 fn request_options(&mut self) -> &mut crate::RequestOptions {
1989 &mut self.0.options
1990 }
1991 }
1992
1993 #[derive(Clone, Debug)]
2010 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2011
2012 impl GetOperation {
2013 pub(crate) fn new(
2014 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
2015 ) -> Self {
2016 Self(RequestBuilder::new(stub))
2017 }
2018
2019 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2021 mut self,
2022 v: V,
2023 ) -> Self {
2024 self.0.request = v.into();
2025 self
2026 }
2027
2028 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2030 self.0.options = v.into();
2031 self
2032 }
2033
2034 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2036 (*self.0.stub)
2037 .get_operation(self.0.request, self.0.options)
2038 .await
2039 .map(crate::Response::into_body)
2040 }
2041
2042 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2044 self.0.request.name = v.into();
2045 self
2046 }
2047 }
2048
2049 #[doc(hidden)]
2050 impl crate::RequestBuilder for GetOperation {
2051 fn request_options(&mut self) -> &mut crate::RequestOptions {
2052 &mut self.0.options
2053 }
2054 }
2055
2056 #[derive(Clone, Debug)]
2073 pub struct DeleteOperation(
2074 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
2075 );
2076
2077 impl DeleteOperation {
2078 pub(crate) fn new(
2079 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
2080 ) -> Self {
2081 Self(RequestBuilder::new(stub))
2082 }
2083
2084 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
2086 mut self,
2087 v: V,
2088 ) -> Self {
2089 self.0.request = v.into();
2090 self
2091 }
2092
2093 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2095 self.0.options = v.into();
2096 self
2097 }
2098
2099 pub async fn send(self) -> Result<()> {
2101 (*self.0.stub)
2102 .delete_operation(self.0.request, self.0.options)
2103 .await
2104 .map(crate::Response::into_body)
2105 }
2106
2107 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2109 self.0.request.name = v.into();
2110 self
2111 }
2112 }
2113
2114 #[doc(hidden)]
2115 impl crate::RequestBuilder for DeleteOperation {
2116 fn request_options(&mut self) -> &mut crate::RequestOptions {
2117 &mut self.0.options
2118 }
2119 }
2120
2121 #[derive(Clone, Debug)]
2138 pub struct CancelOperation(
2139 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2140 );
2141
2142 impl CancelOperation {
2143 pub(crate) fn new(
2144 stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
2145 ) -> Self {
2146 Self(RequestBuilder::new(stub))
2147 }
2148
2149 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2151 mut self,
2152 v: V,
2153 ) -> Self {
2154 self.0.request = v.into();
2155 self
2156 }
2157
2158 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2160 self.0.options = v.into();
2161 self
2162 }
2163
2164 pub async fn send(self) -> Result<()> {
2166 (*self.0.stub)
2167 .cancel_operation(self.0.request, self.0.options)
2168 .await
2169 .map(crate::Response::into_body)
2170 }
2171
2172 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2174 self.0.request.name = v.into();
2175 self
2176 }
2177 }
2178
2179 #[doc(hidden)]
2180 impl crate::RequestBuilder for CancelOperation {
2181 fn request_options(&mut self) -> &mut crate::RequestOptions {
2182 &mut self.0.options
2183 }
2184 }
2185}