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