google_cloud_datastream_v1/builder.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod datastream {
18 use crate::Result;
19
20 /// A builder for [Datastream][crate::client::Datastream].
21 ///
22 /// ```
23 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24 /// # use google_cloud_datastream_v1::*;
25 /// # use builder::datastream::ClientBuilder;
26 /// # use client::Datastream;
27 /// let builder : ClientBuilder = Datastream::builder();
28 /// let client = builder
29 /// .with_endpoint("https://datastream.googleapis.com")
30 /// .build().await?;
31 /// # Ok(()) }
32 /// ```
33 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::Datastream;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = Datastream;
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 /// Common implementation for [crate::client::Datastream] request builders.
51 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
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::Datastream>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 /// The request builder for [Datastream::list_connection_profiles][crate::client::Datastream::list_connection_profiles] calls.
74 ///
75 /// # Example
76 /// ```
77 /// # use google_cloud_datastream_v1::builder::datastream::ListConnectionProfiles;
78 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
79 /// use google_cloud_gax::paginator::ItemPaginator;
80 ///
81 /// let builder = prepare_request_builder();
82 /// let mut items = builder.by_item();
83 /// while let Some(result) = items.next().await {
84 /// let item = result?;
85 /// }
86 /// # Ok(()) }
87 ///
88 /// fn prepare_request_builder() -> ListConnectionProfiles {
89 /// # panic!();
90 /// // ... details omitted ...
91 /// }
92 /// ```
93 #[derive(Clone, Debug)]
94 pub struct ListConnectionProfiles(RequestBuilder<crate::model::ListConnectionProfilesRequest>);
95
96 impl ListConnectionProfiles {
97 pub(crate) fn new(
98 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
99 ) -> Self {
100 Self(RequestBuilder::new(stub))
101 }
102
103 /// Sets the full request, replacing any prior values.
104 pub fn with_request<V: Into<crate::model::ListConnectionProfilesRequest>>(
105 mut self,
106 v: V,
107 ) -> Self {
108 self.0.request = v.into();
109 self
110 }
111
112 /// Sets all the options, replacing any prior values.
113 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
114 self.0.options = v.into();
115 self
116 }
117
118 /// Sends the request.
119 pub async fn send(self) -> Result<crate::model::ListConnectionProfilesResponse> {
120 (*self.0.stub)
121 .list_connection_profiles(self.0.request, self.0.options)
122 .await
123 .map(crate::Response::into_body)
124 }
125
126 /// Streams each page in the collection.
127 pub fn by_page(
128 self,
129 ) -> impl google_cloud_gax::paginator::Paginator<
130 crate::model::ListConnectionProfilesResponse,
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 /// Streams each item in the collection.
144 pub fn by_item(
145 self,
146 ) -> impl google_cloud_gax::paginator::ItemPaginator<
147 crate::model::ListConnectionProfilesResponse,
148 crate::Error,
149 > {
150 use google_cloud_gax::paginator::Paginator;
151 self.by_page().items()
152 }
153
154 /// Sets the value of [parent][crate::model::ListConnectionProfilesRequest::parent].
155 ///
156 /// This is a **required** field for requests.
157 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 /// Sets the value of [page_size][crate::model::ListConnectionProfilesRequest::page_size].
163 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 /// Sets the value of [page_token][crate::model::ListConnectionProfilesRequest::page_token].
169 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 /// Sets the value of [filter][crate::model::ListConnectionProfilesRequest::filter].
175 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
176 self.0.request.filter = v.into();
177 self
178 }
179
180 /// Sets the value of [order_by][crate::model::ListConnectionProfilesRequest::order_by].
181 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
182 self.0.request.order_by = v.into();
183 self
184 }
185 }
186
187 #[doc(hidden)]
188 impl crate::RequestBuilder for ListConnectionProfiles {
189 fn request_options(&mut self) -> &mut crate::RequestOptions {
190 &mut self.0.options
191 }
192 }
193
194 /// The request builder for [Datastream::get_connection_profile][crate::client::Datastream::get_connection_profile] calls.
195 ///
196 /// # Example
197 /// ```
198 /// # use google_cloud_datastream_v1::builder::datastream::GetConnectionProfile;
199 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
200 ///
201 /// let builder = prepare_request_builder();
202 /// let response = builder.send().await?;
203 /// # Ok(()) }
204 ///
205 /// fn prepare_request_builder() -> GetConnectionProfile {
206 /// # panic!();
207 /// // ... details omitted ...
208 /// }
209 /// ```
210 #[derive(Clone, Debug)]
211 pub struct GetConnectionProfile(RequestBuilder<crate::model::GetConnectionProfileRequest>);
212
213 impl GetConnectionProfile {
214 pub(crate) fn new(
215 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
216 ) -> Self {
217 Self(RequestBuilder::new(stub))
218 }
219
220 /// Sets the full request, replacing any prior values.
221 pub fn with_request<V: Into<crate::model::GetConnectionProfileRequest>>(
222 mut self,
223 v: V,
224 ) -> Self {
225 self.0.request = v.into();
226 self
227 }
228
229 /// Sets all the options, replacing any prior values.
230 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
231 self.0.options = v.into();
232 self
233 }
234
235 /// Sends the request.
236 pub async fn send(self) -> Result<crate::model::ConnectionProfile> {
237 (*self.0.stub)
238 .get_connection_profile(self.0.request, self.0.options)
239 .await
240 .map(crate::Response::into_body)
241 }
242
243 /// Sets the value of [name][crate::model::GetConnectionProfileRequest::name].
244 ///
245 /// This is a **required** field for requests.
246 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
247 self.0.request.name = v.into();
248 self
249 }
250 }
251
252 #[doc(hidden)]
253 impl crate::RequestBuilder for GetConnectionProfile {
254 fn request_options(&mut self) -> &mut crate::RequestOptions {
255 &mut self.0.options
256 }
257 }
258
259 /// The request builder for [Datastream::create_connection_profile][crate::client::Datastream::create_connection_profile] calls.
260 ///
261 /// # Example
262 /// ```
263 /// # use google_cloud_datastream_v1::builder::datastream::CreateConnectionProfile;
264 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
265 /// use google_cloud_lro::Poller;
266 ///
267 /// let builder = prepare_request_builder();
268 /// let response = builder.poller().until_done().await?;
269 /// # Ok(()) }
270 ///
271 /// fn prepare_request_builder() -> CreateConnectionProfile {
272 /// # panic!();
273 /// // ... details omitted ...
274 /// }
275 /// ```
276 #[derive(Clone, Debug)]
277 pub struct CreateConnectionProfile(
278 RequestBuilder<crate::model::CreateConnectionProfileRequest>,
279 );
280
281 impl CreateConnectionProfile {
282 pub(crate) fn new(
283 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
284 ) -> Self {
285 Self(RequestBuilder::new(stub))
286 }
287
288 /// Sets the full request, replacing any prior values.
289 pub fn with_request<V: Into<crate::model::CreateConnectionProfileRequest>>(
290 mut self,
291 v: V,
292 ) -> Self {
293 self.0.request = v.into();
294 self
295 }
296
297 /// Sets all the options, replacing any prior values.
298 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
299 self.0.options = v.into();
300 self
301 }
302
303 /// Sends the request.
304 ///
305 /// # Long running operations
306 ///
307 /// This starts, but does not poll, a longrunning operation. More information
308 /// on [create_connection_profile][crate::client::Datastream::create_connection_profile].
309 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
310 (*self.0.stub)
311 .create_connection_profile(self.0.request, self.0.options)
312 .await
313 .map(crate::Response::into_body)
314 }
315
316 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_connection_profile`.
317 pub fn poller(
318 self,
319 ) -> impl google_cloud_lro::Poller<
320 crate::model::ConnectionProfile,
321 crate::model::OperationMetadata,
322 > {
323 type Operation = google_cloud_lro::internal::Operation<
324 crate::model::ConnectionProfile,
325 crate::model::OperationMetadata,
326 >;
327 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
328 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
329
330 let stub = self.0.stub.clone();
331 let mut options = self.0.options.clone();
332 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
333 let query = move |name| {
334 let stub = stub.clone();
335 let options = options.clone();
336 async {
337 let op = GetOperation::new(stub)
338 .set_name(name)
339 .with_options(options)
340 .send()
341 .await?;
342 Ok(Operation::new(op))
343 }
344 };
345
346 let start = move || async {
347 let op = self.send().await?;
348 Ok(Operation::new(op))
349 };
350
351 google_cloud_lro::internal::new_poller(
352 polling_error_policy,
353 polling_backoff_policy,
354 start,
355 query,
356 )
357 }
358
359 /// Sets the value of [parent][crate::model::CreateConnectionProfileRequest::parent].
360 ///
361 /// This is a **required** field for requests.
362 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
363 self.0.request.parent = v.into();
364 self
365 }
366
367 /// Sets the value of [connection_profile_id][crate::model::CreateConnectionProfileRequest::connection_profile_id].
368 ///
369 /// This is a **required** field for requests.
370 pub fn set_connection_profile_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
371 self.0.request.connection_profile_id = v.into();
372 self
373 }
374
375 /// Sets the value of [connection_profile][crate::model::CreateConnectionProfileRequest::connection_profile].
376 ///
377 /// This is a **required** field for requests.
378 pub fn set_connection_profile<T>(mut self, v: T) -> Self
379 where
380 T: std::convert::Into<crate::model::ConnectionProfile>,
381 {
382 self.0.request.connection_profile = std::option::Option::Some(v.into());
383 self
384 }
385
386 /// Sets or clears the value of [connection_profile][crate::model::CreateConnectionProfileRequest::connection_profile].
387 ///
388 /// This is a **required** field for requests.
389 pub fn set_or_clear_connection_profile<T>(mut self, v: std::option::Option<T>) -> Self
390 where
391 T: std::convert::Into<crate::model::ConnectionProfile>,
392 {
393 self.0.request.connection_profile = v.map(|x| x.into());
394 self
395 }
396
397 /// Sets the value of [request_id][crate::model::CreateConnectionProfileRequest::request_id].
398 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
399 self.0.request.request_id = v.into();
400 self
401 }
402
403 /// Sets the value of [validate_only][crate::model::CreateConnectionProfileRequest::validate_only].
404 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
405 self.0.request.validate_only = v.into();
406 self
407 }
408
409 /// Sets the value of [force][crate::model::CreateConnectionProfileRequest::force].
410 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
411 self.0.request.force = v.into();
412 self
413 }
414 }
415
416 #[doc(hidden)]
417 impl crate::RequestBuilder for CreateConnectionProfile {
418 fn request_options(&mut self) -> &mut crate::RequestOptions {
419 &mut self.0.options
420 }
421 }
422
423 /// The request builder for [Datastream::update_connection_profile][crate::client::Datastream::update_connection_profile] calls.
424 ///
425 /// # Example
426 /// ```
427 /// # use google_cloud_datastream_v1::builder::datastream::UpdateConnectionProfile;
428 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
429 /// use google_cloud_lro::Poller;
430 ///
431 /// let builder = prepare_request_builder();
432 /// let response = builder.poller().until_done().await?;
433 /// # Ok(()) }
434 ///
435 /// fn prepare_request_builder() -> UpdateConnectionProfile {
436 /// # panic!();
437 /// // ... details omitted ...
438 /// }
439 /// ```
440 #[derive(Clone, Debug)]
441 pub struct UpdateConnectionProfile(
442 RequestBuilder<crate::model::UpdateConnectionProfileRequest>,
443 );
444
445 impl UpdateConnectionProfile {
446 pub(crate) fn new(
447 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
448 ) -> Self {
449 Self(RequestBuilder::new(stub))
450 }
451
452 /// Sets the full request, replacing any prior values.
453 pub fn with_request<V: Into<crate::model::UpdateConnectionProfileRequest>>(
454 mut self,
455 v: V,
456 ) -> Self {
457 self.0.request = v.into();
458 self
459 }
460
461 /// Sets all the options, replacing any prior values.
462 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
463 self.0.options = v.into();
464 self
465 }
466
467 /// Sends the request.
468 ///
469 /// # Long running operations
470 ///
471 /// This starts, but does not poll, a longrunning operation. More information
472 /// on [update_connection_profile][crate::client::Datastream::update_connection_profile].
473 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
474 (*self.0.stub)
475 .update_connection_profile(self.0.request, self.0.options)
476 .await
477 .map(crate::Response::into_body)
478 }
479
480 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_connection_profile`.
481 pub fn poller(
482 self,
483 ) -> impl google_cloud_lro::Poller<
484 crate::model::ConnectionProfile,
485 crate::model::OperationMetadata,
486 > {
487 type Operation = google_cloud_lro::internal::Operation<
488 crate::model::ConnectionProfile,
489 crate::model::OperationMetadata,
490 >;
491 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
492 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
493
494 let stub = self.0.stub.clone();
495 let mut options = self.0.options.clone();
496 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
497 let query = move |name| {
498 let stub = stub.clone();
499 let options = options.clone();
500 async {
501 let op = GetOperation::new(stub)
502 .set_name(name)
503 .with_options(options)
504 .send()
505 .await?;
506 Ok(Operation::new(op))
507 }
508 };
509
510 let start = move || async {
511 let op = self.send().await?;
512 Ok(Operation::new(op))
513 };
514
515 google_cloud_lro::internal::new_poller(
516 polling_error_policy,
517 polling_backoff_policy,
518 start,
519 query,
520 )
521 }
522
523 /// Sets the value of [update_mask][crate::model::UpdateConnectionProfileRequest::update_mask].
524 pub fn set_update_mask<T>(mut self, v: T) -> Self
525 where
526 T: std::convert::Into<wkt::FieldMask>,
527 {
528 self.0.request.update_mask = std::option::Option::Some(v.into());
529 self
530 }
531
532 /// Sets or clears the value of [update_mask][crate::model::UpdateConnectionProfileRequest::update_mask].
533 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
534 where
535 T: std::convert::Into<wkt::FieldMask>,
536 {
537 self.0.request.update_mask = v.map(|x| x.into());
538 self
539 }
540
541 /// Sets the value of [connection_profile][crate::model::UpdateConnectionProfileRequest::connection_profile].
542 ///
543 /// This is a **required** field for requests.
544 pub fn set_connection_profile<T>(mut self, v: T) -> Self
545 where
546 T: std::convert::Into<crate::model::ConnectionProfile>,
547 {
548 self.0.request.connection_profile = std::option::Option::Some(v.into());
549 self
550 }
551
552 /// Sets or clears the value of [connection_profile][crate::model::UpdateConnectionProfileRequest::connection_profile].
553 ///
554 /// This is a **required** field for requests.
555 pub fn set_or_clear_connection_profile<T>(mut self, v: std::option::Option<T>) -> Self
556 where
557 T: std::convert::Into<crate::model::ConnectionProfile>,
558 {
559 self.0.request.connection_profile = v.map(|x| x.into());
560 self
561 }
562
563 /// Sets the value of [request_id][crate::model::UpdateConnectionProfileRequest::request_id].
564 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
565 self.0.request.request_id = v.into();
566 self
567 }
568
569 /// Sets the value of [validate_only][crate::model::UpdateConnectionProfileRequest::validate_only].
570 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
571 self.0.request.validate_only = v.into();
572 self
573 }
574
575 /// Sets the value of [force][crate::model::UpdateConnectionProfileRequest::force].
576 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
577 self.0.request.force = v.into();
578 self
579 }
580 }
581
582 #[doc(hidden)]
583 impl crate::RequestBuilder for UpdateConnectionProfile {
584 fn request_options(&mut self) -> &mut crate::RequestOptions {
585 &mut self.0.options
586 }
587 }
588
589 /// The request builder for [Datastream::delete_connection_profile][crate::client::Datastream::delete_connection_profile] calls.
590 ///
591 /// # Example
592 /// ```
593 /// # use google_cloud_datastream_v1::builder::datastream::DeleteConnectionProfile;
594 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
595 /// use google_cloud_lro::Poller;
596 ///
597 /// let builder = prepare_request_builder();
598 /// let response = builder.poller().until_done().await?;
599 /// # Ok(()) }
600 ///
601 /// fn prepare_request_builder() -> DeleteConnectionProfile {
602 /// # panic!();
603 /// // ... details omitted ...
604 /// }
605 /// ```
606 #[derive(Clone, Debug)]
607 pub struct DeleteConnectionProfile(
608 RequestBuilder<crate::model::DeleteConnectionProfileRequest>,
609 );
610
611 impl DeleteConnectionProfile {
612 pub(crate) fn new(
613 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
614 ) -> Self {
615 Self(RequestBuilder::new(stub))
616 }
617
618 /// Sets the full request, replacing any prior values.
619 pub fn with_request<V: Into<crate::model::DeleteConnectionProfileRequest>>(
620 mut self,
621 v: V,
622 ) -> Self {
623 self.0.request = v.into();
624 self
625 }
626
627 /// Sets all the options, replacing any prior values.
628 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
629 self.0.options = v.into();
630 self
631 }
632
633 /// Sends the request.
634 ///
635 /// # Long running operations
636 ///
637 /// This starts, but does not poll, a longrunning operation. More information
638 /// on [delete_connection_profile][crate::client::Datastream::delete_connection_profile].
639 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
640 (*self.0.stub)
641 .delete_connection_profile(self.0.request, self.0.options)
642 .await
643 .map(crate::Response::into_body)
644 }
645
646 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_connection_profile`.
647 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
648 type Operation =
649 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
650 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
651 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
652
653 let stub = self.0.stub.clone();
654 let mut options = self.0.options.clone();
655 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
656 let query = move |name| {
657 let stub = stub.clone();
658 let options = options.clone();
659 async {
660 let op = GetOperation::new(stub)
661 .set_name(name)
662 .with_options(options)
663 .send()
664 .await?;
665 Ok(Operation::new(op))
666 }
667 };
668
669 let start = move || async {
670 let op = self.send().await?;
671 Ok(Operation::new(op))
672 };
673
674 google_cloud_lro::internal::new_unit_response_poller(
675 polling_error_policy,
676 polling_backoff_policy,
677 start,
678 query,
679 )
680 }
681
682 /// Sets the value of [name][crate::model::DeleteConnectionProfileRequest::name].
683 ///
684 /// This is a **required** field for requests.
685 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
686 self.0.request.name = v.into();
687 self
688 }
689
690 /// Sets the value of [request_id][crate::model::DeleteConnectionProfileRequest::request_id].
691 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
692 self.0.request.request_id = v.into();
693 self
694 }
695 }
696
697 #[doc(hidden)]
698 impl crate::RequestBuilder for DeleteConnectionProfile {
699 fn request_options(&mut self) -> &mut crate::RequestOptions {
700 &mut self.0.options
701 }
702 }
703
704 /// The request builder for [Datastream::discover_connection_profile][crate::client::Datastream::discover_connection_profile] calls.
705 ///
706 /// # Example
707 /// ```
708 /// # use google_cloud_datastream_v1::builder::datastream::DiscoverConnectionProfile;
709 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
710 ///
711 /// let builder = prepare_request_builder();
712 /// let response = builder.send().await?;
713 /// # Ok(()) }
714 ///
715 /// fn prepare_request_builder() -> DiscoverConnectionProfile {
716 /// # panic!();
717 /// // ... details omitted ...
718 /// }
719 /// ```
720 #[derive(Clone, Debug)]
721 pub struct DiscoverConnectionProfile(
722 RequestBuilder<crate::model::DiscoverConnectionProfileRequest>,
723 );
724
725 impl DiscoverConnectionProfile {
726 pub(crate) fn new(
727 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
728 ) -> Self {
729 Self(RequestBuilder::new(stub))
730 }
731
732 /// Sets the full request, replacing any prior values.
733 pub fn with_request<V: Into<crate::model::DiscoverConnectionProfileRequest>>(
734 mut self,
735 v: V,
736 ) -> Self {
737 self.0.request = v.into();
738 self
739 }
740
741 /// Sets all the options, replacing any prior values.
742 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
743 self.0.options = v.into();
744 self
745 }
746
747 /// Sends the request.
748 pub async fn send(self) -> Result<crate::model::DiscoverConnectionProfileResponse> {
749 (*self.0.stub)
750 .discover_connection_profile(self.0.request, self.0.options)
751 .await
752 .map(crate::Response::into_body)
753 }
754
755 /// Sets the value of [parent][crate::model::DiscoverConnectionProfileRequest::parent].
756 ///
757 /// This is a **required** field for requests.
758 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
759 self.0.request.parent = v.into();
760 self
761 }
762
763 /// Sets the value of [target][crate::model::DiscoverConnectionProfileRequest::target].
764 ///
765 /// Note that all the setters affecting `target` are
766 /// mutually exclusive.
767 pub fn set_target<
768 T: Into<Option<crate::model::discover_connection_profile_request::Target>>,
769 >(
770 mut self,
771 v: T,
772 ) -> Self {
773 self.0.request.target = v.into();
774 self
775 }
776
777 /// Sets the value of [target][crate::model::DiscoverConnectionProfileRequest::target]
778 /// to hold a `ConnectionProfile`.
779 ///
780 /// Note that all the setters affecting `target` are
781 /// mutually exclusive.
782 pub fn set_connection_profile<
783 T: std::convert::Into<std::boxed::Box<crate::model::ConnectionProfile>>,
784 >(
785 mut self,
786 v: T,
787 ) -> Self {
788 self.0.request = self.0.request.set_connection_profile(v);
789 self
790 }
791
792 /// Sets the value of [target][crate::model::DiscoverConnectionProfileRequest::target]
793 /// to hold a `ConnectionProfileName`.
794 ///
795 /// Note that all the setters affecting `target` are
796 /// mutually exclusive.
797 pub fn set_connection_profile_name<T: std::convert::Into<std::string::String>>(
798 mut self,
799 v: T,
800 ) -> Self {
801 self.0.request = self.0.request.set_connection_profile_name(v);
802 self
803 }
804
805 /// Sets the value of [hierarchy][crate::model::DiscoverConnectionProfileRequest::hierarchy].
806 ///
807 /// Note that all the setters affecting `hierarchy` are
808 /// mutually exclusive.
809 pub fn set_hierarchy<
810 T: Into<Option<crate::model::discover_connection_profile_request::Hierarchy>>,
811 >(
812 mut self,
813 v: T,
814 ) -> Self {
815 self.0.request.hierarchy = v.into();
816 self
817 }
818
819 /// Sets the value of [hierarchy][crate::model::DiscoverConnectionProfileRequest::hierarchy]
820 /// to hold a `FullHierarchy`.
821 ///
822 /// Note that all the setters affecting `hierarchy` are
823 /// mutually exclusive.
824 pub fn set_full_hierarchy<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
825 self.0.request = self.0.request.set_full_hierarchy(v);
826 self
827 }
828
829 /// Sets the value of [hierarchy][crate::model::DiscoverConnectionProfileRequest::hierarchy]
830 /// to hold a `HierarchyDepth`.
831 ///
832 /// Note that all the setters affecting `hierarchy` are
833 /// mutually exclusive.
834 pub fn set_hierarchy_depth<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
835 self.0.request = self.0.request.set_hierarchy_depth(v);
836 self
837 }
838
839 /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object].
840 ///
841 /// Note that all the setters affecting `data_object` are
842 /// mutually exclusive.
843 pub fn set_data_object<
844 T: Into<Option<crate::model::discover_connection_profile_request::DataObject>>,
845 >(
846 mut self,
847 v: T,
848 ) -> Self {
849 self.0.request.data_object = v.into();
850 self
851 }
852
853 /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
854 /// to hold a `OracleRdbms`.
855 ///
856 /// Note that all the setters affecting `data_object` are
857 /// mutually exclusive.
858 pub fn set_oracle_rdbms<
859 T: std::convert::Into<std::boxed::Box<crate::model::OracleRdbms>>,
860 >(
861 mut self,
862 v: T,
863 ) -> Self {
864 self.0.request = self.0.request.set_oracle_rdbms(v);
865 self
866 }
867
868 /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
869 /// to hold a `MysqlRdbms`.
870 ///
871 /// Note that all the setters affecting `data_object` are
872 /// mutually exclusive.
873 pub fn set_mysql_rdbms<T: std::convert::Into<std::boxed::Box<crate::model::MysqlRdbms>>>(
874 mut self,
875 v: T,
876 ) -> Self {
877 self.0.request = self.0.request.set_mysql_rdbms(v);
878 self
879 }
880
881 /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
882 /// to hold a `PostgresqlRdbms`.
883 ///
884 /// Note that all the setters affecting `data_object` are
885 /// mutually exclusive.
886 pub fn set_postgresql_rdbms<
887 T: std::convert::Into<std::boxed::Box<crate::model::PostgresqlRdbms>>,
888 >(
889 mut self,
890 v: T,
891 ) -> Self {
892 self.0.request = self.0.request.set_postgresql_rdbms(v);
893 self
894 }
895
896 /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
897 /// to hold a `SqlServerRdbms`.
898 ///
899 /// Note that all the setters affecting `data_object` are
900 /// mutually exclusive.
901 pub fn set_sql_server_rdbms<
902 T: std::convert::Into<std::boxed::Box<crate::model::SqlServerRdbms>>,
903 >(
904 mut self,
905 v: T,
906 ) -> Self {
907 self.0.request = self.0.request.set_sql_server_rdbms(v);
908 self
909 }
910
911 /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
912 /// to hold a `SalesforceOrg`.
913 ///
914 /// Note that all the setters affecting `data_object` are
915 /// mutually exclusive.
916 pub fn set_salesforce_org<
917 T: std::convert::Into<std::boxed::Box<crate::model::SalesforceOrg>>,
918 >(
919 mut self,
920 v: T,
921 ) -> Self {
922 self.0.request = self.0.request.set_salesforce_org(v);
923 self
924 }
925
926 /// Sets the value of [data_object][crate::model::DiscoverConnectionProfileRequest::data_object]
927 /// to hold a `MongodbCluster`.
928 ///
929 /// Note that all the setters affecting `data_object` are
930 /// mutually exclusive.
931 pub fn set_mongodb_cluster<
932 T: std::convert::Into<std::boxed::Box<crate::model::MongodbCluster>>,
933 >(
934 mut self,
935 v: T,
936 ) -> Self {
937 self.0.request = self.0.request.set_mongodb_cluster(v);
938 self
939 }
940 }
941
942 #[doc(hidden)]
943 impl crate::RequestBuilder for DiscoverConnectionProfile {
944 fn request_options(&mut self) -> &mut crate::RequestOptions {
945 &mut self.0.options
946 }
947 }
948
949 /// The request builder for [Datastream::list_streams][crate::client::Datastream::list_streams] calls.
950 ///
951 /// # Example
952 /// ```
953 /// # use google_cloud_datastream_v1::builder::datastream::ListStreams;
954 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
955 /// use google_cloud_gax::paginator::ItemPaginator;
956 ///
957 /// let builder = prepare_request_builder();
958 /// let mut items = builder.by_item();
959 /// while let Some(result) = items.next().await {
960 /// let item = result?;
961 /// }
962 /// # Ok(()) }
963 ///
964 /// fn prepare_request_builder() -> ListStreams {
965 /// # panic!();
966 /// // ... details omitted ...
967 /// }
968 /// ```
969 #[derive(Clone, Debug)]
970 pub struct ListStreams(RequestBuilder<crate::model::ListStreamsRequest>);
971
972 impl ListStreams {
973 pub(crate) fn new(
974 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
975 ) -> Self {
976 Self(RequestBuilder::new(stub))
977 }
978
979 /// Sets the full request, replacing any prior values.
980 pub fn with_request<V: Into<crate::model::ListStreamsRequest>>(mut self, v: V) -> Self {
981 self.0.request = v.into();
982 self
983 }
984
985 /// Sets all the options, replacing any prior values.
986 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
987 self.0.options = v.into();
988 self
989 }
990
991 /// Sends the request.
992 pub async fn send(self) -> Result<crate::model::ListStreamsResponse> {
993 (*self.0.stub)
994 .list_streams(self.0.request, self.0.options)
995 .await
996 .map(crate::Response::into_body)
997 }
998
999 /// Streams each page in the collection.
1000 pub fn by_page(
1001 self,
1002 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListStreamsResponse, crate::Error>
1003 {
1004 use std::clone::Clone;
1005 let token = self.0.request.page_token.clone();
1006 let execute = move |token: String| {
1007 let mut builder = self.clone();
1008 builder.0.request = builder.0.request.set_page_token(token);
1009 builder.send()
1010 };
1011 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1012 }
1013
1014 /// Streams each item in the collection.
1015 pub fn by_item(
1016 self,
1017 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1018 crate::model::ListStreamsResponse,
1019 crate::Error,
1020 > {
1021 use google_cloud_gax::paginator::Paginator;
1022 self.by_page().items()
1023 }
1024
1025 /// Sets the value of [parent][crate::model::ListStreamsRequest::parent].
1026 ///
1027 /// This is a **required** field for requests.
1028 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1029 self.0.request.parent = v.into();
1030 self
1031 }
1032
1033 /// Sets the value of [page_size][crate::model::ListStreamsRequest::page_size].
1034 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1035 self.0.request.page_size = v.into();
1036 self
1037 }
1038
1039 /// Sets the value of [page_token][crate::model::ListStreamsRequest::page_token].
1040 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1041 self.0.request.page_token = v.into();
1042 self
1043 }
1044
1045 /// Sets the value of [filter][crate::model::ListStreamsRequest::filter].
1046 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1047 self.0.request.filter = v.into();
1048 self
1049 }
1050
1051 /// Sets the value of [order_by][crate::model::ListStreamsRequest::order_by].
1052 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
1053 self.0.request.order_by = v.into();
1054 self
1055 }
1056 }
1057
1058 #[doc(hidden)]
1059 impl crate::RequestBuilder for ListStreams {
1060 fn request_options(&mut self) -> &mut crate::RequestOptions {
1061 &mut self.0.options
1062 }
1063 }
1064
1065 /// The request builder for [Datastream::get_stream][crate::client::Datastream::get_stream] calls.
1066 ///
1067 /// # Example
1068 /// ```
1069 /// # use google_cloud_datastream_v1::builder::datastream::GetStream;
1070 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1071 ///
1072 /// let builder = prepare_request_builder();
1073 /// let response = builder.send().await?;
1074 /// # Ok(()) }
1075 ///
1076 /// fn prepare_request_builder() -> GetStream {
1077 /// # panic!();
1078 /// // ... details omitted ...
1079 /// }
1080 /// ```
1081 #[derive(Clone, Debug)]
1082 pub struct GetStream(RequestBuilder<crate::model::GetStreamRequest>);
1083
1084 impl GetStream {
1085 pub(crate) fn new(
1086 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1087 ) -> Self {
1088 Self(RequestBuilder::new(stub))
1089 }
1090
1091 /// Sets the full request, replacing any prior values.
1092 pub fn with_request<V: Into<crate::model::GetStreamRequest>>(mut self, v: V) -> Self {
1093 self.0.request = v.into();
1094 self
1095 }
1096
1097 /// Sets all the options, replacing any prior values.
1098 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1099 self.0.options = v.into();
1100 self
1101 }
1102
1103 /// Sends the request.
1104 pub async fn send(self) -> Result<crate::model::Stream> {
1105 (*self.0.stub)
1106 .get_stream(self.0.request, self.0.options)
1107 .await
1108 .map(crate::Response::into_body)
1109 }
1110
1111 /// Sets the value of [name][crate::model::GetStreamRequest::name].
1112 ///
1113 /// This is a **required** field for requests.
1114 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1115 self.0.request.name = v.into();
1116 self
1117 }
1118 }
1119
1120 #[doc(hidden)]
1121 impl crate::RequestBuilder for GetStream {
1122 fn request_options(&mut self) -> &mut crate::RequestOptions {
1123 &mut self.0.options
1124 }
1125 }
1126
1127 /// The request builder for [Datastream::create_stream][crate::client::Datastream::create_stream] calls.
1128 ///
1129 /// # Example
1130 /// ```
1131 /// # use google_cloud_datastream_v1::builder::datastream::CreateStream;
1132 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1133 /// use google_cloud_lro::Poller;
1134 ///
1135 /// let builder = prepare_request_builder();
1136 /// let response = builder.poller().until_done().await?;
1137 /// # Ok(()) }
1138 ///
1139 /// fn prepare_request_builder() -> CreateStream {
1140 /// # panic!();
1141 /// // ... details omitted ...
1142 /// }
1143 /// ```
1144 #[derive(Clone, Debug)]
1145 pub struct CreateStream(RequestBuilder<crate::model::CreateStreamRequest>);
1146
1147 impl CreateStream {
1148 pub(crate) fn new(
1149 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1150 ) -> Self {
1151 Self(RequestBuilder::new(stub))
1152 }
1153
1154 /// Sets the full request, replacing any prior values.
1155 pub fn with_request<V: Into<crate::model::CreateStreamRequest>>(mut self, v: V) -> Self {
1156 self.0.request = v.into();
1157 self
1158 }
1159
1160 /// Sets all the options, replacing any prior values.
1161 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1162 self.0.options = v.into();
1163 self
1164 }
1165
1166 /// Sends the request.
1167 ///
1168 /// # Long running operations
1169 ///
1170 /// This starts, but does not poll, a longrunning operation. More information
1171 /// on [create_stream][crate::client::Datastream::create_stream].
1172 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1173 (*self.0.stub)
1174 .create_stream(self.0.request, self.0.options)
1175 .await
1176 .map(crate::Response::into_body)
1177 }
1178
1179 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_stream`.
1180 pub fn poller(
1181 self,
1182 ) -> impl google_cloud_lro::Poller<crate::model::Stream, crate::model::OperationMetadata>
1183 {
1184 type Operation = google_cloud_lro::internal::Operation<
1185 crate::model::Stream,
1186 crate::model::OperationMetadata,
1187 >;
1188 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1189 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1190
1191 let stub = self.0.stub.clone();
1192 let mut options = self.0.options.clone();
1193 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1194 let query = move |name| {
1195 let stub = stub.clone();
1196 let options = options.clone();
1197 async {
1198 let op = GetOperation::new(stub)
1199 .set_name(name)
1200 .with_options(options)
1201 .send()
1202 .await?;
1203 Ok(Operation::new(op))
1204 }
1205 };
1206
1207 let start = move || async {
1208 let op = self.send().await?;
1209 Ok(Operation::new(op))
1210 };
1211
1212 google_cloud_lro::internal::new_poller(
1213 polling_error_policy,
1214 polling_backoff_policy,
1215 start,
1216 query,
1217 )
1218 }
1219
1220 /// Sets the value of [parent][crate::model::CreateStreamRequest::parent].
1221 ///
1222 /// This is a **required** field for requests.
1223 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1224 self.0.request.parent = v.into();
1225 self
1226 }
1227
1228 /// Sets the value of [stream_id][crate::model::CreateStreamRequest::stream_id].
1229 ///
1230 /// This is a **required** field for requests.
1231 pub fn set_stream_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1232 self.0.request.stream_id = v.into();
1233 self
1234 }
1235
1236 /// Sets the value of [stream][crate::model::CreateStreamRequest::stream].
1237 ///
1238 /// This is a **required** field for requests.
1239 pub fn set_stream<T>(mut self, v: T) -> Self
1240 where
1241 T: std::convert::Into<crate::model::Stream>,
1242 {
1243 self.0.request.stream = std::option::Option::Some(v.into());
1244 self
1245 }
1246
1247 /// Sets or clears the value of [stream][crate::model::CreateStreamRequest::stream].
1248 ///
1249 /// This is a **required** field for requests.
1250 pub fn set_or_clear_stream<T>(mut self, v: std::option::Option<T>) -> Self
1251 where
1252 T: std::convert::Into<crate::model::Stream>,
1253 {
1254 self.0.request.stream = v.map(|x| x.into());
1255 self
1256 }
1257
1258 /// Sets the value of [request_id][crate::model::CreateStreamRequest::request_id].
1259 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1260 self.0.request.request_id = v.into();
1261 self
1262 }
1263
1264 /// Sets the value of [validate_only][crate::model::CreateStreamRequest::validate_only].
1265 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1266 self.0.request.validate_only = v.into();
1267 self
1268 }
1269
1270 /// Sets the value of [force][crate::model::CreateStreamRequest::force].
1271 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1272 self.0.request.force = v.into();
1273 self
1274 }
1275 }
1276
1277 #[doc(hidden)]
1278 impl crate::RequestBuilder for CreateStream {
1279 fn request_options(&mut self) -> &mut crate::RequestOptions {
1280 &mut self.0.options
1281 }
1282 }
1283
1284 /// The request builder for [Datastream::update_stream][crate::client::Datastream::update_stream] calls.
1285 ///
1286 /// # Example
1287 /// ```
1288 /// # use google_cloud_datastream_v1::builder::datastream::UpdateStream;
1289 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1290 /// use google_cloud_lro::Poller;
1291 ///
1292 /// let builder = prepare_request_builder();
1293 /// let response = builder.poller().until_done().await?;
1294 /// # Ok(()) }
1295 ///
1296 /// fn prepare_request_builder() -> UpdateStream {
1297 /// # panic!();
1298 /// // ... details omitted ...
1299 /// }
1300 /// ```
1301 #[derive(Clone, Debug)]
1302 pub struct UpdateStream(RequestBuilder<crate::model::UpdateStreamRequest>);
1303
1304 impl UpdateStream {
1305 pub(crate) fn new(
1306 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1307 ) -> Self {
1308 Self(RequestBuilder::new(stub))
1309 }
1310
1311 /// Sets the full request, replacing any prior values.
1312 pub fn with_request<V: Into<crate::model::UpdateStreamRequest>>(mut self, v: V) -> Self {
1313 self.0.request = v.into();
1314 self
1315 }
1316
1317 /// Sets all the options, replacing any prior values.
1318 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1319 self.0.options = v.into();
1320 self
1321 }
1322
1323 /// Sends the request.
1324 ///
1325 /// # Long running operations
1326 ///
1327 /// This starts, but does not poll, a longrunning operation. More information
1328 /// on [update_stream][crate::client::Datastream::update_stream].
1329 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1330 (*self.0.stub)
1331 .update_stream(self.0.request, self.0.options)
1332 .await
1333 .map(crate::Response::into_body)
1334 }
1335
1336 /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_stream`.
1337 pub fn poller(
1338 self,
1339 ) -> impl google_cloud_lro::Poller<crate::model::Stream, crate::model::OperationMetadata>
1340 {
1341 type Operation = google_cloud_lro::internal::Operation<
1342 crate::model::Stream,
1343 crate::model::OperationMetadata,
1344 >;
1345 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1346 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1347
1348 let stub = self.0.stub.clone();
1349 let mut options = self.0.options.clone();
1350 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1351 let query = move |name| {
1352 let stub = stub.clone();
1353 let options = options.clone();
1354 async {
1355 let op = GetOperation::new(stub)
1356 .set_name(name)
1357 .with_options(options)
1358 .send()
1359 .await?;
1360 Ok(Operation::new(op))
1361 }
1362 };
1363
1364 let start = move || async {
1365 let op = self.send().await?;
1366 Ok(Operation::new(op))
1367 };
1368
1369 google_cloud_lro::internal::new_poller(
1370 polling_error_policy,
1371 polling_backoff_policy,
1372 start,
1373 query,
1374 )
1375 }
1376
1377 /// Sets the value of [update_mask][crate::model::UpdateStreamRequest::update_mask].
1378 pub fn set_update_mask<T>(mut self, v: T) -> Self
1379 where
1380 T: std::convert::Into<wkt::FieldMask>,
1381 {
1382 self.0.request.update_mask = std::option::Option::Some(v.into());
1383 self
1384 }
1385
1386 /// Sets or clears the value of [update_mask][crate::model::UpdateStreamRequest::update_mask].
1387 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1388 where
1389 T: std::convert::Into<wkt::FieldMask>,
1390 {
1391 self.0.request.update_mask = v.map(|x| x.into());
1392 self
1393 }
1394
1395 /// Sets the value of [stream][crate::model::UpdateStreamRequest::stream].
1396 ///
1397 /// This is a **required** field for requests.
1398 pub fn set_stream<T>(mut self, v: T) -> Self
1399 where
1400 T: std::convert::Into<crate::model::Stream>,
1401 {
1402 self.0.request.stream = std::option::Option::Some(v.into());
1403 self
1404 }
1405
1406 /// Sets or clears the value of [stream][crate::model::UpdateStreamRequest::stream].
1407 ///
1408 /// This is a **required** field for requests.
1409 pub fn set_or_clear_stream<T>(mut self, v: std::option::Option<T>) -> Self
1410 where
1411 T: std::convert::Into<crate::model::Stream>,
1412 {
1413 self.0.request.stream = v.map(|x| x.into());
1414 self
1415 }
1416
1417 /// Sets the value of [request_id][crate::model::UpdateStreamRequest::request_id].
1418 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1419 self.0.request.request_id = v.into();
1420 self
1421 }
1422
1423 /// Sets the value of [validate_only][crate::model::UpdateStreamRequest::validate_only].
1424 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1425 self.0.request.validate_only = v.into();
1426 self
1427 }
1428
1429 /// Sets the value of [force][crate::model::UpdateStreamRequest::force].
1430 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1431 self.0.request.force = v.into();
1432 self
1433 }
1434 }
1435
1436 #[doc(hidden)]
1437 impl crate::RequestBuilder for UpdateStream {
1438 fn request_options(&mut self) -> &mut crate::RequestOptions {
1439 &mut self.0.options
1440 }
1441 }
1442
1443 /// The request builder for [Datastream::delete_stream][crate::client::Datastream::delete_stream] calls.
1444 ///
1445 /// # Example
1446 /// ```
1447 /// # use google_cloud_datastream_v1::builder::datastream::DeleteStream;
1448 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1449 /// use google_cloud_lro::Poller;
1450 ///
1451 /// let builder = prepare_request_builder();
1452 /// let response = builder.poller().until_done().await?;
1453 /// # Ok(()) }
1454 ///
1455 /// fn prepare_request_builder() -> DeleteStream {
1456 /// # panic!();
1457 /// // ... details omitted ...
1458 /// }
1459 /// ```
1460 #[derive(Clone, Debug)]
1461 pub struct DeleteStream(RequestBuilder<crate::model::DeleteStreamRequest>);
1462
1463 impl DeleteStream {
1464 pub(crate) fn new(
1465 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1466 ) -> Self {
1467 Self(RequestBuilder::new(stub))
1468 }
1469
1470 /// Sets the full request, replacing any prior values.
1471 pub fn with_request<V: Into<crate::model::DeleteStreamRequest>>(mut self, v: V) -> Self {
1472 self.0.request = v.into();
1473 self
1474 }
1475
1476 /// Sets all the options, replacing any prior values.
1477 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1478 self.0.options = v.into();
1479 self
1480 }
1481
1482 /// Sends the request.
1483 ///
1484 /// # Long running operations
1485 ///
1486 /// This starts, but does not poll, a longrunning operation. More information
1487 /// on [delete_stream][crate::client::Datastream::delete_stream].
1488 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1489 (*self.0.stub)
1490 .delete_stream(self.0.request, self.0.options)
1491 .await
1492 .map(crate::Response::into_body)
1493 }
1494
1495 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_stream`.
1496 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
1497 type Operation =
1498 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1499 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1500 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1501
1502 let stub = self.0.stub.clone();
1503 let mut options = self.0.options.clone();
1504 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1505 let query = move |name| {
1506 let stub = stub.clone();
1507 let options = options.clone();
1508 async {
1509 let op = GetOperation::new(stub)
1510 .set_name(name)
1511 .with_options(options)
1512 .send()
1513 .await?;
1514 Ok(Operation::new(op))
1515 }
1516 };
1517
1518 let start = move || async {
1519 let op = self.send().await?;
1520 Ok(Operation::new(op))
1521 };
1522
1523 google_cloud_lro::internal::new_unit_response_poller(
1524 polling_error_policy,
1525 polling_backoff_policy,
1526 start,
1527 query,
1528 )
1529 }
1530
1531 /// Sets the value of [name][crate::model::DeleteStreamRequest::name].
1532 ///
1533 /// This is a **required** field for requests.
1534 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1535 self.0.request.name = v.into();
1536 self
1537 }
1538
1539 /// Sets the value of [request_id][crate::model::DeleteStreamRequest::request_id].
1540 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1541 self.0.request.request_id = v.into();
1542 self
1543 }
1544 }
1545
1546 #[doc(hidden)]
1547 impl crate::RequestBuilder for DeleteStream {
1548 fn request_options(&mut self) -> &mut crate::RequestOptions {
1549 &mut self.0.options
1550 }
1551 }
1552
1553 /// The request builder for [Datastream::run_stream][crate::client::Datastream::run_stream] calls.
1554 ///
1555 /// # Example
1556 /// ```
1557 /// # use google_cloud_datastream_v1::builder::datastream::RunStream;
1558 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1559 /// use google_cloud_lro::Poller;
1560 ///
1561 /// let builder = prepare_request_builder();
1562 /// let response = builder.poller().until_done().await?;
1563 /// # Ok(()) }
1564 ///
1565 /// fn prepare_request_builder() -> RunStream {
1566 /// # panic!();
1567 /// // ... details omitted ...
1568 /// }
1569 /// ```
1570 #[derive(Clone, Debug)]
1571 pub struct RunStream(RequestBuilder<crate::model::RunStreamRequest>);
1572
1573 impl RunStream {
1574 pub(crate) fn new(
1575 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1576 ) -> Self {
1577 Self(RequestBuilder::new(stub))
1578 }
1579
1580 /// Sets the full request, replacing any prior values.
1581 pub fn with_request<V: Into<crate::model::RunStreamRequest>>(mut self, v: V) -> Self {
1582 self.0.request = v.into();
1583 self
1584 }
1585
1586 /// Sets all the options, replacing any prior values.
1587 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1588 self.0.options = v.into();
1589 self
1590 }
1591
1592 /// Sends the request.
1593 ///
1594 /// # Long running operations
1595 ///
1596 /// This starts, but does not poll, a longrunning operation. More information
1597 /// on [run_stream][crate::client::Datastream::run_stream].
1598 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1599 (*self.0.stub)
1600 .run_stream(self.0.request, self.0.options)
1601 .await
1602 .map(crate::Response::into_body)
1603 }
1604
1605 /// Creates a [Poller][google_cloud_lro::Poller] to work with `run_stream`.
1606 pub fn poller(
1607 self,
1608 ) -> impl google_cloud_lro::Poller<crate::model::Stream, crate::model::OperationMetadata>
1609 {
1610 type Operation = google_cloud_lro::internal::Operation<
1611 crate::model::Stream,
1612 crate::model::OperationMetadata,
1613 >;
1614 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1615 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1616
1617 let stub = self.0.stub.clone();
1618 let mut options = self.0.options.clone();
1619 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1620 let query = move |name| {
1621 let stub = stub.clone();
1622 let options = options.clone();
1623 async {
1624 let op = GetOperation::new(stub)
1625 .set_name(name)
1626 .with_options(options)
1627 .send()
1628 .await?;
1629 Ok(Operation::new(op))
1630 }
1631 };
1632
1633 let start = move || async {
1634 let op = self.send().await?;
1635 Ok(Operation::new(op))
1636 };
1637
1638 google_cloud_lro::internal::new_poller(
1639 polling_error_policy,
1640 polling_backoff_policy,
1641 start,
1642 query,
1643 )
1644 }
1645
1646 /// Sets the value of [name][crate::model::RunStreamRequest::name].
1647 ///
1648 /// This is a **required** field for requests.
1649 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1650 self.0.request.name = v.into();
1651 self
1652 }
1653
1654 /// Sets the value of [cdc_strategy][crate::model::RunStreamRequest::cdc_strategy].
1655 pub fn set_cdc_strategy<T>(mut self, v: T) -> Self
1656 where
1657 T: std::convert::Into<crate::model::CdcStrategy>,
1658 {
1659 self.0.request.cdc_strategy = std::option::Option::Some(v.into());
1660 self
1661 }
1662
1663 /// Sets or clears the value of [cdc_strategy][crate::model::RunStreamRequest::cdc_strategy].
1664 pub fn set_or_clear_cdc_strategy<T>(mut self, v: std::option::Option<T>) -> Self
1665 where
1666 T: std::convert::Into<crate::model::CdcStrategy>,
1667 {
1668 self.0.request.cdc_strategy = v.map(|x| x.into());
1669 self
1670 }
1671
1672 /// Sets the value of [force][crate::model::RunStreamRequest::force].
1673 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
1674 self.0.request.force = v.into();
1675 self
1676 }
1677 }
1678
1679 #[doc(hidden)]
1680 impl crate::RequestBuilder for RunStream {
1681 fn request_options(&mut self) -> &mut crate::RequestOptions {
1682 &mut self.0.options
1683 }
1684 }
1685
1686 /// The request builder for [Datastream::get_stream_object][crate::client::Datastream::get_stream_object] calls.
1687 ///
1688 /// # Example
1689 /// ```
1690 /// # use google_cloud_datastream_v1::builder::datastream::GetStreamObject;
1691 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1692 ///
1693 /// let builder = prepare_request_builder();
1694 /// let response = builder.send().await?;
1695 /// # Ok(()) }
1696 ///
1697 /// fn prepare_request_builder() -> GetStreamObject {
1698 /// # panic!();
1699 /// // ... details omitted ...
1700 /// }
1701 /// ```
1702 #[derive(Clone, Debug)]
1703 pub struct GetStreamObject(RequestBuilder<crate::model::GetStreamObjectRequest>);
1704
1705 impl GetStreamObject {
1706 pub(crate) fn new(
1707 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1708 ) -> Self {
1709 Self(RequestBuilder::new(stub))
1710 }
1711
1712 /// Sets the full request, replacing any prior values.
1713 pub fn with_request<V: Into<crate::model::GetStreamObjectRequest>>(mut self, v: V) -> Self {
1714 self.0.request = v.into();
1715 self
1716 }
1717
1718 /// Sets all the options, replacing any prior values.
1719 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1720 self.0.options = v.into();
1721 self
1722 }
1723
1724 /// Sends the request.
1725 pub async fn send(self) -> Result<crate::model::StreamObject> {
1726 (*self.0.stub)
1727 .get_stream_object(self.0.request, self.0.options)
1728 .await
1729 .map(crate::Response::into_body)
1730 }
1731
1732 /// Sets the value of [name][crate::model::GetStreamObjectRequest::name].
1733 ///
1734 /// This is a **required** field for requests.
1735 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1736 self.0.request.name = v.into();
1737 self
1738 }
1739 }
1740
1741 #[doc(hidden)]
1742 impl crate::RequestBuilder for GetStreamObject {
1743 fn request_options(&mut self) -> &mut crate::RequestOptions {
1744 &mut self.0.options
1745 }
1746 }
1747
1748 /// The request builder for [Datastream::lookup_stream_object][crate::client::Datastream::lookup_stream_object] calls.
1749 ///
1750 /// # Example
1751 /// ```
1752 /// # use google_cloud_datastream_v1::builder::datastream::LookupStreamObject;
1753 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1754 ///
1755 /// let builder = prepare_request_builder();
1756 /// let response = builder.send().await?;
1757 /// # Ok(()) }
1758 ///
1759 /// fn prepare_request_builder() -> LookupStreamObject {
1760 /// # panic!();
1761 /// // ... details omitted ...
1762 /// }
1763 /// ```
1764 #[derive(Clone, Debug)]
1765 pub struct LookupStreamObject(RequestBuilder<crate::model::LookupStreamObjectRequest>);
1766
1767 impl LookupStreamObject {
1768 pub(crate) fn new(
1769 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1770 ) -> Self {
1771 Self(RequestBuilder::new(stub))
1772 }
1773
1774 /// Sets the full request, replacing any prior values.
1775 pub fn with_request<V: Into<crate::model::LookupStreamObjectRequest>>(
1776 mut self,
1777 v: V,
1778 ) -> Self {
1779 self.0.request = v.into();
1780 self
1781 }
1782
1783 /// Sets all the options, replacing any prior values.
1784 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1785 self.0.options = v.into();
1786 self
1787 }
1788
1789 /// Sends the request.
1790 pub async fn send(self) -> Result<crate::model::StreamObject> {
1791 (*self.0.stub)
1792 .lookup_stream_object(self.0.request, self.0.options)
1793 .await
1794 .map(crate::Response::into_body)
1795 }
1796
1797 /// Sets the value of [parent][crate::model::LookupStreamObjectRequest::parent].
1798 ///
1799 /// This is a **required** field for requests.
1800 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1801 self.0.request.parent = v.into();
1802 self
1803 }
1804
1805 /// Sets the value of [source_object_identifier][crate::model::LookupStreamObjectRequest::source_object_identifier].
1806 ///
1807 /// This is a **required** field for requests.
1808 pub fn set_source_object_identifier<T>(mut self, v: T) -> Self
1809 where
1810 T: std::convert::Into<crate::model::SourceObjectIdentifier>,
1811 {
1812 self.0.request.source_object_identifier = std::option::Option::Some(v.into());
1813 self
1814 }
1815
1816 /// Sets or clears the value of [source_object_identifier][crate::model::LookupStreamObjectRequest::source_object_identifier].
1817 ///
1818 /// This is a **required** field for requests.
1819 pub fn set_or_clear_source_object_identifier<T>(mut self, v: std::option::Option<T>) -> Self
1820 where
1821 T: std::convert::Into<crate::model::SourceObjectIdentifier>,
1822 {
1823 self.0.request.source_object_identifier = v.map(|x| x.into());
1824 self
1825 }
1826 }
1827
1828 #[doc(hidden)]
1829 impl crate::RequestBuilder for LookupStreamObject {
1830 fn request_options(&mut self) -> &mut crate::RequestOptions {
1831 &mut self.0.options
1832 }
1833 }
1834
1835 /// The request builder for [Datastream::list_stream_objects][crate::client::Datastream::list_stream_objects] calls.
1836 ///
1837 /// # Example
1838 /// ```
1839 /// # use google_cloud_datastream_v1::builder::datastream::ListStreamObjects;
1840 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1841 /// use google_cloud_gax::paginator::ItemPaginator;
1842 ///
1843 /// let builder = prepare_request_builder();
1844 /// let mut items = builder.by_item();
1845 /// while let Some(result) = items.next().await {
1846 /// let item = result?;
1847 /// }
1848 /// # Ok(()) }
1849 ///
1850 /// fn prepare_request_builder() -> ListStreamObjects {
1851 /// # panic!();
1852 /// // ... details omitted ...
1853 /// }
1854 /// ```
1855 #[derive(Clone, Debug)]
1856 pub struct ListStreamObjects(RequestBuilder<crate::model::ListStreamObjectsRequest>);
1857
1858 impl ListStreamObjects {
1859 pub(crate) fn new(
1860 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1861 ) -> Self {
1862 Self(RequestBuilder::new(stub))
1863 }
1864
1865 /// Sets the full request, replacing any prior values.
1866 pub fn with_request<V: Into<crate::model::ListStreamObjectsRequest>>(
1867 mut self,
1868 v: V,
1869 ) -> Self {
1870 self.0.request = v.into();
1871 self
1872 }
1873
1874 /// Sets all the options, replacing any prior values.
1875 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1876 self.0.options = v.into();
1877 self
1878 }
1879
1880 /// Sends the request.
1881 pub async fn send(self) -> Result<crate::model::ListStreamObjectsResponse> {
1882 (*self.0.stub)
1883 .list_stream_objects(self.0.request, self.0.options)
1884 .await
1885 .map(crate::Response::into_body)
1886 }
1887
1888 /// Streams each page in the collection.
1889 pub fn by_page(
1890 self,
1891 ) -> impl google_cloud_gax::paginator::Paginator<
1892 crate::model::ListStreamObjectsResponse,
1893 crate::Error,
1894 > {
1895 use std::clone::Clone;
1896 let token = self.0.request.page_token.clone();
1897 let execute = move |token: String| {
1898 let mut builder = self.clone();
1899 builder.0.request = builder.0.request.set_page_token(token);
1900 builder.send()
1901 };
1902 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1903 }
1904
1905 /// Streams each item in the collection.
1906 pub fn by_item(
1907 self,
1908 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1909 crate::model::ListStreamObjectsResponse,
1910 crate::Error,
1911 > {
1912 use google_cloud_gax::paginator::Paginator;
1913 self.by_page().items()
1914 }
1915
1916 /// Sets the value of [parent][crate::model::ListStreamObjectsRequest::parent].
1917 ///
1918 /// This is a **required** field for requests.
1919 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1920 self.0.request.parent = v.into();
1921 self
1922 }
1923
1924 /// Sets the value of [page_size][crate::model::ListStreamObjectsRequest::page_size].
1925 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1926 self.0.request.page_size = v.into();
1927 self
1928 }
1929
1930 /// Sets the value of [page_token][crate::model::ListStreamObjectsRequest::page_token].
1931 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1932 self.0.request.page_token = v.into();
1933 self
1934 }
1935 }
1936
1937 #[doc(hidden)]
1938 impl crate::RequestBuilder for ListStreamObjects {
1939 fn request_options(&mut self) -> &mut crate::RequestOptions {
1940 &mut self.0.options
1941 }
1942 }
1943
1944 /// The request builder for [Datastream::start_backfill_job][crate::client::Datastream::start_backfill_job] calls.
1945 ///
1946 /// # Example
1947 /// ```
1948 /// # use google_cloud_datastream_v1::builder::datastream::StartBackfillJob;
1949 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
1950 ///
1951 /// let builder = prepare_request_builder();
1952 /// let response = builder.send().await?;
1953 /// # Ok(()) }
1954 ///
1955 /// fn prepare_request_builder() -> StartBackfillJob {
1956 /// # panic!();
1957 /// // ... details omitted ...
1958 /// }
1959 /// ```
1960 #[derive(Clone, Debug)]
1961 pub struct StartBackfillJob(RequestBuilder<crate::model::StartBackfillJobRequest>);
1962
1963 impl StartBackfillJob {
1964 pub(crate) fn new(
1965 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
1966 ) -> Self {
1967 Self(RequestBuilder::new(stub))
1968 }
1969
1970 /// Sets the full request, replacing any prior values.
1971 pub fn with_request<V: Into<crate::model::StartBackfillJobRequest>>(
1972 mut self,
1973 v: V,
1974 ) -> Self {
1975 self.0.request = v.into();
1976 self
1977 }
1978
1979 /// Sets all the options, replacing any prior values.
1980 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1981 self.0.options = v.into();
1982 self
1983 }
1984
1985 /// Sends the request.
1986 pub async fn send(self) -> Result<crate::model::StartBackfillJobResponse> {
1987 (*self.0.stub)
1988 .start_backfill_job(self.0.request, self.0.options)
1989 .await
1990 .map(crate::Response::into_body)
1991 }
1992
1993 /// Sets the value of [object][crate::model::StartBackfillJobRequest::object].
1994 ///
1995 /// This is a **required** field for requests.
1996 pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
1997 self.0.request.object = v.into();
1998 self
1999 }
2000 }
2001
2002 #[doc(hidden)]
2003 impl crate::RequestBuilder for StartBackfillJob {
2004 fn request_options(&mut self) -> &mut crate::RequestOptions {
2005 &mut self.0.options
2006 }
2007 }
2008
2009 /// The request builder for [Datastream::stop_backfill_job][crate::client::Datastream::stop_backfill_job] calls.
2010 ///
2011 /// # Example
2012 /// ```
2013 /// # use google_cloud_datastream_v1::builder::datastream::StopBackfillJob;
2014 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2015 ///
2016 /// let builder = prepare_request_builder();
2017 /// let response = builder.send().await?;
2018 /// # Ok(()) }
2019 ///
2020 /// fn prepare_request_builder() -> StopBackfillJob {
2021 /// # panic!();
2022 /// // ... details omitted ...
2023 /// }
2024 /// ```
2025 #[derive(Clone, Debug)]
2026 pub struct StopBackfillJob(RequestBuilder<crate::model::StopBackfillJobRequest>);
2027
2028 impl StopBackfillJob {
2029 pub(crate) fn new(
2030 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2031 ) -> Self {
2032 Self(RequestBuilder::new(stub))
2033 }
2034
2035 /// Sets the full request, replacing any prior values.
2036 pub fn with_request<V: Into<crate::model::StopBackfillJobRequest>>(mut self, v: V) -> Self {
2037 self.0.request = v.into();
2038 self
2039 }
2040
2041 /// Sets all the options, replacing any prior values.
2042 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2043 self.0.options = v.into();
2044 self
2045 }
2046
2047 /// Sends the request.
2048 pub async fn send(self) -> Result<crate::model::StopBackfillJobResponse> {
2049 (*self.0.stub)
2050 .stop_backfill_job(self.0.request, self.0.options)
2051 .await
2052 .map(crate::Response::into_body)
2053 }
2054
2055 /// Sets the value of [object][crate::model::StopBackfillJobRequest::object].
2056 ///
2057 /// This is a **required** field for requests.
2058 pub fn set_object<T: Into<std::string::String>>(mut self, v: T) -> Self {
2059 self.0.request.object = v.into();
2060 self
2061 }
2062 }
2063
2064 #[doc(hidden)]
2065 impl crate::RequestBuilder for StopBackfillJob {
2066 fn request_options(&mut self) -> &mut crate::RequestOptions {
2067 &mut self.0.options
2068 }
2069 }
2070
2071 /// The request builder for [Datastream::fetch_static_ips][crate::client::Datastream::fetch_static_ips] calls.
2072 ///
2073 /// # Example
2074 /// ```
2075 /// # use google_cloud_datastream_v1::builder::datastream::FetchStaticIps;
2076 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2077 ///
2078 /// let builder = prepare_request_builder();
2079 /// let response = builder.send().await?;
2080 /// # Ok(()) }
2081 ///
2082 /// fn prepare_request_builder() -> FetchStaticIps {
2083 /// # panic!();
2084 /// // ... details omitted ...
2085 /// }
2086 /// ```
2087 #[derive(Clone, Debug)]
2088 pub struct FetchStaticIps(RequestBuilder<crate::model::FetchStaticIpsRequest>);
2089
2090 impl FetchStaticIps {
2091 pub(crate) fn new(
2092 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2093 ) -> Self {
2094 Self(RequestBuilder::new(stub))
2095 }
2096
2097 /// Sets the full request, replacing any prior values.
2098 pub fn with_request<V: Into<crate::model::FetchStaticIpsRequest>>(mut self, v: V) -> Self {
2099 self.0.request = v.into();
2100 self
2101 }
2102
2103 /// Sets all the options, replacing any prior values.
2104 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2105 self.0.options = v.into();
2106 self
2107 }
2108
2109 /// Sends the request.
2110 pub async fn send(self) -> Result<crate::model::FetchStaticIpsResponse> {
2111 (*self.0.stub)
2112 .fetch_static_ips(self.0.request, self.0.options)
2113 .await
2114 .map(crate::Response::into_body)
2115 }
2116
2117 /// Sets the value of [name][crate::model::FetchStaticIpsRequest::name].
2118 ///
2119 /// This is a **required** field for requests.
2120 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2121 self.0.request.name = v.into();
2122 self
2123 }
2124
2125 /// Sets the value of [page_size][crate::model::FetchStaticIpsRequest::page_size].
2126 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2127 self.0.request.page_size = v.into();
2128 self
2129 }
2130
2131 /// Sets the value of [page_token][crate::model::FetchStaticIpsRequest::page_token].
2132 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2133 self.0.request.page_token = v.into();
2134 self
2135 }
2136 }
2137
2138 #[doc(hidden)]
2139 impl crate::RequestBuilder for FetchStaticIps {
2140 fn request_options(&mut self) -> &mut crate::RequestOptions {
2141 &mut self.0.options
2142 }
2143 }
2144
2145 /// The request builder for [Datastream::create_private_connection][crate::client::Datastream::create_private_connection] calls.
2146 ///
2147 /// # Example
2148 /// ```
2149 /// # use google_cloud_datastream_v1::builder::datastream::CreatePrivateConnection;
2150 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2151 /// use google_cloud_lro::Poller;
2152 ///
2153 /// let builder = prepare_request_builder();
2154 /// let response = builder.poller().until_done().await?;
2155 /// # Ok(()) }
2156 ///
2157 /// fn prepare_request_builder() -> CreatePrivateConnection {
2158 /// # panic!();
2159 /// // ... details omitted ...
2160 /// }
2161 /// ```
2162 #[derive(Clone, Debug)]
2163 pub struct CreatePrivateConnection(
2164 RequestBuilder<crate::model::CreatePrivateConnectionRequest>,
2165 );
2166
2167 impl CreatePrivateConnection {
2168 pub(crate) fn new(
2169 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2170 ) -> Self {
2171 Self(RequestBuilder::new(stub))
2172 }
2173
2174 /// Sets the full request, replacing any prior values.
2175 pub fn with_request<V: Into<crate::model::CreatePrivateConnectionRequest>>(
2176 mut self,
2177 v: V,
2178 ) -> Self {
2179 self.0.request = v.into();
2180 self
2181 }
2182
2183 /// Sets all the options, replacing any prior values.
2184 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2185 self.0.options = v.into();
2186 self
2187 }
2188
2189 /// Sends the request.
2190 ///
2191 /// # Long running operations
2192 ///
2193 /// This starts, but does not poll, a longrunning operation. More information
2194 /// on [create_private_connection][crate::client::Datastream::create_private_connection].
2195 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2196 (*self.0.stub)
2197 .create_private_connection(self.0.request, self.0.options)
2198 .await
2199 .map(crate::Response::into_body)
2200 }
2201
2202 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_private_connection`.
2203 pub fn poller(
2204 self,
2205 ) -> impl google_cloud_lro::Poller<
2206 crate::model::PrivateConnection,
2207 crate::model::OperationMetadata,
2208 > {
2209 type Operation = google_cloud_lro::internal::Operation<
2210 crate::model::PrivateConnection,
2211 crate::model::OperationMetadata,
2212 >;
2213 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2214 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2215
2216 let stub = self.0.stub.clone();
2217 let mut options = self.0.options.clone();
2218 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2219 let query = move |name| {
2220 let stub = stub.clone();
2221 let options = options.clone();
2222 async {
2223 let op = GetOperation::new(stub)
2224 .set_name(name)
2225 .with_options(options)
2226 .send()
2227 .await?;
2228 Ok(Operation::new(op))
2229 }
2230 };
2231
2232 let start = move || async {
2233 let op = self.send().await?;
2234 Ok(Operation::new(op))
2235 };
2236
2237 google_cloud_lro::internal::new_poller(
2238 polling_error_policy,
2239 polling_backoff_policy,
2240 start,
2241 query,
2242 )
2243 }
2244
2245 /// Sets the value of [parent][crate::model::CreatePrivateConnectionRequest::parent].
2246 ///
2247 /// This is a **required** field for requests.
2248 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2249 self.0.request.parent = v.into();
2250 self
2251 }
2252
2253 /// Sets the value of [private_connection_id][crate::model::CreatePrivateConnectionRequest::private_connection_id].
2254 ///
2255 /// This is a **required** field for requests.
2256 pub fn set_private_connection_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2257 self.0.request.private_connection_id = v.into();
2258 self
2259 }
2260
2261 /// Sets the value of [private_connection][crate::model::CreatePrivateConnectionRequest::private_connection].
2262 ///
2263 /// This is a **required** field for requests.
2264 pub fn set_private_connection<T>(mut self, v: T) -> Self
2265 where
2266 T: std::convert::Into<crate::model::PrivateConnection>,
2267 {
2268 self.0.request.private_connection = std::option::Option::Some(v.into());
2269 self
2270 }
2271
2272 /// Sets or clears the value of [private_connection][crate::model::CreatePrivateConnectionRequest::private_connection].
2273 ///
2274 /// This is a **required** field for requests.
2275 pub fn set_or_clear_private_connection<T>(mut self, v: std::option::Option<T>) -> Self
2276 where
2277 T: std::convert::Into<crate::model::PrivateConnection>,
2278 {
2279 self.0.request.private_connection = v.map(|x| x.into());
2280 self
2281 }
2282
2283 /// Sets the value of [request_id][crate::model::CreatePrivateConnectionRequest::request_id].
2284 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2285 self.0.request.request_id = v.into();
2286 self
2287 }
2288
2289 /// Sets the value of [force][crate::model::CreatePrivateConnectionRequest::force].
2290 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
2291 self.0.request.force = v.into();
2292 self
2293 }
2294
2295 /// Sets the value of [validate_only][crate::model::CreatePrivateConnectionRequest::validate_only].
2296 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2297 self.0.request.validate_only = v.into();
2298 self
2299 }
2300 }
2301
2302 #[doc(hidden)]
2303 impl crate::RequestBuilder for CreatePrivateConnection {
2304 fn request_options(&mut self) -> &mut crate::RequestOptions {
2305 &mut self.0.options
2306 }
2307 }
2308
2309 /// The request builder for [Datastream::get_private_connection][crate::client::Datastream::get_private_connection] calls.
2310 ///
2311 /// # Example
2312 /// ```
2313 /// # use google_cloud_datastream_v1::builder::datastream::GetPrivateConnection;
2314 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2315 ///
2316 /// let builder = prepare_request_builder();
2317 /// let response = builder.send().await?;
2318 /// # Ok(()) }
2319 ///
2320 /// fn prepare_request_builder() -> GetPrivateConnection {
2321 /// # panic!();
2322 /// // ... details omitted ...
2323 /// }
2324 /// ```
2325 #[derive(Clone, Debug)]
2326 pub struct GetPrivateConnection(RequestBuilder<crate::model::GetPrivateConnectionRequest>);
2327
2328 impl GetPrivateConnection {
2329 pub(crate) fn new(
2330 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2331 ) -> Self {
2332 Self(RequestBuilder::new(stub))
2333 }
2334
2335 /// Sets the full request, replacing any prior values.
2336 pub fn with_request<V: Into<crate::model::GetPrivateConnectionRequest>>(
2337 mut self,
2338 v: V,
2339 ) -> Self {
2340 self.0.request = v.into();
2341 self
2342 }
2343
2344 /// Sets all the options, replacing any prior values.
2345 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2346 self.0.options = v.into();
2347 self
2348 }
2349
2350 /// Sends the request.
2351 pub async fn send(self) -> Result<crate::model::PrivateConnection> {
2352 (*self.0.stub)
2353 .get_private_connection(self.0.request, self.0.options)
2354 .await
2355 .map(crate::Response::into_body)
2356 }
2357
2358 /// Sets the value of [name][crate::model::GetPrivateConnectionRequest::name].
2359 ///
2360 /// This is a **required** field for requests.
2361 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2362 self.0.request.name = v.into();
2363 self
2364 }
2365 }
2366
2367 #[doc(hidden)]
2368 impl crate::RequestBuilder for GetPrivateConnection {
2369 fn request_options(&mut self) -> &mut crate::RequestOptions {
2370 &mut self.0.options
2371 }
2372 }
2373
2374 /// The request builder for [Datastream::list_private_connections][crate::client::Datastream::list_private_connections] calls.
2375 ///
2376 /// # Example
2377 /// ```
2378 /// # use google_cloud_datastream_v1::builder::datastream::ListPrivateConnections;
2379 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2380 /// use google_cloud_gax::paginator::ItemPaginator;
2381 ///
2382 /// let builder = prepare_request_builder();
2383 /// let mut items = builder.by_item();
2384 /// while let Some(result) = items.next().await {
2385 /// let item = result?;
2386 /// }
2387 /// # Ok(()) }
2388 ///
2389 /// fn prepare_request_builder() -> ListPrivateConnections {
2390 /// # panic!();
2391 /// // ... details omitted ...
2392 /// }
2393 /// ```
2394 #[derive(Clone, Debug)]
2395 pub struct ListPrivateConnections(RequestBuilder<crate::model::ListPrivateConnectionsRequest>);
2396
2397 impl ListPrivateConnections {
2398 pub(crate) fn new(
2399 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2400 ) -> Self {
2401 Self(RequestBuilder::new(stub))
2402 }
2403
2404 /// Sets the full request, replacing any prior values.
2405 pub fn with_request<V: Into<crate::model::ListPrivateConnectionsRequest>>(
2406 mut self,
2407 v: V,
2408 ) -> Self {
2409 self.0.request = v.into();
2410 self
2411 }
2412
2413 /// Sets all the options, replacing any prior values.
2414 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2415 self.0.options = v.into();
2416 self
2417 }
2418
2419 /// Sends the request.
2420 pub async fn send(self) -> Result<crate::model::ListPrivateConnectionsResponse> {
2421 (*self.0.stub)
2422 .list_private_connections(self.0.request, self.0.options)
2423 .await
2424 .map(crate::Response::into_body)
2425 }
2426
2427 /// Streams each page in the collection.
2428 pub fn by_page(
2429 self,
2430 ) -> impl google_cloud_gax::paginator::Paginator<
2431 crate::model::ListPrivateConnectionsResponse,
2432 crate::Error,
2433 > {
2434 use std::clone::Clone;
2435 let token = self.0.request.page_token.clone();
2436 let execute = move |token: String| {
2437 let mut builder = self.clone();
2438 builder.0.request = builder.0.request.set_page_token(token);
2439 builder.send()
2440 };
2441 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2442 }
2443
2444 /// Streams each item in the collection.
2445 pub fn by_item(
2446 self,
2447 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2448 crate::model::ListPrivateConnectionsResponse,
2449 crate::Error,
2450 > {
2451 use google_cloud_gax::paginator::Paginator;
2452 self.by_page().items()
2453 }
2454
2455 /// Sets the value of [parent][crate::model::ListPrivateConnectionsRequest::parent].
2456 ///
2457 /// This is a **required** field for requests.
2458 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2459 self.0.request.parent = v.into();
2460 self
2461 }
2462
2463 /// Sets the value of [page_size][crate::model::ListPrivateConnectionsRequest::page_size].
2464 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2465 self.0.request.page_size = v.into();
2466 self
2467 }
2468
2469 /// Sets the value of [page_token][crate::model::ListPrivateConnectionsRequest::page_token].
2470 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2471 self.0.request.page_token = v.into();
2472 self
2473 }
2474
2475 /// Sets the value of [filter][crate::model::ListPrivateConnectionsRequest::filter].
2476 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2477 self.0.request.filter = v.into();
2478 self
2479 }
2480
2481 /// Sets the value of [order_by][crate::model::ListPrivateConnectionsRequest::order_by].
2482 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2483 self.0.request.order_by = v.into();
2484 self
2485 }
2486 }
2487
2488 #[doc(hidden)]
2489 impl crate::RequestBuilder for ListPrivateConnections {
2490 fn request_options(&mut self) -> &mut crate::RequestOptions {
2491 &mut self.0.options
2492 }
2493 }
2494
2495 /// The request builder for [Datastream::delete_private_connection][crate::client::Datastream::delete_private_connection] calls.
2496 ///
2497 /// # Example
2498 /// ```
2499 /// # use google_cloud_datastream_v1::builder::datastream::DeletePrivateConnection;
2500 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2501 /// use google_cloud_lro::Poller;
2502 ///
2503 /// let builder = prepare_request_builder();
2504 /// let response = builder.poller().until_done().await?;
2505 /// # Ok(()) }
2506 ///
2507 /// fn prepare_request_builder() -> DeletePrivateConnection {
2508 /// # panic!();
2509 /// // ... details omitted ...
2510 /// }
2511 /// ```
2512 #[derive(Clone, Debug)]
2513 pub struct DeletePrivateConnection(
2514 RequestBuilder<crate::model::DeletePrivateConnectionRequest>,
2515 );
2516
2517 impl DeletePrivateConnection {
2518 pub(crate) fn new(
2519 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2520 ) -> Self {
2521 Self(RequestBuilder::new(stub))
2522 }
2523
2524 /// Sets the full request, replacing any prior values.
2525 pub fn with_request<V: Into<crate::model::DeletePrivateConnectionRequest>>(
2526 mut self,
2527 v: V,
2528 ) -> Self {
2529 self.0.request = v.into();
2530 self
2531 }
2532
2533 /// Sets all the options, replacing any prior values.
2534 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2535 self.0.options = v.into();
2536 self
2537 }
2538
2539 /// Sends the request.
2540 ///
2541 /// # Long running operations
2542 ///
2543 /// This starts, but does not poll, a longrunning operation. More information
2544 /// on [delete_private_connection][crate::client::Datastream::delete_private_connection].
2545 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2546 (*self.0.stub)
2547 .delete_private_connection(self.0.request, self.0.options)
2548 .await
2549 .map(crate::Response::into_body)
2550 }
2551
2552 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_private_connection`.
2553 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
2554 type Operation =
2555 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2556 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2557 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2558
2559 let stub = self.0.stub.clone();
2560 let mut options = self.0.options.clone();
2561 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2562 let query = move |name| {
2563 let stub = stub.clone();
2564 let options = options.clone();
2565 async {
2566 let op = GetOperation::new(stub)
2567 .set_name(name)
2568 .with_options(options)
2569 .send()
2570 .await?;
2571 Ok(Operation::new(op))
2572 }
2573 };
2574
2575 let start = move || async {
2576 let op = self.send().await?;
2577 Ok(Operation::new(op))
2578 };
2579
2580 google_cloud_lro::internal::new_unit_response_poller(
2581 polling_error_policy,
2582 polling_backoff_policy,
2583 start,
2584 query,
2585 )
2586 }
2587
2588 /// Sets the value of [name][crate::model::DeletePrivateConnectionRequest::name].
2589 ///
2590 /// This is a **required** field for requests.
2591 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2592 self.0.request.name = v.into();
2593 self
2594 }
2595
2596 /// Sets the value of [request_id][crate::model::DeletePrivateConnectionRequest::request_id].
2597 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2598 self.0.request.request_id = v.into();
2599 self
2600 }
2601
2602 /// Sets the value of [force][crate::model::DeletePrivateConnectionRequest::force].
2603 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
2604 self.0.request.force = v.into();
2605 self
2606 }
2607 }
2608
2609 #[doc(hidden)]
2610 impl crate::RequestBuilder for DeletePrivateConnection {
2611 fn request_options(&mut self) -> &mut crate::RequestOptions {
2612 &mut self.0.options
2613 }
2614 }
2615
2616 /// The request builder for [Datastream::create_route][crate::client::Datastream::create_route] calls.
2617 ///
2618 /// # Example
2619 /// ```
2620 /// # use google_cloud_datastream_v1::builder::datastream::CreateRoute;
2621 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2622 /// use google_cloud_lro::Poller;
2623 ///
2624 /// let builder = prepare_request_builder();
2625 /// let response = builder.poller().until_done().await?;
2626 /// # Ok(()) }
2627 ///
2628 /// fn prepare_request_builder() -> CreateRoute {
2629 /// # panic!();
2630 /// // ... details omitted ...
2631 /// }
2632 /// ```
2633 #[derive(Clone, Debug)]
2634 pub struct CreateRoute(RequestBuilder<crate::model::CreateRouteRequest>);
2635
2636 impl CreateRoute {
2637 pub(crate) fn new(
2638 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2639 ) -> Self {
2640 Self(RequestBuilder::new(stub))
2641 }
2642
2643 /// Sets the full request, replacing any prior values.
2644 pub fn with_request<V: Into<crate::model::CreateRouteRequest>>(mut self, v: V) -> Self {
2645 self.0.request = v.into();
2646 self
2647 }
2648
2649 /// Sets all the options, replacing any prior values.
2650 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2651 self.0.options = v.into();
2652 self
2653 }
2654
2655 /// Sends the request.
2656 ///
2657 /// # Long running operations
2658 ///
2659 /// This starts, but does not poll, a longrunning operation. More information
2660 /// on [create_route][crate::client::Datastream::create_route].
2661 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2662 (*self.0.stub)
2663 .create_route(self.0.request, self.0.options)
2664 .await
2665 .map(crate::Response::into_body)
2666 }
2667
2668 /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_route`.
2669 pub fn poller(
2670 self,
2671 ) -> impl google_cloud_lro::Poller<crate::model::Route, crate::model::OperationMetadata>
2672 {
2673 type Operation = google_cloud_lro::internal::Operation<
2674 crate::model::Route,
2675 crate::model::OperationMetadata,
2676 >;
2677 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2678 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2679
2680 let stub = self.0.stub.clone();
2681 let mut options = self.0.options.clone();
2682 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2683 let query = move |name| {
2684 let stub = stub.clone();
2685 let options = options.clone();
2686 async {
2687 let op = GetOperation::new(stub)
2688 .set_name(name)
2689 .with_options(options)
2690 .send()
2691 .await?;
2692 Ok(Operation::new(op))
2693 }
2694 };
2695
2696 let start = move || async {
2697 let op = self.send().await?;
2698 Ok(Operation::new(op))
2699 };
2700
2701 google_cloud_lro::internal::new_poller(
2702 polling_error_policy,
2703 polling_backoff_policy,
2704 start,
2705 query,
2706 )
2707 }
2708
2709 /// Sets the value of [parent][crate::model::CreateRouteRequest::parent].
2710 ///
2711 /// This is a **required** field for requests.
2712 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2713 self.0.request.parent = v.into();
2714 self
2715 }
2716
2717 /// Sets the value of [route_id][crate::model::CreateRouteRequest::route_id].
2718 ///
2719 /// This is a **required** field for requests.
2720 pub fn set_route_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2721 self.0.request.route_id = v.into();
2722 self
2723 }
2724
2725 /// Sets the value of [route][crate::model::CreateRouteRequest::route].
2726 ///
2727 /// This is a **required** field for requests.
2728 pub fn set_route<T>(mut self, v: T) -> Self
2729 where
2730 T: std::convert::Into<crate::model::Route>,
2731 {
2732 self.0.request.route = std::option::Option::Some(v.into());
2733 self
2734 }
2735
2736 /// Sets or clears the value of [route][crate::model::CreateRouteRequest::route].
2737 ///
2738 /// This is a **required** field for requests.
2739 pub fn set_or_clear_route<T>(mut self, v: std::option::Option<T>) -> Self
2740 where
2741 T: std::convert::Into<crate::model::Route>,
2742 {
2743 self.0.request.route = v.map(|x| x.into());
2744 self
2745 }
2746
2747 /// Sets the value of [request_id][crate::model::CreateRouteRequest::request_id].
2748 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2749 self.0.request.request_id = v.into();
2750 self
2751 }
2752 }
2753
2754 #[doc(hidden)]
2755 impl crate::RequestBuilder for CreateRoute {
2756 fn request_options(&mut self) -> &mut crate::RequestOptions {
2757 &mut self.0.options
2758 }
2759 }
2760
2761 /// The request builder for [Datastream::get_route][crate::client::Datastream::get_route] calls.
2762 ///
2763 /// # Example
2764 /// ```
2765 /// # use google_cloud_datastream_v1::builder::datastream::GetRoute;
2766 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2767 ///
2768 /// let builder = prepare_request_builder();
2769 /// let response = builder.send().await?;
2770 /// # Ok(()) }
2771 ///
2772 /// fn prepare_request_builder() -> GetRoute {
2773 /// # panic!();
2774 /// // ... details omitted ...
2775 /// }
2776 /// ```
2777 #[derive(Clone, Debug)]
2778 pub struct GetRoute(RequestBuilder<crate::model::GetRouteRequest>);
2779
2780 impl GetRoute {
2781 pub(crate) fn new(
2782 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2783 ) -> Self {
2784 Self(RequestBuilder::new(stub))
2785 }
2786
2787 /// Sets the full request, replacing any prior values.
2788 pub fn with_request<V: Into<crate::model::GetRouteRequest>>(mut self, v: V) -> Self {
2789 self.0.request = v.into();
2790 self
2791 }
2792
2793 /// Sets all the options, replacing any prior values.
2794 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2795 self.0.options = v.into();
2796 self
2797 }
2798
2799 /// Sends the request.
2800 pub async fn send(self) -> Result<crate::model::Route> {
2801 (*self.0.stub)
2802 .get_route(self.0.request, self.0.options)
2803 .await
2804 .map(crate::Response::into_body)
2805 }
2806
2807 /// Sets the value of [name][crate::model::GetRouteRequest::name].
2808 ///
2809 /// This is a **required** field for requests.
2810 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2811 self.0.request.name = v.into();
2812 self
2813 }
2814 }
2815
2816 #[doc(hidden)]
2817 impl crate::RequestBuilder for GetRoute {
2818 fn request_options(&mut self) -> &mut crate::RequestOptions {
2819 &mut self.0.options
2820 }
2821 }
2822
2823 /// The request builder for [Datastream::list_routes][crate::client::Datastream::list_routes] calls.
2824 ///
2825 /// # Example
2826 /// ```
2827 /// # use google_cloud_datastream_v1::builder::datastream::ListRoutes;
2828 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2829 /// use google_cloud_gax::paginator::ItemPaginator;
2830 ///
2831 /// let builder = prepare_request_builder();
2832 /// let mut items = builder.by_item();
2833 /// while let Some(result) = items.next().await {
2834 /// let item = result?;
2835 /// }
2836 /// # Ok(()) }
2837 ///
2838 /// fn prepare_request_builder() -> ListRoutes {
2839 /// # panic!();
2840 /// // ... details omitted ...
2841 /// }
2842 /// ```
2843 #[derive(Clone, Debug)]
2844 pub struct ListRoutes(RequestBuilder<crate::model::ListRoutesRequest>);
2845
2846 impl ListRoutes {
2847 pub(crate) fn new(
2848 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2849 ) -> Self {
2850 Self(RequestBuilder::new(stub))
2851 }
2852
2853 /// Sets the full request, replacing any prior values.
2854 pub fn with_request<V: Into<crate::model::ListRoutesRequest>>(mut self, v: V) -> Self {
2855 self.0.request = v.into();
2856 self
2857 }
2858
2859 /// Sets all the options, replacing any prior values.
2860 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2861 self.0.options = v.into();
2862 self
2863 }
2864
2865 /// Sends the request.
2866 pub async fn send(self) -> Result<crate::model::ListRoutesResponse> {
2867 (*self.0.stub)
2868 .list_routes(self.0.request, self.0.options)
2869 .await
2870 .map(crate::Response::into_body)
2871 }
2872
2873 /// Streams each page in the collection.
2874 pub fn by_page(
2875 self,
2876 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListRoutesResponse, crate::Error>
2877 {
2878 use std::clone::Clone;
2879 let token = self.0.request.page_token.clone();
2880 let execute = move |token: String| {
2881 let mut builder = self.clone();
2882 builder.0.request = builder.0.request.set_page_token(token);
2883 builder.send()
2884 };
2885 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2886 }
2887
2888 /// Streams each item in the collection.
2889 pub fn by_item(
2890 self,
2891 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2892 crate::model::ListRoutesResponse,
2893 crate::Error,
2894 > {
2895 use google_cloud_gax::paginator::Paginator;
2896 self.by_page().items()
2897 }
2898
2899 /// Sets the value of [parent][crate::model::ListRoutesRequest::parent].
2900 ///
2901 /// This is a **required** field for requests.
2902 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2903 self.0.request.parent = v.into();
2904 self
2905 }
2906
2907 /// Sets the value of [page_size][crate::model::ListRoutesRequest::page_size].
2908 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2909 self.0.request.page_size = v.into();
2910 self
2911 }
2912
2913 /// Sets the value of [page_token][crate::model::ListRoutesRequest::page_token].
2914 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2915 self.0.request.page_token = v.into();
2916 self
2917 }
2918
2919 /// Sets the value of [filter][crate::model::ListRoutesRequest::filter].
2920 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2921 self.0.request.filter = v.into();
2922 self
2923 }
2924
2925 /// Sets the value of [order_by][crate::model::ListRoutesRequest::order_by].
2926 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2927 self.0.request.order_by = v.into();
2928 self
2929 }
2930 }
2931
2932 #[doc(hidden)]
2933 impl crate::RequestBuilder for ListRoutes {
2934 fn request_options(&mut self) -> &mut crate::RequestOptions {
2935 &mut self.0.options
2936 }
2937 }
2938
2939 /// The request builder for [Datastream::delete_route][crate::client::Datastream::delete_route] calls.
2940 ///
2941 /// # Example
2942 /// ```
2943 /// # use google_cloud_datastream_v1::builder::datastream::DeleteRoute;
2944 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
2945 /// use google_cloud_lro::Poller;
2946 ///
2947 /// let builder = prepare_request_builder();
2948 /// let response = builder.poller().until_done().await?;
2949 /// # Ok(()) }
2950 ///
2951 /// fn prepare_request_builder() -> DeleteRoute {
2952 /// # panic!();
2953 /// // ... details omitted ...
2954 /// }
2955 /// ```
2956 #[derive(Clone, Debug)]
2957 pub struct DeleteRoute(RequestBuilder<crate::model::DeleteRouteRequest>);
2958
2959 impl DeleteRoute {
2960 pub(crate) fn new(
2961 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
2962 ) -> Self {
2963 Self(RequestBuilder::new(stub))
2964 }
2965
2966 /// Sets the full request, replacing any prior values.
2967 pub fn with_request<V: Into<crate::model::DeleteRouteRequest>>(mut self, v: V) -> Self {
2968 self.0.request = v.into();
2969 self
2970 }
2971
2972 /// Sets all the options, replacing any prior values.
2973 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2974 self.0.options = v.into();
2975 self
2976 }
2977
2978 /// Sends the request.
2979 ///
2980 /// # Long running operations
2981 ///
2982 /// This starts, but does not poll, a longrunning operation. More information
2983 /// on [delete_route][crate::client::Datastream::delete_route].
2984 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2985 (*self.0.stub)
2986 .delete_route(self.0.request, self.0.options)
2987 .await
2988 .map(crate::Response::into_body)
2989 }
2990
2991 /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_route`.
2992 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::OperationMetadata> {
2993 type Operation =
2994 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
2995 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2996 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2997
2998 let stub = self.0.stub.clone();
2999 let mut options = self.0.options.clone();
3000 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3001 let query = move |name| {
3002 let stub = stub.clone();
3003 let options = options.clone();
3004 async {
3005 let op = GetOperation::new(stub)
3006 .set_name(name)
3007 .with_options(options)
3008 .send()
3009 .await?;
3010 Ok(Operation::new(op))
3011 }
3012 };
3013
3014 let start = move || async {
3015 let op = self.send().await?;
3016 Ok(Operation::new(op))
3017 };
3018
3019 google_cloud_lro::internal::new_unit_response_poller(
3020 polling_error_policy,
3021 polling_backoff_policy,
3022 start,
3023 query,
3024 )
3025 }
3026
3027 /// Sets the value of [name][crate::model::DeleteRouteRequest::name].
3028 ///
3029 /// This is a **required** field for requests.
3030 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3031 self.0.request.name = v.into();
3032 self
3033 }
3034
3035 /// Sets the value of [request_id][crate::model::DeleteRouteRequest::request_id].
3036 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3037 self.0.request.request_id = v.into();
3038 self
3039 }
3040 }
3041
3042 #[doc(hidden)]
3043 impl crate::RequestBuilder for DeleteRoute {
3044 fn request_options(&mut self) -> &mut crate::RequestOptions {
3045 &mut self.0.options
3046 }
3047 }
3048
3049 /// The request builder for [Datastream::list_locations][crate::client::Datastream::list_locations] calls.
3050 ///
3051 /// # Example
3052 /// ```
3053 /// # use google_cloud_datastream_v1::builder::datastream::ListLocations;
3054 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
3055 /// use google_cloud_gax::paginator::ItemPaginator;
3056 ///
3057 /// let builder = prepare_request_builder();
3058 /// let mut items = builder.by_item();
3059 /// while let Some(result) = items.next().await {
3060 /// let item = result?;
3061 /// }
3062 /// # Ok(()) }
3063 ///
3064 /// fn prepare_request_builder() -> ListLocations {
3065 /// # panic!();
3066 /// // ... details omitted ...
3067 /// }
3068 /// ```
3069 #[derive(Clone, Debug)]
3070 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
3071
3072 impl ListLocations {
3073 pub(crate) fn new(
3074 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3075 ) -> Self {
3076 Self(RequestBuilder::new(stub))
3077 }
3078
3079 /// Sets the full request, replacing any prior values.
3080 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
3081 mut self,
3082 v: V,
3083 ) -> Self {
3084 self.0.request = v.into();
3085 self
3086 }
3087
3088 /// Sets all the options, replacing any prior values.
3089 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3090 self.0.options = v.into();
3091 self
3092 }
3093
3094 /// Sends the request.
3095 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
3096 (*self.0.stub)
3097 .list_locations(self.0.request, self.0.options)
3098 .await
3099 .map(crate::Response::into_body)
3100 }
3101
3102 /// Streams each page in the collection.
3103 pub fn by_page(
3104 self,
3105 ) -> impl google_cloud_gax::paginator::Paginator<
3106 google_cloud_location::model::ListLocationsResponse,
3107 crate::Error,
3108 > {
3109 use std::clone::Clone;
3110 let token = self.0.request.page_token.clone();
3111 let execute = move |token: String| {
3112 let mut builder = self.clone();
3113 builder.0.request = builder.0.request.set_page_token(token);
3114 builder.send()
3115 };
3116 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3117 }
3118
3119 /// Streams each item in the collection.
3120 pub fn by_item(
3121 self,
3122 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3123 google_cloud_location::model::ListLocationsResponse,
3124 crate::Error,
3125 > {
3126 use google_cloud_gax::paginator::Paginator;
3127 self.by_page().items()
3128 }
3129
3130 /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
3131 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3132 self.0.request.name = v.into();
3133 self
3134 }
3135
3136 /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
3137 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3138 self.0.request.filter = v.into();
3139 self
3140 }
3141
3142 /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
3143 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3144 self.0.request.page_size = v.into();
3145 self
3146 }
3147
3148 /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
3149 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3150 self.0.request.page_token = v.into();
3151 self
3152 }
3153 }
3154
3155 #[doc(hidden)]
3156 impl crate::RequestBuilder for ListLocations {
3157 fn request_options(&mut self) -> &mut crate::RequestOptions {
3158 &mut self.0.options
3159 }
3160 }
3161
3162 /// The request builder for [Datastream::get_location][crate::client::Datastream::get_location] calls.
3163 ///
3164 /// # Example
3165 /// ```
3166 /// # use google_cloud_datastream_v1::builder::datastream::GetLocation;
3167 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
3168 ///
3169 /// let builder = prepare_request_builder();
3170 /// let response = builder.send().await?;
3171 /// # Ok(()) }
3172 ///
3173 /// fn prepare_request_builder() -> GetLocation {
3174 /// # panic!();
3175 /// // ... details omitted ...
3176 /// }
3177 /// ```
3178 #[derive(Clone, Debug)]
3179 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
3180
3181 impl GetLocation {
3182 pub(crate) fn new(
3183 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3184 ) -> Self {
3185 Self(RequestBuilder::new(stub))
3186 }
3187
3188 /// Sets the full request, replacing any prior values.
3189 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
3190 mut self,
3191 v: V,
3192 ) -> Self {
3193 self.0.request = v.into();
3194 self
3195 }
3196
3197 /// Sets all the options, replacing any prior values.
3198 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3199 self.0.options = v.into();
3200 self
3201 }
3202
3203 /// Sends the request.
3204 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
3205 (*self.0.stub)
3206 .get_location(self.0.request, self.0.options)
3207 .await
3208 .map(crate::Response::into_body)
3209 }
3210
3211 /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
3212 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3213 self.0.request.name = v.into();
3214 self
3215 }
3216 }
3217
3218 #[doc(hidden)]
3219 impl crate::RequestBuilder for GetLocation {
3220 fn request_options(&mut self) -> &mut crate::RequestOptions {
3221 &mut self.0.options
3222 }
3223 }
3224
3225 /// The request builder for [Datastream::list_operations][crate::client::Datastream::list_operations] calls.
3226 ///
3227 /// # Example
3228 /// ```
3229 /// # use google_cloud_datastream_v1::builder::datastream::ListOperations;
3230 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
3231 /// use google_cloud_gax::paginator::ItemPaginator;
3232 ///
3233 /// let builder = prepare_request_builder();
3234 /// let mut items = builder.by_item();
3235 /// while let Some(result) = items.next().await {
3236 /// let item = result?;
3237 /// }
3238 /// # Ok(()) }
3239 ///
3240 /// fn prepare_request_builder() -> ListOperations {
3241 /// # panic!();
3242 /// // ... details omitted ...
3243 /// }
3244 /// ```
3245 #[derive(Clone, Debug)]
3246 pub struct ListOperations(
3247 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3248 );
3249
3250 impl ListOperations {
3251 pub(crate) fn new(
3252 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3253 ) -> Self {
3254 Self(RequestBuilder::new(stub))
3255 }
3256
3257 /// Sets the full request, replacing any prior values.
3258 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3259 mut self,
3260 v: V,
3261 ) -> Self {
3262 self.0.request = v.into();
3263 self
3264 }
3265
3266 /// Sets all the options, replacing any prior values.
3267 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3268 self.0.options = v.into();
3269 self
3270 }
3271
3272 /// Sends the request.
3273 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3274 (*self.0.stub)
3275 .list_operations(self.0.request, self.0.options)
3276 .await
3277 .map(crate::Response::into_body)
3278 }
3279
3280 /// Streams each page in the collection.
3281 pub fn by_page(
3282 self,
3283 ) -> impl google_cloud_gax::paginator::Paginator<
3284 google_cloud_longrunning::model::ListOperationsResponse,
3285 crate::Error,
3286 > {
3287 use std::clone::Clone;
3288 let token = self.0.request.page_token.clone();
3289 let execute = move |token: String| {
3290 let mut builder = self.clone();
3291 builder.0.request = builder.0.request.set_page_token(token);
3292 builder.send()
3293 };
3294 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3295 }
3296
3297 /// Streams each item in the collection.
3298 pub fn by_item(
3299 self,
3300 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3301 google_cloud_longrunning::model::ListOperationsResponse,
3302 crate::Error,
3303 > {
3304 use google_cloud_gax::paginator::Paginator;
3305 self.by_page().items()
3306 }
3307
3308 /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
3309 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3310 self.0.request.name = v.into();
3311 self
3312 }
3313
3314 /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
3315 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3316 self.0.request.filter = v.into();
3317 self
3318 }
3319
3320 /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
3321 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3322 self.0.request.page_size = v.into();
3323 self
3324 }
3325
3326 /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
3327 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3328 self.0.request.page_token = v.into();
3329 self
3330 }
3331
3332 /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
3333 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3334 self.0.request.return_partial_success = v.into();
3335 self
3336 }
3337 }
3338
3339 #[doc(hidden)]
3340 impl crate::RequestBuilder for ListOperations {
3341 fn request_options(&mut self) -> &mut crate::RequestOptions {
3342 &mut self.0.options
3343 }
3344 }
3345
3346 /// The request builder for [Datastream::get_operation][crate::client::Datastream::get_operation] calls.
3347 ///
3348 /// # Example
3349 /// ```
3350 /// # use google_cloud_datastream_v1::builder::datastream::GetOperation;
3351 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
3352 ///
3353 /// let builder = prepare_request_builder();
3354 /// let response = builder.send().await?;
3355 /// # Ok(()) }
3356 ///
3357 /// fn prepare_request_builder() -> GetOperation {
3358 /// # panic!();
3359 /// // ... details omitted ...
3360 /// }
3361 /// ```
3362 #[derive(Clone, Debug)]
3363 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3364
3365 impl GetOperation {
3366 pub(crate) fn new(
3367 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3368 ) -> Self {
3369 Self(RequestBuilder::new(stub))
3370 }
3371
3372 /// Sets the full request, replacing any prior values.
3373 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3374 mut self,
3375 v: V,
3376 ) -> Self {
3377 self.0.request = v.into();
3378 self
3379 }
3380
3381 /// Sets all the options, replacing any prior values.
3382 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3383 self.0.options = v.into();
3384 self
3385 }
3386
3387 /// Sends the request.
3388 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3389 (*self.0.stub)
3390 .get_operation(self.0.request, self.0.options)
3391 .await
3392 .map(crate::Response::into_body)
3393 }
3394
3395 /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
3396 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3397 self.0.request.name = v.into();
3398 self
3399 }
3400 }
3401
3402 #[doc(hidden)]
3403 impl crate::RequestBuilder for GetOperation {
3404 fn request_options(&mut self) -> &mut crate::RequestOptions {
3405 &mut self.0.options
3406 }
3407 }
3408
3409 /// The request builder for [Datastream::delete_operation][crate::client::Datastream::delete_operation] calls.
3410 ///
3411 /// # Example
3412 /// ```
3413 /// # use google_cloud_datastream_v1::builder::datastream::DeleteOperation;
3414 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
3415 ///
3416 /// let builder = prepare_request_builder();
3417 /// let response = builder.send().await?;
3418 /// # Ok(()) }
3419 ///
3420 /// fn prepare_request_builder() -> DeleteOperation {
3421 /// # panic!();
3422 /// // ... details omitted ...
3423 /// }
3424 /// ```
3425 #[derive(Clone, Debug)]
3426 pub struct DeleteOperation(
3427 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3428 );
3429
3430 impl DeleteOperation {
3431 pub(crate) fn new(
3432 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3433 ) -> Self {
3434 Self(RequestBuilder::new(stub))
3435 }
3436
3437 /// Sets the full request, replacing any prior values.
3438 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3439 mut self,
3440 v: V,
3441 ) -> Self {
3442 self.0.request = v.into();
3443 self
3444 }
3445
3446 /// Sets all the options, replacing any prior values.
3447 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3448 self.0.options = v.into();
3449 self
3450 }
3451
3452 /// Sends the request.
3453 pub async fn send(self) -> Result<()> {
3454 (*self.0.stub)
3455 .delete_operation(self.0.request, self.0.options)
3456 .await
3457 .map(crate::Response::into_body)
3458 }
3459
3460 /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
3461 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3462 self.0.request.name = v.into();
3463 self
3464 }
3465 }
3466
3467 #[doc(hidden)]
3468 impl crate::RequestBuilder for DeleteOperation {
3469 fn request_options(&mut self) -> &mut crate::RequestOptions {
3470 &mut self.0.options
3471 }
3472 }
3473
3474 /// The request builder for [Datastream::cancel_operation][crate::client::Datastream::cancel_operation] calls.
3475 ///
3476 /// # Example
3477 /// ```
3478 /// # use google_cloud_datastream_v1::builder::datastream::CancelOperation;
3479 /// # async fn sample() -> google_cloud_datastream_v1::Result<()> {
3480 ///
3481 /// let builder = prepare_request_builder();
3482 /// let response = builder.send().await?;
3483 /// # Ok(()) }
3484 ///
3485 /// fn prepare_request_builder() -> CancelOperation {
3486 /// # panic!();
3487 /// // ... details omitted ...
3488 /// }
3489 /// ```
3490 #[derive(Clone, Debug)]
3491 pub struct CancelOperation(
3492 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3493 );
3494
3495 impl CancelOperation {
3496 pub(crate) fn new(
3497 stub: std::sync::Arc<dyn super::super::stub::dynamic::Datastream>,
3498 ) -> Self {
3499 Self(RequestBuilder::new(stub))
3500 }
3501
3502 /// Sets the full request, replacing any prior values.
3503 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3504 mut self,
3505 v: V,
3506 ) -> Self {
3507 self.0.request = v.into();
3508 self
3509 }
3510
3511 /// Sets all the options, replacing any prior values.
3512 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3513 self.0.options = v.into();
3514 self
3515 }
3516
3517 /// Sends the request.
3518 pub async fn send(self) -> Result<()> {
3519 (*self.0.stub)
3520 .cancel_operation(self.0.request, self.0.options)
3521 .await
3522 .map(crate::Response::into_body)
3523 }
3524
3525 /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
3526 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3527 self.0.request.name = v.into();
3528 self
3529 }
3530 }
3531
3532 #[doc(hidden)]
3533 impl crate::RequestBuilder for CancelOperation {
3534 fn request_options(&mut self) -> &mut crate::RequestOptions {
3535 &mut self.0.options
3536 }
3537 }
3538}