google_cloud_datafusion_v1/
builder.rs1pub mod data_fusion {
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::DataFusion;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = DataFusion;
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::DataFusion>,
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::DataFusion>,
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 ListAvailableVersions(RequestBuilder<crate::model::ListAvailableVersionsRequest>);
95
96 impl ListAvailableVersions {
97 pub(crate) fn new(
98 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
99 ) -> Self {
100 Self(RequestBuilder::new(stub))
101 }
102
103 pub fn with_request<V: Into<crate::model::ListAvailableVersionsRequest>>(
105 mut self,
106 v: V,
107 ) -> Self {
108 self.0.request = v.into();
109 self
110 }
111
112 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
114 self.0.options = v.into();
115 self
116 }
117
118 pub async fn send(self) -> Result<crate::model::ListAvailableVersionsResponse> {
120 (*self.0.stub)
121 .list_available_versions(self.0.request, self.0.options)
122 .await
123 .map(crate::Response::into_body)
124 }
125
126 pub fn by_page(
128 self,
129 ) -> impl google_cloud_gax::paginator::Paginator<
130 crate::model::ListAvailableVersionsResponse,
131 crate::Error,
132 > {
133 use std::clone::Clone;
134 let token = self.0.request.page_token.clone();
135 let execute = move |token: String| {
136 let mut builder = self.clone();
137 builder.0.request = builder.0.request.set_page_token(token);
138 builder.send()
139 };
140 google_cloud_gax::paginator::internal::new_paginator(token, execute)
141 }
142
143 pub fn by_item(
145 self,
146 ) -> impl google_cloud_gax::paginator::ItemPaginator<
147 crate::model::ListAvailableVersionsResponse,
148 crate::Error,
149 > {
150 use google_cloud_gax::paginator::Paginator;
151 self.by_page().items()
152 }
153
154 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
158 self.0.request.parent = v.into();
159 self
160 }
161
162 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
164 self.0.request.page_size = v.into();
165 self
166 }
167
168 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
170 self.0.request.page_token = v.into();
171 self
172 }
173
174 pub fn set_latest_patch_only<T: Into<bool>>(mut self, v: T) -> Self {
176 self.0.request.latest_patch_only = v.into();
177 self
178 }
179 }
180
181 #[doc(hidden)]
182 impl crate::RequestBuilder for ListAvailableVersions {
183 fn request_options(&mut self) -> &mut crate::RequestOptions {
184 &mut self.0.options
185 }
186 }
187
188 #[derive(Clone, Debug)]
209 pub struct ListInstances(RequestBuilder<crate::model::ListInstancesRequest>);
210
211 impl ListInstances {
212 pub(crate) fn new(
213 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
214 ) -> Self {
215 Self(RequestBuilder::new(stub))
216 }
217
218 pub fn with_request<V: Into<crate::model::ListInstancesRequest>>(mut self, v: V) -> Self {
220 self.0.request = v.into();
221 self
222 }
223
224 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
226 self.0.options = v.into();
227 self
228 }
229
230 pub async fn send(self) -> Result<crate::model::ListInstancesResponse> {
232 (*self.0.stub)
233 .list_instances(self.0.request, self.0.options)
234 .await
235 .map(crate::Response::into_body)
236 }
237
238 pub fn by_page(
240 self,
241 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListInstancesResponse, crate::Error>
242 {
243 use std::clone::Clone;
244 let token = self.0.request.page_token.clone();
245 let execute = move |token: String| {
246 let mut builder = self.clone();
247 builder.0.request = builder.0.request.set_page_token(token);
248 builder.send()
249 };
250 google_cloud_gax::paginator::internal::new_paginator(token, execute)
251 }
252
253 pub fn by_item(
255 self,
256 ) -> impl google_cloud_gax::paginator::ItemPaginator<
257 crate::model::ListInstancesResponse,
258 crate::Error,
259 > {
260 use google_cloud_gax::paginator::Paginator;
261 self.by_page().items()
262 }
263
264 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
268 self.0.request.parent = v.into();
269 self
270 }
271
272 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
274 self.0.request.page_size = v.into();
275 self
276 }
277
278 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
280 self.0.request.page_token = v.into();
281 self
282 }
283
284 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
286 self.0.request.filter = v.into();
287 self
288 }
289
290 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
292 self.0.request.order_by = v.into();
293 self
294 }
295 }
296
297 #[doc(hidden)]
298 impl crate::RequestBuilder for ListInstances {
299 fn request_options(&mut self) -> &mut crate::RequestOptions {
300 &mut self.0.options
301 }
302 }
303
304 #[derive(Clone, Debug)]
321 pub struct GetInstance(RequestBuilder<crate::model::GetInstanceRequest>);
322
323 impl GetInstance {
324 pub(crate) fn new(
325 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
326 ) -> Self {
327 Self(RequestBuilder::new(stub))
328 }
329
330 pub fn with_request<V: Into<crate::model::GetInstanceRequest>>(mut self, v: V) -> Self {
332 self.0.request = v.into();
333 self
334 }
335
336 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
338 self.0.options = v.into();
339 self
340 }
341
342 pub async fn send(self) -> Result<crate::model::Instance> {
344 (*self.0.stub)
345 .get_instance(self.0.request, self.0.options)
346 .await
347 .map(crate::Response::into_body)
348 }
349
350 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
354 self.0.request.name = v.into();
355 self
356 }
357 }
358
359 #[doc(hidden)]
360 impl crate::RequestBuilder for GetInstance {
361 fn request_options(&mut self) -> &mut crate::RequestOptions {
362 &mut self.0.options
363 }
364 }
365
366 #[derive(Clone, Debug)]
384 pub struct CreateInstance(RequestBuilder<crate::model::CreateInstanceRequest>);
385
386 impl CreateInstance {
387 pub(crate) fn new(
388 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
389 ) -> Self {
390 Self(RequestBuilder::new(stub))
391 }
392
393 pub fn with_request<V: Into<crate::model::CreateInstanceRequest>>(mut self, v: V) -> Self {
395 self.0.request = v.into();
396 self
397 }
398
399 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
401 self.0.options = v.into();
402 self
403 }
404
405 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
412 (*self.0.stub)
413 .create_instance(self.0.request, self.0.options)
414 .await
415 .map(crate::Response::into_body)
416 }
417
418 pub fn poller(
420 self,
421 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
422 {
423 type Operation = google_cloud_lro::internal::Operation<
424 crate::model::Instance,
425 crate::model::OperationMetadata,
426 >;
427 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
428 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
429
430 let stub = self.0.stub.clone();
431 let mut options = self.0.options.clone();
432 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
433 let query = move |name| {
434 let stub = stub.clone();
435 let options = options.clone();
436 async {
437 let op = GetOperation::new(stub)
438 .set_name(name)
439 .with_options(options)
440 .send()
441 .await?;
442 Ok(Operation::new(op))
443 }
444 };
445
446 let start = move || async {
447 let op = self.send().await?;
448 Ok(Operation::new(op))
449 };
450
451 google_cloud_lro::internal::new_poller(
452 polling_error_policy,
453 polling_backoff_policy,
454 start,
455 query,
456 )
457 }
458
459 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
463 self.0.request.parent = v.into();
464 self
465 }
466
467 pub fn set_instance_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
471 self.0.request.instance_id = v.into();
472 self
473 }
474
475 pub fn set_instance<T>(mut self, v: T) -> Self
477 where
478 T: std::convert::Into<crate::model::Instance>,
479 {
480 self.0.request.instance = std::option::Option::Some(v.into());
481 self
482 }
483
484 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
486 where
487 T: std::convert::Into<crate::model::Instance>,
488 {
489 self.0.request.instance = v.map(|x| x.into());
490 self
491 }
492 }
493
494 #[doc(hidden)]
495 impl crate::RequestBuilder for CreateInstance {
496 fn request_options(&mut self) -> &mut crate::RequestOptions {
497 &mut self.0.options
498 }
499 }
500
501 #[derive(Clone, Debug)]
519 pub struct DeleteInstance(RequestBuilder<crate::model::DeleteInstanceRequest>);
520
521 impl DeleteInstance {
522 pub(crate) fn new(
523 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
524 ) -> Self {
525 Self(RequestBuilder::new(stub))
526 }
527
528 pub fn with_request<V: Into<crate::model::DeleteInstanceRequest>>(mut self, v: V) -> Self {
530 self.0.request = v.into();
531 self
532 }
533
534 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
536 self.0.options = v.into();
537 self
538 }
539
540 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
547 (*self.0.stub)
548 .delete_instance(self.0.request, self.0.options)
549 .await
550 .map(crate::Response::into_body)
551 }
552
553 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
555 type Operation =
556 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
557 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
558 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
559
560 let stub = self.0.stub.clone();
561 let mut options = self.0.options.clone();
562 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
563 let query = move |name| {
564 let stub = stub.clone();
565 let options = options.clone();
566 async {
567 let op = GetOperation::new(stub)
568 .set_name(name)
569 .with_options(options)
570 .send()
571 .await?;
572 Ok(Operation::new(op))
573 }
574 };
575
576 let start = move || async {
577 let op = self.send().await?;
578 Ok(Operation::new(op))
579 };
580
581 google_cloud_lro::internal::new_unit_response_poller(
582 polling_error_policy,
583 polling_backoff_policy,
584 start,
585 query,
586 )
587 }
588
589 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
593 self.0.request.name = v.into();
594 self
595 }
596 }
597
598 #[doc(hidden)]
599 impl crate::RequestBuilder for DeleteInstance {
600 fn request_options(&mut self) -> &mut crate::RequestOptions {
601 &mut self.0.options
602 }
603 }
604
605 #[derive(Clone, Debug)]
623 pub struct UpdateInstance(RequestBuilder<crate::model::UpdateInstanceRequest>);
624
625 impl UpdateInstance {
626 pub(crate) fn new(
627 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
628 ) -> Self {
629 Self(RequestBuilder::new(stub))
630 }
631
632 pub fn with_request<V: Into<crate::model::UpdateInstanceRequest>>(mut self, v: V) -> Self {
634 self.0.request = v.into();
635 self
636 }
637
638 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
640 self.0.options = v.into();
641 self
642 }
643
644 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
651 (*self.0.stub)
652 .update_instance(self.0.request, self.0.options)
653 .await
654 .map(crate::Response::into_body)
655 }
656
657 pub fn poller(
659 self,
660 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
661 {
662 type Operation = google_cloud_lro::internal::Operation<
663 crate::model::Instance,
664 crate::model::OperationMetadata,
665 >;
666 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
667 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
668
669 let stub = self.0.stub.clone();
670 let mut options = self.0.options.clone();
671 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
672 let query = move |name| {
673 let stub = stub.clone();
674 let options = options.clone();
675 async {
676 let op = GetOperation::new(stub)
677 .set_name(name)
678 .with_options(options)
679 .send()
680 .await?;
681 Ok(Operation::new(op))
682 }
683 };
684
685 let start = move || async {
686 let op = self.send().await?;
687 Ok(Operation::new(op))
688 };
689
690 google_cloud_lro::internal::new_poller(
691 polling_error_policy,
692 polling_backoff_policy,
693 start,
694 query,
695 )
696 }
697
698 pub fn set_instance<T>(mut self, v: T) -> Self
702 where
703 T: std::convert::Into<crate::model::Instance>,
704 {
705 self.0.request.instance = std::option::Option::Some(v.into());
706 self
707 }
708
709 pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
713 where
714 T: std::convert::Into<crate::model::Instance>,
715 {
716 self.0.request.instance = v.map(|x| x.into());
717 self
718 }
719
720 pub fn set_update_mask<T>(mut self, v: T) -> Self
722 where
723 T: std::convert::Into<wkt::FieldMask>,
724 {
725 self.0.request.update_mask = std::option::Option::Some(v.into());
726 self
727 }
728
729 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
731 where
732 T: std::convert::Into<wkt::FieldMask>,
733 {
734 self.0.request.update_mask = v.map(|x| x.into());
735 self
736 }
737 }
738
739 #[doc(hidden)]
740 impl crate::RequestBuilder for UpdateInstance {
741 fn request_options(&mut self) -> &mut crate::RequestOptions {
742 &mut self.0.options
743 }
744 }
745
746 #[derive(Clone, Debug)]
764 pub struct RestartInstance(RequestBuilder<crate::model::RestartInstanceRequest>);
765
766 impl RestartInstance {
767 pub(crate) fn new(
768 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
769 ) -> Self {
770 Self(RequestBuilder::new(stub))
771 }
772
773 pub fn with_request<V: Into<crate::model::RestartInstanceRequest>>(mut self, v: V) -> Self {
775 self.0.request = v.into();
776 self
777 }
778
779 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
781 self.0.options = v.into();
782 self
783 }
784
785 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
792 (*self.0.stub)
793 .restart_instance(self.0.request, self.0.options)
794 .await
795 .map(crate::Response::into_body)
796 }
797
798 pub fn poller(
800 self,
801 ) -> impl google_cloud_lro::Poller<crate::model::Instance, crate::model::OperationMetadata>
802 {
803 type Operation = google_cloud_lro::internal::Operation<
804 crate::model::Instance,
805 crate::model::OperationMetadata,
806 >;
807 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
808 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
809
810 let stub = self.0.stub.clone();
811 let mut options = self.0.options.clone();
812 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
813 let query = move |name| {
814 let stub = stub.clone();
815 let options = options.clone();
816 async {
817 let op = GetOperation::new(stub)
818 .set_name(name)
819 .with_options(options)
820 .send()
821 .await?;
822 Ok(Operation::new(op))
823 }
824 };
825
826 let start = move || async {
827 let op = self.send().await?;
828 Ok(Operation::new(op))
829 };
830
831 google_cloud_lro::internal::new_poller(
832 polling_error_policy,
833 polling_backoff_policy,
834 start,
835 query,
836 )
837 }
838
839 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
843 self.0.request.name = v.into();
844 self
845 }
846 }
847
848 #[doc(hidden)]
849 impl crate::RequestBuilder for RestartInstance {
850 fn request_options(&mut self) -> &mut crate::RequestOptions {
851 &mut self.0.options
852 }
853 }
854
855 #[derive(Clone, Debug)]
876 pub struct ListOperations(
877 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
878 );
879
880 impl ListOperations {
881 pub(crate) fn new(
882 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
883 ) -> Self {
884 Self(RequestBuilder::new(stub))
885 }
886
887 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
889 mut self,
890 v: V,
891 ) -> Self {
892 self.0.request = v.into();
893 self
894 }
895
896 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
898 self.0.options = v.into();
899 self
900 }
901
902 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
904 (*self.0.stub)
905 .list_operations(self.0.request, self.0.options)
906 .await
907 .map(crate::Response::into_body)
908 }
909
910 pub fn by_page(
912 self,
913 ) -> impl google_cloud_gax::paginator::Paginator<
914 google_cloud_longrunning::model::ListOperationsResponse,
915 crate::Error,
916 > {
917 use std::clone::Clone;
918 let token = self.0.request.page_token.clone();
919 let execute = move |token: String| {
920 let mut builder = self.clone();
921 builder.0.request = builder.0.request.set_page_token(token);
922 builder.send()
923 };
924 google_cloud_gax::paginator::internal::new_paginator(token, execute)
925 }
926
927 pub fn by_item(
929 self,
930 ) -> impl google_cloud_gax::paginator::ItemPaginator<
931 google_cloud_longrunning::model::ListOperationsResponse,
932 crate::Error,
933 > {
934 use google_cloud_gax::paginator::Paginator;
935 self.by_page().items()
936 }
937
938 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
940 self.0.request.name = v.into();
941 self
942 }
943
944 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
946 self.0.request.filter = v.into();
947 self
948 }
949
950 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
952 self.0.request.page_size = v.into();
953 self
954 }
955
956 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
958 self.0.request.page_token = v.into();
959 self
960 }
961
962 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
964 self.0.request.return_partial_success = v.into();
965 self
966 }
967 }
968
969 #[doc(hidden)]
970 impl crate::RequestBuilder for ListOperations {
971 fn request_options(&mut self) -> &mut crate::RequestOptions {
972 &mut self.0.options
973 }
974 }
975
976 #[derive(Clone, Debug)]
993 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
994
995 impl GetOperation {
996 pub(crate) fn new(
997 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
998 ) -> Self {
999 Self(RequestBuilder::new(stub))
1000 }
1001
1002 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1004 mut self,
1005 v: V,
1006 ) -> Self {
1007 self.0.request = v.into();
1008 self
1009 }
1010
1011 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1013 self.0.options = v.into();
1014 self
1015 }
1016
1017 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1019 (*self.0.stub)
1020 .get_operation(self.0.request, self.0.options)
1021 .await
1022 .map(crate::Response::into_body)
1023 }
1024
1025 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1027 self.0.request.name = v.into();
1028 self
1029 }
1030 }
1031
1032 #[doc(hidden)]
1033 impl crate::RequestBuilder for GetOperation {
1034 fn request_options(&mut self) -> &mut crate::RequestOptions {
1035 &mut self.0.options
1036 }
1037 }
1038
1039 #[derive(Clone, Debug)]
1056 pub struct DeleteOperation(
1057 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
1058 );
1059
1060 impl DeleteOperation {
1061 pub(crate) fn new(
1062 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
1063 ) -> Self {
1064 Self(RequestBuilder::new(stub))
1065 }
1066
1067 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
1069 mut self,
1070 v: V,
1071 ) -> Self {
1072 self.0.request = v.into();
1073 self
1074 }
1075
1076 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1078 self.0.options = v.into();
1079 self
1080 }
1081
1082 pub async fn send(self) -> Result<()> {
1084 (*self.0.stub)
1085 .delete_operation(self.0.request, self.0.options)
1086 .await
1087 .map(crate::Response::into_body)
1088 }
1089
1090 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1092 self.0.request.name = v.into();
1093 self
1094 }
1095 }
1096
1097 #[doc(hidden)]
1098 impl crate::RequestBuilder for DeleteOperation {
1099 fn request_options(&mut self) -> &mut crate::RequestOptions {
1100 &mut self.0.options
1101 }
1102 }
1103
1104 #[derive(Clone, Debug)]
1121 pub struct CancelOperation(
1122 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1123 );
1124
1125 impl CancelOperation {
1126 pub(crate) fn new(
1127 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFusion>,
1128 ) -> Self {
1129 Self(RequestBuilder::new(stub))
1130 }
1131
1132 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1134 mut self,
1135 v: V,
1136 ) -> Self {
1137 self.0.request = v.into();
1138 self
1139 }
1140
1141 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1143 self.0.options = v.into();
1144 self
1145 }
1146
1147 pub async fn send(self) -> Result<()> {
1149 (*self.0.stub)
1150 .cancel_operation(self.0.request, self.0.options)
1151 .await
1152 .map(crate::Response::into_body)
1153 }
1154
1155 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1157 self.0.request.name = v.into();
1158 self
1159 }
1160 }
1161
1162 #[doc(hidden)]
1163 impl crate::RequestBuilder for CancelOperation {
1164 fn request_options(&mut self) -> &mut crate::RequestOptions {
1165 &mut self.0.options
1166 }
1167 }
1168}