google_cloud_networkconnectivity_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 Network Connectivity API.
20///
21/// # Example
22/// ```
23/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24/// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
25/// let client = CrossNetworkAutomationService::builder().build().await?;
26/// // use `client` to make requests to the Network Connectivity API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// The service for CrossNetworkAutomation resources.
33///
34/// # Configuration
35///
36/// To configure `CrossNetworkAutomationService` use the `with_*` methods in the type returned
37/// by [builder()][CrossNetworkAutomationService::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://networkconnectivity.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::cross_network_automation_service::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::cross_network_automation_service::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/// `CrossNetworkAutomationService` holds a connection pool internally, it is advised to
57/// create one and the reuse it. You do not need to wrap `CrossNetworkAutomationService` 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 CrossNetworkAutomationService {
62 inner: std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
63}
64
65impl CrossNetworkAutomationService {
66 /// Returns a builder for [CrossNetworkAutomationService].
67 ///
68 /// ```
69 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
70 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
71 /// let client = CrossNetworkAutomationService::builder().build().await?;
72 /// # Ok(()) }
73 /// ```
74 pub fn builder() -> super::builder::cross_network_automation_service::ClientBuilder {
75 crate::new_client_builder(super::builder::cross_network_automation_service::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::CrossNetworkAutomationService + '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 ) -> crate::ClientBuilderResult<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 ) -> crate::ClientBuilderResult<
101 std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
102 > {
103 if gaxi::options::tracing_enabled(&conf) {
104 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
105 }
106 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
107 }
108
109 async fn build_transport(
110 conf: gaxi::options::ClientConfig,
111 ) -> crate::ClientBuilderResult<impl super::stub::CrossNetworkAutomationService> {
112 super::transport::CrossNetworkAutomationService::new(conf).await
113 }
114
115 async fn build_with_tracing(
116 conf: gaxi::options::ClientConfig,
117 ) -> crate::ClientBuilderResult<impl super::stub::CrossNetworkAutomationService> {
118 Self::build_transport(conf)
119 .await
120 .map(super::tracing::CrossNetworkAutomationService::new)
121 }
122
123 /// Lists ServiceConnectionMaps in a given project and location.
124 pub fn list_service_connection_maps(
125 &self,
126 ) -> super::builder::cross_network_automation_service::ListServiceConnectionMaps {
127 super::builder::cross_network_automation_service::ListServiceConnectionMaps::new(
128 self.inner.clone(),
129 )
130 }
131
132 /// Gets details of a single ServiceConnectionMap.
133 pub fn get_service_connection_map(
134 &self,
135 ) -> super::builder::cross_network_automation_service::GetServiceConnectionMap {
136 super::builder::cross_network_automation_service::GetServiceConnectionMap::new(
137 self.inner.clone(),
138 )
139 }
140
141 /// Creates a new ServiceConnectionMap in a given project and location.
142 ///
143 /// # Long running operations
144 ///
145 /// This method is used to start, and/or poll a [long-running Operation].
146 /// The [Working with long-running operations] chapter in the [user guide]
147 /// covers these operations in detail.
148 ///
149 /// [long-running operation]: https://google.aip.dev/151
150 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
151 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
152 pub fn create_service_connection_map(
153 &self,
154 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionMap {
155 super::builder::cross_network_automation_service::CreateServiceConnectionMap::new(
156 self.inner.clone(),
157 )
158 }
159
160 /// Updates the parameters of a single ServiceConnectionMap.
161 ///
162 /// # Long running operations
163 ///
164 /// This method is used to start, and/or poll a [long-running Operation].
165 /// The [Working with long-running operations] chapter in the [user guide]
166 /// covers these operations in detail.
167 ///
168 /// [long-running operation]: https://google.aip.dev/151
169 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
170 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
171 pub fn update_service_connection_map(
172 &self,
173 ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionMap {
174 super::builder::cross_network_automation_service::UpdateServiceConnectionMap::new(
175 self.inner.clone(),
176 )
177 }
178
179 /// Deletes a single ServiceConnectionMap.
180 ///
181 /// # Long running operations
182 ///
183 /// This method is used to start, and/or poll a [long-running Operation].
184 /// The [Working with long-running operations] chapter in the [user guide]
185 /// covers these operations in detail.
186 ///
187 /// [long-running operation]: https://google.aip.dev/151
188 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
189 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
190 pub fn delete_service_connection_map(
191 &self,
192 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionMap {
193 super::builder::cross_network_automation_service::DeleteServiceConnectionMap::new(
194 self.inner.clone(),
195 )
196 }
197
198 /// Lists ServiceConnectionPolicies in a given project and location.
199 pub fn list_service_connection_policies(
200 &self,
201 ) -> super::builder::cross_network_automation_service::ListServiceConnectionPolicies {
202 super::builder::cross_network_automation_service::ListServiceConnectionPolicies::new(
203 self.inner.clone(),
204 )
205 }
206
207 /// Gets details of a single ServiceConnectionPolicy.
208 pub fn get_service_connection_policy(
209 &self,
210 ) -> super::builder::cross_network_automation_service::GetServiceConnectionPolicy {
211 super::builder::cross_network_automation_service::GetServiceConnectionPolicy::new(
212 self.inner.clone(),
213 )
214 }
215
216 /// Creates a new ServiceConnectionPolicy in a given project and location.
217 ///
218 /// # Long running operations
219 ///
220 /// This method is used to start, and/or poll a [long-running Operation].
221 /// The [Working with long-running operations] chapter in the [user guide]
222 /// covers these operations in detail.
223 ///
224 /// [long-running operation]: https://google.aip.dev/151
225 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
226 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
227 pub fn create_service_connection_policy(
228 &self,
229 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionPolicy {
230 super::builder::cross_network_automation_service::CreateServiceConnectionPolicy::new(
231 self.inner.clone(),
232 )
233 }
234
235 /// Updates the parameters of a single ServiceConnectionPolicy.
236 ///
237 /// # Long running operations
238 ///
239 /// This method is used to start, and/or poll a [long-running Operation].
240 /// The [Working with long-running operations] chapter in the [user guide]
241 /// covers these operations in detail.
242 ///
243 /// [long-running operation]: https://google.aip.dev/151
244 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
245 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
246 pub fn update_service_connection_policy(
247 &self,
248 ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy {
249 super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy::new(
250 self.inner.clone(),
251 )
252 }
253
254 /// Deletes a single ServiceConnectionPolicy.
255 ///
256 /// # Long running operations
257 ///
258 /// This method is used to start, and/or poll a [long-running Operation].
259 /// The [Working with long-running operations] chapter in the [user guide]
260 /// covers these operations in detail.
261 ///
262 /// [long-running operation]: https://google.aip.dev/151
263 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
264 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
265 pub fn delete_service_connection_policy(
266 &self,
267 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy {
268 super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy::new(
269 self.inner.clone(),
270 )
271 }
272
273 /// Lists ServiceClasses in a given project and location.
274 pub fn list_service_classes(
275 &self,
276 ) -> super::builder::cross_network_automation_service::ListServiceClasses {
277 super::builder::cross_network_automation_service::ListServiceClasses::new(
278 self.inner.clone(),
279 )
280 }
281
282 /// Gets details of a single ServiceClass.
283 pub fn get_service_class(
284 &self,
285 ) -> super::builder::cross_network_automation_service::GetServiceClass {
286 super::builder::cross_network_automation_service::GetServiceClass::new(self.inner.clone())
287 }
288
289 /// Updates the parameters of a single ServiceClass.
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 update_service_class(
301 &self,
302 ) -> super::builder::cross_network_automation_service::UpdateServiceClass {
303 super::builder::cross_network_automation_service::UpdateServiceClass::new(
304 self.inner.clone(),
305 )
306 }
307
308 /// Deletes a single ServiceClass.
309 ///
310 /// # Long running operations
311 ///
312 /// This method is used to start, and/or poll a [long-running Operation].
313 /// The [Working with long-running operations] chapter in the [user guide]
314 /// covers these operations in detail.
315 ///
316 /// [long-running operation]: https://google.aip.dev/151
317 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
318 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
319 pub fn delete_service_class(
320 &self,
321 ) -> super::builder::cross_network_automation_service::DeleteServiceClass {
322 super::builder::cross_network_automation_service::DeleteServiceClass::new(
323 self.inner.clone(),
324 )
325 }
326
327 /// Gets details of a single ServiceConnectionToken.
328 pub fn get_service_connection_token(
329 &self,
330 ) -> super::builder::cross_network_automation_service::GetServiceConnectionToken {
331 super::builder::cross_network_automation_service::GetServiceConnectionToken::new(
332 self.inner.clone(),
333 )
334 }
335
336 /// Lists ServiceConnectionTokens in a given project and location.
337 pub fn list_service_connection_tokens(
338 &self,
339 ) -> super::builder::cross_network_automation_service::ListServiceConnectionTokens {
340 super::builder::cross_network_automation_service::ListServiceConnectionTokens::new(
341 self.inner.clone(),
342 )
343 }
344
345 /// Creates a new ServiceConnectionToken in a given project and location.
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 pub fn create_service_connection_token(
357 &self,
358 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionToken {
359 super::builder::cross_network_automation_service::CreateServiceConnectionToken::new(
360 self.inner.clone(),
361 )
362 }
363
364 /// Deletes a single ServiceConnectionToken.
365 ///
366 /// # Long running operations
367 ///
368 /// This method is used to start, and/or poll a [long-running Operation].
369 /// The [Working with long-running operations] chapter in the [user guide]
370 /// covers these operations in detail.
371 ///
372 /// [long-running operation]: https://google.aip.dev/151
373 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
374 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
375 pub fn delete_service_connection_token(
376 &self,
377 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionToken {
378 super::builder::cross_network_automation_service::DeleteServiceConnectionToken::new(
379 self.inner.clone(),
380 )
381 }
382
383 /// Lists information about the supported locations for this service.
384 pub fn list_locations(
385 &self,
386 ) -> super::builder::cross_network_automation_service::ListLocations {
387 super::builder::cross_network_automation_service::ListLocations::new(self.inner.clone())
388 }
389
390 /// Gets information about a location.
391 pub fn get_location(&self) -> super::builder::cross_network_automation_service::GetLocation {
392 super::builder::cross_network_automation_service::GetLocation::new(self.inner.clone())
393 }
394
395 /// Sets the access control policy on the specified resource. Replaces
396 /// any existing policy.
397 ///
398 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
399 /// errors.
400 pub fn set_iam_policy(&self) -> super::builder::cross_network_automation_service::SetIamPolicy {
401 super::builder::cross_network_automation_service::SetIamPolicy::new(self.inner.clone())
402 }
403
404 /// Gets the access control policy for a resource. Returns an empty policy
405 /// if the resource exists and does not have a policy set.
406 pub fn get_iam_policy(&self) -> super::builder::cross_network_automation_service::GetIamPolicy {
407 super::builder::cross_network_automation_service::GetIamPolicy::new(self.inner.clone())
408 }
409
410 /// Returns permissions that a caller has on the specified resource. If the
411 /// resource does not exist, this will return an empty set of
412 /// permissions, not a `NOT_FOUND` error.
413 ///
414 /// Note: This operation is designed to be used for building
415 /// permission-aware UIs and command-line tools, not for authorization
416 /// checking. This operation may "fail open" without warning.
417 pub fn test_iam_permissions(
418 &self,
419 ) -> super::builder::cross_network_automation_service::TestIamPermissions {
420 super::builder::cross_network_automation_service::TestIamPermissions::new(
421 self.inner.clone(),
422 )
423 }
424
425 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
426 ///
427 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
428 pub fn list_operations(
429 &self,
430 ) -> super::builder::cross_network_automation_service::ListOperations {
431 super::builder::cross_network_automation_service::ListOperations::new(self.inner.clone())
432 }
433
434 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
435 ///
436 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
437 pub fn get_operation(&self) -> super::builder::cross_network_automation_service::GetOperation {
438 super::builder::cross_network_automation_service::GetOperation::new(self.inner.clone())
439 }
440
441 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
442 ///
443 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
444 pub fn delete_operation(
445 &self,
446 ) -> super::builder::cross_network_automation_service::DeleteOperation {
447 super::builder::cross_network_automation_service::DeleteOperation::new(self.inner.clone())
448 }
449
450 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
451 ///
452 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
453 pub fn cancel_operation(
454 &self,
455 ) -> super::builder::cross_network_automation_service::CancelOperation {
456 super::builder::cross_network_automation_service::CancelOperation::new(self.inner.clone())
457 }
458}
459
460/// Implements a client for the Network Connectivity API.
461///
462/// # Example
463/// ```
464/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
465/// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
466/// let client = DataTransferService::builder().build().await?;
467/// // use `client` to make requests to the Network Connectivity API.
468/// # Ok(()) }
469/// ```
470///
471/// # Service Description
472///
473/// DataTransferService is the service for the Data Transfer API.
474///
475/// # Configuration
476///
477/// To configure `DataTransferService` use the `with_*` methods in the type returned
478/// by [builder()][DataTransferService::builder]. The default configuration should
479/// work for most applications. Common configuration changes include
480///
481/// * [with_endpoint()]: by default this client uses the global default endpoint
482/// (`https://networkconnectivity.googleapis.com`). Applications using regional
483/// endpoints or running in restricted networks (e.g. a network configured
484// with [Private Google Access with VPC Service Controls]) may want to
485/// override this default.
486/// * [with_credentials()]: by default this client uses
487/// [Application Default Credentials]. Applications using custom
488/// authentication may need to override this default.
489///
490/// [with_endpoint()]: super::builder::data_transfer_service::ClientBuilder::with_endpoint
491/// [with_credentials()]: super::builder::data_transfer_service::ClientBuilder::credentials
492/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
493/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
494///
495/// # Pooling and Cloning
496///
497/// `DataTransferService` holds a connection pool internally, it is advised to
498/// create one and the reuse it. You do not need to wrap `DataTransferService` in
499/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
500/// already uses an `Arc` internally.
501#[derive(Clone, Debug)]
502pub struct DataTransferService {
503 inner: std::sync::Arc<dyn super::stub::dynamic::DataTransferService>,
504}
505
506impl DataTransferService {
507 /// Returns a builder for [DataTransferService].
508 ///
509 /// ```
510 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
511 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
512 /// let client = DataTransferService::builder().build().await?;
513 /// # Ok(()) }
514 /// ```
515 pub fn builder() -> super::builder::data_transfer_service::ClientBuilder {
516 crate::new_client_builder(super::builder::data_transfer_service::client::Factory)
517 }
518
519 /// Creates a new client from the provided stub.
520 ///
521 /// The most common case for calling this function is in tests mocking the
522 /// client's behavior.
523 pub fn from_stub<T>(stub: T) -> Self
524 where
525 T: super::stub::DataTransferService + 'static,
526 {
527 Self {
528 inner: std::sync::Arc::new(stub),
529 }
530 }
531
532 pub(crate) async fn new(
533 config: gaxi::options::ClientConfig,
534 ) -> crate::ClientBuilderResult<Self> {
535 let inner = Self::build_inner(config).await?;
536 Ok(Self { inner })
537 }
538
539 async fn build_inner(
540 conf: gaxi::options::ClientConfig,
541 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DataTransferService>>
542 {
543 if gaxi::options::tracing_enabled(&conf) {
544 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
545 }
546 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
547 }
548
549 async fn build_transport(
550 conf: gaxi::options::ClientConfig,
551 ) -> crate::ClientBuilderResult<impl super::stub::DataTransferService> {
552 super::transport::DataTransferService::new(conf).await
553 }
554
555 async fn build_with_tracing(
556 conf: gaxi::options::ClientConfig,
557 ) -> crate::ClientBuilderResult<impl super::stub::DataTransferService> {
558 Self::build_transport(conf)
559 .await
560 .map(super::tracing::DataTransferService::new)
561 }
562
563 /// Lists the `MulticloudDataTransferConfig` resources in a specified project
564 /// and location.
565 pub fn list_multicloud_data_transfer_configs(
566 &self,
567 ) -> super::builder::data_transfer_service::ListMulticloudDataTransferConfigs {
568 super::builder::data_transfer_service::ListMulticloudDataTransferConfigs::new(
569 self.inner.clone(),
570 )
571 }
572
573 /// Gets the details of a `MulticloudDataTransferConfig` resource.
574 pub fn get_multicloud_data_transfer_config(
575 &self,
576 ) -> super::builder::data_transfer_service::GetMulticloudDataTransferConfig {
577 super::builder::data_transfer_service::GetMulticloudDataTransferConfig::new(
578 self.inner.clone(),
579 )
580 }
581
582 /// Creates a `MulticloudDataTransferConfig` resource in a specified project
583 /// and location.
584 ///
585 /// # Long running operations
586 ///
587 /// This method is used to start, and/or poll a [long-running Operation].
588 /// The [Working with long-running operations] chapter in the [user guide]
589 /// covers these operations in detail.
590 ///
591 /// [long-running operation]: https://google.aip.dev/151
592 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
593 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
594 pub fn create_multicloud_data_transfer_config(
595 &self,
596 ) -> super::builder::data_transfer_service::CreateMulticloudDataTransferConfig {
597 super::builder::data_transfer_service::CreateMulticloudDataTransferConfig::new(
598 self.inner.clone(),
599 )
600 }
601
602 /// Updates a `MulticloudDataTransferConfig` resource in a specified project
603 /// and location.
604 ///
605 /// # Long running operations
606 ///
607 /// This method is used to start, and/or poll a [long-running Operation].
608 /// The [Working with long-running operations] chapter in the [user guide]
609 /// covers these operations in detail.
610 ///
611 /// [long-running operation]: https://google.aip.dev/151
612 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
613 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
614 pub fn update_multicloud_data_transfer_config(
615 &self,
616 ) -> super::builder::data_transfer_service::UpdateMulticloudDataTransferConfig {
617 super::builder::data_transfer_service::UpdateMulticloudDataTransferConfig::new(
618 self.inner.clone(),
619 )
620 }
621
622 /// Deletes a `MulticloudDataTransferConfig` resource.
623 ///
624 /// # Long running operations
625 ///
626 /// This method is used to start, and/or poll a [long-running Operation].
627 /// The [Working with long-running operations] chapter in the [user guide]
628 /// covers these operations in detail.
629 ///
630 /// [long-running operation]: https://google.aip.dev/151
631 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
632 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
633 pub fn delete_multicloud_data_transfer_config(
634 &self,
635 ) -> super::builder::data_transfer_service::DeleteMulticloudDataTransferConfig {
636 super::builder::data_transfer_service::DeleteMulticloudDataTransferConfig::new(
637 self.inner.clone(),
638 )
639 }
640
641 /// Lists the `Destination` resources in a specified project and location.
642 pub fn list_destinations(&self) -> super::builder::data_transfer_service::ListDestinations {
643 super::builder::data_transfer_service::ListDestinations::new(self.inner.clone())
644 }
645
646 /// Gets the details of a `Destination` resource.
647 pub fn get_destination(&self) -> super::builder::data_transfer_service::GetDestination {
648 super::builder::data_transfer_service::GetDestination::new(self.inner.clone())
649 }
650
651 /// Creates a `Destination` resource in a specified project and location.
652 ///
653 /// # Long running operations
654 ///
655 /// This method is used to start, and/or poll a [long-running Operation].
656 /// The [Working with long-running operations] chapter in the [user guide]
657 /// covers these operations in detail.
658 ///
659 /// [long-running operation]: https://google.aip.dev/151
660 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
661 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
662 pub fn create_destination(&self) -> super::builder::data_transfer_service::CreateDestination {
663 super::builder::data_transfer_service::CreateDestination::new(self.inner.clone())
664 }
665
666 /// Updates a `Destination` resource in a specified project and location.
667 ///
668 /// # Long running operations
669 ///
670 /// This method is used to start, and/or poll a [long-running Operation].
671 /// The [Working with long-running operations] chapter in the [user guide]
672 /// covers these operations in detail.
673 ///
674 /// [long-running operation]: https://google.aip.dev/151
675 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
676 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
677 pub fn update_destination(&self) -> super::builder::data_transfer_service::UpdateDestination {
678 super::builder::data_transfer_service::UpdateDestination::new(self.inner.clone())
679 }
680
681 /// Deletes a `Destination` resource.
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 pub fn delete_destination(&self) -> super::builder::data_transfer_service::DeleteDestination {
693 super::builder::data_transfer_service::DeleteDestination::new(self.inner.clone())
694 }
695
696 /// Gets the details of a service that is supported for Data Transfer
697 /// Essentials.
698 pub fn get_multicloud_data_transfer_supported_service(
699 &self,
700 ) -> super::builder::data_transfer_service::GetMulticloudDataTransferSupportedService {
701 super::builder::data_transfer_service::GetMulticloudDataTransferSupportedService::new(
702 self.inner.clone(),
703 )
704 }
705
706 /// Lists the services in the project for a region that are supported for
707 /// Data Transfer Essentials.
708 pub fn list_multicloud_data_transfer_supported_services(
709 &self,
710 ) -> super::builder::data_transfer_service::ListMulticloudDataTransferSupportedServices {
711 super::builder::data_transfer_service::ListMulticloudDataTransferSupportedServices::new(
712 self.inner.clone(),
713 )
714 }
715
716 /// Lists information about the supported locations for this service.
717 pub fn list_locations(&self) -> super::builder::data_transfer_service::ListLocations {
718 super::builder::data_transfer_service::ListLocations::new(self.inner.clone())
719 }
720
721 /// Gets information about a location.
722 pub fn get_location(&self) -> super::builder::data_transfer_service::GetLocation {
723 super::builder::data_transfer_service::GetLocation::new(self.inner.clone())
724 }
725
726 /// Sets the access control policy on the specified resource. Replaces
727 /// any existing policy.
728 ///
729 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
730 /// errors.
731 pub fn set_iam_policy(&self) -> super::builder::data_transfer_service::SetIamPolicy {
732 super::builder::data_transfer_service::SetIamPolicy::new(self.inner.clone())
733 }
734
735 /// Gets the access control policy for a resource. Returns an empty policy
736 /// if the resource exists and does not have a policy set.
737 pub fn get_iam_policy(&self) -> super::builder::data_transfer_service::GetIamPolicy {
738 super::builder::data_transfer_service::GetIamPolicy::new(self.inner.clone())
739 }
740
741 /// Returns permissions that a caller has on the specified resource. If the
742 /// resource does not exist, this will return an empty set of
743 /// permissions, not a `NOT_FOUND` error.
744 ///
745 /// Note: This operation is designed to be used for building
746 /// permission-aware UIs and command-line tools, not for authorization
747 /// checking. This operation may "fail open" without warning.
748 pub fn test_iam_permissions(
749 &self,
750 ) -> super::builder::data_transfer_service::TestIamPermissions {
751 super::builder::data_transfer_service::TestIamPermissions::new(self.inner.clone())
752 }
753
754 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
755 ///
756 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
757 pub fn list_operations(&self) -> super::builder::data_transfer_service::ListOperations {
758 super::builder::data_transfer_service::ListOperations::new(self.inner.clone())
759 }
760
761 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
762 ///
763 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
764 pub fn get_operation(&self) -> super::builder::data_transfer_service::GetOperation {
765 super::builder::data_transfer_service::GetOperation::new(self.inner.clone())
766 }
767
768 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
769 ///
770 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
771 pub fn delete_operation(&self) -> super::builder::data_transfer_service::DeleteOperation {
772 super::builder::data_transfer_service::DeleteOperation::new(self.inner.clone())
773 }
774
775 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
776 ///
777 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
778 pub fn cancel_operation(&self) -> super::builder::data_transfer_service::CancelOperation {
779 super::builder::data_transfer_service::CancelOperation::new(self.inner.clone())
780 }
781}
782
783/// Implements a client for the Network Connectivity API.
784///
785/// # Example
786/// ```
787/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
788/// # use google_cloud_networkconnectivity_v1::client::HubService;
789/// let client = HubService::builder().build().await?;
790/// // use `client` to make requests to the Network Connectivity API.
791/// # Ok(()) }
792/// ```
793///
794/// # Service Description
795///
796/// Network Connectivity Center is a hub-and-spoke abstraction for network
797/// connectivity management in Google Cloud. It reduces operational complexity
798/// through a simple, centralized connectivity management model.
799///
800/// # Configuration
801///
802/// To configure `HubService` use the `with_*` methods in the type returned
803/// by [builder()][HubService::builder]. The default configuration should
804/// work for most applications. Common configuration changes include
805///
806/// * [with_endpoint()]: by default this client uses the global default endpoint
807/// (`https://networkconnectivity.googleapis.com`). Applications using regional
808/// endpoints or running in restricted networks (e.g. a network configured
809// with [Private Google Access with VPC Service Controls]) may want to
810/// override this default.
811/// * [with_credentials()]: by default this client uses
812/// [Application Default Credentials]. Applications using custom
813/// authentication may need to override this default.
814///
815/// [with_endpoint()]: super::builder::hub_service::ClientBuilder::with_endpoint
816/// [with_credentials()]: super::builder::hub_service::ClientBuilder::credentials
817/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
818/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
819///
820/// # Pooling and Cloning
821///
822/// `HubService` holds a connection pool internally, it is advised to
823/// create one and the reuse it. You do not need to wrap `HubService` in
824/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
825/// already uses an `Arc` internally.
826#[derive(Clone, Debug)]
827pub struct HubService {
828 inner: std::sync::Arc<dyn super::stub::dynamic::HubService>,
829}
830
831impl HubService {
832 /// Returns a builder for [HubService].
833 ///
834 /// ```
835 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
836 /// # use google_cloud_networkconnectivity_v1::client::HubService;
837 /// let client = HubService::builder().build().await?;
838 /// # Ok(()) }
839 /// ```
840 pub fn builder() -> super::builder::hub_service::ClientBuilder {
841 crate::new_client_builder(super::builder::hub_service::client::Factory)
842 }
843
844 /// Creates a new client from the provided stub.
845 ///
846 /// The most common case for calling this function is in tests mocking the
847 /// client's behavior.
848 pub fn from_stub<T>(stub: T) -> Self
849 where
850 T: super::stub::HubService + 'static,
851 {
852 Self {
853 inner: std::sync::Arc::new(stub),
854 }
855 }
856
857 pub(crate) async fn new(
858 config: gaxi::options::ClientConfig,
859 ) -> crate::ClientBuilderResult<Self> {
860 let inner = Self::build_inner(config).await?;
861 Ok(Self { inner })
862 }
863
864 async fn build_inner(
865 conf: gaxi::options::ClientConfig,
866 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HubService>> {
867 if gaxi::options::tracing_enabled(&conf) {
868 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
869 }
870 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
871 }
872
873 async fn build_transport(
874 conf: gaxi::options::ClientConfig,
875 ) -> crate::ClientBuilderResult<impl super::stub::HubService> {
876 super::transport::HubService::new(conf).await
877 }
878
879 async fn build_with_tracing(
880 conf: gaxi::options::ClientConfig,
881 ) -> crate::ClientBuilderResult<impl super::stub::HubService> {
882 Self::build_transport(conf)
883 .await
884 .map(super::tracing::HubService::new)
885 }
886
887 /// Lists the Network Connectivity Center hubs associated with a given project.
888 pub fn list_hubs(&self) -> super::builder::hub_service::ListHubs {
889 super::builder::hub_service::ListHubs::new(self.inner.clone())
890 }
891
892 /// Gets details about a Network Connectivity Center hub.
893 pub fn get_hub(&self) -> super::builder::hub_service::GetHub {
894 super::builder::hub_service::GetHub::new(self.inner.clone())
895 }
896
897 /// Creates a new Network Connectivity Center hub in the specified project.
898 ///
899 /// # Long running operations
900 ///
901 /// This method is used to start, and/or poll a [long-running Operation].
902 /// The [Working with long-running operations] chapter in the [user guide]
903 /// covers these operations in detail.
904 ///
905 /// [long-running operation]: https://google.aip.dev/151
906 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
907 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
908 pub fn create_hub(&self) -> super::builder::hub_service::CreateHub {
909 super::builder::hub_service::CreateHub::new(self.inner.clone())
910 }
911
912 /// Updates the description and/or labels of a Network Connectivity Center
913 /// hub.
914 ///
915 /// # Long running operations
916 ///
917 /// This method is used to start, and/or poll a [long-running Operation].
918 /// The [Working with long-running operations] chapter in the [user guide]
919 /// covers these operations in detail.
920 ///
921 /// [long-running operation]: https://google.aip.dev/151
922 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
923 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
924 pub fn update_hub(&self) -> super::builder::hub_service::UpdateHub {
925 super::builder::hub_service::UpdateHub::new(self.inner.clone())
926 }
927
928 /// Deletes a Network Connectivity Center hub.
929 ///
930 /// # Long running operations
931 ///
932 /// This method is used to start, and/or poll a [long-running Operation].
933 /// The [Working with long-running operations] chapter in the [user guide]
934 /// covers these operations in detail.
935 ///
936 /// [long-running operation]: https://google.aip.dev/151
937 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
938 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
939 pub fn delete_hub(&self) -> super::builder::hub_service::DeleteHub {
940 super::builder::hub_service::DeleteHub::new(self.inner.clone())
941 }
942
943 /// Lists the Network Connectivity Center spokes associated with a
944 /// specified hub and location. The list includes both spokes that are attached
945 /// to the hub and spokes that have been proposed but not yet accepted.
946 pub fn list_hub_spokes(&self) -> super::builder::hub_service::ListHubSpokes {
947 super::builder::hub_service::ListHubSpokes::new(self.inner.clone())
948 }
949
950 /// Query the Private Service Connect propagation status of a Network
951 /// Connectivity Center hub.
952 pub fn query_hub_status(&self) -> super::builder::hub_service::QueryHubStatus {
953 super::builder::hub_service::QueryHubStatus::new(self.inner.clone())
954 }
955
956 /// Lists the Network Connectivity Center spokes in a specified project and
957 /// location.
958 pub fn list_spokes(&self) -> super::builder::hub_service::ListSpokes {
959 super::builder::hub_service::ListSpokes::new(self.inner.clone())
960 }
961
962 /// Gets details about a Network Connectivity Center spoke.
963 pub fn get_spoke(&self) -> super::builder::hub_service::GetSpoke {
964 super::builder::hub_service::GetSpoke::new(self.inner.clone())
965 }
966
967 /// Creates a Network Connectivity Center spoke.
968 ///
969 /// # Long running operations
970 ///
971 /// This method is used to start, and/or poll a [long-running Operation].
972 /// The [Working with long-running operations] chapter in the [user guide]
973 /// covers these operations in detail.
974 ///
975 /// [long-running operation]: https://google.aip.dev/151
976 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
977 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
978 pub fn create_spoke(&self) -> super::builder::hub_service::CreateSpoke {
979 super::builder::hub_service::CreateSpoke::new(self.inner.clone())
980 }
981
982 /// Updates the parameters of a Network Connectivity Center spoke.
983 ///
984 /// # Long running operations
985 ///
986 /// This method is used to start, and/or poll a [long-running Operation].
987 /// The [Working with long-running operations] chapter in the [user guide]
988 /// covers these operations in detail.
989 ///
990 /// [long-running operation]: https://google.aip.dev/151
991 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
992 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
993 pub fn update_spoke(&self) -> super::builder::hub_service::UpdateSpoke {
994 super::builder::hub_service::UpdateSpoke::new(self.inner.clone())
995 }
996
997 /// Rejects a Network Connectivity Center spoke from being attached to a hub.
998 /// If the spoke was previously in the `ACTIVE` state, it
999 /// transitions to the `INACTIVE` state and is no longer able to
1000 /// connect to other spokes that are attached to the hub.
1001 ///
1002 /// # Long running operations
1003 ///
1004 /// This method is used to start, and/or poll a [long-running Operation].
1005 /// The [Working with long-running operations] chapter in the [user guide]
1006 /// covers these operations in detail.
1007 ///
1008 /// [long-running operation]: https://google.aip.dev/151
1009 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1010 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1011 pub fn reject_hub_spoke(&self) -> super::builder::hub_service::RejectHubSpoke {
1012 super::builder::hub_service::RejectHubSpoke::new(self.inner.clone())
1013 }
1014
1015 /// Accepts a proposal to attach a Network Connectivity Center spoke
1016 /// to a hub.
1017 ///
1018 /// # Long running operations
1019 ///
1020 /// This method is used to start, and/or poll a [long-running Operation].
1021 /// The [Working with long-running operations] chapter in the [user guide]
1022 /// covers these operations in detail.
1023 ///
1024 /// [long-running operation]: https://google.aip.dev/151
1025 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1026 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1027 pub fn accept_hub_spoke(&self) -> super::builder::hub_service::AcceptHubSpoke {
1028 super::builder::hub_service::AcceptHubSpoke::new(self.inner.clone())
1029 }
1030
1031 /// Accepts a proposal to update a Network Connectivity Center spoke in a hub.
1032 ///
1033 /// # Long running operations
1034 ///
1035 /// This method is used to start, and/or poll a [long-running Operation].
1036 /// The [Working with long-running operations] chapter in the [user guide]
1037 /// covers these operations in detail.
1038 ///
1039 /// [long-running operation]: https://google.aip.dev/151
1040 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1041 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1042 pub fn accept_spoke_update(&self) -> super::builder::hub_service::AcceptSpokeUpdate {
1043 super::builder::hub_service::AcceptSpokeUpdate::new(self.inner.clone())
1044 }
1045
1046 /// Rejects a proposal to update a Network Connectivity Center spoke in a hub.
1047 ///
1048 /// # Long running operations
1049 ///
1050 /// This method is used to start, and/or poll a [long-running Operation].
1051 /// The [Working with long-running operations] chapter in the [user guide]
1052 /// covers these operations in detail.
1053 ///
1054 /// [long-running operation]: https://google.aip.dev/151
1055 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1056 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1057 pub fn reject_spoke_update(&self) -> super::builder::hub_service::RejectSpokeUpdate {
1058 super::builder::hub_service::RejectSpokeUpdate::new(self.inner.clone())
1059 }
1060
1061 /// Deletes a Network Connectivity Center spoke.
1062 ///
1063 /// # Long running operations
1064 ///
1065 /// This method is used to start, and/or poll a [long-running Operation].
1066 /// The [Working with long-running operations] chapter in the [user guide]
1067 /// covers these operations in detail.
1068 ///
1069 /// [long-running operation]: https://google.aip.dev/151
1070 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1071 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1072 pub fn delete_spoke(&self) -> super::builder::hub_service::DeleteSpoke {
1073 super::builder::hub_service::DeleteSpoke::new(self.inner.clone())
1074 }
1075
1076 /// Gets details about a Network Connectivity Center route table.
1077 pub fn get_route_table(&self) -> super::builder::hub_service::GetRouteTable {
1078 super::builder::hub_service::GetRouteTable::new(self.inner.clone())
1079 }
1080
1081 /// Gets details about the specified route.
1082 pub fn get_route(&self) -> super::builder::hub_service::GetRoute {
1083 super::builder::hub_service::GetRoute::new(self.inner.clone())
1084 }
1085
1086 /// Lists routes in a given route table.
1087 pub fn list_routes(&self) -> super::builder::hub_service::ListRoutes {
1088 super::builder::hub_service::ListRoutes::new(self.inner.clone())
1089 }
1090
1091 /// Lists route tables in a given hub.
1092 pub fn list_route_tables(&self) -> super::builder::hub_service::ListRouteTables {
1093 super::builder::hub_service::ListRouteTables::new(self.inner.clone())
1094 }
1095
1096 /// Gets details about a Network Connectivity Center group.
1097 pub fn get_group(&self) -> super::builder::hub_service::GetGroup {
1098 super::builder::hub_service::GetGroup::new(self.inner.clone())
1099 }
1100
1101 /// Lists groups in a given hub.
1102 pub fn list_groups(&self) -> super::builder::hub_service::ListGroups {
1103 super::builder::hub_service::ListGroups::new(self.inner.clone())
1104 }
1105
1106 /// Updates the parameters of a Network Connectivity Center group.
1107 ///
1108 /// # Long running operations
1109 ///
1110 /// This method is used to start, and/or poll a [long-running Operation].
1111 /// The [Working with long-running operations] chapter in the [user guide]
1112 /// covers these operations in detail.
1113 ///
1114 /// [long-running operation]: https://google.aip.dev/151
1115 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1116 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1117 pub fn update_group(&self) -> super::builder::hub_service::UpdateGroup {
1118 super::builder::hub_service::UpdateGroup::new(self.inner.clone())
1119 }
1120
1121 /// Lists information about the supported locations for this service.
1122 pub fn list_locations(&self) -> super::builder::hub_service::ListLocations {
1123 super::builder::hub_service::ListLocations::new(self.inner.clone())
1124 }
1125
1126 /// Gets information about a location.
1127 pub fn get_location(&self) -> super::builder::hub_service::GetLocation {
1128 super::builder::hub_service::GetLocation::new(self.inner.clone())
1129 }
1130
1131 /// Sets the access control policy on the specified resource. Replaces
1132 /// any existing policy.
1133 ///
1134 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1135 /// errors.
1136 pub fn set_iam_policy(&self) -> super::builder::hub_service::SetIamPolicy {
1137 super::builder::hub_service::SetIamPolicy::new(self.inner.clone())
1138 }
1139
1140 /// Gets the access control policy for a resource. Returns an empty policy
1141 /// if the resource exists and does not have a policy set.
1142 pub fn get_iam_policy(&self) -> super::builder::hub_service::GetIamPolicy {
1143 super::builder::hub_service::GetIamPolicy::new(self.inner.clone())
1144 }
1145
1146 /// Returns permissions that a caller has on the specified resource. If the
1147 /// resource does not exist, this will return an empty set of
1148 /// permissions, not a `NOT_FOUND` error.
1149 ///
1150 /// Note: This operation is designed to be used for building
1151 /// permission-aware UIs and command-line tools, not for authorization
1152 /// checking. This operation may "fail open" without warning.
1153 pub fn test_iam_permissions(&self) -> super::builder::hub_service::TestIamPermissions {
1154 super::builder::hub_service::TestIamPermissions::new(self.inner.clone())
1155 }
1156
1157 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1158 ///
1159 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1160 pub fn list_operations(&self) -> super::builder::hub_service::ListOperations {
1161 super::builder::hub_service::ListOperations::new(self.inner.clone())
1162 }
1163
1164 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1165 ///
1166 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1167 pub fn get_operation(&self) -> super::builder::hub_service::GetOperation {
1168 super::builder::hub_service::GetOperation::new(self.inner.clone())
1169 }
1170
1171 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1172 ///
1173 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1174 pub fn delete_operation(&self) -> super::builder::hub_service::DeleteOperation {
1175 super::builder::hub_service::DeleteOperation::new(self.inner.clone())
1176 }
1177
1178 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1179 ///
1180 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1181 pub fn cancel_operation(&self) -> super::builder::hub_service::CancelOperation {
1182 super::builder::hub_service::CancelOperation::new(self.inner.clone())
1183 }
1184}
1185
1186/// Implements a client for the Network Connectivity API.
1187///
1188/// # Example
1189/// ```
1190/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1191/// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
1192/// let client = InternalRangeService::builder().build().await?;
1193/// // use `client` to make requests to the Network Connectivity API.
1194/// # Ok(()) }
1195/// ```
1196///
1197/// # Service Description
1198///
1199/// The CLH-based service for internal range resources used to perform IPAM
1200/// operations within a VPC network.
1201///
1202/// # Configuration
1203///
1204/// To configure `InternalRangeService` use the `with_*` methods in the type returned
1205/// by [builder()][InternalRangeService::builder]. The default configuration should
1206/// work for most applications. Common configuration changes include
1207///
1208/// * [with_endpoint()]: by default this client uses the global default endpoint
1209/// (`https://networkconnectivity.googleapis.com`). Applications using regional
1210/// endpoints or running in restricted networks (e.g. a network configured
1211// with [Private Google Access with VPC Service Controls]) may want to
1212/// override this default.
1213/// * [with_credentials()]: by default this client uses
1214/// [Application Default Credentials]. Applications using custom
1215/// authentication may need to override this default.
1216///
1217/// [with_endpoint()]: super::builder::internal_range_service::ClientBuilder::with_endpoint
1218/// [with_credentials()]: super::builder::internal_range_service::ClientBuilder::credentials
1219/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1220/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1221///
1222/// # Pooling and Cloning
1223///
1224/// `InternalRangeService` holds a connection pool internally, it is advised to
1225/// create one and the reuse it. You do not need to wrap `InternalRangeService` in
1226/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1227/// already uses an `Arc` internally.
1228#[derive(Clone, Debug)]
1229pub struct InternalRangeService {
1230 inner: std::sync::Arc<dyn super::stub::dynamic::InternalRangeService>,
1231}
1232
1233impl InternalRangeService {
1234 /// Returns a builder for [InternalRangeService].
1235 ///
1236 /// ```
1237 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1238 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
1239 /// let client = InternalRangeService::builder().build().await?;
1240 /// # Ok(()) }
1241 /// ```
1242 pub fn builder() -> super::builder::internal_range_service::ClientBuilder {
1243 crate::new_client_builder(super::builder::internal_range_service::client::Factory)
1244 }
1245
1246 /// Creates a new client from the provided stub.
1247 ///
1248 /// The most common case for calling this function is in tests mocking the
1249 /// client's behavior.
1250 pub fn from_stub<T>(stub: T) -> Self
1251 where
1252 T: super::stub::InternalRangeService + 'static,
1253 {
1254 Self {
1255 inner: std::sync::Arc::new(stub),
1256 }
1257 }
1258
1259 pub(crate) async fn new(
1260 config: gaxi::options::ClientConfig,
1261 ) -> crate::ClientBuilderResult<Self> {
1262 let inner = Self::build_inner(config).await?;
1263 Ok(Self { inner })
1264 }
1265
1266 async fn build_inner(
1267 conf: gaxi::options::ClientConfig,
1268 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InternalRangeService>>
1269 {
1270 if gaxi::options::tracing_enabled(&conf) {
1271 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1272 }
1273 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1274 }
1275
1276 async fn build_transport(
1277 conf: gaxi::options::ClientConfig,
1278 ) -> crate::ClientBuilderResult<impl super::stub::InternalRangeService> {
1279 super::transport::InternalRangeService::new(conf).await
1280 }
1281
1282 async fn build_with_tracing(
1283 conf: gaxi::options::ClientConfig,
1284 ) -> crate::ClientBuilderResult<impl super::stub::InternalRangeService> {
1285 Self::build_transport(conf)
1286 .await
1287 .map(super::tracing::InternalRangeService::new)
1288 }
1289
1290 /// Lists internal ranges in a given project and location.
1291 pub fn list_internal_ranges(
1292 &self,
1293 ) -> super::builder::internal_range_service::ListInternalRanges {
1294 super::builder::internal_range_service::ListInternalRanges::new(self.inner.clone())
1295 }
1296
1297 /// Gets details of a single internal range.
1298 pub fn get_internal_range(&self) -> super::builder::internal_range_service::GetInternalRange {
1299 super::builder::internal_range_service::GetInternalRange::new(self.inner.clone())
1300 }
1301
1302 /// Creates a new internal range in a given project and location.
1303 ///
1304 /// # Long running operations
1305 ///
1306 /// This method is used to start, and/or poll a [long-running Operation].
1307 /// The [Working with long-running operations] chapter in the [user guide]
1308 /// covers these operations in detail.
1309 ///
1310 /// [long-running operation]: https://google.aip.dev/151
1311 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1312 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1313 pub fn create_internal_range(
1314 &self,
1315 ) -> super::builder::internal_range_service::CreateInternalRange {
1316 super::builder::internal_range_service::CreateInternalRange::new(self.inner.clone())
1317 }
1318
1319 /// Updates the parameters of a single internal range.
1320 ///
1321 /// # Long running operations
1322 ///
1323 /// This method is used to start, and/or poll a [long-running Operation].
1324 /// The [Working with long-running operations] chapter in the [user guide]
1325 /// covers these operations in detail.
1326 ///
1327 /// [long-running operation]: https://google.aip.dev/151
1328 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1329 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1330 pub fn update_internal_range(
1331 &self,
1332 ) -> super::builder::internal_range_service::UpdateInternalRange {
1333 super::builder::internal_range_service::UpdateInternalRange::new(self.inner.clone())
1334 }
1335
1336 /// Deletes a single internal range.
1337 ///
1338 /// # Long running operations
1339 ///
1340 /// This method is used to start, and/or poll a [long-running Operation].
1341 /// The [Working with long-running operations] chapter in the [user guide]
1342 /// covers these operations in detail.
1343 ///
1344 /// [long-running operation]: https://google.aip.dev/151
1345 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1346 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1347 pub fn delete_internal_range(
1348 &self,
1349 ) -> super::builder::internal_range_service::DeleteInternalRange {
1350 super::builder::internal_range_service::DeleteInternalRange::new(self.inner.clone())
1351 }
1352
1353 /// Lists information about the supported locations for this service.
1354 pub fn list_locations(&self) -> super::builder::internal_range_service::ListLocations {
1355 super::builder::internal_range_service::ListLocations::new(self.inner.clone())
1356 }
1357
1358 /// Gets information about a location.
1359 pub fn get_location(&self) -> super::builder::internal_range_service::GetLocation {
1360 super::builder::internal_range_service::GetLocation::new(self.inner.clone())
1361 }
1362
1363 /// Sets the access control policy on the specified resource. Replaces
1364 /// any existing policy.
1365 ///
1366 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1367 /// errors.
1368 pub fn set_iam_policy(&self) -> super::builder::internal_range_service::SetIamPolicy {
1369 super::builder::internal_range_service::SetIamPolicy::new(self.inner.clone())
1370 }
1371
1372 /// Gets the access control policy for a resource. Returns an empty policy
1373 /// if the resource exists and does not have a policy set.
1374 pub fn get_iam_policy(&self) -> super::builder::internal_range_service::GetIamPolicy {
1375 super::builder::internal_range_service::GetIamPolicy::new(self.inner.clone())
1376 }
1377
1378 /// Returns permissions that a caller has on the specified resource. If the
1379 /// resource does not exist, this will return an empty set of
1380 /// permissions, not a `NOT_FOUND` error.
1381 ///
1382 /// Note: This operation is designed to be used for building
1383 /// permission-aware UIs and command-line tools, not for authorization
1384 /// checking. This operation may "fail open" without warning.
1385 pub fn test_iam_permissions(
1386 &self,
1387 ) -> super::builder::internal_range_service::TestIamPermissions {
1388 super::builder::internal_range_service::TestIamPermissions::new(self.inner.clone())
1389 }
1390
1391 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1392 ///
1393 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1394 pub fn list_operations(&self) -> super::builder::internal_range_service::ListOperations {
1395 super::builder::internal_range_service::ListOperations::new(self.inner.clone())
1396 }
1397
1398 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1399 ///
1400 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1401 pub fn get_operation(&self) -> super::builder::internal_range_service::GetOperation {
1402 super::builder::internal_range_service::GetOperation::new(self.inner.clone())
1403 }
1404
1405 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1406 ///
1407 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1408 pub fn delete_operation(&self) -> super::builder::internal_range_service::DeleteOperation {
1409 super::builder::internal_range_service::DeleteOperation::new(self.inner.clone())
1410 }
1411
1412 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1413 ///
1414 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1415 pub fn cancel_operation(&self) -> super::builder::internal_range_service::CancelOperation {
1416 super::builder::internal_range_service::CancelOperation::new(self.inner.clone())
1417 }
1418}
1419
1420/// Implements a client for the Network Connectivity API.
1421///
1422/// # Example
1423/// ```
1424/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1425/// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
1426/// let client = PolicyBasedRoutingService::builder().build().await?;
1427/// // use `client` to make requests to the Network Connectivity API.
1428/// # Ok(()) }
1429/// ```
1430///
1431/// # Service Description
1432///
1433/// Policy-Based Routing allows GCP customers to specify flexibile routing
1434/// policies for Layer 4 traffic traversing through the connected service.
1435///
1436/// # Configuration
1437///
1438/// To configure `PolicyBasedRoutingService` use the `with_*` methods in the type returned
1439/// by [builder()][PolicyBasedRoutingService::builder]. The default configuration should
1440/// work for most applications. Common configuration changes include
1441///
1442/// * [with_endpoint()]: by default this client uses the global default endpoint
1443/// (`https://networkconnectivity.googleapis.com`). Applications using regional
1444/// endpoints or running in restricted networks (e.g. a network configured
1445// with [Private Google Access with VPC Service Controls]) may want to
1446/// override this default.
1447/// * [with_credentials()]: by default this client uses
1448/// [Application Default Credentials]. Applications using custom
1449/// authentication may need to override this default.
1450///
1451/// [with_endpoint()]: super::builder::policy_based_routing_service::ClientBuilder::with_endpoint
1452/// [with_credentials()]: super::builder::policy_based_routing_service::ClientBuilder::credentials
1453/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1454/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1455///
1456/// # Pooling and Cloning
1457///
1458/// `PolicyBasedRoutingService` holds a connection pool internally, it is advised to
1459/// create one and the reuse it. You do not need to wrap `PolicyBasedRoutingService` in
1460/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1461/// already uses an `Arc` internally.
1462#[derive(Clone, Debug)]
1463pub struct PolicyBasedRoutingService {
1464 inner: std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
1465}
1466
1467impl PolicyBasedRoutingService {
1468 /// Returns a builder for [PolicyBasedRoutingService].
1469 ///
1470 /// ```
1471 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1472 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
1473 /// let client = PolicyBasedRoutingService::builder().build().await?;
1474 /// # Ok(()) }
1475 /// ```
1476 pub fn builder() -> super::builder::policy_based_routing_service::ClientBuilder {
1477 crate::new_client_builder(super::builder::policy_based_routing_service::client::Factory)
1478 }
1479
1480 /// Creates a new client from the provided stub.
1481 ///
1482 /// The most common case for calling this function is in tests mocking the
1483 /// client's behavior.
1484 pub fn from_stub<T>(stub: T) -> Self
1485 where
1486 T: super::stub::PolicyBasedRoutingService + 'static,
1487 {
1488 Self {
1489 inner: std::sync::Arc::new(stub),
1490 }
1491 }
1492
1493 pub(crate) async fn new(
1494 config: gaxi::options::ClientConfig,
1495 ) -> crate::ClientBuilderResult<Self> {
1496 let inner = Self::build_inner(config).await?;
1497 Ok(Self { inner })
1498 }
1499
1500 async fn build_inner(
1501 conf: gaxi::options::ClientConfig,
1502 ) -> crate::ClientBuilderResult<
1503 std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
1504 > {
1505 if gaxi::options::tracing_enabled(&conf) {
1506 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1507 }
1508 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1509 }
1510
1511 async fn build_transport(
1512 conf: gaxi::options::ClientConfig,
1513 ) -> crate::ClientBuilderResult<impl super::stub::PolicyBasedRoutingService> {
1514 super::transport::PolicyBasedRoutingService::new(conf).await
1515 }
1516
1517 async fn build_with_tracing(
1518 conf: gaxi::options::ClientConfig,
1519 ) -> crate::ClientBuilderResult<impl super::stub::PolicyBasedRoutingService> {
1520 Self::build_transport(conf)
1521 .await
1522 .map(super::tracing::PolicyBasedRoutingService::new)
1523 }
1524
1525 /// Lists policy-based routes in a given project and location.
1526 pub fn list_policy_based_routes(
1527 &self,
1528 ) -> super::builder::policy_based_routing_service::ListPolicyBasedRoutes {
1529 super::builder::policy_based_routing_service::ListPolicyBasedRoutes::new(self.inner.clone())
1530 }
1531
1532 /// Gets details of a single policy-based route.
1533 pub fn get_policy_based_route(
1534 &self,
1535 ) -> super::builder::policy_based_routing_service::GetPolicyBasedRoute {
1536 super::builder::policy_based_routing_service::GetPolicyBasedRoute::new(self.inner.clone())
1537 }
1538
1539 /// Creates a new policy-based route in a given project and location.
1540 ///
1541 /// # Long running operations
1542 ///
1543 /// This method is used to start, and/or poll a [long-running Operation].
1544 /// The [Working with long-running operations] chapter in the [user guide]
1545 /// covers these operations in detail.
1546 ///
1547 /// [long-running operation]: https://google.aip.dev/151
1548 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1549 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1550 pub fn create_policy_based_route(
1551 &self,
1552 ) -> super::builder::policy_based_routing_service::CreatePolicyBasedRoute {
1553 super::builder::policy_based_routing_service::CreatePolicyBasedRoute::new(
1554 self.inner.clone(),
1555 )
1556 }
1557
1558 /// Deletes a single policy-based route.
1559 ///
1560 /// # Long running operations
1561 ///
1562 /// This method is used to start, and/or poll a [long-running Operation].
1563 /// The [Working with long-running operations] chapter in the [user guide]
1564 /// covers these operations in detail.
1565 ///
1566 /// [long-running operation]: https://google.aip.dev/151
1567 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1568 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1569 pub fn delete_policy_based_route(
1570 &self,
1571 ) -> super::builder::policy_based_routing_service::DeletePolicyBasedRoute {
1572 super::builder::policy_based_routing_service::DeletePolicyBasedRoute::new(
1573 self.inner.clone(),
1574 )
1575 }
1576
1577 /// Lists information about the supported locations for this service.
1578 pub fn list_locations(&self) -> super::builder::policy_based_routing_service::ListLocations {
1579 super::builder::policy_based_routing_service::ListLocations::new(self.inner.clone())
1580 }
1581
1582 /// Gets information about a location.
1583 pub fn get_location(&self) -> super::builder::policy_based_routing_service::GetLocation {
1584 super::builder::policy_based_routing_service::GetLocation::new(self.inner.clone())
1585 }
1586
1587 /// Sets the access control policy on the specified resource. Replaces
1588 /// any existing policy.
1589 ///
1590 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1591 /// errors.
1592 pub fn set_iam_policy(&self) -> super::builder::policy_based_routing_service::SetIamPolicy {
1593 super::builder::policy_based_routing_service::SetIamPolicy::new(self.inner.clone())
1594 }
1595
1596 /// Gets the access control policy for a resource. Returns an empty policy
1597 /// if the resource exists and does not have a policy set.
1598 pub fn get_iam_policy(&self) -> super::builder::policy_based_routing_service::GetIamPolicy {
1599 super::builder::policy_based_routing_service::GetIamPolicy::new(self.inner.clone())
1600 }
1601
1602 /// Returns permissions that a caller has on the specified resource. If the
1603 /// resource does not exist, this will return an empty set of
1604 /// permissions, not a `NOT_FOUND` error.
1605 ///
1606 /// Note: This operation is designed to be used for building
1607 /// permission-aware UIs and command-line tools, not for authorization
1608 /// checking. This operation may "fail open" without warning.
1609 pub fn test_iam_permissions(
1610 &self,
1611 ) -> super::builder::policy_based_routing_service::TestIamPermissions {
1612 super::builder::policy_based_routing_service::TestIamPermissions::new(self.inner.clone())
1613 }
1614
1615 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1616 ///
1617 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1618 pub fn list_operations(&self) -> super::builder::policy_based_routing_service::ListOperations {
1619 super::builder::policy_based_routing_service::ListOperations::new(self.inner.clone())
1620 }
1621
1622 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1623 ///
1624 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1625 pub fn get_operation(&self) -> super::builder::policy_based_routing_service::GetOperation {
1626 super::builder::policy_based_routing_service::GetOperation::new(self.inner.clone())
1627 }
1628
1629 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1630 ///
1631 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1632 pub fn delete_operation(
1633 &self,
1634 ) -> super::builder::policy_based_routing_service::DeleteOperation {
1635 super::builder::policy_based_routing_service::DeleteOperation::new(self.inner.clone())
1636 }
1637
1638 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1639 ///
1640 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1641 pub fn cancel_operation(
1642 &self,
1643 ) -> super::builder::policy_based_routing_service::CancelOperation {
1644 super::builder::policy_based_routing_service::CancelOperation::new(self.inner.clone())
1645 }
1646}