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