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