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