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