google_cloud_datastream_v1/client.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#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Datastream API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_datastream_v1::client::Datastream;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26/// let client = Datastream::builder().build().await?;
27/// let parent = "parent_value";
28/// let mut list = client.list_connection_profiles()
29/// .set_parent(parent)
30/// .by_item();
31/// while let Some(item) = list.next().await.transpose()? {
32/// println!("{:?}", item);
33/// }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// Datastream service
40///
41/// # Configuration
42///
43/// To configure `Datastream` use the `with_*` methods in the type returned
44/// by [builder()][Datastream::builder]. The default configuration should
45/// work for most applications. Common configuration changes include
46///
47/// * [with_endpoint()]: by default this client uses the global default endpoint
48/// (`https://datastream.googleapis.com`). Applications using regional
49/// endpoints or running in restricted networks (e.g. a network configured
50// with [Private Google Access with VPC Service Controls]) may want to
51/// override this default.
52/// * [with_credentials()]: by default this client uses
53/// [Application Default Credentials]. Applications using custom
54/// authentication may need to override this default.
55///
56/// [with_endpoint()]: super::builder::datastream::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::datastream::ClientBuilder::with_credentials
58/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
59/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
60///
61/// # Pooling and Cloning
62///
63/// `Datastream` holds a connection pool internally, it is advised to
64/// create one and reuse it. You do not need to wrap `Datastream` in
65/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
66/// already uses an `Arc` internally.
67#[derive(Clone, Debug)]
68pub struct Datastream {
69 inner: std::sync::Arc<dyn super::stub::dynamic::Datastream>,
70}
71
72impl Datastream {
73 /// Returns a builder for [Datastream].
74 ///
75 /// ```
76 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77 /// # use google_cloud_datastream_v1::client::Datastream;
78 /// let client = Datastream::builder().build().await?;
79 /// # Ok(()) }
80 /// ```
81 pub fn builder() -> super::builder::datastream::ClientBuilder {
82 crate::new_client_builder(super::builder::datastream::client::Factory)
83 }
84
85 /// Creates a new client from the provided stub.
86 ///
87 /// The most common case for calling this function is in tests mocking the
88 /// client's behavior.
89 pub fn from_stub<T>(stub: T) -> Self
90 where
91 T: super::stub::Datastream + 'static,
92 {
93 Self {
94 inner: std::sync::Arc::new(stub),
95 }
96 }
97
98 pub(crate) async fn new(
99 config: gaxi::options::ClientConfig,
100 ) -> crate::ClientBuilderResult<Self> {
101 let inner = Self::build_inner(config).await?;
102 Ok(Self { inner })
103 }
104
105 async fn build_inner(
106 conf: gaxi::options::ClientConfig,
107 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Datastream>> {
108 if gaxi::options::tracing_enabled(&conf) {
109 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
110 }
111 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
112 }
113
114 async fn build_transport(
115 conf: gaxi::options::ClientConfig,
116 ) -> crate::ClientBuilderResult<impl super::stub::Datastream> {
117 super::transport::Datastream::new(conf).await
118 }
119
120 async fn build_with_tracing(
121 conf: gaxi::options::ClientConfig,
122 ) -> crate::ClientBuilderResult<impl super::stub::Datastream> {
123 Self::build_transport(conf)
124 .await
125 .map(super::tracing::Datastream::new)
126 }
127
128 /// Use this method to list connection profiles created in a project and
129 /// location.
130 ///
131 /// # Example
132 /// ```
133 /// # use google_cloud_datastream_v1::client::Datastream;
134 /// use google_cloud_gax::paginator::ItemPaginator as _;
135 /// use google_cloud_datastream_v1::Result;
136 /// async fn sample(
137 /// client: &Datastream, parent: &str
138 /// ) -> Result<()> {
139 /// let mut list = client.list_connection_profiles()
140 /// .set_parent(parent)
141 /// .by_item();
142 /// while let Some(item) = list.next().await.transpose()? {
143 /// println!("{:?}", item);
144 /// }
145 /// Ok(())
146 /// }
147 /// ```
148 pub fn list_connection_profiles(&self) -> super::builder::datastream::ListConnectionProfiles {
149 super::builder::datastream::ListConnectionProfiles::new(self.inner.clone())
150 }
151
152 /// Use this method to get details about a connection profile.
153 ///
154 /// # Example
155 /// ```
156 /// # use google_cloud_datastream_v1::client::Datastream;
157 /// use google_cloud_datastream_v1::Result;
158 /// async fn sample(
159 /// client: &Datastream, name: &str
160 /// ) -> Result<()> {
161 /// let response = client.get_connection_profile()
162 /// .set_name(name)
163 /// .send().await?;
164 /// println!("response {:?}", response);
165 /// Ok(())
166 /// }
167 /// ```
168 pub fn get_connection_profile(&self) -> super::builder::datastream::GetConnectionProfile {
169 super::builder::datastream::GetConnectionProfile::new(self.inner.clone())
170 }
171
172 /// Use this method to create a connection profile in a project and location.
173 ///
174 /// # Long running operations
175 ///
176 /// This method is used to start, and/or poll a [long-running Operation].
177 /// The [Working with long-running operations] chapter in the [user guide]
178 /// covers these operations in detail.
179 ///
180 /// [long-running operation]: https://google.aip.dev/151
181 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
182 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
183 ///
184 /// # Example
185 /// ```
186 /// # use google_cloud_datastream_v1::client::Datastream;
187 /// use google_cloud_lro::Poller;
188 /// use google_cloud_datastream_v1::model::ConnectionProfile;
189 /// use google_cloud_datastream_v1::Result;
190 /// async fn sample(
191 /// client: &Datastream, parent: &str
192 /// ) -> Result<()> {
193 /// let response = client.create_connection_profile()
194 /// .set_parent(parent)
195 /// .set_connection_profile(
196 /// ConnectionProfile::new()/* set fields */
197 /// )
198 /// .poller().until_done().await?;
199 /// println!("response {:?}", response);
200 /// Ok(())
201 /// }
202 /// ```
203 pub fn create_connection_profile(&self) -> super::builder::datastream::CreateConnectionProfile {
204 super::builder::datastream::CreateConnectionProfile::new(self.inner.clone())
205 }
206
207 /// Use this method to update the parameters of a connection profile.
208 ///
209 /// # Long running operations
210 ///
211 /// This method is used to start, and/or poll a [long-running Operation].
212 /// The [Working with long-running operations] chapter in the [user guide]
213 /// covers these operations in detail.
214 ///
215 /// [long-running operation]: https://google.aip.dev/151
216 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
217 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
218 ///
219 /// # Example
220 /// ```
221 /// # use google_cloud_datastream_v1::client::Datastream;
222 /// use google_cloud_lro::Poller;
223 /// # extern crate wkt as google_cloud_wkt;
224 /// use google_cloud_wkt::FieldMask;
225 /// use google_cloud_datastream_v1::model::ConnectionProfile;
226 /// use google_cloud_datastream_v1::Result;
227 /// async fn sample(
228 /// client: &Datastream, name: &str
229 /// ) -> Result<()> {
230 /// let response = client.update_connection_profile()
231 /// .set_connection_profile(
232 /// ConnectionProfile::new().set_name(name)/* set fields */
233 /// )
234 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
235 /// .poller().until_done().await?;
236 /// println!("response {:?}", response);
237 /// Ok(())
238 /// }
239 /// ```
240 pub fn update_connection_profile(&self) -> super::builder::datastream::UpdateConnectionProfile {
241 super::builder::datastream::UpdateConnectionProfile::new(self.inner.clone())
242 }
243
244 /// Use this method to delete a connection profile.
245 ///
246 /// # Long running operations
247 ///
248 /// This method is used to start, and/or poll a [long-running Operation].
249 /// The [Working with long-running operations] chapter in the [user guide]
250 /// covers these operations in detail.
251 ///
252 /// [long-running operation]: https://google.aip.dev/151
253 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
254 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
255 ///
256 /// # Example
257 /// ```
258 /// # use google_cloud_datastream_v1::client::Datastream;
259 /// use google_cloud_lro::Poller;
260 /// use google_cloud_datastream_v1::Result;
261 /// async fn sample(
262 /// client: &Datastream, name: &str
263 /// ) -> Result<()> {
264 /// client.delete_connection_profile()
265 /// .set_name(name)
266 /// .poller().until_done().await?;
267 /// Ok(())
268 /// }
269 /// ```
270 pub fn delete_connection_profile(&self) -> super::builder::datastream::DeleteConnectionProfile {
271 super::builder::datastream::DeleteConnectionProfile::new(self.inner.clone())
272 }
273
274 /// Use this method to discover a connection profile.
275 /// The discover API call exposes the data objects and metadata belonging to
276 /// the profile. Typically, a request returns children data objects of a
277 /// parent data object that's optionally supplied in the request.
278 ///
279 /// # Example
280 /// ```
281 /// # use google_cloud_datastream_v1::client::Datastream;
282 /// use google_cloud_datastream_v1::Result;
283 /// async fn sample(
284 /// client: &Datastream
285 /// ) -> Result<()> {
286 /// let response = client.discover_connection_profile()
287 /// /* set fields */
288 /// .send().await?;
289 /// println!("response {:?}", response);
290 /// Ok(())
291 /// }
292 /// ```
293 pub fn discover_connection_profile(
294 &self,
295 ) -> super::builder::datastream::DiscoverConnectionProfile {
296 super::builder::datastream::DiscoverConnectionProfile::new(self.inner.clone())
297 }
298
299 /// Use this method to list streams in a project and location.
300 ///
301 /// # Example
302 /// ```
303 /// # use google_cloud_datastream_v1::client::Datastream;
304 /// use google_cloud_gax::paginator::ItemPaginator as _;
305 /// use google_cloud_datastream_v1::Result;
306 /// async fn sample(
307 /// client: &Datastream, parent: &str
308 /// ) -> Result<()> {
309 /// let mut list = client.list_streams()
310 /// .set_parent(parent)
311 /// .by_item();
312 /// while let Some(item) = list.next().await.transpose()? {
313 /// println!("{:?}", item);
314 /// }
315 /// Ok(())
316 /// }
317 /// ```
318 pub fn list_streams(&self) -> super::builder::datastream::ListStreams {
319 super::builder::datastream::ListStreams::new(self.inner.clone())
320 }
321
322 /// Use this method to get details about a stream.
323 ///
324 /// # Example
325 /// ```
326 /// # use google_cloud_datastream_v1::client::Datastream;
327 /// use google_cloud_datastream_v1::Result;
328 /// async fn sample(
329 /// client: &Datastream, name: &str
330 /// ) -> Result<()> {
331 /// let response = client.get_stream()
332 /// .set_name(name)
333 /// .send().await?;
334 /// println!("response {:?}", response);
335 /// Ok(())
336 /// }
337 /// ```
338 pub fn get_stream(&self) -> super::builder::datastream::GetStream {
339 super::builder::datastream::GetStream::new(self.inner.clone())
340 }
341
342 /// Use this method to create a stream.
343 ///
344 /// # Long running operations
345 ///
346 /// This method is used to start, and/or poll a [long-running Operation].
347 /// The [Working with long-running operations] chapter in the [user guide]
348 /// covers these operations in detail.
349 ///
350 /// [long-running operation]: https://google.aip.dev/151
351 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
352 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
353 ///
354 /// # Example
355 /// ```
356 /// # use google_cloud_datastream_v1::client::Datastream;
357 /// use google_cloud_lro::Poller;
358 /// use google_cloud_datastream_v1::model::Stream;
359 /// use google_cloud_datastream_v1::Result;
360 /// async fn sample(
361 /// client: &Datastream, parent: &str
362 /// ) -> Result<()> {
363 /// let response = client.create_stream()
364 /// .set_parent(parent)
365 /// .set_stream_id("stream_id_value")
366 /// .set_stream(
367 /// Stream::new()/* set fields */
368 /// )
369 /// .poller().until_done().await?;
370 /// println!("response {:?}", response);
371 /// Ok(())
372 /// }
373 /// ```
374 pub fn create_stream(&self) -> super::builder::datastream::CreateStream {
375 super::builder::datastream::CreateStream::new(self.inner.clone())
376 }
377
378 /// Use this method to update the configuration of a stream.
379 ///
380 /// # Long running operations
381 ///
382 /// This method is used to start, and/or poll a [long-running Operation].
383 /// The [Working with long-running operations] chapter in the [user guide]
384 /// covers these operations in detail.
385 ///
386 /// [long-running operation]: https://google.aip.dev/151
387 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
388 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
389 ///
390 /// # Example
391 /// ```
392 /// # use google_cloud_datastream_v1::client::Datastream;
393 /// use google_cloud_lro::Poller;
394 /// # extern crate wkt as google_cloud_wkt;
395 /// use google_cloud_wkt::FieldMask;
396 /// use google_cloud_datastream_v1::model::Stream;
397 /// use google_cloud_datastream_v1::Result;
398 /// async fn sample(
399 /// client: &Datastream, name: &str
400 /// ) -> Result<()> {
401 /// let response = client.update_stream()
402 /// .set_stream(
403 /// Stream::new().set_name(name)/* set fields */
404 /// )
405 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
406 /// .poller().until_done().await?;
407 /// println!("response {:?}", response);
408 /// Ok(())
409 /// }
410 /// ```
411 pub fn update_stream(&self) -> super::builder::datastream::UpdateStream {
412 super::builder::datastream::UpdateStream::new(self.inner.clone())
413 }
414
415 /// Use this method to delete a stream.
416 ///
417 /// # Long running operations
418 ///
419 /// This method is used to start, and/or poll a [long-running Operation].
420 /// The [Working with long-running operations] chapter in the [user guide]
421 /// covers these operations in detail.
422 ///
423 /// [long-running operation]: https://google.aip.dev/151
424 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
425 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
426 ///
427 /// # Example
428 /// ```
429 /// # use google_cloud_datastream_v1::client::Datastream;
430 /// use google_cloud_lro::Poller;
431 /// use google_cloud_datastream_v1::Result;
432 /// async fn sample(
433 /// client: &Datastream, name: &str
434 /// ) -> Result<()> {
435 /// client.delete_stream()
436 /// .set_name(name)
437 /// .poller().until_done().await?;
438 /// Ok(())
439 /// }
440 /// ```
441 pub fn delete_stream(&self) -> super::builder::datastream::DeleteStream {
442 super::builder::datastream::DeleteStream::new(self.inner.clone())
443 }
444
445 /// Use this method to start, resume or recover a stream with a non default CDC
446 /// strategy.
447 ///
448 /// # Long running operations
449 ///
450 /// This method is used to start, and/or poll a [long-running Operation].
451 /// The [Working with long-running operations] chapter in the [user guide]
452 /// covers these operations in detail.
453 ///
454 /// [long-running operation]: https://google.aip.dev/151
455 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
456 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
457 ///
458 /// # Example
459 /// ```
460 /// # use google_cloud_datastream_v1::client::Datastream;
461 /// use google_cloud_lro::Poller;
462 /// use google_cloud_datastream_v1::Result;
463 /// async fn sample(
464 /// client: &Datastream
465 /// ) -> Result<()> {
466 /// let response = client.run_stream()
467 /// /* set fields */
468 /// .poller().until_done().await?;
469 /// println!("response {:?}", response);
470 /// Ok(())
471 /// }
472 /// ```
473 pub fn run_stream(&self) -> super::builder::datastream::RunStream {
474 super::builder::datastream::RunStream::new(self.inner.clone())
475 }
476
477 /// Use this method to get details about a stream object.
478 ///
479 /// # Example
480 /// ```
481 /// # use google_cloud_datastream_v1::client::Datastream;
482 /// use google_cloud_datastream_v1::Result;
483 /// async fn sample(
484 /// client: &Datastream, name: &str
485 /// ) -> Result<()> {
486 /// let response = client.get_stream_object()
487 /// .set_name(name)
488 /// .send().await?;
489 /// println!("response {:?}", response);
490 /// Ok(())
491 /// }
492 /// ```
493 pub fn get_stream_object(&self) -> super::builder::datastream::GetStreamObject {
494 super::builder::datastream::GetStreamObject::new(self.inner.clone())
495 }
496
497 /// Use this method to look up a stream object by its source object identifier.
498 ///
499 /// # Example
500 /// ```
501 /// # use google_cloud_datastream_v1::client::Datastream;
502 /// use google_cloud_datastream_v1::Result;
503 /// async fn sample(
504 /// client: &Datastream
505 /// ) -> Result<()> {
506 /// let response = client.lookup_stream_object()
507 /// /* set fields */
508 /// .send().await?;
509 /// println!("response {:?}", response);
510 /// Ok(())
511 /// }
512 /// ```
513 pub fn lookup_stream_object(&self) -> super::builder::datastream::LookupStreamObject {
514 super::builder::datastream::LookupStreamObject::new(self.inner.clone())
515 }
516
517 /// Use this method to list the objects of a specific stream.
518 ///
519 /// # Example
520 /// ```
521 /// # use google_cloud_datastream_v1::client::Datastream;
522 /// use google_cloud_gax::paginator::ItemPaginator as _;
523 /// use google_cloud_datastream_v1::Result;
524 /// async fn sample(
525 /// client: &Datastream, parent: &str
526 /// ) -> Result<()> {
527 /// let mut list = client.list_stream_objects()
528 /// .set_parent(parent)
529 /// .by_item();
530 /// while let Some(item) = list.next().await.transpose()? {
531 /// println!("{:?}", item);
532 /// }
533 /// Ok(())
534 /// }
535 /// ```
536 pub fn list_stream_objects(&self) -> super::builder::datastream::ListStreamObjects {
537 super::builder::datastream::ListStreamObjects::new(self.inner.clone())
538 }
539
540 /// Use this method to start a backfill job for the specified stream object.
541 ///
542 /// # Example
543 /// ```
544 /// # use google_cloud_datastream_v1::client::Datastream;
545 /// use google_cloud_datastream_v1::Result;
546 /// async fn sample(
547 /// client: &Datastream
548 /// ) -> Result<()> {
549 /// let response = client.start_backfill_job()
550 /// /* set fields */
551 /// .send().await?;
552 /// println!("response {:?}", response);
553 /// Ok(())
554 /// }
555 /// ```
556 pub fn start_backfill_job(&self) -> super::builder::datastream::StartBackfillJob {
557 super::builder::datastream::StartBackfillJob::new(self.inner.clone())
558 }
559
560 /// Use this method to stop a backfill job for the specified stream object.
561 ///
562 /// # Example
563 /// ```
564 /// # use google_cloud_datastream_v1::client::Datastream;
565 /// use google_cloud_datastream_v1::Result;
566 /// async fn sample(
567 /// client: &Datastream
568 /// ) -> Result<()> {
569 /// let response = client.stop_backfill_job()
570 /// /* set fields */
571 /// .send().await?;
572 /// println!("response {:?}", response);
573 /// Ok(())
574 /// }
575 /// ```
576 pub fn stop_backfill_job(&self) -> super::builder::datastream::StopBackfillJob {
577 super::builder::datastream::StopBackfillJob::new(self.inner.clone())
578 }
579
580 /// The FetchStaticIps API call exposes the static IP addresses used by
581 /// Datastream.
582 ///
583 /// # Example
584 /// ```
585 /// # use google_cloud_datastream_v1::client::Datastream;
586 /// use google_cloud_datastream_v1::Result;
587 /// async fn sample(
588 /// client: &Datastream
589 /// ) -> Result<()> {
590 /// let response = client.fetch_static_ips()
591 /// /* set fields */
592 /// .send().await?;
593 /// println!("response {:?}", response);
594 /// Ok(())
595 /// }
596 /// ```
597 pub fn fetch_static_ips(&self) -> super::builder::datastream::FetchStaticIps {
598 super::builder::datastream::FetchStaticIps::new(self.inner.clone())
599 }
600
601 /// Use this method to create a private connectivity configuration.
602 ///
603 /// # Long running operations
604 ///
605 /// This method is used to start, and/or poll a [long-running Operation].
606 /// The [Working with long-running operations] chapter in the [user guide]
607 /// covers these operations in detail.
608 ///
609 /// [long-running operation]: https://google.aip.dev/151
610 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
611 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
612 ///
613 /// # Example
614 /// ```
615 /// # use google_cloud_datastream_v1::client::Datastream;
616 /// use google_cloud_lro::Poller;
617 /// use google_cloud_datastream_v1::model::PrivateConnection;
618 /// use google_cloud_datastream_v1::Result;
619 /// async fn sample(
620 /// client: &Datastream, parent: &str
621 /// ) -> Result<()> {
622 /// let response = client.create_private_connection()
623 /// .set_parent(parent)
624 /// .set_private_connection(
625 /// PrivateConnection::new()/* set fields */
626 /// )
627 /// .poller().until_done().await?;
628 /// println!("response {:?}", response);
629 /// Ok(())
630 /// }
631 /// ```
632 pub fn create_private_connection(&self) -> super::builder::datastream::CreatePrivateConnection {
633 super::builder::datastream::CreatePrivateConnection::new(self.inner.clone())
634 }
635
636 /// Use this method to get details about a private connectivity configuration.
637 ///
638 /// # Example
639 /// ```
640 /// # use google_cloud_datastream_v1::client::Datastream;
641 /// use google_cloud_datastream_v1::Result;
642 /// async fn sample(
643 /// client: &Datastream, name: &str
644 /// ) -> Result<()> {
645 /// let response = client.get_private_connection()
646 /// .set_name(name)
647 /// .send().await?;
648 /// println!("response {:?}", response);
649 /// Ok(())
650 /// }
651 /// ```
652 pub fn get_private_connection(&self) -> super::builder::datastream::GetPrivateConnection {
653 super::builder::datastream::GetPrivateConnection::new(self.inner.clone())
654 }
655
656 /// Use this method to list private connectivity configurations in a project
657 /// and location.
658 ///
659 /// # Example
660 /// ```
661 /// # use google_cloud_datastream_v1::client::Datastream;
662 /// use google_cloud_gax::paginator::ItemPaginator as _;
663 /// use google_cloud_datastream_v1::Result;
664 /// async fn sample(
665 /// client: &Datastream, parent: &str
666 /// ) -> Result<()> {
667 /// let mut list = client.list_private_connections()
668 /// .set_parent(parent)
669 /// .by_item();
670 /// while let Some(item) = list.next().await.transpose()? {
671 /// println!("{:?}", item);
672 /// }
673 /// Ok(())
674 /// }
675 /// ```
676 pub fn list_private_connections(&self) -> super::builder::datastream::ListPrivateConnections {
677 super::builder::datastream::ListPrivateConnections::new(self.inner.clone())
678 }
679
680 /// Use this method to delete a private connectivity configuration.
681 ///
682 /// # Long running operations
683 ///
684 /// This method is used to start, and/or poll a [long-running Operation].
685 /// The [Working with long-running operations] chapter in the [user guide]
686 /// covers these operations in detail.
687 ///
688 /// [long-running operation]: https://google.aip.dev/151
689 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
690 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
691 ///
692 /// # Example
693 /// ```
694 /// # use google_cloud_datastream_v1::client::Datastream;
695 /// use google_cloud_lro::Poller;
696 /// use google_cloud_datastream_v1::Result;
697 /// async fn sample(
698 /// client: &Datastream, name: &str
699 /// ) -> Result<()> {
700 /// client.delete_private_connection()
701 /// .set_name(name)
702 /// .poller().until_done().await?;
703 /// Ok(())
704 /// }
705 /// ```
706 pub fn delete_private_connection(&self) -> super::builder::datastream::DeletePrivateConnection {
707 super::builder::datastream::DeletePrivateConnection::new(self.inner.clone())
708 }
709
710 /// Use this method to create a route for a private connectivity configuration
711 /// in a project and location.
712 ///
713 /// # Long running operations
714 ///
715 /// This method is used to start, and/or poll a [long-running Operation].
716 /// The [Working with long-running operations] chapter in the [user guide]
717 /// covers these operations in detail.
718 ///
719 /// [long-running operation]: https://google.aip.dev/151
720 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
721 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
722 ///
723 /// # Example
724 /// ```
725 /// # use google_cloud_datastream_v1::client::Datastream;
726 /// use google_cloud_lro::Poller;
727 /// use google_cloud_datastream_v1::model::Route;
728 /// use google_cloud_datastream_v1::Result;
729 /// async fn sample(
730 /// client: &Datastream, parent: &str
731 /// ) -> Result<()> {
732 /// let response = client.create_route()
733 /// .set_parent(parent)
734 /// .set_route_id("route_id_value")
735 /// .set_route(
736 /// Route::new()/* set fields */
737 /// )
738 /// .poller().until_done().await?;
739 /// println!("response {:?}", response);
740 /// Ok(())
741 /// }
742 /// ```
743 pub fn create_route(&self) -> super::builder::datastream::CreateRoute {
744 super::builder::datastream::CreateRoute::new(self.inner.clone())
745 }
746
747 /// Use this method to get details about a route.
748 ///
749 /// # Example
750 /// ```
751 /// # use google_cloud_datastream_v1::client::Datastream;
752 /// use google_cloud_datastream_v1::Result;
753 /// async fn sample(
754 /// client: &Datastream, name: &str
755 /// ) -> Result<()> {
756 /// let response = client.get_route()
757 /// .set_name(name)
758 /// .send().await?;
759 /// println!("response {:?}", response);
760 /// Ok(())
761 /// }
762 /// ```
763 pub fn get_route(&self) -> super::builder::datastream::GetRoute {
764 super::builder::datastream::GetRoute::new(self.inner.clone())
765 }
766
767 /// Use this method to list routes created for a private connectivity
768 /// configuration in a project and location.
769 ///
770 /// # Example
771 /// ```
772 /// # use google_cloud_datastream_v1::client::Datastream;
773 /// use google_cloud_gax::paginator::ItemPaginator as _;
774 /// use google_cloud_datastream_v1::Result;
775 /// async fn sample(
776 /// client: &Datastream, parent: &str
777 /// ) -> Result<()> {
778 /// let mut list = client.list_routes()
779 /// .set_parent(parent)
780 /// .by_item();
781 /// while let Some(item) = list.next().await.transpose()? {
782 /// println!("{:?}", item);
783 /// }
784 /// Ok(())
785 /// }
786 /// ```
787 pub fn list_routes(&self) -> super::builder::datastream::ListRoutes {
788 super::builder::datastream::ListRoutes::new(self.inner.clone())
789 }
790
791 /// Use this method to delete a route.
792 ///
793 /// # Long running operations
794 ///
795 /// This method is used to start, and/or poll a [long-running Operation].
796 /// The [Working with long-running operations] chapter in the [user guide]
797 /// covers these operations in detail.
798 ///
799 /// [long-running operation]: https://google.aip.dev/151
800 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
801 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
802 ///
803 /// # Example
804 /// ```
805 /// # use google_cloud_datastream_v1::client::Datastream;
806 /// use google_cloud_lro::Poller;
807 /// use google_cloud_datastream_v1::Result;
808 /// async fn sample(
809 /// client: &Datastream, name: &str
810 /// ) -> Result<()> {
811 /// client.delete_route()
812 /// .set_name(name)
813 /// .poller().until_done().await?;
814 /// Ok(())
815 /// }
816 /// ```
817 pub fn delete_route(&self) -> super::builder::datastream::DeleteRoute {
818 super::builder::datastream::DeleteRoute::new(self.inner.clone())
819 }
820
821 /// Lists information about the supported locations for this service.
822 ///
823 /// # Example
824 /// ```
825 /// # use google_cloud_datastream_v1::client::Datastream;
826 /// use google_cloud_gax::paginator::ItemPaginator as _;
827 /// use google_cloud_datastream_v1::Result;
828 /// async fn sample(
829 /// client: &Datastream
830 /// ) -> Result<()> {
831 /// let mut list = client.list_locations()
832 /// /* set fields */
833 /// .by_item();
834 /// while let Some(item) = list.next().await.transpose()? {
835 /// println!("{:?}", item);
836 /// }
837 /// Ok(())
838 /// }
839 /// ```
840 pub fn list_locations(&self) -> super::builder::datastream::ListLocations {
841 super::builder::datastream::ListLocations::new(self.inner.clone())
842 }
843
844 /// Gets information about a location.
845 ///
846 /// # Example
847 /// ```
848 /// # use google_cloud_datastream_v1::client::Datastream;
849 /// use google_cloud_datastream_v1::Result;
850 /// async fn sample(
851 /// client: &Datastream
852 /// ) -> Result<()> {
853 /// let response = client.get_location()
854 /// /* set fields */
855 /// .send().await?;
856 /// println!("response {:?}", response);
857 /// Ok(())
858 /// }
859 /// ```
860 pub fn get_location(&self) -> super::builder::datastream::GetLocation {
861 super::builder::datastream::GetLocation::new(self.inner.clone())
862 }
863
864 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
865 ///
866 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
867 ///
868 /// # Example
869 /// ```
870 /// # use google_cloud_datastream_v1::client::Datastream;
871 /// use google_cloud_gax::paginator::ItemPaginator as _;
872 /// use google_cloud_datastream_v1::Result;
873 /// async fn sample(
874 /// client: &Datastream
875 /// ) -> Result<()> {
876 /// let mut list = client.list_operations()
877 /// /* set fields */
878 /// .by_item();
879 /// while let Some(item) = list.next().await.transpose()? {
880 /// println!("{:?}", item);
881 /// }
882 /// Ok(())
883 /// }
884 /// ```
885 pub fn list_operations(&self) -> super::builder::datastream::ListOperations {
886 super::builder::datastream::ListOperations::new(self.inner.clone())
887 }
888
889 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
890 ///
891 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
892 ///
893 /// # Example
894 /// ```
895 /// # use google_cloud_datastream_v1::client::Datastream;
896 /// use google_cloud_datastream_v1::Result;
897 /// async fn sample(
898 /// client: &Datastream
899 /// ) -> Result<()> {
900 /// let response = client.get_operation()
901 /// /* set fields */
902 /// .send().await?;
903 /// println!("response {:?}", response);
904 /// Ok(())
905 /// }
906 /// ```
907 pub fn get_operation(&self) -> super::builder::datastream::GetOperation {
908 super::builder::datastream::GetOperation::new(self.inner.clone())
909 }
910
911 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
912 ///
913 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
914 ///
915 /// # Example
916 /// ```
917 /// # use google_cloud_datastream_v1::client::Datastream;
918 /// use google_cloud_datastream_v1::Result;
919 /// async fn sample(
920 /// client: &Datastream
921 /// ) -> Result<()> {
922 /// client.delete_operation()
923 /// /* set fields */
924 /// .send().await?;
925 /// Ok(())
926 /// }
927 /// ```
928 pub fn delete_operation(&self) -> super::builder::datastream::DeleteOperation {
929 super::builder::datastream::DeleteOperation::new(self.inner.clone())
930 }
931
932 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
933 ///
934 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
935 ///
936 /// # Example
937 /// ```
938 /// # use google_cloud_datastream_v1::client::Datastream;
939 /// use google_cloud_datastream_v1::Result;
940 /// async fn sample(
941 /// client: &Datastream
942 /// ) -> Result<()> {
943 /// client.cancel_operation()
944 /// /* set fields */
945 /// .send().await?;
946 /// Ok(())
947 /// }
948 /// ```
949 pub fn cancel_operation(&self) -> super::builder::datastream::CancelOperation {
950 super::builder::datastream::CancelOperation::new(self.inner.clone())
951 }
952}