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