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;
20use std::sync::Arc;
21
22/// Implements a client for the Network Connectivity API.
23///
24/// # Example
25/// ```
26/// # tokio_test::block_on(async {
27/// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
28/// let client = CrossNetworkAutomationService::builder().build().await?;
29/// // use `client` to make requests to the {Codec.APITitle}}.
30/// # gax::Result::<()>::Ok(()) });
31/// ```
32///
33/// # Service Description
34///
35/// The service for CrossNetworkAutomation resources.
36///
37/// # Configuration
38///
39/// To configure `CrossNetworkAutomationService` use the `with_*` methods in the type returned
40/// by [builder()][CrossNetworkAutomationService::builder]. The default configuration should
41/// work for most applications. Common configuration changes include
42///
43/// * [with_endpoint()]: by default this client uses the global default endpoint
44/// (`https://networkconnectivity.googleapis.com`). Applications using regional
45/// endpoints or running in restricted networks (e.g. a network configured
46// with [Private Google Access with VPC Service Controls]) may want to
47/// override this default.
48/// * [with_credentials()]: by default this client uses
49/// [Application Default Credentials]. Applications using custom
50/// authentication may need to override this default.
51///
52/// [with_endpoint()]: super::builder::cross_network_automation_service::ClientBuilder::with_endpoint
53/// [with_credentials()]: super::builder::cross_network_automation_service::ClientBuilder::credentials
54/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
55/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
56///
57/// # Pooling and Cloning
58///
59/// `CrossNetworkAutomationService` holds a connection pool internally, it is advised to
60/// create one and the reuse it. You do not need to wrap `CrossNetworkAutomationService` in
61/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc`
62/// internally.
63#[derive(Clone, Debug)]
64pub struct CrossNetworkAutomationService {
65 inner: Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
66}
67
68impl CrossNetworkAutomationService {
69 /// Returns a builder for [CrossNetworkAutomationService].
70 ///
71 /// ```
72 /// # tokio_test::block_on(async {
73 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
74 /// let client = CrossNetworkAutomationService::builder().build().await?;
75 /// # gax::Result::<()>::Ok(()) });
76 /// ```
77 pub fn builder() -> super::builder::cross_network_automation_service::ClientBuilder {
78 gax::client_builder::internal::new_builder(
79 super::builder::cross_network_automation_service::client::Factory,
80 )
81 }
82
83 /// Creates a new client from the provided stub.
84 ///
85 /// The most common case for calling this function is in tests mocking the
86 /// client's behavior.
87 pub fn from_stub<T>(stub: T) -> Self
88 where
89 T: super::stub::CrossNetworkAutomationService + 'static,
90 {
91 Self {
92 inner: Arc::new(stub),
93 }
94 }
95
96 pub(crate) async fn new(config: gaxi::options::ClientConfig) -> Result<Self> {
97 let inner = Self::build_inner(config).await?;
98 Ok(Self { inner })
99 }
100
101 async fn build_inner(
102 conf: gaxi::options::ClientConfig,
103 ) -> Result<Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>> {
104 if gaxi::options::tracing_enabled(&conf) {
105 return Ok(Arc::new(Self::build_with_tracing(conf).await?));
106 }
107 Ok(Arc::new(Self::build_transport(conf).await?))
108 }
109
110 async fn build_transport(
111 conf: gaxi::options::ClientConfig,
112 ) -> Result<impl super::stub::CrossNetworkAutomationService> {
113 super::transport::CrossNetworkAutomationService::new(conf).await
114 }
115
116 async fn build_with_tracing(
117 conf: gaxi::options::ClientConfig,
118 ) -> Result<impl super::stub::CrossNetworkAutomationService> {
119 Self::build_transport(conf)
120 .await
121 .map(super::tracing::CrossNetworkAutomationService::new)
122 }
123
124 /// Lists ServiceConnectionMaps in a given project and location.
125 pub fn list_service_connection_maps(
126 &self,
127 parent: impl Into<std::string::String>,
128 ) -> super::builder::cross_network_automation_service::ListServiceConnectionMaps {
129 super::builder::cross_network_automation_service::ListServiceConnectionMaps::new(
130 self.inner.clone(),
131 )
132 .set_parent(parent.into())
133 }
134
135 /// Gets details of a single ServiceConnectionMap.
136 pub fn get_service_connection_map(
137 &self,
138 name: impl Into<std::string::String>,
139 ) -> super::builder::cross_network_automation_service::GetServiceConnectionMap {
140 super::builder::cross_network_automation_service::GetServiceConnectionMap::new(
141 self.inner.clone(),
142 )
143 .set_name(name.into())
144 }
145
146 /// Creates a new ServiceConnectionMap in a given project and location.
147 ///
148 /// # Long running operations
149 ///
150 /// This method is used to start, and/or poll a [long-running Operation].
151 /// The [Working with long-running operations] chapter in the [user guide]
152 /// covers these operations in detail.
153 ///
154 /// [long-running operation]: https://google.aip.dev/151
155 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
156 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
157 pub fn create_service_connection_map(
158 &self,
159 parent: impl Into<std::string::String>,
160 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionMap {
161 super::builder::cross_network_automation_service::CreateServiceConnectionMap::new(
162 self.inner.clone(),
163 )
164 .set_parent(parent.into())
165 }
166
167 /// Updates the parameters of a single ServiceConnectionMap.
168 ///
169 /// # Long running operations
170 ///
171 /// This method is used to start, and/or poll a [long-running Operation].
172 /// The [Working with long-running operations] chapter in the [user guide]
173 /// covers these operations in detail.
174 ///
175 /// [long-running operation]: https://google.aip.dev/151
176 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
177 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
178 pub fn update_service_connection_map(
179 &self,
180 service_connection_map: impl Into<crate::model::ServiceConnectionMap>,
181 ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionMap {
182 super::builder::cross_network_automation_service::UpdateServiceConnectionMap::new(
183 self.inner.clone(),
184 )
185 .set_service_connection_map(service_connection_map.into())
186 }
187
188 /// Deletes a single ServiceConnectionMap.
189 ///
190 /// # Long running operations
191 ///
192 /// This method is used to start, and/or poll a [long-running Operation].
193 /// The [Working with long-running operations] chapter in the [user guide]
194 /// covers these operations in detail.
195 ///
196 /// [long-running operation]: https://google.aip.dev/151
197 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
198 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
199 pub fn delete_service_connection_map(
200 &self,
201 name: impl Into<std::string::String>,
202 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionMap {
203 super::builder::cross_network_automation_service::DeleteServiceConnectionMap::new(
204 self.inner.clone(),
205 )
206 .set_name(name.into())
207 }
208
209 /// Lists ServiceConnectionPolicies in a given project and location.
210 pub fn list_service_connection_policies(
211 &self,
212 parent: impl Into<std::string::String>,
213 ) -> super::builder::cross_network_automation_service::ListServiceConnectionPolicies {
214 super::builder::cross_network_automation_service::ListServiceConnectionPolicies::new(
215 self.inner.clone(),
216 )
217 .set_parent(parent.into())
218 }
219
220 /// Gets details of a single ServiceConnectionPolicy.
221 pub fn get_service_connection_policy(
222 &self,
223 name: impl Into<std::string::String>,
224 ) -> super::builder::cross_network_automation_service::GetServiceConnectionPolicy {
225 super::builder::cross_network_automation_service::GetServiceConnectionPolicy::new(
226 self.inner.clone(),
227 )
228 .set_name(name.into())
229 }
230
231 /// Creates a new ServiceConnectionPolicy in a given project and location.
232 ///
233 /// # Long running operations
234 ///
235 /// This method is used to start, and/or poll a [long-running Operation].
236 /// The [Working with long-running operations] chapter in the [user guide]
237 /// covers these operations in detail.
238 ///
239 /// [long-running operation]: https://google.aip.dev/151
240 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
241 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
242 pub fn create_service_connection_policy(
243 &self,
244 parent: impl Into<std::string::String>,
245 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionPolicy {
246 super::builder::cross_network_automation_service::CreateServiceConnectionPolicy::new(
247 self.inner.clone(),
248 )
249 .set_parent(parent.into())
250 }
251
252 /// Updates the parameters of a single ServiceConnectionPolicy.
253 ///
254 /// # Long running operations
255 ///
256 /// This method is used to start, and/or poll a [long-running Operation].
257 /// The [Working with long-running operations] chapter in the [user guide]
258 /// covers these operations in detail.
259 ///
260 /// [long-running operation]: https://google.aip.dev/151
261 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
262 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
263 pub fn update_service_connection_policy(
264 &self,
265 service_connection_policy: impl Into<crate::model::ServiceConnectionPolicy>,
266 ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy {
267 super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy::new(
268 self.inner.clone(),
269 )
270 .set_service_connection_policy(service_connection_policy.into())
271 }
272
273 /// Deletes a single ServiceConnectionPolicy.
274 ///
275 /// # Long running operations
276 ///
277 /// This method is used to start, and/or poll a [long-running Operation].
278 /// The [Working with long-running operations] chapter in the [user guide]
279 /// covers these operations in detail.
280 ///
281 /// [long-running operation]: https://google.aip.dev/151
282 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
283 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
284 pub fn delete_service_connection_policy(
285 &self,
286 name: impl Into<std::string::String>,
287 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy {
288 super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy::new(
289 self.inner.clone(),
290 )
291 .set_name(name.into())
292 }
293
294 /// Lists ServiceClasses in a given project and location.
295 pub fn list_service_classes(
296 &self,
297 parent: impl Into<std::string::String>,
298 ) -> super::builder::cross_network_automation_service::ListServiceClasses {
299 super::builder::cross_network_automation_service::ListServiceClasses::new(
300 self.inner.clone(),
301 )
302 .set_parent(parent.into())
303 }
304
305 /// Gets details of a single ServiceClass.
306 pub fn get_service_class(
307 &self,
308 name: impl Into<std::string::String>,
309 ) -> super::builder::cross_network_automation_service::GetServiceClass {
310 super::builder::cross_network_automation_service::GetServiceClass::new(self.inner.clone())
311 .set_name(name.into())
312 }
313
314 /// Updates the parameters of a single ServiceClass.
315 ///
316 /// # Long running operations
317 ///
318 /// This method is used to start, and/or poll a [long-running Operation].
319 /// The [Working with long-running operations] chapter in the [user guide]
320 /// covers these operations in detail.
321 ///
322 /// [long-running operation]: https://google.aip.dev/151
323 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
324 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
325 pub fn update_service_class(
326 &self,
327 service_class: impl Into<crate::model::ServiceClass>,
328 ) -> super::builder::cross_network_automation_service::UpdateServiceClass {
329 super::builder::cross_network_automation_service::UpdateServiceClass::new(
330 self.inner.clone(),
331 )
332 .set_service_class(service_class.into())
333 }
334
335 /// Deletes a single ServiceClass.
336 ///
337 /// # Long running operations
338 ///
339 /// This method is used to start, and/or poll a [long-running Operation].
340 /// The [Working with long-running operations] chapter in the [user guide]
341 /// covers these operations in detail.
342 ///
343 /// [long-running operation]: https://google.aip.dev/151
344 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
345 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
346 pub fn delete_service_class(
347 &self,
348 name: impl Into<std::string::String>,
349 ) -> super::builder::cross_network_automation_service::DeleteServiceClass {
350 super::builder::cross_network_automation_service::DeleteServiceClass::new(
351 self.inner.clone(),
352 )
353 .set_name(name.into())
354 }
355
356 /// Gets details of a single ServiceConnectionToken.
357 pub fn get_service_connection_token(
358 &self,
359 name: impl Into<std::string::String>,
360 ) -> super::builder::cross_network_automation_service::GetServiceConnectionToken {
361 super::builder::cross_network_automation_service::GetServiceConnectionToken::new(
362 self.inner.clone(),
363 )
364 .set_name(name.into())
365 }
366
367 /// Lists ServiceConnectionTokens in a given project and location.
368 pub fn list_service_connection_tokens(
369 &self,
370 parent: impl Into<std::string::String>,
371 ) -> super::builder::cross_network_automation_service::ListServiceConnectionTokens {
372 super::builder::cross_network_automation_service::ListServiceConnectionTokens::new(
373 self.inner.clone(),
374 )
375 .set_parent(parent.into())
376 }
377
378 /// Creates a new ServiceConnectionToken in a given project and location.
379 ///
380 /// # Long running operations
381 ///
382 /// This method is used to start, and/or poll a [long-running Operation].
383 /// The [Working with long-running operations] chapter in the [user guide]
384 /// covers these operations in detail.
385 ///
386 /// [long-running operation]: https://google.aip.dev/151
387 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
388 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
389 pub fn create_service_connection_token(
390 &self,
391 parent: impl Into<std::string::String>,
392 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionToken {
393 super::builder::cross_network_automation_service::CreateServiceConnectionToken::new(
394 self.inner.clone(),
395 )
396 .set_parent(parent.into())
397 }
398
399 /// Deletes a single ServiceConnectionToken.
400 ///
401 /// # Long running operations
402 ///
403 /// This method is used to start, and/or poll a [long-running Operation].
404 /// The [Working with long-running operations] chapter in the [user guide]
405 /// covers these operations in detail.
406 ///
407 /// [long-running operation]: https://google.aip.dev/151
408 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
409 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
410 pub fn delete_service_connection_token(
411 &self,
412 name: impl Into<std::string::String>,
413 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionToken {
414 super::builder::cross_network_automation_service::DeleteServiceConnectionToken::new(
415 self.inner.clone(),
416 )
417 .set_name(name.into())
418 }
419
420 /// Lists information about the supported locations for this service.
421 pub fn list_locations(
422 &self,
423 name: impl Into<std::string::String>,
424 ) -> super::builder::cross_network_automation_service::ListLocations {
425 super::builder::cross_network_automation_service::ListLocations::new(self.inner.clone())
426 .set_name(name.into())
427 }
428
429 /// Gets information about a location.
430 pub fn get_location(
431 &self,
432 name: impl Into<std::string::String>,
433 ) -> super::builder::cross_network_automation_service::GetLocation {
434 super::builder::cross_network_automation_service::GetLocation::new(self.inner.clone())
435 .set_name(name.into())
436 }
437
438 /// Sets the access control policy on the specified resource. Replaces
439 /// any existing policy.
440 ///
441 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
442 /// errors.
443 pub fn set_iam_policy(
444 &self,
445 resource: impl Into<std::string::String>,
446 ) -> super::builder::cross_network_automation_service::SetIamPolicy {
447 super::builder::cross_network_automation_service::SetIamPolicy::new(self.inner.clone())
448 .set_resource(resource.into())
449 }
450
451 /// Gets the access control policy for a resource. Returns an empty policy
452 /// if the resource exists and does not have a policy set.
453 pub fn get_iam_policy(
454 &self,
455 resource: impl Into<std::string::String>,
456 ) -> super::builder::cross_network_automation_service::GetIamPolicy {
457 super::builder::cross_network_automation_service::GetIamPolicy::new(self.inner.clone())
458 .set_resource(resource.into())
459 }
460
461 /// Returns permissions that a caller has on the specified resource. If the
462 /// resource does not exist, this will return an empty set of
463 /// permissions, not a `NOT_FOUND` error.
464 ///
465 /// Note: This operation is designed to be used for building
466 /// permission-aware UIs and command-line tools, not for authorization
467 /// checking. This operation may "fail open" without warning.
468 pub fn test_iam_permissions(
469 &self,
470 resource: impl Into<std::string::String>,
471 ) -> super::builder::cross_network_automation_service::TestIamPermissions {
472 super::builder::cross_network_automation_service::TestIamPermissions::new(
473 self.inner.clone(),
474 )
475 .set_resource(resource.into())
476 }
477
478 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
479 ///
480 /// [google.longrunning.Operations]: longrunning::client::Operations
481 pub fn list_operations(
482 &self,
483 name: impl Into<std::string::String>,
484 ) -> super::builder::cross_network_automation_service::ListOperations {
485 super::builder::cross_network_automation_service::ListOperations::new(self.inner.clone())
486 .set_name(name.into())
487 }
488
489 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
490 ///
491 /// [google.longrunning.Operations]: longrunning::client::Operations
492 pub fn get_operation(
493 &self,
494 name: impl Into<std::string::String>,
495 ) -> super::builder::cross_network_automation_service::GetOperation {
496 super::builder::cross_network_automation_service::GetOperation::new(self.inner.clone())
497 .set_name(name.into())
498 }
499
500 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
501 ///
502 /// [google.longrunning.Operations]: longrunning::client::Operations
503 pub fn delete_operation(
504 &self,
505 name: impl Into<std::string::String>,
506 ) -> super::builder::cross_network_automation_service::DeleteOperation {
507 super::builder::cross_network_automation_service::DeleteOperation::new(self.inner.clone())
508 .set_name(name.into())
509 }
510
511 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
512 ///
513 /// [google.longrunning.Operations]: longrunning::client::Operations
514 pub fn cancel_operation(
515 &self,
516 name: impl Into<std::string::String>,
517 ) -> super::builder::cross_network_automation_service::CancelOperation {
518 super::builder::cross_network_automation_service::CancelOperation::new(self.inner.clone())
519 .set_name(name.into())
520 }
521}
522
523/// Implements a client for the Network Connectivity API.
524///
525/// # Example
526/// ```
527/// # tokio_test::block_on(async {
528/// # use google_cloud_networkconnectivity_v1::client::HubService;
529/// let client = HubService::builder().build().await?;
530/// // use `client` to make requests to the {Codec.APITitle}}.
531/// # gax::Result::<()>::Ok(()) });
532/// ```
533///
534/// # Service Description
535///
536/// Network Connectivity Center is a hub-and-spoke abstraction for network
537/// connectivity management in Google Cloud. It reduces operational complexity
538/// through a simple, centralized connectivity management model.
539///
540/// # Configuration
541///
542/// To configure `HubService` use the `with_*` methods in the type returned
543/// by [builder()][HubService::builder]. The default configuration should
544/// work for most applications. Common configuration changes include
545///
546/// * [with_endpoint()]: by default this client uses the global default endpoint
547/// (`https://networkconnectivity.googleapis.com`). Applications using regional
548/// endpoints or running in restricted networks (e.g. a network configured
549// with [Private Google Access with VPC Service Controls]) may want to
550/// override this default.
551/// * [with_credentials()]: by default this client uses
552/// [Application Default Credentials]. Applications using custom
553/// authentication may need to override this default.
554///
555/// [with_endpoint()]: super::builder::hub_service::ClientBuilder::with_endpoint
556/// [with_credentials()]: super::builder::hub_service::ClientBuilder::credentials
557/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
558/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
559///
560/// # Pooling and Cloning
561///
562/// `HubService` holds a connection pool internally, it is advised to
563/// create one and the reuse it. You do not need to wrap `HubService` in
564/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc`
565/// internally.
566#[derive(Clone, Debug)]
567pub struct HubService {
568 inner: Arc<dyn super::stub::dynamic::HubService>,
569}
570
571impl HubService {
572 /// Returns a builder for [HubService].
573 ///
574 /// ```
575 /// # tokio_test::block_on(async {
576 /// # use google_cloud_networkconnectivity_v1::client::HubService;
577 /// let client = HubService::builder().build().await?;
578 /// # gax::Result::<()>::Ok(()) });
579 /// ```
580 pub fn builder() -> super::builder::hub_service::ClientBuilder {
581 gax::client_builder::internal::new_builder(super::builder::hub_service::client::Factory)
582 }
583
584 /// Creates a new client from the provided stub.
585 ///
586 /// The most common case for calling this function is in tests mocking the
587 /// client's behavior.
588 pub fn from_stub<T>(stub: T) -> Self
589 where
590 T: super::stub::HubService + 'static,
591 {
592 Self {
593 inner: Arc::new(stub),
594 }
595 }
596
597 pub(crate) async fn new(config: gaxi::options::ClientConfig) -> Result<Self> {
598 let inner = Self::build_inner(config).await?;
599 Ok(Self { inner })
600 }
601
602 async fn build_inner(
603 conf: gaxi::options::ClientConfig,
604 ) -> Result<Arc<dyn super::stub::dynamic::HubService>> {
605 if gaxi::options::tracing_enabled(&conf) {
606 return Ok(Arc::new(Self::build_with_tracing(conf).await?));
607 }
608 Ok(Arc::new(Self::build_transport(conf).await?))
609 }
610
611 async fn build_transport(
612 conf: gaxi::options::ClientConfig,
613 ) -> Result<impl super::stub::HubService> {
614 super::transport::HubService::new(conf).await
615 }
616
617 async fn build_with_tracing(
618 conf: gaxi::options::ClientConfig,
619 ) -> Result<impl super::stub::HubService> {
620 Self::build_transport(conf)
621 .await
622 .map(super::tracing::HubService::new)
623 }
624
625 /// Lists the Network Connectivity Center hubs associated with a given project.
626 pub fn list_hubs(
627 &self,
628 parent: impl Into<std::string::String>,
629 ) -> super::builder::hub_service::ListHubs {
630 super::builder::hub_service::ListHubs::new(self.inner.clone()).set_parent(parent.into())
631 }
632
633 /// Gets details about a Network Connectivity Center hub.
634 pub fn get_hub(
635 &self,
636 name: impl Into<std::string::String>,
637 ) -> super::builder::hub_service::GetHub {
638 super::builder::hub_service::GetHub::new(self.inner.clone()).set_name(name.into())
639 }
640
641 /// Creates a new Network Connectivity Center hub in the specified project.
642 ///
643 /// # Long running operations
644 ///
645 /// This method is used to start, and/or poll a [long-running Operation].
646 /// The [Working with long-running operations] chapter in the [user guide]
647 /// covers these operations in detail.
648 ///
649 /// [long-running operation]: https://google.aip.dev/151
650 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
651 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
652 pub fn create_hub(
653 &self,
654 parent: impl Into<std::string::String>,
655 ) -> super::builder::hub_service::CreateHub {
656 super::builder::hub_service::CreateHub::new(self.inner.clone()).set_parent(parent.into())
657 }
658
659 /// Updates the description and/or labels of a Network Connectivity Center
660 /// hub.
661 ///
662 /// # Long running operations
663 ///
664 /// This method is used to start, and/or poll a [long-running Operation].
665 /// The [Working with long-running operations] chapter in the [user guide]
666 /// covers these operations in detail.
667 ///
668 /// [long-running operation]: https://google.aip.dev/151
669 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
670 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
671 pub fn update_hub(
672 &self,
673 hub: impl Into<crate::model::Hub>,
674 ) -> super::builder::hub_service::UpdateHub {
675 super::builder::hub_service::UpdateHub::new(self.inner.clone()).set_hub(hub.into())
676 }
677
678 /// Deletes a Network Connectivity Center hub.
679 ///
680 /// # Long running operations
681 ///
682 /// This method is used to start, and/or poll a [long-running Operation].
683 /// The [Working with long-running operations] chapter in the [user guide]
684 /// covers these operations in detail.
685 ///
686 /// [long-running operation]: https://google.aip.dev/151
687 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
688 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
689 pub fn delete_hub(
690 &self,
691 name: impl Into<std::string::String>,
692 ) -> super::builder::hub_service::DeleteHub {
693 super::builder::hub_service::DeleteHub::new(self.inner.clone()).set_name(name.into())
694 }
695
696 /// Lists the Network Connectivity Center spokes associated with a
697 /// specified hub and location. The list includes both spokes that are attached
698 /// to the hub and spokes that have been proposed but not yet accepted.
699 pub fn list_hub_spokes(
700 &self,
701 name: impl Into<std::string::String>,
702 ) -> super::builder::hub_service::ListHubSpokes {
703 super::builder::hub_service::ListHubSpokes::new(self.inner.clone()).set_name(name.into())
704 }
705
706 /// Query the Private Service Connect propagation status of a Network
707 /// Connectivity Center hub.
708 pub fn query_hub_status(
709 &self,
710 name: impl Into<std::string::String>,
711 ) -> super::builder::hub_service::QueryHubStatus {
712 super::builder::hub_service::QueryHubStatus::new(self.inner.clone()).set_name(name.into())
713 }
714
715 /// Lists the Network Connectivity Center spokes in a specified project and
716 /// location.
717 pub fn list_spokes(
718 &self,
719 parent: impl Into<std::string::String>,
720 ) -> super::builder::hub_service::ListSpokes {
721 super::builder::hub_service::ListSpokes::new(self.inner.clone()).set_parent(parent.into())
722 }
723
724 /// Gets details about a Network Connectivity Center spoke.
725 pub fn get_spoke(
726 &self,
727 name: impl Into<std::string::String>,
728 ) -> super::builder::hub_service::GetSpoke {
729 super::builder::hub_service::GetSpoke::new(self.inner.clone()).set_name(name.into())
730 }
731
732 /// Creates a Network Connectivity Center spoke.
733 ///
734 /// # Long running operations
735 ///
736 /// This method is used to start, and/or poll a [long-running Operation].
737 /// The [Working with long-running operations] chapter in the [user guide]
738 /// covers these operations in detail.
739 ///
740 /// [long-running operation]: https://google.aip.dev/151
741 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
742 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
743 pub fn create_spoke(
744 &self,
745 parent: impl Into<std::string::String>,
746 ) -> super::builder::hub_service::CreateSpoke {
747 super::builder::hub_service::CreateSpoke::new(self.inner.clone()).set_parent(parent.into())
748 }
749
750 /// Updates the parameters of a Network Connectivity Center spoke.
751 ///
752 /// # Long running operations
753 ///
754 /// This method is used to start, and/or poll a [long-running Operation].
755 /// The [Working with long-running operations] chapter in the [user guide]
756 /// covers these operations in detail.
757 ///
758 /// [long-running operation]: https://google.aip.dev/151
759 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
760 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
761 pub fn update_spoke(
762 &self,
763 spoke: impl Into<crate::model::Spoke>,
764 ) -> super::builder::hub_service::UpdateSpoke {
765 super::builder::hub_service::UpdateSpoke::new(self.inner.clone()).set_spoke(spoke.into())
766 }
767
768 /// Rejects a Network Connectivity Center spoke from being attached to a hub.
769 /// If the spoke was previously in the `ACTIVE` state, it
770 /// transitions to the `INACTIVE` state and is no longer able to
771 /// connect to other spokes that are attached to the hub.
772 ///
773 /// # Long running operations
774 ///
775 /// This method is used to start, and/or poll a [long-running Operation].
776 /// The [Working with long-running operations] chapter in the [user guide]
777 /// covers these operations in detail.
778 ///
779 /// [long-running operation]: https://google.aip.dev/151
780 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
781 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
782 pub fn reject_hub_spoke(
783 &self,
784 name: impl Into<std::string::String>,
785 ) -> super::builder::hub_service::RejectHubSpoke {
786 super::builder::hub_service::RejectHubSpoke::new(self.inner.clone()).set_name(name.into())
787 }
788
789 /// Accepts a proposal to attach a Network Connectivity Center spoke
790 /// to a hub.
791 ///
792 /// # Long running operations
793 ///
794 /// This method is used to start, and/or poll a [long-running Operation].
795 /// The [Working with long-running operations] chapter in the [user guide]
796 /// covers these operations in detail.
797 ///
798 /// [long-running operation]: https://google.aip.dev/151
799 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
800 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
801 pub fn accept_hub_spoke(
802 &self,
803 name: impl Into<std::string::String>,
804 ) -> super::builder::hub_service::AcceptHubSpoke {
805 super::builder::hub_service::AcceptHubSpoke::new(self.inner.clone()).set_name(name.into())
806 }
807
808 /// Accepts a proposal to update a Network Connectivity Center spoke in a hub.
809 ///
810 /// # Long running operations
811 ///
812 /// This method is used to start, and/or poll a [long-running Operation].
813 /// The [Working with long-running operations] chapter in the [user guide]
814 /// covers these operations in detail.
815 ///
816 /// [long-running operation]: https://google.aip.dev/151
817 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
818 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
819 pub fn accept_spoke_update(
820 &self,
821 name: impl Into<std::string::String>,
822 ) -> super::builder::hub_service::AcceptSpokeUpdate {
823 super::builder::hub_service::AcceptSpokeUpdate::new(self.inner.clone())
824 .set_name(name.into())
825 }
826
827 /// Rejects a proposal to update a Network Connectivity Center spoke in a hub.
828 ///
829 /// # Long running operations
830 ///
831 /// This method is used to start, and/or poll a [long-running Operation].
832 /// The [Working with long-running operations] chapter in the [user guide]
833 /// covers these operations in detail.
834 ///
835 /// [long-running operation]: https://google.aip.dev/151
836 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
837 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
838 pub fn reject_spoke_update(
839 &self,
840 name: impl Into<std::string::String>,
841 ) -> super::builder::hub_service::RejectSpokeUpdate {
842 super::builder::hub_service::RejectSpokeUpdate::new(self.inner.clone())
843 .set_name(name.into())
844 }
845
846 /// Deletes a Network Connectivity Center spoke.
847 ///
848 /// # Long running operations
849 ///
850 /// This method is used to start, and/or poll a [long-running Operation].
851 /// The [Working with long-running operations] chapter in the [user guide]
852 /// covers these operations in detail.
853 ///
854 /// [long-running operation]: https://google.aip.dev/151
855 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
856 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
857 pub fn delete_spoke(
858 &self,
859 name: impl Into<std::string::String>,
860 ) -> super::builder::hub_service::DeleteSpoke {
861 super::builder::hub_service::DeleteSpoke::new(self.inner.clone()).set_name(name.into())
862 }
863
864 /// Gets details about a Network Connectivity Center route table.
865 pub fn get_route_table(
866 &self,
867 name: impl Into<std::string::String>,
868 ) -> super::builder::hub_service::GetRouteTable {
869 super::builder::hub_service::GetRouteTable::new(self.inner.clone()).set_name(name.into())
870 }
871
872 /// Gets details about the specified route.
873 pub fn get_route(
874 &self,
875 name: impl Into<std::string::String>,
876 ) -> super::builder::hub_service::GetRoute {
877 super::builder::hub_service::GetRoute::new(self.inner.clone()).set_name(name.into())
878 }
879
880 /// Lists routes in a given route table.
881 pub fn list_routes(
882 &self,
883 parent: impl Into<std::string::String>,
884 ) -> super::builder::hub_service::ListRoutes {
885 super::builder::hub_service::ListRoutes::new(self.inner.clone()).set_parent(parent.into())
886 }
887
888 /// Lists route tables in a given hub.
889 pub fn list_route_tables(
890 &self,
891 parent: impl Into<std::string::String>,
892 ) -> super::builder::hub_service::ListRouteTables {
893 super::builder::hub_service::ListRouteTables::new(self.inner.clone())
894 .set_parent(parent.into())
895 }
896
897 /// Gets details about a Network Connectivity Center group.
898 pub fn get_group(
899 &self,
900 name: impl Into<std::string::String>,
901 ) -> super::builder::hub_service::GetGroup {
902 super::builder::hub_service::GetGroup::new(self.inner.clone()).set_name(name.into())
903 }
904
905 /// Lists groups in a given hub.
906 pub fn list_groups(
907 &self,
908 parent: impl Into<std::string::String>,
909 ) -> super::builder::hub_service::ListGroups {
910 super::builder::hub_service::ListGroups::new(self.inner.clone()).set_parent(parent.into())
911 }
912
913 /// Updates the parameters of a Network Connectivity Center group.
914 ///
915 /// # Long running operations
916 ///
917 /// This method is used to start, and/or poll a [long-running Operation].
918 /// The [Working with long-running operations] chapter in the [user guide]
919 /// covers these operations in detail.
920 ///
921 /// [long-running operation]: https://google.aip.dev/151
922 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
923 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
924 pub fn update_group(
925 &self,
926 group: impl Into<crate::model::Group>,
927 ) -> super::builder::hub_service::UpdateGroup {
928 super::builder::hub_service::UpdateGroup::new(self.inner.clone()).set_group(group.into())
929 }
930
931 /// Lists information about the supported locations for this service.
932 pub fn list_locations(
933 &self,
934 name: impl Into<std::string::String>,
935 ) -> super::builder::hub_service::ListLocations {
936 super::builder::hub_service::ListLocations::new(self.inner.clone()).set_name(name.into())
937 }
938
939 /// Gets information about a location.
940 pub fn get_location(
941 &self,
942 name: impl Into<std::string::String>,
943 ) -> super::builder::hub_service::GetLocation {
944 super::builder::hub_service::GetLocation::new(self.inner.clone()).set_name(name.into())
945 }
946
947 /// Sets the access control policy on the specified resource. Replaces
948 /// any existing policy.
949 ///
950 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
951 /// errors.
952 pub fn set_iam_policy(
953 &self,
954 resource: impl Into<std::string::String>,
955 ) -> super::builder::hub_service::SetIamPolicy {
956 super::builder::hub_service::SetIamPolicy::new(self.inner.clone())
957 .set_resource(resource.into())
958 }
959
960 /// Gets the access control policy for a resource. Returns an empty policy
961 /// if the resource exists and does not have a policy set.
962 pub fn get_iam_policy(
963 &self,
964 resource: impl Into<std::string::String>,
965 ) -> super::builder::hub_service::GetIamPolicy {
966 super::builder::hub_service::GetIamPolicy::new(self.inner.clone())
967 .set_resource(resource.into())
968 }
969
970 /// Returns permissions that a caller has on the specified resource. If the
971 /// resource does not exist, this will return an empty set of
972 /// permissions, not a `NOT_FOUND` error.
973 ///
974 /// Note: This operation is designed to be used for building
975 /// permission-aware UIs and command-line tools, not for authorization
976 /// checking. This operation may "fail open" without warning.
977 pub fn test_iam_permissions(
978 &self,
979 resource: impl Into<std::string::String>,
980 ) -> super::builder::hub_service::TestIamPermissions {
981 super::builder::hub_service::TestIamPermissions::new(self.inner.clone())
982 .set_resource(resource.into())
983 }
984
985 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
986 ///
987 /// [google.longrunning.Operations]: longrunning::client::Operations
988 pub fn list_operations(
989 &self,
990 name: impl Into<std::string::String>,
991 ) -> super::builder::hub_service::ListOperations {
992 super::builder::hub_service::ListOperations::new(self.inner.clone()).set_name(name.into())
993 }
994
995 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
996 ///
997 /// [google.longrunning.Operations]: longrunning::client::Operations
998 pub fn get_operation(
999 &self,
1000 name: impl Into<std::string::String>,
1001 ) -> super::builder::hub_service::GetOperation {
1002 super::builder::hub_service::GetOperation::new(self.inner.clone()).set_name(name.into())
1003 }
1004
1005 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1006 ///
1007 /// [google.longrunning.Operations]: longrunning::client::Operations
1008 pub fn delete_operation(
1009 &self,
1010 name: impl Into<std::string::String>,
1011 ) -> super::builder::hub_service::DeleteOperation {
1012 super::builder::hub_service::DeleteOperation::new(self.inner.clone()).set_name(name.into())
1013 }
1014
1015 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1016 ///
1017 /// [google.longrunning.Operations]: longrunning::client::Operations
1018 pub fn cancel_operation(
1019 &self,
1020 name: impl Into<std::string::String>,
1021 ) -> super::builder::hub_service::CancelOperation {
1022 super::builder::hub_service::CancelOperation::new(self.inner.clone()).set_name(name.into())
1023 }
1024}
1025
1026/// Implements a client for the Network Connectivity API.
1027///
1028/// # Example
1029/// ```
1030/// # tokio_test::block_on(async {
1031/// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
1032/// let client = PolicyBasedRoutingService::builder().build().await?;
1033/// // use `client` to make requests to the {Codec.APITitle}}.
1034/// # gax::Result::<()>::Ok(()) });
1035/// ```
1036///
1037/// # Service Description
1038///
1039/// Policy-Based Routing allows GCP customers to specify flexibile routing
1040/// policies for Layer 4 traffic traversing through the connected service.
1041///
1042/// # Configuration
1043///
1044/// To configure `PolicyBasedRoutingService` use the `with_*` methods in the type returned
1045/// by [builder()][PolicyBasedRoutingService::builder]. The default configuration should
1046/// work for most applications. Common configuration changes include
1047///
1048/// * [with_endpoint()]: by default this client uses the global default endpoint
1049/// (`https://networkconnectivity.googleapis.com`). Applications using regional
1050/// endpoints or running in restricted networks (e.g. a network configured
1051// with [Private Google Access with VPC Service Controls]) may want to
1052/// override this default.
1053/// * [with_credentials()]: by default this client uses
1054/// [Application Default Credentials]. Applications using custom
1055/// authentication may need to override this default.
1056///
1057/// [with_endpoint()]: super::builder::policy_based_routing_service::ClientBuilder::with_endpoint
1058/// [with_credentials()]: super::builder::policy_based_routing_service::ClientBuilder::credentials
1059/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1060/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1061///
1062/// # Pooling and Cloning
1063///
1064/// `PolicyBasedRoutingService` holds a connection pool internally, it is advised to
1065/// create one and the reuse it. You do not need to wrap `PolicyBasedRoutingService` in
1066/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc`
1067/// internally.
1068#[derive(Clone, Debug)]
1069pub struct PolicyBasedRoutingService {
1070 inner: Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
1071}
1072
1073impl PolicyBasedRoutingService {
1074 /// Returns a builder for [PolicyBasedRoutingService].
1075 ///
1076 /// ```
1077 /// # tokio_test::block_on(async {
1078 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
1079 /// let client = PolicyBasedRoutingService::builder().build().await?;
1080 /// # gax::Result::<()>::Ok(()) });
1081 /// ```
1082 pub fn builder() -> super::builder::policy_based_routing_service::ClientBuilder {
1083 gax::client_builder::internal::new_builder(
1084 super::builder::policy_based_routing_service::client::Factory,
1085 )
1086 }
1087
1088 /// Creates a new client from the provided stub.
1089 ///
1090 /// The most common case for calling this function is in tests mocking the
1091 /// client's behavior.
1092 pub fn from_stub<T>(stub: T) -> Self
1093 where
1094 T: super::stub::PolicyBasedRoutingService + 'static,
1095 {
1096 Self {
1097 inner: Arc::new(stub),
1098 }
1099 }
1100
1101 pub(crate) async fn new(config: gaxi::options::ClientConfig) -> Result<Self> {
1102 let inner = Self::build_inner(config).await?;
1103 Ok(Self { inner })
1104 }
1105
1106 async fn build_inner(
1107 conf: gaxi::options::ClientConfig,
1108 ) -> Result<Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>> {
1109 if gaxi::options::tracing_enabled(&conf) {
1110 return Ok(Arc::new(Self::build_with_tracing(conf).await?));
1111 }
1112 Ok(Arc::new(Self::build_transport(conf).await?))
1113 }
1114
1115 async fn build_transport(
1116 conf: gaxi::options::ClientConfig,
1117 ) -> Result<impl super::stub::PolicyBasedRoutingService> {
1118 super::transport::PolicyBasedRoutingService::new(conf).await
1119 }
1120
1121 async fn build_with_tracing(
1122 conf: gaxi::options::ClientConfig,
1123 ) -> Result<impl super::stub::PolicyBasedRoutingService> {
1124 Self::build_transport(conf)
1125 .await
1126 .map(super::tracing::PolicyBasedRoutingService::new)
1127 }
1128
1129 /// Lists policy-based routes in a given project and location.
1130 pub fn list_policy_based_routes(
1131 &self,
1132 parent: impl Into<std::string::String>,
1133 ) -> super::builder::policy_based_routing_service::ListPolicyBasedRoutes {
1134 super::builder::policy_based_routing_service::ListPolicyBasedRoutes::new(self.inner.clone())
1135 .set_parent(parent.into())
1136 }
1137
1138 /// Gets details of a single policy-based route.
1139 pub fn get_policy_based_route(
1140 &self,
1141 name: impl Into<std::string::String>,
1142 ) -> super::builder::policy_based_routing_service::GetPolicyBasedRoute {
1143 super::builder::policy_based_routing_service::GetPolicyBasedRoute::new(self.inner.clone())
1144 .set_name(name.into())
1145 }
1146
1147 /// Creates a new policy-based route in a given project and location.
1148 ///
1149 /// # Long running operations
1150 ///
1151 /// This method is used to start, and/or poll a [long-running Operation].
1152 /// The [Working with long-running operations] chapter in the [user guide]
1153 /// covers these operations in detail.
1154 ///
1155 /// [long-running operation]: https://google.aip.dev/151
1156 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1157 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1158 pub fn create_policy_based_route(
1159 &self,
1160 parent: impl Into<std::string::String>,
1161 ) -> super::builder::policy_based_routing_service::CreatePolicyBasedRoute {
1162 super::builder::policy_based_routing_service::CreatePolicyBasedRoute::new(
1163 self.inner.clone(),
1164 )
1165 .set_parent(parent.into())
1166 }
1167
1168 /// Deletes a single policy-based route.
1169 ///
1170 /// # Long running operations
1171 ///
1172 /// This method is used to start, and/or poll a [long-running Operation].
1173 /// The [Working with long-running operations] chapter in the [user guide]
1174 /// covers these operations in detail.
1175 ///
1176 /// [long-running operation]: https://google.aip.dev/151
1177 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1178 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1179 pub fn delete_policy_based_route(
1180 &self,
1181 name: impl Into<std::string::String>,
1182 ) -> super::builder::policy_based_routing_service::DeletePolicyBasedRoute {
1183 super::builder::policy_based_routing_service::DeletePolicyBasedRoute::new(
1184 self.inner.clone(),
1185 )
1186 .set_name(name.into())
1187 }
1188
1189 /// Lists information about the supported locations for this service.
1190 pub fn list_locations(
1191 &self,
1192 name: impl Into<std::string::String>,
1193 ) -> super::builder::policy_based_routing_service::ListLocations {
1194 super::builder::policy_based_routing_service::ListLocations::new(self.inner.clone())
1195 .set_name(name.into())
1196 }
1197
1198 /// Gets information about a location.
1199 pub fn get_location(
1200 &self,
1201 name: impl Into<std::string::String>,
1202 ) -> super::builder::policy_based_routing_service::GetLocation {
1203 super::builder::policy_based_routing_service::GetLocation::new(self.inner.clone())
1204 .set_name(name.into())
1205 }
1206
1207 /// Sets the access control policy on the specified resource. Replaces
1208 /// any existing policy.
1209 ///
1210 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1211 /// errors.
1212 pub fn set_iam_policy(
1213 &self,
1214 resource: impl Into<std::string::String>,
1215 ) -> super::builder::policy_based_routing_service::SetIamPolicy {
1216 super::builder::policy_based_routing_service::SetIamPolicy::new(self.inner.clone())
1217 .set_resource(resource.into())
1218 }
1219
1220 /// Gets the access control policy for a resource. Returns an empty policy
1221 /// if the resource exists and does not have a policy set.
1222 pub fn get_iam_policy(
1223 &self,
1224 resource: impl Into<std::string::String>,
1225 ) -> super::builder::policy_based_routing_service::GetIamPolicy {
1226 super::builder::policy_based_routing_service::GetIamPolicy::new(self.inner.clone())
1227 .set_resource(resource.into())
1228 }
1229
1230 /// Returns permissions that a caller has on the specified resource. If the
1231 /// resource does not exist, this will return an empty set of
1232 /// permissions, not a `NOT_FOUND` error.
1233 ///
1234 /// Note: This operation is designed to be used for building
1235 /// permission-aware UIs and command-line tools, not for authorization
1236 /// checking. This operation may "fail open" without warning.
1237 pub fn test_iam_permissions(
1238 &self,
1239 resource: impl Into<std::string::String>,
1240 ) -> super::builder::policy_based_routing_service::TestIamPermissions {
1241 super::builder::policy_based_routing_service::TestIamPermissions::new(self.inner.clone())
1242 .set_resource(resource.into())
1243 }
1244
1245 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1246 ///
1247 /// [google.longrunning.Operations]: longrunning::client::Operations
1248 pub fn list_operations(
1249 &self,
1250 name: impl Into<std::string::String>,
1251 ) -> super::builder::policy_based_routing_service::ListOperations {
1252 super::builder::policy_based_routing_service::ListOperations::new(self.inner.clone())
1253 .set_name(name.into())
1254 }
1255
1256 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1257 ///
1258 /// [google.longrunning.Operations]: longrunning::client::Operations
1259 pub fn get_operation(
1260 &self,
1261 name: impl Into<std::string::String>,
1262 ) -> super::builder::policy_based_routing_service::GetOperation {
1263 super::builder::policy_based_routing_service::GetOperation::new(self.inner.clone())
1264 .set_name(name.into())
1265 }
1266
1267 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1268 ///
1269 /// [google.longrunning.Operations]: longrunning::client::Operations
1270 pub fn delete_operation(
1271 &self,
1272 name: impl Into<std::string::String>,
1273 ) -> super::builder::policy_based_routing_service::DeleteOperation {
1274 super::builder::policy_based_routing_service::DeleteOperation::new(self.inner.clone())
1275 .set_name(name.into())
1276 }
1277
1278 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1279 ///
1280 /// [google.longrunning.Operations]: longrunning::client::Operations
1281 pub fn cancel_operation(
1282 &self,
1283 name: impl Into<std::string::String>,
1284 ) -> super::builder::policy_based_routing_service::CancelOperation {
1285 super::builder::policy_based_routing_service::CancelOperation::new(self.inner.clone())
1286 .set_name(name.into())
1287 }
1288}