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