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
19use crate::Result;
20
21/// Implements a client for the Network Connectivity API.
22///
23/// # Example
24/// ```
25/// # tokio_test::block_on(async {
26/// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
27/// let client = CrossNetworkAutomationService::builder().build().await?;
28/// // use `client` to make requests to the Network Connectivity API.
29/// # gax::Result::<()>::Ok(()) });
30/// ```
31///
32/// # Service Description
33///
34/// The service for CrossNetworkAutomation resources.
35///
36/// # Configuration
37///
38/// To configure `CrossNetworkAutomationService` use the `with_*` methods in the type returned
39/// by [builder()][CrossNetworkAutomationService::builder]. The default configuration should
40/// work for most applications. Common configuration changes include
41///
42/// * [with_endpoint()]: by default this client uses the global default endpoint
43/// (`https://networkconnectivity.googleapis.com`). Applications using regional
44/// endpoints or running in restricted networks (e.g. a network configured
45// with [Private Google Access with VPC Service Controls]) may want to
46/// override this default.
47/// * [with_credentials()]: by default this client uses
48/// [Application Default Credentials]. Applications using custom
49/// authentication may need to override this default.
50///
51/// [with_endpoint()]: super::builder::cross_network_automation_service::ClientBuilder::with_endpoint
52/// [with_credentials()]: super::builder::cross_network_automation_service::ClientBuilder::credentials
53/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
54/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
55///
56/// # Pooling and Cloning
57///
58/// `CrossNetworkAutomationService` holds a connection pool internally, it is advised to
59/// create one and the reuse it. You do not need to wrap `CrossNetworkAutomationService` in
60/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
61/// already uses an `Arc` internally.
62#[derive(Clone, Debug)]
63pub struct CrossNetworkAutomationService {
64 inner: std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
65}
66
67impl CrossNetworkAutomationService {
68 /// Returns a builder for [CrossNetworkAutomationService].
69 ///
70 /// ```
71 /// # tokio_test::block_on(async {
72 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
73 /// let client = CrossNetworkAutomationService::builder().build().await?;
74 /// # gax::Result::<()>::Ok(()) });
75 /// ```
76 pub fn builder() -> super::builder::cross_network_automation_service::ClientBuilder {
77 gax::client_builder::internal::new_builder(
78 super::builder::cross_network_automation_service::client::Factory,
79 )
80 }
81
82 /// Creates a new client from the provided stub.
83 ///
84 /// The most common case for calling this function is in tests mocking the
85 /// client's behavior.
86 pub fn from_stub<T>(stub: T) -> Self
87 where
88 T: super::stub::CrossNetworkAutomationService + 'static,
89 {
90 Self {
91 inner: std::sync::Arc::new(stub),
92 }
93 }
94
95 pub(crate) async fn new(config: gaxi::options::ClientConfig) -> 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 ) -> Result<std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>> {
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 ) -> Result<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 ) -> Result<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]: 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]: 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]: 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]: 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/// # tokio_test::block_on(async {
465/// # use google_cloud_networkconnectivity_v1::client::HubService;
466/// let client = HubService::builder().build().await?;
467/// // use `client` to make requests to the Network Connectivity API.
468/// # gax::Result::<()>::Ok(()) });
469/// ```
470///
471/// # Service Description
472///
473/// Network Connectivity Center is a hub-and-spoke abstraction for network
474/// connectivity management in Google Cloud. It reduces operational complexity
475/// through a simple, centralized connectivity management model.
476///
477/// # Configuration
478///
479/// To configure `HubService` use the `with_*` methods in the type returned
480/// by [builder()][HubService::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::hub_service::ClientBuilder::with_endpoint
493/// [with_credentials()]: super::builder::hub_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/// `HubService` holds a connection pool internally, it is advised to
500/// create one and the reuse it. You do not need to wrap `HubService` 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 HubService {
505 inner: std::sync::Arc<dyn super::stub::dynamic::HubService>,
506}
507
508impl HubService {
509 /// Returns a builder for [HubService].
510 ///
511 /// ```
512 /// # tokio_test::block_on(async {
513 /// # use google_cloud_networkconnectivity_v1::client::HubService;
514 /// let client = HubService::builder().build().await?;
515 /// # gax::Result::<()>::Ok(()) });
516 /// ```
517 pub fn builder() -> super::builder::hub_service::ClientBuilder {
518 gax::client_builder::internal::new_builder(super::builder::hub_service::client::Factory)
519 }
520
521 /// Creates a new client from the provided stub.
522 ///
523 /// The most common case for calling this function is in tests mocking the
524 /// client's behavior.
525 pub fn from_stub<T>(stub: T) -> Self
526 where
527 T: super::stub::HubService + 'static,
528 {
529 Self {
530 inner: std::sync::Arc::new(stub),
531 }
532 }
533
534 pub(crate) async fn new(config: gaxi::options::ClientConfig) -> Result<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 ) -> Result<std::sync::Arc<dyn super::stub::dynamic::HubService>> {
542 if gaxi::options::tracing_enabled(&conf) {
543 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
544 }
545 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
546 }
547
548 async fn build_transport(
549 conf: gaxi::options::ClientConfig,
550 ) -> Result<impl super::stub::HubService> {
551 super::transport::HubService::new(conf).await
552 }
553
554 async fn build_with_tracing(
555 conf: gaxi::options::ClientConfig,
556 ) -> Result<impl super::stub::HubService> {
557 Self::build_transport(conf)
558 .await
559 .map(super::tracing::HubService::new)
560 }
561
562 /// Lists the Network Connectivity Center hubs associated with a given project.
563 pub fn list_hubs(&self) -> super::builder::hub_service::ListHubs {
564 super::builder::hub_service::ListHubs::new(self.inner.clone())
565 }
566
567 /// Gets details about a Network Connectivity Center hub.
568 pub fn get_hub(&self) -> super::builder::hub_service::GetHub {
569 super::builder::hub_service::GetHub::new(self.inner.clone())
570 }
571
572 /// Creates a new Network Connectivity Center hub in the specified project.
573 ///
574 /// # Long running operations
575 ///
576 /// This method is used to start, and/or poll a [long-running Operation].
577 /// The [Working with long-running operations] chapter in the [user guide]
578 /// covers these operations in detail.
579 ///
580 /// [long-running operation]: https://google.aip.dev/151
581 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
582 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
583 pub fn create_hub(&self) -> super::builder::hub_service::CreateHub {
584 super::builder::hub_service::CreateHub::new(self.inner.clone())
585 }
586
587 /// Updates the description and/or labels of a Network Connectivity Center
588 /// hub.
589 ///
590 /// # Long running operations
591 ///
592 /// This method is used to start, and/or poll a [long-running Operation].
593 /// The [Working with long-running operations] chapter in the [user guide]
594 /// covers these operations in detail.
595 ///
596 /// [long-running operation]: https://google.aip.dev/151
597 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
598 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
599 pub fn update_hub(&self) -> super::builder::hub_service::UpdateHub {
600 super::builder::hub_service::UpdateHub::new(self.inner.clone())
601 }
602
603 /// Deletes a Network Connectivity Center hub.
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 delete_hub(&self) -> super::builder::hub_service::DeleteHub {
615 super::builder::hub_service::DeleteHub::new(self.inner.clone())
616 }
617
618 /// Lists the Network Connectivity Center spokes associated with a
619 /// specified hub and location. The list includes both spokes that are attached
620 /// to the hub and spokes that have been proposed but not yet accepted.
621 pub fn list_hub_spokes(&self) -> super::builder::hub_service::ListHubSpokes {
622 super::builder::hub_service::ListHubSpokes::new(self.inner.clone())
623 }
624
625 /// Query the Private Service Connect propagation status of a Network
626 /// Connectivity Center hub.
627 pub fn query_hub_status(&self) -> super::builder::hub_service::QueryHubStatus {
628 super::builder::hub_service::QueryHubStatus::new(self.inner.clone())
629 }
630
631 /// Lists the Network Connectivity Center spokes in a specified project and
632 /// location.
633 pub fn list_spokes(&self) -> super::builder::hub_service::ListSpokes {
634 super::builder::hub_service::ListSpokes::new(self.inner.clone())
635 }
636
637 /// Gets details about a Network Connectivity Center spoke.
638 pub fn get_spoke(&self) -> super::builder::hub_service::GetSpoke {
639 super::builder::hub_service::GetSpoke::new(self.inner.clone())
640 }
641
642 /// Creates a Network Connectivity Center spoke.
643 ///
644 /// # Long running operations
645 ///
646 /// This method is used to start, and/or poll a [long-running Operation].
647 /// The [Working with long-running operations] chapter in the [user guide]
648 /// covers these operations in detail.
649 ///
650 /// [long-running operation]: https://google.aip.dev/151
651 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
652 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
653 pub fn create_spoke(&self) -> super::builder::hub_service::CreateSpoke {
654 super::builder::hub_service::CreateSpoke::new(self.inner.clone())
655 }
656
657 /// Updates the parameters of a Network Connectivity Center spoke.
658 ///
659 /// # Long running operations
660 ///
661 /// This method is used to start, and/or poll a [long-running Operation].
662 /// The [Working with long-running operations] chapter in the [user guide]
663 /// covers these operations in detail.
664 ///
665 /// [long-running operation]: https://google.aip.dev/151
666 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
667 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
668 pub fn update_spoke(&self) -> super::builder::hub_service::UpdateSpoke {
669 super::builder::hub_service::UpdateSpoke::new(self.inner.clone())
670 }
671
672 /// Rejects a Network Connectivity Center spoke from being attached to a hub.
673 /// If the spoke was previously in the `ACTIVE` state, it
674 /// transitions to the `INACTIVE` state and is no longer able to
675 /// connect to other spokes that are attached to the hub.
676 ///
677 /// # Long running operations
678 ///
679 /// This method is used to start, and/or poll a [long-running Operation].
680 /// The [Working with long-running operations] chapter in the [user guide]
681 /// covers these operations in detail.
682 ///
683 /// [long-running operation]: https://google.aip.dev/151
684 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
685 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
686 pub fn reject_hub_spoke(&self) -> super::builder::hub_service::RejectHubSpoke {
687 super::builder::hub_service::RejectHubSpoke::new(self.inner.clone())
688 }
689
690 /// Accepts a proposal to attach a Network Connectivity Center spoke
691 /// to a hub.
692 ///
693 /// # Long running operations
694 ///
695 /// This method is used to start, and/or poll a [long-running Operation].
696 /// The [Working with long-running operations] chapter in the [user guide]
697 /// covers these operations in detail.
698 ///
699 /// [long-running operation]: https://google.aip.dev/151
700 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
701 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
702 pub fn accept_hub_spoke(&self) -> super::builder::hub_service::AcceptHubSpoke {
703 super::builder::hub_service::AcceptHubSpoke::new(self.inner.clone())
704 }
705
706 /// Accepts a proposal to update a Network Connectivity Center spoke in a hub.
707 ///
708 /// # Long running operations
709 ///
710 /// This method is used to start, and/or poll a [long-running Operation].
711 /// The [Working with long-running operations] chapter in the [user guide]
712 /// covers these operations in detail.
713 ///
714 /// [long-running operation]: https://google.aip.dev/151
715 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
716 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
717 pub fn accept_spoke_update(&self) -> super::builder::hub_service::AcceptSpokeUpdate {
718 super::builder::hub_service::AcceptSpokeUpdate::new(self.inner.clone())
719 }
720
721 /// Rejects a proposal to update a Network Connectivity Center spoke in a hub.
722 ///
723 /// # Long running operations
724 ///
725 /// This method is used to start, and/or poll a [long-running Operation].
726 /// The [Working with long-running operations] chapter in the [user guide]
727 /// covers these operations in detail.
728 ///
729 /// [long-running operation]: https://google.aip.dev/151
730 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
731 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
732 pub fn reject_spoke_update(&self) -> super::builder::hub_service::RejectSpokeUpdate {
733 super::builder::hub_service::RejectSpokeUpdate::new(self.inner.clone())
734 }
735
736 /// Deletes a Network Connectivity Center spoke.
737 ///
738 /// # Long running operations
739 ///
740 /// This method is used to start, and/or poll a [long-running Operation].
741 /// The [Working with long-running operations] chapter in the [user guide]
742 /// covers these operations in detail.
743 ///
744 /// [long-running operation]: https://google.aip.dev/151
745 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
746 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
747 pub fn delete_spoke(&self) -> super::builder::hub_service::DeleteSpoke {
748 super::builder::hub_service::DeleteSpoke::new(self.inner.clone())
749 }
750
751 /// Gets details about a Network Connectivity Center route table.
752 pub fn get_route_table(&self) -> super::builder::hub_service::GetRouteTable {
753 super::builder::hub_service::GetRouteTable::new(self.inner.clone())
754 }
755
756 /// Gets details about the specified route.
757 pub fn get_route(&self) -> super::builder::hub_service::GetRoute {
758 super::builder::hub_service::GetRoute::new(self.inner.clone())
759 }
760
761 /// Lists routes in a given route table.
762 pub fn list_routes(&self) -> super::builder::hub_service::ListRoutes {
763 super::builder::hub_service::ListRoutes::new(self.inner.clone())
764 }
765
766 /// Lists route tables in a given hub.
767 pub fn list_route_tables(&self) -> super::builder::hub_service::ListRouteTables {
768 super::builder::hub_service::ListRouteTables::new(self.inner.clone())
769 }
770
771 /// Gets details about a Network Connectivity Center group.
772 pub fn get_group(&self) -> super::builder::hub_service::GetGroup {
773 super::builder::hub_service::GetGroup::new(self.inner.clone())
774 }
775
776 /// Lists groups in a given hub.
777 pub fn list_groups(&self) -> super::builder::hub_service::ListGroups {
778 super::builder::hub_service::ListGroups::new(self.inner.clone())
779 }
780
781 /// Updates the parameters of a Network Connectivity Center group.
782 ///
783 /// # Long running operations
784 ///
785 /// This method is used to start, and/or poll a [long-running Operation].
786 /// The [Working with long-running operations] chapter in the [user guide]
787 /// covers these operations in detail.
788 ///
789 /// [long-running operation]: https://google.aip.dev/151
790 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
791 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
792 pub fn update_group(&self) -> super::builder::hub_service::UpdateGroup {
793 super::builder::hub_service::UpdateGroup::new(self.inner.clone())
794 }
795
796 /// Lists information about the supported locations for this service.
797 pub fn list_locations(&self) -> super::builder::hub_service::ListLocations {
798 super::builder::hub_service::ListLocations::new(self.inner.clone())
799 }
800
801 /// Gets information about a location.
802 pub fn get_location(&self) -> super::builder::hub_service::GetLocation {
803 super::builder::hub_service::GetLocation::new(self.inner.clone())
804 }
805
806 /// Sets the access control policy on the specified resource. Replaces
807 /// any existing policy.
808 ///
809 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
810 /// errors.
811 pub fn set_iam_policy(&self) -> super::builder::hub_service::SetIamPolicy {
812 super::builder::hub_service::SetIamPolicy::new(self.inner.clone())
813 }
814
815 /// Gets the access control policy for a resource. Returns an empty policy
816 /// if the resource exists and does not have a policy set.
817 pub fn get_iam_policy(&self) -> super::builder::hub_service::GetIamPolicy {
818 super::builder::hub_service::GetIamPolicy::new(self.inner.clone())
819 }
820
821 /// Returns permissions that a caller has on the specified resource. If the
822 /// resource does not exist, this will return an empty set of
823 /// permissions, not a `NOT_FOUND` error.
824 ///
825 /// Note: This operation is designed to be used for building
826 /// permission-aware UIs and command-line tools, not for authorization
827 /// checking. This operation may "fail open" without warning.
828 pub fn test_iam_permissions(&self) -> super::builder::hub_service::TestIamPermissions {
829 super::builder::hub_service::TestIamPermissions::new(self.inner.clone())
830 }
831
832 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
833 ///
834 /// [google.longrunning.Operations]: longrunning::client::Operations
835 pub fn list_operations(&self) -> super::builder::hub_service::ListOperations {
836 super::builder::hub_service::ListOperations::new(self.inner.clone())
837 }
838
839 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
840 ///
841 /// [google.longrunning.Operations]: longrunning::client::Operations
842 pub fn get_operation(&self) -> super::builder::hub_service::GetOperation {
843 super::builder::hub_service::GetOperation::new(self.inner.clone())
844 }
845
846 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
847 ///
848 /// [google.longrunning.Operations]: longrunning::client::Operations
849 pub fn delete_operation(&self) -> super::builder::hub_service::DeleteOperation {
850 super::builder::hub_service::DeleteOperation::new(self.inner.clone())
851 }
852
853 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
854 ///
855 /// [google.longrunning.Operations]: longrunning::client::Operations
856 pub fn cancel_operation(&self) -> super::builder::hub_service::CancelOperation {
857 super::builder::hub_service::CancelOperation::new(self.inner.clone())
858 }
859}
860
861/// Implements a client for the Network Connectivity API.
862///
863/// # Example
864/// ```
865/// # tokio_test::block_on(async {
866/// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
867/// let client = PolicyBasedRoutingService::builder().build().await?;
868/// // use `client` to make requests to the Network Connectivity API.
869/// # gax::Result::<()>::Ok(()) });
870/// ```
871///
872/// # Service Description
873///
874/// Policy-Based Routing allows GCP customers to specify flexibile routing
875/// policies for Layer 4 traffic traversing through the connected service.
876///
877/// # Configuration
878///
879/// To configure `PolicyBasedRoutingService` use the `with_*` methods in the type returned
880/// by [builder()][PolicyBasedRoutingService::builder]. The default configuration should
881/// work for most applications. Common configuration changes include
882///
883/// * [with_endpoint()]: by default this client uses the global default endpoint
884/// (`https://networkconnectivity.googleapis.com`). Applications using regional
885/// endpoints or running in restricted networks (e.g. a network configured
886// with [Private Google Access with VPC Service Controls]) may want to
887/// override this default.
888/// * [with_credentials()]: by default this client uses
889/// [Application Default Credentials]. Applications using custom
890/// authentication may need to override this default.
891///
892/// [with_endpoint()]: super::builder::policy_based_routing_service::ClientBuilder::with_endpoint
893/// [with_credentials()]: super::builder::policy_based_routing_service::ClientBuilder::credentials
894/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
895/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
896///
897/// # Pooling and Cloning
898///
899/// `PolicyBasedRoutingService` holds a connection pool internally, it is advised to
900/// create one and the reuse it. You do not need to wrap `PolicyBasedRoutingService` in
901/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
902/// already uses an `Arc` internally.
903#[derive(Clone, Debug)]
904pub struct PolicyBasedRoutingService {
905 inner: std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
906}
907
908impl PolicyBasedRoutingService {
909 /// Returns a builder for [PolicyBasedRoutingService].
910 ///
911 /// ```
912 /// # tokio_test::block_on(async {
913 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
914 /// let client = PolicyBasedRoutingService::builder().build().await?;
915 /// # gax::Result::<()>::Ok(()) });
916 /// ```
917 pub fn builder() -> super::builder::policy_based_routing_service::ClientBuilder {
918 gax::client_builder::internal::new_builder(
919 super::builder::policy_based_routing_service::client::Factory,
920 )
921 }
922
923 /// Creates a new client from the provided stub.
924 ///
925 /// The most common case for calling this function is in tests mocking the
926 /// client's behavior.
927 pub fn from_stub<T>(stub: T) -> Self
928 where
929 T: super::stub::PolicyBasedRoutingService + 'static,
930 {
931 Self {
932 inner: std::sync::Arc::new(stub),
933 }
934 }
935
936 pub(crate) async fn new(config: gaxi::options::ClientConfig) -> Result<Self> {
937 let inner = Self::build_inner(config).await?;
938 Ok(Self { inner })
939 }
940
941 async fn build_inner(
942 conf: gaxi::options::ClientConfig,
943 ) -> Result<std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>> {
944 if gaxi::options::tracing_enabled(&conf) {
945 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
946 }
947 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
948 }
949
950 async fn build_transport(
951 conf: gaxi::options::ClientConfig,
952 ) -> Result<impl super::stub::PolicyBasedRoutingService> {
953 super::transport::PolicyBasedRoutingService::new(conf).await
954 }
955
956 async fn build_with_tracing(
957 conf: gaxi::options::ClientConfig,
958 ) -> Result<impl super::stub::PolicyBasedRoutingService> {
959 Self::build_transport(conf)
960 .await
961 .map(super::tracing::PolicyBasedRoutingService::new)
962 }
963
964 /// Lists policy-based routes in a given project and location.
965 pub fn list_policy_based_routes(
966 &self,
967 ) -> super::builder::policy_based_routing_service::ListPolicyBasedRoutes {
968 super::builder::policy_based_routing_service::ListPolicyBasedRoutes::new(self.inner.clone())
969 }
970
971 /// Gets details of a single policy-based route.
972 pub fn get_policy_based_route(
973 &self,
974 ) -> super::builder::policy_based_routing_service::GetPolicyBasedRoute {
975 super::builder::policy_based_routing_service::GetPolicyBasedRoute::new(self.inner.clone())
976 }
977
978 /// Creates a new policy-based route in a given project and location.
979 ///
980 /// # Long running operations
981 ///
982 /// This method is used to start, and/or poll a [long-running Operation].
983 /// The [Working with long-running operations] chapter in the [user guide]
984 /// covers these operations in detail.
985 ///
986 /// [long-running operation]: https://google.aip.dev/151
987 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
988 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
989 pub fn create_policy_based_route(
990 &self,
991 ) -> super::builder::policy_based_routing_service::CreatePolicyBasedRoute {
992 super::builder::policy_based_routing_service::CreatePolicyBasedRoute::new(
993 self.inner.clone(),
994 )
995 }
996
997 /// Deletes a single policy-based route.
998 ///
999 /// # Long running operations
1000 ///
1001 /// This method is used to start, and/or poll a [long-running Operation].
1002 /// The [Working with long-running operations] chapter in the [user guide]
1003 /// covers these operations in detail.
1004 ///
1005 /// [long-running operation]: https://google.aip.dev/151
1006 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1007 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1008 pub fn delete_policy_based_route(
1009 &self,
1010 ) -> super::builder::policy_based_routing_service::DeletePolicyBasedRoute {
1011 super::builder::policy_based_routing_service::DeletePolicyBasedRoute::new(
1012 self.inner.clone(),
1013 )
1014 }
1015
1016 /// Lists information about the supported locations for this service.
1017 pub fn list_locations(&self) -> super::builder::policy_based_routing_service::ListLocations {
1018 super::builder::policy_based_routing_service::ListLocations::new(self.inner.clone())
1019 }
1020
1021 /// Gets information about a location.
1022 pub fn get_location(&self) -> super::builder::policy_based_routing_service::GetLocation {
1023 super::builder::policy_based_routing_service::GetLocation::new(self.inner.clone())
1024 }
1025
1026 /// Sets the access control policy on the specified resource. Replaces
1027 /// any existing policy.
1028 ///
1029 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1030 /// errors.
1031 pub fn set_iam_policy(&self) -> super::builder::policy_based_routing_service::SetIamPolicy {
1032 super::builder::policy_based_routing_service::SetIamPolicy::new(self.inner.clone())
1033 }
1034
1035 /// Gets the access control policy for a resource. Returns an empty policy
1036 /// if the resource exists and does not have a policy set.
1037 pub fn get_iam_policy(&self) -> super::builder::policy_based_routing_service::GetIamPolicy {
1038 super::builder::policy_based_routing_service::GetIamPolicy::new(self.inner.clone())
1039 }
1040
1041 /// Returns permissions that a caller has on the specified resource. If the
1042 /// resource does not exist, this will return an empty set of
1043 /// permissions, not a `NOT_FOUND` error.
1044 ///
1045 /// Note: This operation is designed to be used for building
1046 /// permission-aware UIs and command-line tools, not for authorization
1047 /// checking. This operation may "fail open" without warning.
1048 pub fn test_iam_permissions(
1049 &self,
1050 ) -> super::builder::policy_based_routing_service::TestIamPermissions {
1051 super::builder::policy_based_routing_service::TestIamPermissions::new(self.inner.clone())
1052 }
1053
1054 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1055 ///
1056 /// [google.longrunning.Operations]: longrunning::client::Operations
1057 pub fn list_operations(&self) -> super::builder::policy_based_routing_service::ListOperations {
1058 super::builder::policy_based_routing_service::ListOperations::new(self.inner.clone())
1059 }
1060
1061 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1062 ///
1063 /// [google.longrunning.Operations]: longrunning::client::Operations
1064 pub fn get_operation(&self) -> super::builder::policy_based_routing_service::GetOperation {
1065 super::builder::policy_based_routing_service::GetOperation::new(self.inner.clone())
1066 }
1067
1068 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1069 ///
1070 /// [google.longrunning.Operations]: longrunning::client::Operations
1071 pub fn delete_operation(
1072 &self,
1073 ) -> super::builder::policy_based_routing_service::DeleteOperation {
1074 super::builder::policy_based_routing_service::DeleteOperation::new(self.inner.clone())
1075 }
1076
1077 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1078 ///
1079 /// [google.longrunning.Operations]: longrunning::client::Operations
1080 pub fn cancel_operation(
1081 &self,
1082 ) -> super::builder::policy_based_routing_service::CancelOperation {
1083 super::builder::policy_based_routing_service::CancelOperation::new(self.inner.clone())
1084 }
1085}