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
19use crate::Result;
20use std::sync::Arc;
21
22/// Implements a client for the Datastream API.
23///
24/// # Service Description
25///
26/// Datastream service
27///
28/// # Configuration
29///
30/// `Datastream` has various configuration parameters, the defaults should
31/// work with most applications.
32///
33/// # Pooling and Cloning
34///
35/// `Datastream` holds a connection pool internally, it is advised to
36/// create one and the reuse it.  You do not need to wrap `Datastream` in
37/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc`
38/// internally.
39#[derive(Clone, Debug)]
40pub struct Datastream {
41    inner: Arc<dyn crate::stubs::dynamic::Datastream>,
42}
43
44impl Datastream {
45    /// Creates a new client with the default configuration.
46    pub async fn new() -> Result<Self> {
47        Self::new_with_config(gax::options::ClientConfig::default()).await
48    }
49
50    /// Creates a new client with the specified configuration.
51    pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result<Self> {
52        let inner = Self::build_inner(conf).await?;
53        Ok(Self { inner })
54    }
55
56    /// Creates a new client from the provided stub.
57    ///
58    /// The most common case for calling this function is when mocking the
59    /// client.
60    pub fn from_stub<T>(stub: T) -> Self
61    where
62        T: crate::stubs::Datastream + 'static,
63    {
64        Self {
65            inner: Arc::new(stub),
66        }
67    }
68
69    async fn build_inner(
70        conf: gax::options::ClientConfig,
71    ) -> Result<Arc<dyn crate::stubs::dynamic::Datastream>> {
72        if conf.tracing_enabled() {
73            return Ok(Arc::new(Self::build_with_tracing(conf).await?));
74        }
75        Ok(Arc::new(Self::build_transport(conf).await?))
76    }
77
78    async fn build_transport(
79        conf: gax::options::ClientConfig,
80    ) -> Result<impl crate::stubs::Datastream> {
81        crate::transport::Datastream::new(conf).await
82    }
83
84    async fn build_with_tracing(
85        conf: gax::options::ClientConfig,
86    ) -> Result<impl crate::stubs::Datastream> {
87        Self::build_transport(conf)
88            .await
89            .map(crate::tracing::Datastream::new)
90    }
91
92    /// Use this method to list connection profiles created in a project and
93    /// location.
94    pub fn list_connection_profiles(
95        &self,
96        parent: impl Into<std::string::String>,
97    ) -> crate::builders::datastream::ListConnectionProfiles {
98        crate::builders::datastream::ListConnectionProfiles::new(self.inner.clone())
99            .set_parent(parent.into())
100    }
101
102    /// Use this method to get details about a connection profile.
103    pub fn get_connection_profile(
104        &self,
105        name: impl Into<std::string::String>,
106    ) -> crate::builders::datastream::GetConnectionProfile {
107        crate::builders::datastream::GetConnectionProfile::new(self.inner.clone())
108            .set_name(name.into())
109    }
110
111    /// Use this method to create a connection profile in a project and location.
112    ///
113    /// # Long running operations
114    ///
115    /// This method is used to start, and/or poll a [long-running Operation].
116    /// The [Working with long-running operations] chapter in the [user guide]
117    /// covers these operations in detail.
118    ///
119    /// [long-running operation]: https://google.aip.dev/151
120    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
121    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
122    pub fn create_connection_profile(
123        &self,
124        parent: impl Into<std::string::String>,
125    ) -> crate::builders::datastream::CreateConnectionProfile {
126        crate::builders::datastream::CreateConnectionProfile::new(self.inner.clone())
127            .set_parent(parent.into())
128    }
129
130    /// Use this method to update the parameters of a connection profile.
131    ///
132    /// # Long running operations
133    ///
134    /// This method is used to start, and/or poll a [long-running Operation].
135    /// The [Working with long-running operations] chapter in the [user guide]
136    /// covers these operations in detail.
137    ///
138    /// [long-running operation]: https://google.aip.dev/151
139    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
140    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
141    pub fn update_connection_profile(
142        &self,
143        connection_profile: impl Into<crate::model::ConnectionProfile>,
144    ) -> crate::builders::datastream::UpdateConnectionProfile {
145        crate::builders::datastream::UpdateConnectionProfile::new(self.inner.clone())
146            .set_connection_profile(connection_profile.into())
147    }
148
149    /// Use this method to delete a connection profile.
150    ///
151    /// # Long running operations
152    ///
153    /// This method is used to start, and/or poll a [long-running Operation].
154    /// The [Working with long-running operations] chapter in the [user guide]
155    /// covers these operations in detail.
156    ///
157    /// [long-running operation]: https://google.aip.dev/151
158    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
159    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
160    pub fn delete_connection_profile(
161        &self,
162        name: impl Into<std::string::String>,
163    ) -> crate::builders::datastream::DeleteConnectionProfile {
164        crate::builders::datastream::DeleteConnectionProfile::new(self.inner.clone())
165            .set_name(name.into())
166    }
167
168    /// Use this method to discover a connection profile.
169    /// The discover API call exposes the data objects and metadata belonging to
170    /// the profile. Typically, a request returns children data objects of a
171    /// parent data object that's optionally supplied in the request.
172    pub fn discover_connection_profile(
173        &self,
174        parent: impl Into<std::string::String>,
175    ) -> crate::builders::datastream::DiscoverConnectionProfile {
176        crate::builders::datastream::DiscoverConnectionProfile::new(self.inner.clone())
177            .set_parent(parent.into())
178    }
179
180    /// Use this method to list streams in a project and location.
181    pub fn list_streams(
182        &self,
183        parent: impl Into<std::string::String>,
184    ) -> crate::builders::datastream::ListStreams {
185        crate::builders::datastream::ListStreams::new(self.inner.clone()).set_parent(parent.into())
186    }
187
188    /// Use this method to get details about a stream.
189    pub fn get_stream(
190        &self,
191        name: impl Into<std::string::String>,
192    ) -> crate::builders::datastream::GetStream {
193        crate::builders::datastream::GetStream::new(self.inner.clone()).set_name(name.into())
194    }
195
196    /// Use this method to create a stream.
197    ///
198    /// # Long running operations
199    ///
200    /// This method is used to start, and/or poll a [long-running Operation].
201    /// The [Working with long-running operations] chapter in the [user guide]
202    /// covers these operations in detail.
203    ///
204    /// [long-running operation]: https://google.aip.dev/151
205    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
206    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
207    pub fn create_stream(
208        &self,
209        parent: impl Into<std::string::String>,
210    ) -> crate::builders::datastream::CreateStream {
211        crate::builders::datastream::CreateStream::new(self.inner.clone()).set_parent(parent.into())
212    }
213
214    /// Use this method to update the configuration of a stream.
215    ///
216    /// # Long running operations
217    ///
218    /// This method is used to start, and/or poll a [long-running Operation].
219    /// The [Working with long-running operations] chapter in the [user guide]
220    /// covers these operations in detail.
221    ///
222    /// [long-running operation]: https://google.aip.dev/151
223    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
224    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
225    pub fn update_stream(
226        &self,
227        stream: impl Into<crate::model::Stream>,
228    ) -> crate::builders::datastream::UpdateStream {
229        crate::builders::datastream::UpdateStream::new(self.inner.clone()).set_stream(stream.into())
230    }
231
232    /// Use this method to delete a stream.
233    ///
234    /// # Long running operations
235    ///
236    /// This method is used to start, and/or poll a [long-running Operation].
237    /// The [Working with long-running operations] chapter in the [user guide]
238    /// covers these operations in detail.
239    ///
240    /// [long-running operation]: https://google.aip.dev/151
241    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
242    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
243    pub fn delete_stream(
244        &self,
245        name: impl Into<std::string::String>,
246    ) -> crate::builders::datastream::DeleteStream {
247        crate::builders::datastream::DeleteStream::new(self.inner.clone()).set_name(name.into())
248    }
249
250    /// Use this method to start, resume or recover a stream with a non default CDC
251    /// strategy.
252    ///
253    /// # Long running operations
254    ///
255    /// This method is used to start, and/or poll a [long-running Operation].
256    /// The [Working with long-running operations] chapter in the [user guide]
257    /// covers these operations in detail.
258    ///
259    /// [long-running operation]: https://google.aip.dev/151
260    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
261    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
262    pub fn run_stream(
263        &self,
264        name: impl Into<std::string::String>,
265    ) -> crate::builders::datastream::RunStream {
266        crate::builders::datastream::RunStream::new(self.inner.clone()).set_name(name.into())
267    }
268
269    /// Use this method to get details about a stream object.
270    pub fn get_stream_object(
271        &self,
272        name: impl Into<std::string::String>,
273    ) -> crate::builders::datastream::GetStreamObject {
274        crate::builders::datastream::GetStreamObject::new(self.inner.clone()).set_name(name.into())
275    }
276
277    /// Use this method to look up a stream object by its source object identifier.
278    pub fn lookup_stream_object(
279        &self,
280        parent: impl Into<std::string::String>,
281    ) -> crate::builders::datastream::LookupStreamObject {
282        crate::builders::datastream::LookupStreamObject::new(self.inner.clone())
283            .set_parent(parent.into())
284    }
285
286    /// Use this method to list the objects of a specific stream.
287    pub fn list_stream_objects(
288        &self,
289        parent: impl Into<std::string::String>,
290    ) -> crate::builders::datastream::ListStreamObjects {
291        crate::builders::datastream::ListStreamObjects::new(self.inner.clone())
292            .set_parent(parent.into())
293    }
294
295    /// Use this method to start a backfill job for the specified stream object.
296    pub fn start_backfill_job(
297        &self,
298        object: impl Into<std::string::String>,
299    ) -> crate::builders::datastream::StartBackfillJob {
300        crate::builders::datastream::StartBackfillJob::new(self.inner.clone())
301            .set_object(object.into())
302    }
303
304    /// Use this method to stop a backfill job for the specified stream object.
305    pub fn stop_backfill_job(
306        &self,
307        object: impl Into<std::string::String>,
308    ) -> crate::builders::datastream::StopBackfillJob {
309        crate::builders::datastream::StopBackfillJob::new(self.inner.clone())
310            .set_object(object.into())
311    }
312
313    /// The FetchStaticIps API call exposes the static IP addresses used by
314    /// Datastream.
315    pub fn fetch_static_ips(
316        &self,
317        name: impl Into<std::string::String>,
318    ) -> crate::builders::datastream::FetchStaticIps {
319        crate::builders::datastream::FetchStaticIps::new(self.inner.clone()).set_name(name.into())
320    }
321
322    /// Use this method to create a private connectivity configuration.
323    ///
324    /// # Long running operations
325    ///
326    /// This method is used to start, and/or poll a [long-running Operation].
327    /// The [Working with long-running operations] chapter in the [user guide]
328    /// covers these operations in detail.
329    ///
330    /// [long-running operation]: https://google.aip.dev/151
331    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
332    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
333    pub fn create_private_connection(
334        &self,
335        parent: impl Into<std::string::String>,
336    ) -> crate::builders::datastream::CreatePrivateConnection {
337        crate::builders::datastream::CreatePrivateConnection::new(self.inner.clone())
338            .set_parent(parent.into())
339    }
340
341    /// Use this method to get details about a private connectivity configuration.
342    pub fn get_private_connection(
343        &self,
344        name: impl Into<std::string::String>,
345    ) -> crate::builders::datastream::GetPrivateConnection {
346        crate::builders::datastream::GetPrivateConnection::new(self.inner.clone())
347            .set_name(name.into())
348    }
349
350    /// Use this method to list private connectivity configurations in a project
351    /// and location.
352    pub fn list_private_connections(
353        &self,
354        parent: impl Into<std::string::String>,
355    ) -> crate::builders::datastream::ListPrivateConnections {
356        crate::builders::datastream::ListPrivateConnections::new(self.inner.clone())
357            .set_parent(parent.into())
358    }
359
360    /// Use this method to delete a private connectivity configuration.
361    ///
362    /// # Long running operations
363    ///
364    /// This method is used to start, and/or poll a [long-running Operation].
365    /// The [Working with long-running operations] chapter in the [user guide]
366    /// covers these operations in detail.
367    ///
368    /// [long-running operation]: https://google.aip.dev/151
369    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
370    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
371    pub fn delete_private_connection(
372        &self,
373        name: impl Into<std::string::String>,
374    ) -> crate::builders::datastream::DeletePrivateConnection {
375        crate::builders::datastream::DeletePrivateConnection::new(self.inner.clone())
376            .set_name(name.into())
377    }
378
379    /// Use this method to create a route for a private connectivity configuration
380    /// in a project and location.
381    ///
382    /// # Long running operations
383    ///
384    /// This method is used to start, and/or poll a [long-running Operation].
385    /// The [Working with long-running operations] chapter in the [user guide]
386    /// covers these operations in detail.
387    ///
388    /// [long-running operation]: https://google.aip.dev/151
389    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
390    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
391    pub fn create_route(
392        &self,
393        parent: impl Into<std::string::String>,
394    ) -> crate::builders::datastream::CreateRoute {
395        crate::builders::datastream::CreateRoute::new(self.inner.clone()).set_parent(parent.into())
396    }
397
398    /// Use this method to get details about a route.
399    pub fn get_route(
400        &self,
401        name: impl Into<std::string::String>,
402    ) -> crate::builders::datastream::GetRoute {
403        crate::builders::datastream::GetRoute::new(self.inner.clone()).set_name(name.into())
404    }
405
406    /// Use this method to list routes created for a private connectivity
407    /// configuration in a project and location.
408    pub fn list_routes(
409        &self,
410        parent: impl Into<std::string::String>,
411    ) -> crate::builders::datastream::ListRoutes {
412        crate::builders::datastream::ListRoutes::new(self.inner.clone()).set_parent(parent.into())
413    }
414
415    /// Use this method to delete a route.
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    pub fn delete_route(
427        &self,
428        name: impl Into<std::string::String>,
429    ) -> crate::builders::datastream::DeleteRoute {
430        crate::builders::datastream::DeleteRoute::new(self.inner.clone()).set_name(name.into())
431    }
432
433    /// Lists information about the supported locations for this service.
434    pub fn list_locations(
435        &self,
436        name: impl Into<std::string::String>,
437    ) -> crate::builders::datastream::ListLocations {
438        crate::builders::datastream::ListLocations::new(self.inner.clone()).set_name(name.into())
439    }
440
441    /// Gets information about a location.
442    pub fn get_location(
443        &self,
444        name: impl Into<std::string::String>,
445    ) -> crate::builders::datastream::GetLocation {
446        crate::builders::datastream::GetLocation::new(self.inner.clone()).set_name(name.into())
447    }
448
449    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
450    ///
451    /// [google.longrunning.Operations]: longrunning::client::Operations
452    pub fn list_operations(
453        &self,
454        name: impl Into<std::string::String>,
455    ) -> crate::builders::datastream::ListOperations {
456        crate::builders::datastream::ListOperations::new(self.inner.clone()).set_name(name.into())
457    }
458
459    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
460    ///
461    /// [google.longrunning.Operations]: longrunning::client::Operations
462    pub fn get_operation(
463        &self,
464        name: impl Into<std::string::String>,
465    ) -> crate::builders::datastream::GetOperation {
466        crate::builders::datastream::GetOperation::new(self.inner.clone()).set_name(name.into())
467    }
468
469    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
470    ///
471    /// [google.longrunning.Operations]: longrunning::client::Operations
472    pub fn delete_operation(
473        &self,
474        name: impl Into<std::string::String>,
475    ) -> crate::builders::datastream::DeleteOperation {
476        crate::builders::datastream::DeleteOperation::new(self.inner.clone()).set_name(name.into())
477    }
478
479    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
480    ///
481    /// [google.longrunning.Operations]: longrunning::client::Operations
482    pub fn cancel_operation(
483        &self,
484        name: impl Into<std::string::String>,
485    ) -> crate::builders::datastream::CancelOperation {
486        crate::builders::datastream::CancelOperation::new(self.inner.clone()).set_name(name.into())
487    }
488}