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/// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26/// let client = CrossNetworkAutomationService::builder().build().await?;
27/// let parent = "parent_value";
28/// let mut list = client.list_service_connection_maps()
29/// .set_parent(parent)
30/// .by_item();
31/// while let Some(item) = list.next().await.transpose()? {
32/// println!("{:?}", item);
33/// }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// The service for CrossNetworkAutomation resources.
40///
41/// # Configuration
42///
43/// To configure `CrossNetworkAutomationService` use the `with_*` methods in the type returned
44/// by [builder()][CrossNetworkAutomationService::builder]. The default configuration should
45/// work for most applications. Common configuration changes include
46///
47/// * [with_endpoint()]: by default this client uses the global default endpoint
48/// (`https://networkconnectivity.googleapis.com`). Applications using regional
49/// endpoints or running in restricted networks (e.g. a network configured
50// with [Private Google Access with VPC Service Controls]) may want to
51/// override this default.
52/// * [with_credentials()]: by default this client uses
53/// [Application Default Credentials]. Applications using custom
54/// authentication may need to override this default.
55///
56/// [with_endpoint()]: super::builder::cross_network_automation_service::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::cross_network_automation_service::ClientBuilder::with_credentials
58/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
59/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
60///
61/// # Pooling and Cloning
62///
63/// `CrossNetworkAutomationService` holds a connection pool internally, it is advised to
64/// create one and reuse it. You do not need to wrap `CrossNetworkAutomationService` in
65/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
66/// already uses an `Arc` internally.
67#[derive(Clone, Debug)]
68pub struct CrossNetworkAutomationService {
69 inner: std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
70}
71
72impl CrossNetworkAutomationService {
73 /// Returns a builder for [CrossNetworkAutomationService].
74 ///
75 /// ```
76 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
78 /// let client = CrossNetworkAutomationService::builder().build().await?;
79 /// # Ok(()) }
80 /// ```
81 pub fn builder() -> super::builder::cross_network_automation_service::ClientBuilder {
82 crate::new_client_builder(super::builder::cross_network_automation_service::client::Factory)
83 }
84
85 /// Creates a new client from the provided stub.
86 ///
87 /// The most common case for calling this function is in tests mocking the
88 /// client's behavior.
89 pub fn from_stub<T>(stub: T) -> Self
90 where
91 T: super::stub::CrossNetworkAutomationService + 'static,
92 {
93 Self {
94 inner: std::sync::Arc::new(stub),
95 }
96 }
97
98 pub(crate) async fn new(
99 config: gaxi::options::ClientConfig,
100 ) -> crate::ClientBuilderResult<Self> {
101 let inner = Self::build_inner(config).await?;
102 Ok(Self { inner })
103 }
104
105 async fn build_inner(
106 conf: gaxi::options::ClientConfig,
107 ) -> crate::ClientBuilderResult<
108 std::sync::Arc<dyn super::stub::dynamic::CrossNetworkAutomationService>,
109 > {
110 if gaxi::options::tracing_enabled(&conf) {
111 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
112 }
113 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
114 }
115
116 async fn build_transport(
117 conf: gaxi::options::ClientConfig,
118 ) -> crate::ClientBuilderResult<impl super::stub::CrossNetworkAutomationService> {
119 super::transport::CrossNetworkAutomationService::new(conf).await
120 }
121
122 async fn build_with_tracing(
123 conf: gaxi::options::ClientConfig,
124 ) -> crate::ClientBuilderResult<impl super::stub::CrossNetworkAutomationService> {
125 Self::build_transport(conf)
126 .await
127 .map(super::tracing::CrossNetworkAutomationService::new)
128 }
129
130 /// Lists ServiceConnectionMaps in a given project and location.
131 ///
132 /// # Example
133 /// ```
134 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
135 /// use google_cloud_gax::paginator::ItemPaginator as _;
136 /// use google_cloud_networkconnectivity_v1::Result;
137 /// async fn sample(
138 /// client: &CrossNetworkAutomationService, parent: &str
139 /// ) -> Result<()> {
140 /// let mut list = client.list_service_connection_maps()
141 /// .set_parent(parent)
142 /// .by_item();
143 /// while let Some(item) = list.next().await.transpose()? {
144 /// println!("{:?}", item);
145 /// }
146 /// Ok(())
147 /// }
148 /// ```
149 pub fn list_service_connection_maps(
150 &self,
151 ) -> super::builder::cross_network_automation_service::ListServiceConnectionMaps {
152 super::builder::cross_network_automation_service::ListServiceConnectionMaps::new(
153 self.inner.clone(),
154 )
155 }
156
157 /// Gets details of a single ServiceConnectionMap.
158 ///
159 /// # Example
160 /// ```
161 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
162 /// use google_cloud_networkconnectivity_v1::Result;
163 /// async fn sample(
164 /// client: &CrossNetworkAutomationService, name: &str
165 /// ) -> Result<()> {
166 /// let response = client.get_service_connection_map()
167 /// .set_name(name)
168 /// .send().await?;
169 /// println!("response {:?}", response);
170 /// Ok(())
171 /// }
172 /// ```
173 pub fn get_service_connection_map(
174 &self,
175 ) -> super::builder::cross_network_automation_service::GetServiceConnectionMap {
176 super::builder::cross_network_automation_service::GetServiceConnectionMap::new(
177 self.inner.clone(),
178 )
179 }
180
181 /// Creates a new ServiceConnectionMap in a given project and location.
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 ///
193 /// # Example
194 /// ```
195 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
196 /// use google_cloud_lro::Poller;
197 /// use google_cloud_networkconnectivity_v1::model::ServiceConnectionMap;
198 /// use google_cloud_networkconnectivity_v1::Result;
199 /// async fn sample(
200 /// client: &CrossNetworkAutomationService, parent: &str
201 /// ) -> Result<()> {
202 /// let response = client.create_service_connection_map()
203 /// .set_parent(parent)
204 /// .set_service_connection_map(
205 /// ServiceConnectionMap::new()/* set fields */
206 /// )
207 /// .poller().until_done().await?;
208 /// println!("response {:?}", response);
209 /// Ok(())
210 /// }
211 /// ```
212 pub fn create_service_connection_map(
213 &self,
214 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionMap {
215 super::builder::cross_network_automation_service::CreateServiceConnectionMap::new(
216 self.inner.clone(),
217 )
218 }
219
220 /// Updates the parameters of a single ServiceConnectionMap.
221 ///
222 /// # Long running operations
223 ///
224 /// This method is used to start, and/or poll a [long-running Operation].
225 /// The [Working with long-running operations] chapter in the [user guide]
226 /// covers these operations in detail.
227 ///
228 /// [long-running operation]: https://google.aip.dev/151
229 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
230 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
231 ///
232 /// # Example
233 /// ```
234 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
235 /// use google_cloud_lro::Poller;
236 /// # extern crate wkt as google_cloud_wkt;
237 /// use google_cloud_wkt::FieldMask;
238 /// use google_cloud_networkconnectivity_v1::model::ServiceConnectionMap;
239 /// use google_cloud_networkconnectivity_v1::Result;
240 /// async fn sample(
241 /// client: &CrossNetworkAutomationService, name: &str
242 /// ) -> Result<()> {
243 /// let response = client.update_service_connection_map()
244 /// .set_service_connection_map(
245 /// ServiceConnectionMap::new().set_name(name)/* set fields */
246 /// )
247 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
248 /// .poller().until_done().await?;
249 /// println!("response {:?}", response);
250 /// Ok(())
251 /// }
252 /// ```
253 pub fn update_service_connection_map(
254 &self,
255 ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionMap {
256 super::builder::cross_network_automation_service::UpdateServiceConnectionMap::new(
257 self.inner.clone(),
258 )
259 }
260
261 /// Deletes a single ServiceConnectionMap.
262 ///
263 /// # Long running operations
264 ///
265 /// This method is used to start, and/or poll a [long-running Operation].
266 /// The [Working with long-running operations] chapter in the [user guide]
267 /// covers these operations in detail.
268 ///
269 /// [long-running operation]: https://google.aip.dev/151
270 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
271 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
272 ///
273 /// # Example
274 /// ```
275 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
276 /// use google_cloud_lro::Poller;
277 /// use google_cloud_networkconnectivity_v1::Result;
278 /// async fn sample(
279 /// client: &CrossNetworkAutomationService, name: &str
280 /// ) -> Result<()> {
281 /// client.delete_service_connection_map()
282 /// .set_name(name)
283 /// .poller().until_done().await?;
284 /// Ok(())
285 /// }
286 /// ```
287 pub fn delete_service_connection_map(
288 &self,
289 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionMap {
290 super::builder::cross_network_automation_service::DeleteServiceConnectionMap::new(
291 self.inner.clone(),
292 )
293 }
294
295 /// Lists ServiceConnectionPolicies in a given project and location.
296 ///
297 /// # Example
298 /// ```
299 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
300 /// use google_cloud_gax::paginator::ItemPaginator as _;
301 /// use google_cloud_networkconnectivity_v1::Result;
302 /// async fn sample(
303 /// client: &CrossNetworkAutomationService, parent: &str
304 /// ) -> Result<()> {
305 /// let mut list = client.list_service_connection_policies()
306 /// .set_parent(parent)
307 /// .by_item();
308 /// while let Some(item) = list.next().await.transpose()? {
309 /// println!("{:?}", item);
310 /// }
311 /// Ok(())
312 /// }
313 /// ```
314 pub fn list_service_connection_policies(
315 &self,
316 ) -> super::builder::cross_network_automation_service::ListServiceConnectionPolicies {
317 super::builder::cross_network_automation_service::ListServiceConnectionPolicies::new(
318 self.inner.clone(),
319 )
320 }
321
322 /// Gets details of a single ServiceConnectionPolicy.
323 ///
324 /// # Example
325 /// ```
326 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
327 /// use google_cloud_networkconnectivity_v1::Result;
328 /// async fn sample(
329 /// client: &CrossNetworkAutomationService, name: &str
330 /// ) -> Result<()> {
331 /// let response = client.get_service_connection_policy()
332 /// .set_name(name)
333 /// .send().await?;
334 /// println!("response {:?}", response);
335 /// Ok(())
336 /// }
337 /// ```
338 pub fn get_service_connection_policy(
339 &self,
340 ) -> super::builder::cross_network_automation_service::GetServiceConnectionPolicy {
341 super::builder::cross_network_automation_service::GetServiceConnectionPolicy::new(
342 self.inner.clone(),
343 )
344 }
345
346 /// Creates a new ServiceConnectionPolicy in a given project and location.
347 ///
348 /// # Long running operations
349 ///
350 /// This method is used to start, and/or poll a [long-running Operation].
351 /// The [Working with long-running operations] chapter in the [user guide]
352 /// covers these operations in detail.
353 ///
354 /// [long-running operation]: https://google.aip.dev/151
355 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
356 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
357 ///
358 /// # Example
359 /// ```
360 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
361 /// use google_cloud_lro::Poller;
362 /// use google_cloud_networkconnectivity_v1::model::ServiceConnectionPolicy;
363 /// use google_cloud_networkconnectivity_v1::Result;
364 /// async fn sample(
365 /// client: &CrossNetworkAutomationService, parent: &str
366 /// ) -> Result<()> {
367 /// let response = client.create_service_connection_policy()
368 /// .set_parent(parent)
369 /// .set_service_connection_policy(
370 /// ServiceConnectionPolicy::new()/* set fields */
371 /// )
372 /// .poller().until_done().await?;
373 /// println!("response {:?}", response);
374 /// Ok(())
375 /// }
376 /// ```
377 pub fn create_service_connection_policy(
378 &self,
379 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionPolicy {
380 super::builder::cross_network_automation_service::CreateServiceConnectionPolicy::new(
381 self.inner.clone(),
382 )
383 }
384
385 /// Updates the parameters of a single ServiceConnectionPolicy.
386 ///
387 /// # Long running operations
388 ///
389 /// This method is used to start, and/or poll a [long-running Operation].
390 /// The [Working with long-running operations] chapter in the [user guide]
391 /// covers these operations in detail.
392 ///
393 /// [long-running operation]: https://google.aip.dev/151
394 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
395 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
396 ///
397 /// # Example
398 /// ```
399 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
400 /// use google_cloud_lro::Poller;
401 /// # extern crate wkt as google_cloud_wkt;
402 /// use google_cloud_wkt::FieldMask;
403 /// use google_cloud_networkconnectivity_v1::model::ServiceConnectionPolicy;
404 /// use google_cloud_networkconnectivity_v1::Result;
405 /// async fn sample(
406 /// client: &CrossNetworkAutomationService, name: &str
407 /// ) -> Result<()> {
408 /// let response = client.update_service_connection_policy()
409 /// .set_service_connection_policy(
410 /// ServiceConnectionPolicy::new().set_name(name)/* set fields */
411 /// )
412 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
413 /// .poller().until_done().await?;
414 /// println!("response {:?}", response);
415 /// Ok(())
416 /// }
417 /// ```
418 pub fn update_service_connection_policy(
419 &self,
420 ) -> super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy {
421 super::builder::cross_network_automation_service::UpdateServiceConnectionPolicy::new(
422 self.inner.clone(),
423 )
424 }
425
426 /// Deletes a single ServiceConnectionPolicy.
427 ///
428 /// # Long running operations
429 ///
430 /// This method is used to start, and/or poll a [long-running Operation].
431 /// The [Working with long-running operations] chapter in the [user guide]
432 /// covers these operations in detail.
433 ///
434 /// [long-running operation]: https://google.aip.dev/151
435 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
436 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
437 ///
438 /// # Example
439 /// ```
440 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
441 /// use google_cloud_lro::Poller;
442 /// use google_cloud_networkconnectivity_v1::Result;
443 /// async fn sample(
444 /// client: &CrossNetworkAutomationService, name: &str
445 /// ) -> Result<()> {
446 /// client.delete_service_connection_policy()
447 /// .set_name(name)
448 /// .poller().until_done().await?;
449 /// Ok(())
450 /// }
451 /// ```
452 pub fn delete_service_connection_policy(
453 &self,
454 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy {
455 super::builder::cross_network_automation_service::DeleteServiceConnectionPolicy::new(
456 self.inner.clone(),
457 )
458 }
459
460 /// Lists ServiceClasses in a given project and location.
461 ///
462 /// # Example
463 /// ```
464 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
465 /// use google_cloud_gax::paginator::ItemPaginator as _;
466 /// use google_cloud_networkconnectivity_v1::Result;
467 /// async fn sample(
468 /// client: &CrossNetworkAutomationService, parent: &str
469 /// ) -> Result<()> {
470 /// let mut list = client.list_service_classes()
471 /// .set_parent(parent)
472 /// .by_item();
473 /// while let Some(item) = list.next().await.transpose()? {
474 /// println!("{:?}", item);
475 /// }
476 /// Ok(())
477 /// }
478 /// ```
479 pub fn list_service_classes(
480 &self,
481 ) -> super::builder::cross_network_automation_service::ListServiceClasses {
482 super::builder::cross_network_automation_service::ListServiceClasses::new(
483 self.inner.clone(),
484 )
485 }
486
487 /// Gets details of a single ServiceClass.
488 ///
489 /// # Example
490 /// ```
491 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
492 /// use google_cloud_networkconnectivity_v1::Result;
493 /// async fn sample(
494 /// client: &CrossNetworkAutomationService, name: &str
495 /// ) -> Result<()> {
496 /// let response = client.get_service_class()
497 /// .set_name(name)
498 /// .send().await?;
499 /// println!("response {:?}", response);
500 /// Ok(())
501 /// }
502 /// ```
503 pub fn get_service_class(
504 &self,
505 ) -> super::builder::cross_network_automation_service::GetServiceClass {
506 super::builder::cross_network_automation_service::GetServiceClass::new(self.inner.clone())
507 }
508
509 /// Updates the parameters of a single ServiceClass.
510 ///
511 /// # Long running operations
512 ///
513 /// This method is used to start, and/or poll a [long-running Operation].
514 /// The [Working with long-running operations] chapter in the [user guide]
515 /// covers these operations in detail.
516 ///
517 /// [long-running operation]: https://google.aip.dev/151
518 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
519 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
520 ///
521 /// # Example
522 /// ```
523 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
524 /// use google_cloud_lro::Poller;
525 /// # extern crate wkt as google_cloud_wkt;
526 /// use google_cloud_wkt::FieldMask;
527 /// use google_cloud_networkconnectivity_v1::model::ServiceClass;
528 /// use google_cloud_networkconnectivity_v1::Result;
529 /// async fn sample(
530 /// client: &CrossNetworkAutomationService, name: &str
531 /// ) -> Result<()> {
532 /// let response = client.update_service_class()
533 /// .set_service_class(
534 /// ServiceClass::new().set_name(name)/* set fields */
535 /// )
536 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
537 /// .poller().until_done().await?;
538 /// println!("response {:?}", response);
539 /// Ok(())
540 /// }
541 /// ```
542 pub fn update_service_class(
543 &self,
544 ) -> super::builder::cross_network_automation_service::UpdateServiceClass {
545 super::builder::cross_network_automation_service::UpdateServiceClass::new(
546 self.inner.clone(),
547 )
548 }
549
550 /// Deletes a single ServiceClass.
551 ///
552 /// # Long running operations
553 ///
554 /// This method is used to start, and/or poll a [long-running Operation].
555 /// The [Working with long-running operations] chapter in the [user guide]
556 /// covers these operations in detail.
557 ///
558 /// [long-running operation]: https://google.aip.dev/151
559 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
560 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
561 ///
562 /// # Example
563 /// ```
564 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
565 /// use google_cloud_lro::Poller;
566 /// use google_cloud_networkconnectivity_v1::Result;
567 /// async fn sample(
568 /// client: &CrossNetworkAutomationService, name: &str
569 /// ) -> Result<()> {
570 /// client.delete_service_class()
571 /// .set_name(name)
572 /// .poller().until_done().await?;
573 /// Ok(())
574 /// }
575 /// ```
576 pub fn delete_service_class(
577 &self,
578 ) -> super::builder::cross_network_automation_service::DeleteServiceClass {
579 super::builder::cross_network_automation_service::DeleteServiceClass::new(
580 self.inner.clone(),
581 )
582 }
583
584 /// Gets details of a single ServiceConnectionToken.
585 ///
586 /// # Example
587 /// ```
588 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
589 /// use google_cloud_networkconnectivity_v1::Result;
590 /// async fn sample(
591 /// client: &CrossNetworkAutomationService, name: &str
592 /// ) -> Result<()> {
593 /// let response = client.get_service_connection_token()
594 /// .set_name(name)
595 /// .send().await?;
596 /// println!("response {:?}", response);
597 /// Ok(())
598 /// }
599 /// ```
600 pub fn get_service_connection_token(
601 &self,
602 ) -> super::builder::cross_network_automation_service::GetServiceConnectionToken {
603 super::builder::cross_network_automation_service::GetServiceConnectionToken::new(
604 self.inner.clone(),
605 )
606 }
607
608 /// Lists ServiceConnectionTokens in a given project and location.
609 ///
610 /// # Example
611 /// ```
612 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
613 /// use google_cloud_gax::paginator::ItemPaginator as _;
614 /// use google_cloud_networkconnectivity_v1::Result;
615 /// async fn sample(
616 /// client: &CrossNetworkAutomationService, parent: &str
617 /// ) -> Result<()> {
618 /// let mut list = client.list_service_connection_tokens()
619 /// .set_parent(parent)
620 /// .by_item();
621 /// while let Some(item) = list.next().await.transpose()? {
622 /// println!("{:?}", item);
623 /// }
624 /// Ok(())
625 /// }
626 /// ```
627 pub fn list_service_connection_tokens(
628 &self,
629 ) -> super::builder::cross_network_automation_service::ListServiceConnectionTokens {
630 super::builder::cross_network_automation_service::ListServiceConnectionTokens::new(
631 self.inner.clone(),
632 )
633 }
634
635 /// Creates a new ServiceConnectionToken in a given project and location.
636 ///
637 /// # Long running operations
638 ///
639 /// This method is used to start, and/or poll a [long-running Operation].
640 /// The [Working with long-running operations] chapter in the [user guide]
641 /// covers these operations in detail.
642 ///
643 /// [long-running operation]: https://google.aip.dev/151
644 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
645 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
646 ///
647 /// # Example
648 /// ```
649 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
650 /// use google_cloud_lro::Poller;
651 /// use google_cloud_networkconnectivity_v1::model::ServiceConnectionToken;
652 /// use google_cloud_networkconnectivity_v1::Result;
653 /// async fn sample(
654 /// client: &CrossNetworkAutomationService, parent: &str
655 /// ) -> Result<()> {
656 /// let response = client.create_service_connection_token()
657 /// .set_parent(parent)
658 /// .set_service_connection_token(
659 /// ServiceConnectionToken::new()/* set fields */
660 /// )
661 /// .poller().until_done().await?;
662 /// println!("response {:?}", response);
663 /// Ok(())
664 /// }
665 /// ```
666 pub fn create_service_connection_token(
667 &self,
668 ) -> super::builder::cross_network_automation_service::CreateServiceConnectionToken {
669 super::builder::cross_network_automation_service::CreateServiceConnectionToken::new(
670 self.inner.clone(),
671 )
672 }
673
674 /// Deletes a single ServiceConnectionToken.
675 ///
676 /// # Long running operations
677 ///
678 /// This method is used to start, and/or poll a [long-running Operation].
679 /// The [Working with long-running operations] chapter in the [user guide]
680 /// covers these operations in detail.
681 ///
682 /// [long-running operation]: https://google.aip.dev/151
683 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
684 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
685 ///
686 /// # Example
687 /// ```
688 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
689 /// use google_cloud_lro::Poller;
690 /// use google_cloud_networkconnectivity_v1::Result;
691 /// async fn sample(
692 /// client: &CrossNetworkAutomationService, name: &str
693 /// ) -> Result<()> {
694 /// client.delete_service_connection_token()
695 /// .set_name(name)
696 /// .poller().until_done().await?;
697 /// Ok(())
698 /// }
699 /// ```
700 pub fn delete_service_connection_token(
701 &self,
702 ) -> super::builder::cross_network_automation_service::DeleteServiceConnectionToken {
703 super::builder::cross_network_automation_service::DeleteServiceConnectionToken::new(
704 self.inner.clone(),
705 )
706 }
707
708 /// Lists information about the supported locations for this service.
709 ///
710 /// # Example
711 /// ```
712 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
713 /// use google_cloud_gax::paginator::ItemPaginator as _;
714 /// use google_cloud_networkconnectivity_v1::Result;
715 /// async fn sample(
716 /// client: &CrossNetworkAutomationService
717 /// ) -> Result<()> {
718 /// let mut list = client.list_locations()
719 /// /* set fields */
720 /// .by_item();
721 /// while let Some(item) = list.next().await.transpose()? {
722 /// println!("{:?}", item);
723 /// }
724 /// Ok(())
725 /// }
726 /// ```
727 pub fn list_locations(
728 &self,
729 ) -> super::builder::cross_network_automation_service::ListLocations {
730 super::builder::cross_network_automation_service::ListLocations::new(self.inner.clone())
731 }
732
733 /// Gets information about a location.
734 ///
735 /// # Example
736 /// ```
737 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
738 /// use google_cloud_networkconnectivity_v1::Result;
739 /// async fn sample(
740 /// client: &CrossNetworkAutomationService
741 /// ) -> Result<()> {
742 /// let response = client.get_location()
743 /// /* set fields */
744 /// .send().await?;
745 /// println!("response {:?}", response);
746 /// Ok(())
747 /// }
748 /// ```
749 pub fn get_location(&self) -> super::builder::cross_network_automation_service::GetLocation {
750 super::builder::cross_network_automation_service::GetLocation::new(self.inner.clone())
751 }
752
753 /// Sets the access control policy on the specified resource. Replaces
754 /// any existing policy.
755 ///
756 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
757 /// errors.
758 ///
759 /// # Example
760 /// ```
761 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
762 /// use google_cloud_networkconnectivity_v1::Result;
763 /// async fn sample(
764 /// client: &CrossNetworkAutomationService
765 /// ) -> Result<()> {
766 /// let response = client.set_iam_policy()
767 /// /* set fields */
768 /// .send().await?;
769 /// println!("response {:?}", response);
770 /// Ok(())
771 /// }
772 /// ```
773 pub fn set_iam_policy(&self) -> super::builder::cross_network_automation_service::SetIamPolicy {
774 super::builder::cross_network_automation_service::SetIamPolicy::new(self.inner.clone())
775 }
776
777 /// Gets the access control policy for a resource. Returns an empty policy
778 /// if the resource exists and does not have a policy set.
779 ///
780 /// # Example
781 /// ```
782 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
783 /// use google_cloud_networkconnectivity_v1::Result;
784 /// async fn sample(
785 /// client: &CrossNetworkAutomationService
786 /// ) -> Result<()> {
787 /// let response = client.get_iam_policy()
788 /// /* set fields */
789 /// .send().await?;
790 /// println!("response {:?}", response);
791 /// Ok(())
792 /// }
793 /// ```
794 pub fn get_iam_policy(&self) -> super::builder::cross_network_automation_service::GetIamPolicy {
795 super::builder::cross_network_automation_service::GetIamPolicy::new(self.inner.clone())
796 }
797
798 /// Returns permissions that a caller has on the specified resource. If the
799 /// resource does not exist, this will return an empty set of
800 /// permissions, not a `NOT_FOUND` error.
801 ///
802 /// Note: This operation is designed to be used for building
803 /// permission-aware UIs and command-line tools, not for authorization
804 /// checking. This operation may "fail open" without warning.
805 ///
806 /// # Example
807 /// ```
808 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
809 /// use google_cloud_networkconnectivity_v1::Result;
810 /// async fn sample(
811 /// client: &CrossNetworkAutomationService
812 /// ) -> Result<()> {
813 /// let response = client.test_iam_permissions()
814 /// /* set fields */
815 /// .send().await?;
816 /// println!("response {:?}", response);
817 /// Ok(())
818 /// }
819 /// ```
820 pub fn test_iam_permissions(
821 &self,
822 ) -> super::builder::cross_network_automation_service::TestIamPermissions {
823 super::builder::cross_network_automation_service::TestIamPermissions::new(
824 self.inner.clone(),
825 )
826 }
827
828 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
829 ///
830 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
831 ///
832 /// # Example
833 /// ```
834 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
835 /// use google_cloud_gax::paginator::ItemPaginator as _;
836 /// use google_cloud_networkconnectivity_v1::Result;
837 /// async fn sample(
838 /// client: &CrossNetworkAutomationService
839 /// ) -> Result<()> {
840 /// let mut list = client.list_operations()
841 /// /* set fields */
842 /// .by_item();
843 /// while let Some(item) = list.next().await.transpose()? {
844 /// println!("{:?}", item);
845 /// }
846 /// Ok(())
847 /// }
848 /// ```
849 pub fn list_operations(
850 &self,
851 ) -> super::builder::cross_network_automation_service::ListOperations {
852 super::builder::cross_network_automation_service::ListOperations::new(self.inner.clone())
853 }
854
855 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
856 ///
857 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
858 ///
859 /// # Example
860 /// ```
861 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
862 /// use google_cloud_networkconnectivity_v1::Result;
863 /// async fn sample(
864 /// client: &CrossNetworkAutomationService
865 /// ) -> Result<()> {
866 /// let response = client.get_operation()
867 /// /* set fields */
868 /// .send().await?;
869 /// println!("response {:?}", response);
870 /// Ok(())
871 /// }
872 /// ```
873 pub fn get_operation(&self) -> super::builder::cross_network_automation_service::GetOperation {
874 super::builder::cross_network_automation_service::GetOperation::new(self.inner.clone())
875 }
876
877 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
878 ///
879 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
880 ///
881 /// # Example
882 /// ```
883 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
884 /// use google_cloud_networkconnectivity_v1::Result;
885 /// async fn sample(
886 /// client: &CrossNetworkAutomationService
887 /// ) -> Result<()> {
888 /// client.delete_operation()
889 /// /* set fields */
890 /// .send().await?;
891 /// Ok(())
892 /// }
893 /// ```
894 pub fn delete_operation(
895 &self,
896 ) -> super::builder::cross_network_automation_service::DeleteOperation {
897 super::builder::cross_network_automation_service::DeleteOperation::new(self.inner.clone())
898 }
899
900 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
901 ///
902 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
903 ///
904 /// # Example
905 /// ```
906 /// # use google_cloud_networkconnectivity_v1::client::CrossNetworkAutomationService;
907 /// use google_cloud_networkconnectivity_v1::Result;
908 /// async fn sample(
909 /// client: &CrossNetworkAutomationService
910 /// ) -> Result<()> {
911 /// client.cancel_operation()
912 /// /* set fields */
913 /// .send().await?;
914 /// Ok(())
915 /// }
916 /// ```
917 pub fn cancel_operation(
918 &self,
919 ) -> super::builder::cross_network_automation_service::CancelOperation {
920 super::builder::cross_network_automation_service::CancelOperation::new(self.inner.clone())
921 }
922}
923
924/// Implements a client for the Network Connectivity API.
925///
926/// # Example
927/// ```
928/// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
929/// use google_cloud_gax::paginator::ItemPaginator as _;
930/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
931/// let client = DataTransferService::builder().build().await?;
932/// let parent = "parent_value";
933/// let mut list = client.list_multicloud_data_transfer_configs()
934/// .set_parent(parent)
935/// .by_item();
936/// while let Some(item) = list.next().await.transpose()? {
937/// println!("{:?}", item);
938/// }
939/// # Ok(()) }
940/// ```
941///
942/// # Service Description
943///
944/// DataTransferService is the service for the Data Transfer API.
945///
946/// # Configuration
947///
948/// To configure `DataTransferService` use the `with_*` methods in the type returned
949/// by [builder()][DataTransferService::builder]. The default configuration should
950/// work for most applications. Common configuration changes include
951///
952/// * [with_endpoint()]: by default this client uses the global default endpoint
953/// (`https://networkconnectivity.googleapis.com`). Applications using regional
954/// endpoints or running in restricted networks (e.g. a network configured
955// with [Private Google Access with VPC Service Controls]) may want to
956/// override this default.
957/// * [with_credentials()]: by default this client uses
958/// [Application Default Credentials]. Applications using custom
959/// authentication may need to override this default.
960///
961/// [with_endpoint()]: super::builder::data_transfer_service::ClientBuilder::with_endpoint
962/// [with_credentials()]: super::builder::data_transfer_service::ClientBuilder::with_credentials
963/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
964/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
965///
966/// # Pooling and Cloning
967///
968/// `DataTransferService` holds a connection pool internally, it is advised to
969/// create one and reuse it. You do not need to wrap `DataTransferService` in
970/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
971/// already uses an `Arc` internally.
972#[derive(Clone, Debug)]
973pub struct DataTransferService {
974 inner: std::sync::Arc<dyn super::stub::dynamic::DataTransferService>,
975}
976
977impl DataTransferService {
978 /// Returns a builder for [DataTransferService].
979 ///
980 /// ```
981 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
982 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
983 /// let client = DataTransferService::builder().build().await?;
984 /// # Ok(()) }
985 /// ```
986 pub fn builder() -> super::builder::data_transfer_service::ClientBuilder {
987 crate::new_client_builder(super::builder::data_transfer_service::client::Factory)
988 }
989
990 /// Creates a new client from the provided stub.
991 ///
992 /// The most common case for calling this function is in tests mocking the
993 /// client's behavior.
994 pub fn from_stub<T>(stub: T) -> Self
995 where
996 T: super::stub::DataTransferService + 'static,
997 {
998 Self {
999 inner: std::sync::Arc::new(stub),
1000 }
1001 }
1002
1003 pub(crate) async fn new(
1004 config: gaxi::options::ClientConfig,
1005 ) -> crate::ClientBuilderResult<Self> {
1006 let inner = Self::build_inner(config).await?;
1007 Ok(Self { inner })
1008 }
1009
1010 async fn build_inner(
1011 conf: gaxi::options::ClientConfig,
1012 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DataTransferService>>
1013 {
1014 if gaxi::options::tracing_enabled(&conf) {
1015 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1016 }
1017 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1018 }
1019
1020 async fn build_transport(
1021 conf: gaxi::options::ClientConfig,
1022 ) -> crate::ClientBuilderResult<impl super::stub::DataTransferService> {
1023 super::transport::DataTransferService::new(conf).await
1024 }
1025
1026 async fn build_with_tracing(
1027 conf: gaxi::options::ClientConfig,
1028 ) -> crate::ClientBuilderResult<impl super::stub::DataTransferService> {
1029 Self::build_transport(conf)
1030 .await
1031 .map(super::tracing::DataTransferService::new)
1032 }
1033
1034 /// Lists the `MulticloudDataTransferConfig` resources in a specified project
1035 /// and location.
1036 ///
1037 /// # Example
1038 /// ```
1039 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1040 /// use google_cloud_gax::paginator::ItemPaginator as _;
1041 /// use google_cloud_networkconnectivity_v1::Result;
1042 /// async fn sample(
1043 /// client: &DataTransferService, parent: &str
1044 /// ) -> Result<()> {
1045 /// let mut list = client.list_multicloud_data_transfer_configs()
1046 /// .set_parent(parent)
1047 /// .by_item();
1048 /// while let Some(item) = list.next().await.transpose()? {
1049 /// println!("{:?}", item);
1050 /// }
1051 /// Ok(())
1052 /// }
1053 /// ```
1054 pub fn list_multicloud_data_transfer_configs(
1055 &self,
1056 ) -> super::builder::data_transfer_service::ListMulticloudDataTransferConfigs {
1057 super::builder::data_transfer_service::ListMulticloudDataTransferConfigs::new(
1058 self.inner.clone(),
1059 )
1060 }
1061
1062 /// Gets the details of a `MulticloudDataTransferConfig` resource.
1063 ///
1064 /// # Example
1065 /// ```
1066 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1067 /// use google_cloud_networkconnectivity_v1::Result;
1068 /// async fn sample(
1069 /// client: &DataTransferService, name: &str
1070 /// ) -> Result<()> {
1071 /// let response = client.get_multicloud_data_transfer_config()
1072 /// .set_name(name)
1073 /// .send().await?;
1074 /// println!("response {:?}", response);
1075 /// Ok(())
1076 /// }
1077 /// ```
1078 pub fn get_multicloud_data_transfer_config(
1079 &self,
1080 ) -> super::builder::data_transfer_service::GetMulticloudDataTransferConfig {
1081 super::builder::data_transfer_service::GetMulticloudDataTransferConfig::new(
1082 self.inner.clone(),
1083 )
1084 }
1085
1086 /// Creates a `MulticloudDataTransferConfig` resource in a specified project
1087 /// and location.
1088 ///
1089 /// # Long running operations
1090 ///
1091 /// This method is used to start, and/or poll a [long-running Operation].
1092 /// The [Working with long-running operations] chapter in the [user guide]
1093 /// covers these operations in detail.
1094 ///
1095 /// [long-running operation]: https://google.aip.dev/151
1096 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1097 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1098 ///
1099 /// # Example
1100 /// ```
1101 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1102 /// use google_cloud_lro::Poller;
1103 /// use google_cloud_networkconnectivity_v1::model::MulticloudDataTransferConfig;
1104 /// use google_cloud_networkconnectivity_v1::Result;
1105 /// async fn sample(
1106 /// client: &DataTransferService, parent: &str
1107 /// ) -> Result<()> {
1108 /// let response = client.create_multicloud_data_transfer_config()
1109 /// .set_parent(parent)
1110 /// .set_multicloud_data_transfer_config(
1111 /// MulticloudDataTransferConfig::new()/* set fields */
1112 /// )
1113 /// .poller().until_done().await?;
1114 /// println!("response {:?}", response);
1115 /// Ok(())
1116 /// }
1117 /// ```
1118 pub fn create_multicloud_data_transfer_config(
1119 &self,
1120 ) -> super::builder::data_transfer_service::CreateMulticloudDataTransferConfig {
1121 super::builder::data_transfer_service::CreateMulticloudDataTransferConfig::new(
1122 self.inner.clone(),
1123 )
1124 }
1125
1126 /// Updates a `MulticloudDataTransferConfig` resource in a specified project
1127 /// and location.
1128 ///
1129 /// # Long running operations
1130 ///
1131 /// This method is used to start, and/or poll a [long-running Operation].
1132 /// The [Working with long-running operations] chapter in the [user guide]
1133 /// covers these operations in detail.
1134 ///
1135 /// [long-running operation]: https://google.aip.dev/151
1136 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1137 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1138 ///
1139 /// # Example
1140 /// ```
1141 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1142 /// use google_cloud_lro::Poller;
1143 /// # extern crate wkt as google_cloud_wkt;
1144 /// use google_cloud_wkt::FieldMask;
1145 /// use google_cloud_networkconnectivity_v1::model::MulticloudDataTransferConfig;
1146 /// use google_cloud_networkconnectivity_v1::Result;
1147 /// async fn sample(
1148 /// client: &DataTransferService, name: &str
1149 /// ) -> Result<()> {
1150 /// let response = client.update_multicloud_data_transfer_config()
1151 /// .set_multicloud_data_transfer_config(
1152 /// MulticloudDataTransferConfig::new().set_name(name)/* set fields */
1153 /// )
1154 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1155 /// .poller().until_done().await?;
1156 /// println!("response {:?}", response);
1157 /// Ok(())
1158 /// }
1159 /// ```
1160 pub fn update_multicloud_data_transfer_config(
1161 &self,
1162 ) -> super::builder::data_transfer_service::UpdateMulticloudDataTransferConfig {
1163 super::builder::data_transfer_service::UpdateMulticloudDataTransferConfig::new(
1164 self.inner.clone(),
1165 )
1166 }
1167
1168 /// Deletes a `MulticloudDataTransferConfig` resource.
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 ///
1180 /// # Example
1181 /// ```
1182 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1183 /// use google_cloud_lro::Poller;
1184 /// use google_cloud_networkconnectivity_v1::Result;
1185 /// async fn sample(
1186 /// client: &DataTransferService, name: &str
1187 /// ) -> Result<()> {
1188 /// client.delete_multicloud_data_transfer_config()
1189 /// .set_name(name)
1190 /// .poller().until_done().await?;
1191 /// Ok(())
1192 /// }
1193 /// ```
1194 pub fn delete_multicloud_data_transfer_config(
1195 &self,
1196 ) -> super::builder::data_transfer_service::DeleteMulticloudDataTransferConfig {
1197 super::builder::data_transfer_service::DeleteMulticloudDataTransferConfig::new(
1198 self.inner.clone(),
1199 )
1200 }
1201
1202 /// Lists the `Destination` resources in a specified project and location.
1203 ///
1204 /// # Example
1205 /// ```
1206 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1207 /// use google_cloud_gax::paginator::ItemPaginator as _;
1208 /// use google_cloud_networkconnectivity_v1::Result;
1209 /// async fn sample(
1210 /// client: &DataTransferService, parent: &str
1211 /// ) -> Result<()> {
1212 /// let mut list = client.list_destinations()
1213 /// .set_parent(parent)
1214 /// .by_item();
1215 /// while let Some(item) = list.next().await.transpose()? {
1216 /// println!("{:?}", item);
1217 /// }
1218 /// Ok(())
1219 /// }
1220 /// ```
1221 pub fn list_destinations(&self) -> super::builder::data_transfer_service::ListDestinations {
1222 super::builder::data_transfer_service::ListDestinations::new(self.inner.clone())
1223 }
1224
1225 /// Gets the details of a `Destination` resource.
1226 ///
1227 /// # Example
1228 /// ```
1229 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1230 /// use google_cloud_networkconnectivity_v1::Result;
1231 /// async fn sample(
1232 /// client: &DataTransferService, name: &str
1233 /// ) -> Result<()> {
1234 /// let response = client.get_destination()
1235 /// .set_name(name)
1236 /// .send().await?;
1237 /// println!("response {:?}", response);
1238 /// Ok(())
1239 /// }
1240 /// ```
1241 pub fn get_destination(&self) -> super::builder::data_transfer_service::GetDestination {
1242 super::builder::data_transfer_service::GetDestination::new(self.inner.clone())
1243 }
1244
1245 /// Creates a `Destination` resource in a specified project and location.
1246 ///
1247 /// # Long running operations
1248 ///
1249 /// This method is used to start, and/or poll a [long-running Operation].
1250 /// The [Working with long-running operations] chapter in the [user guide]
1251 /// covers these operations in detail.
1252 ///
1253 /// [long-running operation]: https://google.aip.dev/151
1254 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1255 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1256 ///
1257 /// # Example
1258 /// ```
1259 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1260 /// use google_cloud_lro::Poller;
1261 /// use google_cloud_networkconnectivity_v1::model::Destination;
1262 /// use google_cloud_networkconnectivity_v1::Result;
1263 /// async fn sample(
1264 /// client: &DataTransferService, parent: &str
1265 /// ) -> Result<()> {
1266 /// let response = client.create_destination()
1267 /// .set_parent(parent)
1268 /// .set_destination_id("destination_id_value")
1269 /// .set_destination(
1270 /// Destination::new()/* set fields */
1271 /// )
1272 /// .poller().until_done().await?;
1273 /// println!("response {:?}", response);
1274 /// Ok(())
1275 /// }
1276 /// ```
1277 pub fn create_destination(&self) -> super::builder::data_transfer_service::CreateDestination {
1278 super::builder::data_transfer_service::CreateDestination::new(self.inner.clone())
1279 }
1280
1281 /// Updates a `Destination` resource in a specified project and location.
1282 ///
1283 /// # Long running operations
1284 ///
1285 /// This method is used to start, and/or poll a [long-running Operation].
1286 /// The [Working with long-running operations] chapter in the [user guide]
1287 /// covers these operations in detail.
1288 ///
1289 /// [long-running operation]: https://google.aip.dev/151
1290 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1291 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1292 ///
1293 /// # Example
1294 /// ```
1295 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1296 /// use google_cloud_lro::Poller;
1297 /// # extern crate wkt as google_cloud_wkt;
1298 /// use google_cloud_wkt::FieldMask;
1299 /// use google_cloud_networkconnectivity_v1::model::Destination;
1300 /// use google_cloud_networkconnectivity_v1::Result;
1301 /// async fn sample(
1302 /// client: &DataTransferService, name: &str
1303 /// ) -> Result<()> {
1304 /// let response = client.update_destination()
1305 /// .set_destination(
1306 /// Destination::new().set_name(name)/* set fields */
1307 /// )
1308 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1309 /// .poller().until_done().await?;
1310 /// println!("response {:?}", response);
1311 /// Ok(())
1312 /// }
1313 /// ```
1314 pub fn update_destination(&self) -> super::builder::data_transfer_service::UpdateDestination {
1315 super::builder::data_transfer_service::UpdateDestination::new(self.inner.clone())
1316 }
1317
1318 /// Deletes a `Destination` resource.
1319 ///
1320 /// # Long running operations
1321 ///
1322 /// This method is used to start, and/or poll a [long-running Operation].
1323 /// The [Working with long-running operations] chapter in the [user guide]
1324 /// covers these operations in detail.
1325 ///
1326 /// [long-running operation]: https://google.aip.dev/151
1327 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1328 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1329 ///
1330 /// # Example
1331 /// ```
1332 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1333 /// use google_cloud_lro::Poller;
1334 /// use google_cloud_networkconnectivity_v1::Result;
1335 /// async fn sample(
1336 /// client: &DataTransferService, name: &str
1337 /// ) -> Result<()> {
1338 /// client.delete_destination()
1339 /// .set_name(name)
1340 /// .poller().until_done().await?;
1341 /// Ok(())
1342 /// }
1343 /// ```
1344 pub fn delete_destination(&self) -> super::builder::data_transfer_service::DeleteDestination {
1345 super::builder::data_transfer_service::DeleteDestination::new(self.inner.clone())
1346 }
1347
1348 /// Gets the details of a service that is supported for Data Transfer
1349 /// Essentials.
1350 ///
1351 /// # Example
1352 /// ```
1353 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1354 /// use google_cloud_networkconnectivity_v1::Result;
1355 /// async fn sample(
1356 /// client: &DataTransferService, name: &str
1357 /// ) -> Result<()> {
1358 /// let response = client.get_multicloud_data_transfer_supported_service()
1359 /// .set_name(name)
1360 /// .send().await?;
1361 /// println!("response {:?}", response);
1362 /// Ok(())
1363 /// }
1364 /// ```
1365 pub fn get_multicloud_data_transfer_supported_service(
1366 &self,
1367 ) -> super::builder::data_transfer_service::GetMulticloudDataTransferSupportedService {
1368 super::builder::data_transfer_service::GetMulticloudDataTransferSupportedService::new(
1369 self.inner.clone(),
1370 )
1371 }
1372
1373 /// Lists the services in the project for a region that are supported for
1374 /// Data Transfer Essentials.
1375 ///
1376 /// # Example
1377 /// ```
1378 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1379 /// use google_cloud_gax::paginator::ItemPaginator as _;
1380 /// use google_cloud_networkconnectivity_v1::Result;
1381 /// async fn sample(
1382 /// client: &DataTransferService, parent: &str
1383 /// ) -> Result<()> {
1384 /// let mut list = client.list_multicloud_data_transfer_supported_services()
1385 /// .set_parent(parent)
1386 /// .by_item();
1387 /// while let Some(item) = list.next().await.transpose()? {
1388 /// println!("{:?}", item);
1389 /// }
1390 /// Ok(())
1391 /// }
1392 /// ```
1393 pub fn list_multicloud_data_transfer_supported_services(
1394 &self,
1395 ) -> super::builder::data_transfer_service::ListMulticloudDataTransferSupportedServices {
1396 super::builder::data_transfer_service::ListMulticloudDataTransferSupportedServices::new(
1397 self.inner.clone(),
1398 )
1399 }
1400
1401 /// Lists information about the supported locations for this service.
1402 ///
1403 /// # Example
1404 /// ```
1405 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1406 /// use google_cloud_gax::paginator::ItemPaginator as _;
1407 /// use google_cloud_networkconnectivity_v1::Result;
1408 /// async fn sample(
1409 /// client: &DataTransferService
1410 /// ) -> Result<()> {
1411 /// let mut list = client.list_locations()
1412 /// /* set fields */
1413 /// .by_item();
1414 /// while let Some(item) = list.next().await.transpose()? {
1415 /// println!("{:?}", item);
1416 /// }
1417 /// Ok(())
1418 /// }
1419 /// ```
1420 pub fn list_locations(&self) -> super::builder::data_transfer_service::ListLocations {
1421 super::builder::data_transfer_service::ListLocations::new(self.inner.clone())
1422 }
1423
1424 /// Gets information about a location.
1425 ///
1426 /// # Example
1427 /// ```
1428 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1429 /// use google_cloud_networkconnectivity_v1::Result;
1430 /// async fn sample(
1431 /// client: &DataTransferService
1432 /// ) -> Result<()> {
1433 /// let response = client.get_location()
1434 /// /* set fields */
1435 /// .send().await?;
1436 /// println!("response {:?}", response);
1437 /// Ok(())
1438 /// }
1439 /// ```
1440 pub fn get_location(&self) -> super::builder::data_transfer_service::GetLocation {
1441 super::builder::data_transfer_service::GetLocation::new(self.inner.clone())
1442 }
1443
1444 /// Sets the access control policy on the specified resource. Replaces
1445 /// any existing policy.
1446 ///
1447 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1448 /// errors.
1449 ///
1450 /// # Example
1451 /// ```
1452 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1453 /// use google_cloud_networkconnectivity_v1::Result;
1454 /// async fn sample(
1455 /// client: &DataTransferService
1456 /// ) -> Result<()> {
1457 /// let response = client.set_iam_policy()
1458 /// /* set fields */
1459 /// .send().await?;
1460 /// println!("response {:?}", response);
1461 /// Ok(())
1462 /// }
1463 /// ```
1464 pub fn set_iam_policy(&self) -> super::builder::data_transfer_service::SetIamPolicy {
1465 super::builder::data_transfer_service::SetIamPolicy::new(self.inner.clone())
1466 }
1467
1468 /// Gets the access control policy for a resource. Returns an empty policy
1469 /// if the resource exists and does not have a policy set.
1470 ///
1471 /// # Example
1472 /// ```
1473 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1474 /// use google_cloud_networkconnectivity_v1::Result;
1475 /// async fn sample(
1476 /// client: &DataTransferService
1477 /// ) -> Result<()> {
1478 /// let response = client.get_iam_policy()
1479 /// /* set fields */
1480 /// .send().await?;
1481 /// println!("response {:?}", response);
1482 /// Ok(())
1483 /// }
1484 /// ```
1485 pub fn get_iam_policy(&self) -> super::builder::data_transfer_service::GetIamPolicy {
1486 super::builder::data_transfer_service::GetIamPolicy::new(self.inner.clone())
1487 }
1488
1489 /// Returns permissions that a caller has on the specified resource. If the
1490 /// resource does not exist, this will return an empty set of
1491 /// permissions, not a `NOT_FOUND` error.
1492 ///
1493 /// Note: This operation is designed to be used for building
1494 /// permission-aware UIs and command-line tools, not for authorization
1495 /// checking. This operation may "fail open" without warning.
1496 ///
1497 /// # Example
1498 /// ```
1499 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1500 /// use google_cloud_networkconnectivity_v1::Result;
1501 /// async fn sample(
1502 /// client: &DataTransferService
1503 /// ) -> Result<()> {
1504 /// let response = client.test_iam_permissions()
1505 /// /* set fields */
1506 /// .send().await?;
1507 /// println!("response {:?}", response);
1508 /// Ok(())
1509 /// }
1510 /// ```
1511 pub fn test_iam_permissions(
1512 &self,
1513 ) -> super::builder::data_transfer_service::TestIamPermissions {
1514 super::builder::data_transfer_service::TestIamPermissions::new(self.inner.clone())
1515 }
1516
1517 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1518 ///
1519 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1520 ///
1521 /// # Example
1522 /// ```
1523 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1524 /// use google_cloud_gax::paginator::ItemPaginator as _;
1525 /// use google_cloud_networkconnectivity_v1::Result;
1526 /// async fn sample(
1527 /// client: &DataTransferService
1528 /// ) -> Result<()> {
1529 /// let mut list = client.list_operations()
1530 /// /* set fields */
1531 /// .by_item();
1532 /// while let Some(item) = list.next().await.transpose()? {
1533 /// println!("{:?}", item);
1534 /// }
1535 /// Ok(())
1536 /// }
1537 /// ```
1538 pub fn list_operations(&self) -> super::builder::data_transfer_service::ListOperations {
1539 super::builder::data_transfer_service::ListOperations::new(self.inner.clone())
1540 }
1541
1542 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1543 ///
1544 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1545 ///
1546 /// # Example
1547 /// ```
1548 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1549 /// use google_cloud_networkconnectivity_v1::Result;
1550 /// async fn sample(
1551 /// client: &DataTransferService
1552 /// ) -> Result<()> {
1553 /// let response = client.get_operation()
1554 /// /* set fields */
1555 /// .send().await?;
1556 /// println!("response {:?}", response);
1557 /// Ok(())
1558 /// }
1559 /// ```
1560 pub fn get_operation(&self) -> super::builder::data_transfer_service::GetOperation {
1561 super::builder::data_transfer_service::GetOperation::new(self.inner.clone())
1562 }
1563
1564 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1565 ///
1566 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1567 ///
1568 /// # Example
1569 /// ```
1570 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1571 /// use google_cloud_networkconnectivity_v1::Result;
1572 /// async fn sample(
1573 /// client: &DataTransferService
1574 /// ) -> Result<()> {
1575 /// client.delete_operation()
1576 /// /* set fields */
1577 /// .send().await?;
1578 /// Ok(())
1579 /// }
1580 /// ```
1581 pub fn delete_operation(&self) -> super::builder::data_transfer_service::DeleteOperation {
1582 super::builder::data_transfer_service::DeleteOperation::new(self.inner.clone())
1583 }
1584
1585 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1586 ///
1587 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1588 ///
1589 /// # Example
1590 /// ```
1591 /// # use google_cloud_networkconnectivity_v1::client::DataTransferService;
1592 /// use google_cloud_networkconnectivity_v1::Result;
1593 /// async fn sample(
1594 /// client: &DataTransferService
1595 /// ) -> Result<()> {
1596 /// client.cancel_operation()
1597 /// /* set fields */
1598 /// .send().await?;
1599 /// Ok(())
1600 /// }
1601 /// ```
1602 pub fn cancel_operation(&self) -> super::builder::data_transfer_service::CancelOperation {
1603 super::builder::data_transfer_service::CancelOperation::new(self.inner.clone())
1604 }
1605}
1606
1607/// Implements a client for the Network Connectivity API.
1608///
1609/// # Example
1610/// ```
1611/// # use google_cloud_networkconnectivity_v1::client::HubService;
1612/// use google_cloud_gax::paginator::ItemPaginator as _;
1613/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1614/// let client = HubService::builder().build().await?;
1615/// let parent = "parent_value";
1616/// let mut list = client.list_hubs()
1617/// .set_parent(parent)
1618/// .by_item();
1619/// while let Some(item) = list.next().await.transpose()? {
1620/// println!("{:?}", item);
1621/// }
1622/// # Ok(()) }
1623/// ```
1624///
1625/// # Service Description
1626///
1627/// Network Connectivity Center is a hub-and-spoke abstraction for network
1628/// connectivity management in Google Cloud. It reduces operational complexity
1629/// through a simple, centralized connectivity management model.
1630///
1631/// # Configuration
1632///
1633/// To configure `HubService` use the `with_*` methods in the type returned
1634/// by [builder()][HubService::builder]. The default configuration should
1635/// work for most applications. Common configuration changes include
1636///
1637/// * [with_endpoint()]: by default this client uses the global default endpoint
1638/// (`https://networkconnectivity.googleapis.com`). Applications using regional
1639/// endpoints or running in restricted networks (e.g. a network configured
1640// with [Private Google Access with VPC Service Controls]) may want to
1641/// override this default.
1642/// * [with_credentials()]: by default this client uses
1643/// [Application Default Credentials]. Applications using custom
1644/// authentication may need to override this default.
1645///
1646/// [with_endpoint()]: super::builder::hub_service::ClientBuilder::with_endpoint
1647/// [with_credentials()]: super::builder::hub_service::ClientBuilder::with_credentials
1648/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1649/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1650///
1651/// # Pooling and Cloning
1652///
1653/// `HubService` holds a connection pool internally, it is advised to
1654/// create one and reuse it. You do not need to wrap `HubService` in
1655/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1656/// already uses an `Arc` internally.
1657#[derive(Clone, Debug)]
1658pub struct HubService {
1659 inner: std::sync::Arc<dyn super::stub::dynamic::HubService>,
1660}
1661
1662impl HubService {
1663 /// Returns a builder for [HubService].
1664 ///
1665 /// ```
1666 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1667 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1668 /// let client = HubService::builder().build().await?;
1669 /// # Ok(()) }
1670 /// ```
1671 pub fn builder() -> super::builder::hub_service::ClientBuilder {
1672 crate::new_client_builder(super::builder::hub_service::client::Factory)
1673 }
1674
1675 /// Creates a new client from the provided stub.
1676 ///
1677 /// The most common case for calling this function is in tests mocking the
1678 /// client's behavior.
1679 pub fn from_stub<T>(stub: T) -> Self
1680 where
1681 T: super::stub::HubService + 'static,
1682 {
1683 Self {
1684 inner: std::sync::Arc::new(stub),
1685 }
1686 }
1687
1688 pub(crate) async fn new(
1689 config: gaxi::options::ClientConfig,
1690 ) -> crate::ClientBuilderResult<Self> {
1691 let inner = Self::build_inner(config).await?;
1692 Ok(Self { inner })
1693 }
1694
1695 async fn build_inner(
1696 conf: gaxi::options::ClientConfig,
1697 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HubService>> {
1698 if gaxi::options::tracing_enabled(&conf) {
1699 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1700 }
1701 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1702 }
1703
1704 async fn build_transport(
1705 conf: gaxi::options::ClientConfig,
1706 ) -> crate::ClientBuilderResult<impl super::stub::HubService> {
1707 super::transport::HubService::new(conf).await
1708 }
1709
1710 async fn build_with_tracing(
1711 conf: gaxi::options::ClientConfig,
1712 ) -> crate::ClientBuilderResult<impl super::stub::HubService> {
1713 Self::build_transport(conf)
1714 .await
1715 .map(super::tracing::HubService::new)
1716 }
1717
1718 /// Lists the Network Connectivity Center hubs associated with a given project.
1719 ///
1720 /// # Example
1721 /// ```
1722 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1723 /// use google_cloud_gax::paginator::ItemPaginator as _;
1724 /// use google_cloud_networkconnectivity_v1::Result;
1725 /// async fn sample(
1726 /// client: &HubService, parent: &str
1727 /// ) -> Result<()> {
1728 /// let mut list = client.list_hubs()
1729 /// .set_parent(parent)
1730 /// .by_item();
1731 /// while let Some(item) = list.next().await.transpose()? {
1732 /// println!("{:?}", item);
1733 /// }
1734 /// Ok(())
1735 /// }
1736 /// ```
1737 pub fn list_hubs(&self) -> super::builder::hub_service::ListHubs {
1738 super::builder::hub_service::ListHubs::new(self.inner.clone())
1739 }
1740
1741 /// Gets details about a Network Connectivity Center hub.
1742 ///
1743 /// # Example
1744 /// ```
1745 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1746 /// use google_cloud_networkconnectivity_v1::Result;
1747 /// async fn sample(
1748 /// client: &HubService, name: &str
1749 /// ) -> Result<()> {
1750 /// let response = client.get_hub()
1751 /// .set_name(name)
1752 /// .send().await?;
1753 /// println!("response {:?}", response);
1754 /// Ok(())
1755 /// }
1756 /// ```
1757 pub fn get_hub(&self) -> super::builder::hub_service::GetHub {
1758 super::builder::hub_service::GetHub::new(self.inner.clone())
1759 }
1760
1761 /// Creates a new Network Connectivity Center hub in the specified project.
1762 ///
1763 /// # Long running operations
1764 ///
1765 /// This method is used to start, and/or poll a [long-running Operation].
1766 /// The [Working with long-running operations] chapter in the [user guide]
1767 /// covers these operations in detail.
1768 ///
1769 /// [long-running operation]: https://google.aip.dev/151
1770 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1771 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1772 ///
1773 /// # Example
1774 /// ```
1775 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1776 /// use google_cloud_lro::Poller;
1777 /// use google_cloud_networkconnectivity_v1::model::Hub;
1778 /// use google_cloud_networkconnectivity_v1::Result;
1779 /// async fn sample(
1780 /// client: &HubService, parent: &str
1781 /// ) -> Result<()> {
1782 /// let response = client.create_hub()
1783 /// .set_parent(parent)
1784 /// .set_hub_id("hub_id_value")
1785 /// .set_hub(
1786 /// Hub::new()/* set fields */
1787 /// )
1788 /// .poller().until_done().await?;
1789 /// println!("response {:?}", response);
1790 /// Ok(())
1791 /// }
1792 /// ```
1793 pub fn create_hub(&self) -> super::builder::hub_service::CreateHub {
1794 super::builder::hub_service::CreateHub::new(self.inner.clone())
1795 }
1796
1797 /// Updates the description and/or labels of a Network Connectivity Center
1798 /// hub.
1799 ///
1800 /// # Long running operations
1801 ///
1802 /// This method is used to start, and/or poll a [long-running Operation].
1803 /// The [Working with long-running operations] chapter in the [user guide]
1804 /// covers these operations in detail.
1805 ///
1806 /// [long-running operation]: https://google.aip.dev/151
1807 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1808 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1809 ///
1810 /// # Example
1811 /// ```
1812 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1813 /// use google_cloud_lro::Poller;
1814 /// # extern crate wkt as google_cloud_wkt;
1815 /// use google_cloud_wkt::FieldMask;
1816 /// use google_cloud_networkconnectivity_v1::model::Hub;
1817 /// use google_cloud_networkconnectivity_v1::Result;
1818 /// async fn sample(
1819 /// client: &HubService, name: &str
1820 /// ) -> Result<()> {
1821 /// let response = client.update_hub()
1822 /// .set_hub(
1823 /// Hub::new().set_name(name)/* set fields */
1824 /// )
1825 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1826 /// .poller().until_done().await?;
1827 /// println!("response {:?}", response);
1828 /// Ok(())
1829 /// }
1830 /// ```
1831 pub fn update_hub(&self) -> super::builder::hub_service::UpdateHub {
1832 super::builder::hub_service::UpdateHub::new(self.inner.clone())
1833 }
1834
1835 /// Deletes a Network Connectivity Center hub.
1836 ///
1837 /// # Long running operations
1838 ///
1839 /// This method is used to start, and/or poll a [long-running Operation].
1840 /// The [Working with long-running operations] chapter in the [user guide]
1841 /// covers these operations in detail.
1842 ///
1843 /// [long-running operation]: https://google.aip.dev/151
1844 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1845 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1846 ///
1847 /// # Example
1848 /// ```
1849 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1850 /// use google_cloud_lro::Poller;
1851 /// use google_cloud_networkconnectivity_v1::Result;
1852 /// async fn sample(
1853 /// client: &HubService, name: &str
1854 /// ) -> Result<()> {
1855 /// client.delete_hub()
1856 /// .set_name(name)
1857 /// .poller().until_done().await?;
1858 /// Ok(())
1859 /// }
1860 /// ```
1861 pub fn delete_hub(&self) -> super::builder::hub_service::DeleteHub {
1862 super::builder::hub_service::DeleteHub::new(self.inner.clone())
1863 }
1864
1865 /// Lists the Network Connectivity Center spokes associated with a
1866 /// specified hub and location. The list includes both spokes that are attached
1867 /// to the hub and spokes that have been proposed but not yet accepted.
1868 ///
1869 /// # Example
1870 /// ```
1871 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1872 /// use google_cloud_gax::paginator::ItemPaginator as _;
1873 /// use google_cloud_networkconnectivity_v1::Result;
1874 /// async fn sample(
1875 /// client: &HubService
1876 /// ) -> Result<()> {
1877 /// let mut list = client.list_hub_spokes()
1878 /// /* set fields */
1879 /// .by_item();
1880 /// while let Some(item) = list.next().await.transpose()? {
1881 /// println!("{:?}", item);
1882 /// }
1883 /// Ok(())
1884 /// }
1885 /// ```
1886 pub fn list_hub_spokes(&self) -> super::builder::hub_service::ListHubSpokes {
1887 super::builder::hub_service::ListHubSpokes::new(self.inner.clone())
1888 }
1889
1890 /// Query the Private Service Connect propagation status of a Network
1891 /// Connectivity Center hub.
1892 ///
1893 /// # Example
1894 /// ```
1895 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1896 /// use google_cloud_gax::paginator::ItemPaginator as _;
1897 /// use google_cloud_networkconnectivity_v1::Result;
1898 /// async fn sample(
1899 /// client: &HubService
1900 /// ) -> Result<()> {
1901 /// let mut list = client.query_hub_status()
1902 /// /* set fields */
1903 /// .by_item();
1904 /// while let Some(item) = list.next().await.transpose()? {
1905 /// println!("{:?}", item);
1906 /// }
1907 /// Ok(())
1908 /// }
1909 /// ```
1910 pub fn query_hub_status(&self) -> super::builder::hub_service::QueryHubStatus {
1911 super::builder::hub_service::QueryHubStatus::new(self.inner.clone())
1912 }
1913
1914 /// Lists the Network Connectivity Center spokes in a specified project and
1915 /// location.
1916 ///
1917 /// # Example
1918 /// ```
1919 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1920 /// use google_cloud_gax::paginator::ItemPaginator as _;
1921 /// use google_cloud_networkconnectivity_v1::Result;
1922 /// async fn sample(
1923 /// client: &HubService, parent: &str
1924 /// ) -> Result<()> {
1925 /// let mut list = client.list_spokes()
1926 /// .set_parent(parent)
1927 /// .by_item();
1928 /// while let Some(item) = list.next().await.transpose()? {
1929 /// println!("{:?}", item);
1930 /// }
1931 /// Ok(())
1932 /// }
1933 /// ```
1934 pub fn list_spokes(&self) -> super::builder::hub_service::ListSpokes {
1935 super::builder::hub_service::ListSpokes::new(self.inner.clone())
1936 }
1937
1938 /// Gets details about a Network Connectivity Center spoke.
1939 ///
1940 /// # Example
1941 /// ```
1942 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1943 /// use google_cloud_networkconnectivity_v1::Result;
1944 /// async fn sample(
1945 /// client: &HubService, name: &str
1946 /// ) -> Result<()> {
1947 /// let response = client.get_spoke()
1948 /// .set_name(name)
1949 /// .send().await?;
1950 /// println!("response {:?}", response);
1951 /// Ok(())
1952 /// }
1953 /// ```
1954 pub fn get_spoke(&self) -> super::builder::hub_service::GetSpoke {
1955 super::builder::hub_service::GetSpoke::new(self.inner.clone())
1956 }
1957
1958 /// Creates a Network Connectivity Center spoke.
1959 ///
1960 /// # Long running operations
1961 ///
1962 /// This method is used to start, and/or poll a [long-running Operation].
1963 /// The [Working with long-running operations] chapter in the [user guide]
1964 /// covers these operations in detail.
1965 ///
1966 /// [long-running operation]: https://google.aip.dev/151
1967 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1968 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1969 ///
1970 /// # Example
1971 /// ```
1972 /// # use google_cloud_networkconnectivity_v1::client::HubService;
1973 /// use google_cloud_lro::Poller;
1974 /// use google_cloud_networkconnectivity_v1::model::Spoke;
1975 /// use google_cloud_networkconnectivity_v1::Result;
1976 /// async fn sample(
1977 /// client: &HubService, parent: &str
1978 /// ) -> Result<()> {
1979 /// let response = client.create_spoke()
1980 /// .set_parent(parent)
1981 /// .set_spoke_id("spoke_id_value")
1982 /// .set_spoke(
1983 /// Spoke::new()/* set fields */
1984 /// )
1985 /// .poller().until_done().await?;
1986 /// println!("response {:?}", response);
1987 /// Ok(())
1988 /// }
1989 /// ```
1990 pub fn create_spoke(&self) -> super::builder::hub_service::CreateSpoke {
1991 super::builder::hub_service::CreateSpoke::new(self.inner.clone())
1992 }
1993
1994 /// Updates the parameters of a Network Connectivity Center spoke.
1995 ///
1996 /// # Long running operations
1997 ///
1998 /// This method is used to start, and/or poll a [long-running Operation].
1999 /// The [Working with long-running operations] chapter in the [user guide]
2000 /// covers these operations in detail.
2001 ///
2002 /// [long-running operation]: https://google.aip.dev/151
2003 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2004 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2005 ///
2006 /// # Example
2007 /// ```
2008 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2009 /// use google_cloud_lro::Poller;
2010 /// # extern crate wkt as google_cloud_wkt;
2011 /// use google_cloud_wkt::FieldMask;
2012 /// use google_cloud_networkconnectivity_v1::model::Spoke;
2013 /// use google_cloud_networkconnectivity_v1::Result;
2014 /// async fn sample(
2015 /// client: &HubService, name: &str
2016 /// ) -> Result<()> {
2017 /// let response = client.update_spoke()
2018 /// .set_spoke(
2019 /// Spoke::new().set_name(name)/* set fields */
2020 /// )
2021 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2022 /// .poller().until_done().await?;
2023 /// println!("response {:?}", response);
2024 /// Ok(())
2025 /// }
2026 /// ```
2027 pub fn update_spoke(&self) -> super::builder::hub_service::UpdateSpoke {
2028 super::builder::hub_service::UpdateSpoke::new(self.inner.clone())
2029 }
2030
2031 /// Rejects a Network Connectivity Center spoke from being attached to a hub.
2032 /// If the spoke was previously in the `ACTIVE` state, it
2033 /// transitions to the `INACTIVE` state and is no longer able to
2034 /// connect to other spokes that are attached to the hub.
2035 ///
2036 /// # Long running operations
2037 ///
2038 /// This method is used to start, and/or poll a [long-running Operation].
2039 /// The [Working with long-running operations] chapter in the [user guide]
2040 /// covers these operations in detail.
2041 ///
2042 /// [long-running operation]: https://google.aip.dev/151
2043 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2044 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2045 ///
2046 /// # Example
2047 /// ```
2048 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2049 /// use google_cloud_lro::Poller;
2050 /// use google_cloud_networkconnectivity_v1::Result;
2051 /// async fn sample(
2052 /// client: &HubService
2053 /// ) -> Result<()> {
2054 /// let response = client.reject_hub_spoke()
2055 /// /* set fields */
2056 /// .poller().until_done().await?;
2057 /// println!("response {:?}", response);
2058 /// Ok(())
2059 /// }
2060 /// ```
2061 pub fn reject_hub_spoke(&self) -> super::builder::hub_service::RejectHubSpoke {
2062 super::builder::hub_service::RejectHubSpoke::new(self.inner.clone())
2063 }
2064
2065 /// Accepts a proposal to attach a Network Connectivity Center spoke
2066 /// to a hub.
2067 ///
2068 /// # Long running operations
2069 ///
2070 /// This method is used to start, and/or poll a [long-running Operation].
2071 /// The [Working with long-running operations] chapter in the [user guide]
2072 /// covers these operations in detail.
2073 ///
2074 /// [long-running operation]: https://google.aip.dev/151
2075 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2076 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2077 ///
2078 /// # Example
2079 /// ```
2080 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2081 /// use google_cloud_lro::Poller;
2082 /// use google_cloud_networkconnectivity_v1::Result;
2083 /// async fn sample(
2084 /// client: &HubService
2085 /// ) -> Result<()> {
2086 /// let response = client.accept_hub_spoke()
2087 /// /* set fields */
2088 /// .poller().until_done().await?;
2089 /// println!("response {:?}", response);
2090 /// Ok(())
2091 /// }
2092 /// ```
2093 pub fn accept_hub_spoke(&self) -> super::builder::hub_service::AcceptHubSpoke {
2094 super::builder::hub_service::AcceptHubSpoke::new(self.inner.clone())
2095 }
2096
2097 /// Accepts a proposal to update a Network Connectivity Center spoke in a hub.
2098 ///
2099 /// # Long running operations
2100 ///
2101 /// This method is used to start, and/or poll a [long-running Operation].
2102 /// The [Working with long-running operations] chapter in the [user guide]
2103 /// covers these operations in detail.
2104 ///
2105 /// [long-running operation]: https://google.aip.dev/151
2106 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2107 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2108 ///
2109 /// # Example
2110 /// ```
2111 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2112 /// use google_cloud_lro::Poller;
2113 /// use google_cloud_networkconnectivity_v1::Result;
2114 /// async fn sample(
2115 /// client: &HubService
2116 /// ) -> Result<()> {
2117 /// let response = client.accept_spoke_update()
2118 /// /* set fields */
2119 /// .poller().until_done().await?;
2120 /// println!("response {:?}", response);
2121 /// Ok(())
2122 /// }
2123 /// ```
2124 pub fn accept_spoke_update(&self) -> super::builder::hub_service::AcceptSpokeUpdate {
2125 super::builder::hub_service::AcceptSpokeUpdate::new(self.inner.clone())
2126 }
2127
2128 /// Rejects a proposal to update a Network Connectivity Center spoke in a hub.
2129 ///
2130 /// # Long running operations
2131 ///
2132 /// This method is used to start, and/or poll a [long-running Operation].
2133 /// The [Working with long-running operations] chapter in the [user guide]
2134 /// covers these operations in detail.
2135 ///
2136 /// [long-running operation]: https://google.aip.dev/151
2137 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2138 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2139 ///
2140 /// # Example
2141 /// ```
2142 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2143 /// use google_cloud_lro::Poller;
2144 /// use google_cloud_networkconnectivity_v1::Result;
2145 /// async fn sample(
2146 /// client: &HubService
2147 /// ) -> Result<()> {
2148 /// let response = client.reject_spoke_update()
2149 /// /* set fields */
2150 /// .poller().until_done().await?;
2151 /// println!("response {:?}", response);
2152 /// Ok(())
2153 /// }
2154 /// ```
2155 pub fn reject_spoke_update(&self) -> super::builder::hub_service::RejectSpokeUpdate {
2156 super::builder::hub_service::RejectSpokeUpdate::new(self.inner.clone())
2157 }
2158
2159 /// Deletes a Network Connectivity Center spoke.
2160 ///
2161 /// # Long running operations
2162 ///
2163 /// This method is used to start, and/or poll a [long-running Operation].
2164 /// The [Working with long-running operations] chapter in the [user guide]
2165 /// covers these operations in detail.
2166 ///
2167 /// [long-running operation]: https://google.aip.dev/151
2168 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2169 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2170 ///
2171 /// # Example
2172 /// ```
2173 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2174 /// use google_cloud_lro::Poller;
2175 /// use google_cloud_networkconnectivity_v1::Result;
2176 /// async fn sample(
2177 /// client: &HubService, name: &str
2178 /// ) -> Result<()> {
2179 /// client.delete_spoke()
2180 /// .set_name(name)
2181 /// .poller().until_done().await?;
2182 /// Ok(())
2183 /// }
2184 /// ```
2185 pub fn delete_spoke(&self) -> super::builder::hub_service::DeleteSpoke {
2186 super::builder::hub_service::DeleteSpoke::new(self.inner.clone())
2187 }
2188
2189 /// Gets details about a Network Connectivity Center route table.
2190 ///
2191 /// # Example
2192 /// ```
2193 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2194 /// use google_cloud_networkconnectivity_v1::Result;
2195 /// async fn sample(
2196 /// client: &HubService, name: &str
2197 /// ) -> Result<()> {
2198 /// let response = client.get_route_table()
2199 /// .set_name(name)
2200 /// .send().await?;
2201 /// println!("response {:?}", response);
2202 /// Ok(())
2203 /// }
2204 /// ```
2205 pub fn get_route_table(&self) -> super::builder::hub_service::GetRouteTable {
2206 super::builder::hub_service::GetRouteTable::new(self.inner.clone())
2207 }
2208
2209 /// Gets details about the specified route.
2210 ///
2211 /// # Example
2212 /// ```
2213 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2214 /// use google_cloud_networkconnectivity_v1::Result;
2215 /// async fn sample(
2216 /// client: &HubService, name: &str
2217 /// ) -> Result<()> {
2218 /// let response = client.get_route()
2219 /// .set_name(name)
2220 /// .send().await?;
2221 /// println!("response {:?}", response);
2222 /// Ok(())
2223 /// }
2224 /// ```
2225 pub fn get_route(&self) -> super::builder::hub_service::GetRoute {
2226 super::builder::hub_service::GetRoute::new(self.inner.clone())
2227 }
2228
2229 /// Lists routes in a given route table.
2230 ///
2231 /// # Example
2232 /// ```
2233 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2234 /// use google_cloud_gax::paginator::ItemPaginator as _;
2235 /// use google_cloud_networkconnectivity_v1::Result;
2236 /// async fn sample(
2237 /// client: &HubService, parent: &str
2238 /// ) -> Result<()> {
2239 /// let mut list = client.list_routes()
2240 /// .set_parent(parent)
2241 /// .by_item();
2242 /// while let Some(item) = list.next().await.transpose()? {
2243 /// println!("{:?}", item);
2244 /// }
2245 /// Ok(())
2246 /// }
2247 /// ```
2248 pub fn list_routes(&self) -> super::builder::hub_service::ListRoutes {
2249 super::builder::hub_service::ListRoutes::new(self.inner.clone())
2250 }
2251
2252 /// Lists route tables in a given hub.
2253 ///
2254 /// # Example
2255 /// ```
2256 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2257 /// use google_cloud_gax::paginator::ItemPaginator as _;
2258 /// use google_cloud_networkconnectivity_v1::Result;
2259 /// async fn sample(
2260 /// client: &HubService, parent: &str
2261 /// ) -> Result<()> {
2262 /// let mut list = client.list_route_tables()
2263 /// .set_parent(parent)
2264 /// .by_item();
2265 /// while let Some(item) = list.next().await.transpose()? {
2266 /// println!("{:?}", item);
2267 /// }
2268 /// Ok(())
2269 /// }
2270 /// ```
2271 pub fn list_route_tables(&self) -> super::builder::hub_service::ListRouteTables {
2272 super::builder::hub_service::ListRouteTables::new(self.inner.clone())
2273 }
2274
2275 /// Gets details about a Network Connectivity Center group.
2276 ///
2277 /// # Example
2278 /// ```
2279 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2280 /// use google_cloud_networkconnectivity_v1::Result;
2281 /// async fn sample(
2282 /// client: &HubService, name: &str
2283 /// ) -> Result<()> {
2284 /// let response = client.get_group()
2285 /// .set_name(name)
2286 /// .send().await?;
2287 /// println!("response {:?}", response);
2288 /// Ok(())
2289 /// }
2290 /// ```
2291 pub fn get_group(&self) -> super::builder::hub_service::GetGroup {
2292 super::builder::hub_service::GetGroup::new(self.inner.clone())
2293 }
2294
2295 /// Lists groups in a given hub.
2296 ///
2297 /// # Example
2298 /// ```
2299 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2300 /// use google_cloud_gax::paginator::ItemPaginator as _;
2301 /// use google_cloud_networkconnectivity_v1::Result;
2302 /// async fn sample(
2303 /// client: &HubService, parent: &str
2304 /// ) -> Result<()> {
2305 /// let mut list = client.list_groups()
2306 /// .set_parent(parent)
2307 /// .by_item();
2308 /// while let Some(item) = list.next().await.transpose()? {
2309 /// println!("{:?}", item);
2310 /// }
2311 /// Ok(())
2312 /// }
2313 /// ```
2314 pub fn list_groups(&self) -> super::builder::hub_service::ListGroups {
2315 super::builder::hub_service::ListGroups::new(self.inner.clone())
2316 }
2317
2318 /// Updates the parameters of a Network Connectivity Center group.
2319 ///
2320 /// # Long running operations
2321 ///
2322 /// This method is used to start, and/or poll a [long-running Operation].
2323 /// The [Working with long-running operations] chapter in the [user guide]
2324 /// covers these operations in detail.
2325 ///
2326 /// [long-running operation]: https://google.aip.dev/151
2327 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2328 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2329 ///
2330 /// # Example
2331 /// ```
2332 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2333 /// use google_cloud_lro::Poller;
2334 /// # extern crate wkt as google_cloud_wkt;
2335 /// use google_cloud_wkt::FieldMask;
2336 /// use google_cloud_networkconnectivity_v1::model::Group;
2337 /// use google_cloud_networkconnectivity_v1::Result;
2338 /// async fn sample(
2339 /// client: &HubService, name: &str
2340 /// ) -> Result<()> {
2341 /// let response = client.update_group()
2342 /// .set_group(
2343 /// Group::new().set_name(name)/* set fields */
2344 /// )
2345 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2346 /// .poller().until_done().await?;
2347 /// println!("response {:?}", response);
2348 /// Ok(())
2349 /// }
2350 /// ```
2351 pub fn update_group(&self) -> super::builder::hub_service::UpdateGroup {
2352 super::builder::hub_service::UpdateGroup::new(self.inner.clone())
2353 }
2354
2355 /// Lists information about the supported locations for this service.
2356 ///
2357 /// # Example
2358 /// ```
2359 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2360 /// use google_cloud_gax::paginator::ItemPaginator as _;
2361 /// use google_cloud_networkconnectivity_v1::Result;
2362 /// async fn sample(
2363 /// client: &HubService
2364 /// ) -> Result<()> {
2365 /// let mut list = client.list_locations()
2366 /// /* set fields */
2367 /// .by_item();
2368 /// while let Some(item) = list.next().await.transpose()? {
2369 /// println!("{:?}", item);
2370 /// }
2371 /// Ok(())
2372 /// }
2373 /// ```
2374 pub fn list_locations(&self) -> super::builder::hub_service::ListLocations {
2375 super::builder::hub_service::ListLocations::new(self.inner.clone())
2376 }
2377
2378 /// Gets information about a location.
2379 ///
2380 /// # Example
2381 /// ```
2382 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2383 /// use google_cloud_networkconnectivity_v1::Result;
2384 /// async fn sample(
2385 /// client: &HubService
2386 /// ) -> Result<()> {
2387 /// let response = client.get_location()
2388 /// /* set fields */
2389 /// .send().await?;
2390 /// println!("response {:?}", response);
2391 /// Ok(())
2392 /// }
2393 /// ```
2394 pub fn get_location(&self) -> super::builder::hub_service::GetLocation {
2395 super::builder::hub_service::GetLocation::new(self.inner.clone())
2396 }
2397
2398 /// Sets the access control policy on the specified resource. Replaces
2399 /// any existing policy.
2400 ///
2401 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2402 /// errors.
2403 ///
2404 /// # Example
2405 /// ```
2406 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2407 /// use google_cloud_networkconnectivity_v1::Result;
2408 /// async fn sample(
2409 /// client: &HubService
2410 /// ) -> Result<()> {
2411 /// let response = client.set_iam_policy()
2412 /// /* set fields */
2413 /// .send().await?;
2414 /// println!("response {:?}", response);
2415 /// Ok(())
2416 /// }
2417 /// ```
2418 pub fn set_iam_policy(&self) -> super::builder::hub_service::SetIamPolicy {
2419 super::builder::hub_service::SetIamPolicy::new(self.inner.clone())
2420 }
2421
2422 /// Gets the access control policy for a resource. Returns an empty policy
2423 /// if the resource exists and does not have a policy set.
2424 ///
2425 /// # Example
2426 /// ```
2427 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2428 /// use google_cloud_networkconnectivity_v1::Result;
2429 /// async fn sample(
2430 /// client: &HubService
2431 /// ) -> Result<()> {
2432 /// let response = client.get_iam_policy()
2433 /// /* set fields */
2434 /// .send().await?;
2435 /// println!("response {:?}", response);
2436 /// Ok(())
2437 /// }
2438 /// ```
2439 pub fn get_iam_policy(&self) -> super::builder::hub_service::GetIamPolicy {
2440 super::builder::hub_service::GetIamPolicy::new(self.inner.clone())
2441 }
2442
2443 /// Returns permissions that a caller has on the specified resource. If the
2444 /// resource does not exist, this will return an empty set of
2445 /// permissions, not a `NOT_FOUND` error.
2446 ///
2447 /// Note: This operation is designed to be used for building
2448 /// permission-aware UIs and command-line tools, not for authorization
2449 /// checking. This operation may "fail open" without warning.
2450 ///
2451 /// # Example
2452 /// ```
2453 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2454 /// use google_cloud_networkconnectivity_v1::Result;
2455 /// async fn sample(
2456 /// client: &HubService
2457 /// ) -> Result<()> {
2458 /// let response = client.test_iam_permissions()
2459 /// /* set fields */
2460 /// .send().await?;
2461 /// println!("response {:?}", response);
2462 /// Ok(())
2463 /// }
2464 /// ```
2465 pub fn test_iam_permissions(&self) -> super::builder::hub_service::TestIamPermissions {
2466 super::builder::hub_service::TestIamPermissions::new(self.inner.clone())
2467 }
2468
2469 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2470 ///
2471 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2472 ///
2473 /// # Example
2474 /// ```
2475 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2476 /// use google_cloud_gax::paginator::ItemPaginator as _;
2477 /// use google_cloud_networkconnectivity_v1::Result;
2478 /// async fn sample(
2479 /// client: &HubService
2480 /// ) -> Result<()> {
2481 /// let mut list = client.list_operations()
2482 /// /* set fields */
2483 /// .by_item();
2484 /// while let Some(item) = list.next().await.transpose()? {
2485 /// println!("{:?}", item);
2486 /// }
2487 /// Ok(())
2488 /// }
2489 /// ```
2490 pub fn list_operations(&self) -> super::builder::hub_service::ListOperations {
2491 super::builder::hub_service::ListOperations::new(self.inner.clone())
2492 }
2493
2494 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2495 ///
2496 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2497 ///
2498 /// # Example
2499 /// ```
2500 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2501 /// use google_cloud_networkconnectivity_v1::Result;
2502 /// async fn sample(
2503 /// client: &HubService
2504 /// ) -> Result<()> {
2505 /// let response = client.get_operation()
2506 /// /* set fields */
2507 /// .send().await?;
2508 /// println!("response {:?}", response);
2509 /// Ok(())
2510 /// }
2511 /// ```
2512 pub fn get_operation(&self) -> super::builder::hub_service::GetOperation {
2513 super::builder::hub_service::GetOperation::new(self.inner.clone())
2514 }
2515
2516 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2517 ///
2518 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2519 ///
2520 /// # Example
2521 /// ```
2522 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2523 /// use google_cloud_networkconnectivity_v1::Result;
2524 /// async fn sample(
2525 /// client: &HubService
2526 /// ) -> Result<()> {
2527 /// client.delete_operation()
2528 /// /* set fields */
2529 /// .send().await?;
2530 /// Ok(())
2531 /// }
2532 /// ```
2533 pub fn delete_operation(&self) -> super::builder::hub_service::DeleteOperation {
2534 super::builder::hub_service::DeleteOperation::new(self.inner.clone())
2535 }
2536
2537 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2538 ///
2539 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2540 ///
2541 /// # Example
2542 /// ```
2543 /// # use google_cloud_networkconnectivity_v1::client::HubService;
2544 /// use google_cloud_networkconnectivity_v1::Result;
2545 /// async fn sample(
2546 /// client: &HubService
2547 /// ) -> Result<()> {
2548 /// client.cancel_operation()
2549 /// /* set fields */
2550 /// .send().await?;
2551 /// Ok(())
2552 /// }
2553 /// ```
2554 pub fn cancel_operation(&self) -> super::builder::hub_service::CancelOperation {
2555 super::builder::hub_service::CancelOperation::new(self.inner.clone())
2556 }
2557}
2558
2559/// Implements a client for the Network Connectivity API.
2560///
2561/// # Example
2562/// ```
2563/// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2564/// use google_cloud_gax::paginator::ItemPaginator as _;
2565/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
2566/// let client = InternalRangeService::builder().build().await?;
2567/// let parent = "parent_value";
2568/// let mut list = client.list_internal_ranges()
2569/// .set_parent(parent)
2570/// .by_item();
2571/// while let Some(item) = list.next().await.transpose()? {
2572/// println!("{:?}", item);
2573/// }
2574/// # Ok(()) }
2575/// ```
2576///
2577/// # Service Description
2578///
2579/// The CLH-based service for internal range resources used to perform IPAM
2580/// operations within a VPC network.
2581///
2582/// # Configuration
2583///
2584/// To configure `InternalRangeService` use the `with_*` methods in the type returned
2585/// by [builder()][InternalRangeService::builder]. The default configuration should
2586/// work for most applications. Common configuration changes include
2587///
2588/// * [with_endpoint()]: by default this client uses the global default endpoint
2589/// (`https://networkconnectivity.googleapis.com`). Applications using regional
2590/// endpoints or running in restricted networks (e.g. a network configured
2591// with [Private Google Access with VPC Service Controls]) may want to
2592/// override this default.
2593/// * [with_credentials()]: by default this client uses
2594/// [Application Default Credentials]. Applications using custom
2595/// authentication may need to override this default.
2596///
2597/// [with_endpoint()]: super::builder::internal_range_service::ClientBuilder::with_endpoint
2598/// [with_credentials()]: super::builder::internal_range_service::ClientBuilder::with_credentials
2599/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2600/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2601///
2602/// # Pooling and Cloning
2603///
2604/// `InternalRangeService` holds a connection pool internally, it is advised to
2605/// create one and reuse it. You do not need to wrap `InternalRangeService` in
2606/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2607/// already uses an `Arc` internally.
2608#[derive(Clone, Debug)]
2609pub struct InternalRangeService {
2610 inner: std::sync::Arc<dyn super::stub::dynamic::InternalRangeService>,
2611}
2612
2613impl InternalRangeService {
2614 /// Returns a builder for [InternalRangeService].
2615 ///
2616 /// ```
2617 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2618 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2619 /// let client = InternalRangeService::builder().build().await?;
2620 /// # Ok(()) }
2621 /// ```
2622 pub fn builder() -> super::builder::internal_range_service::ClientBuilder {
2623 crate::new_client_builder(super::builder::internal_range_service::client::Factory)
2624 }
2625
2626 /// Creates a new client from the provided stub.
2627 ///
2628 /// The most common case for calling this function is in tests mocking the
2629 /// client's behavior.
2630 pub fn from_stub<T>(stub: T) -> Self
2631 where
2632 T: super::stub::InternalRangeService + 'static,
2633 {
2634 Self {
2635 inner: std::sync::Arc::new(stub),
2636 }
2637 }
2638
2639 pub(crate) async fn new(
2640 config: gaxi::options::ClientConfig,
2641 ) -> crate::ClientBuilderResult<Self> {
2642 let inner = Self::build_inner(config).await?;
2643 Ok(Self { inner })
2644 }
2645
2646 async fn build_inner(
2647 conf: gaxi::options::ClientConfig,
2648 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InternalRangeService>>
2649 {
2650 if gaxi::options::tracing_enabled(&conf) {
2651 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2652 }
2653 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2654 }
2655
2656 async fn build_transport(
2657 conf: gaxi::options::ClientConfig,
2658 ) -> crate::ClientBuilderResult<impl super::stub::InternalRangeService> {
2659 super::transport::InternalRangeService::new(conf).await
2660 }
2661
2662 async fn build_with_tracing(
2663 conf: gaxi::options::ClientConfig,
2664 ) -> crate::ClientBuilderResult<impl super::stub::InternalRangeService> {
2665 Self::build_transport(conf)
2666 .await
2667 .map(super::tracing::InternalRangeService::new)
2668 }
2669
2670 /// Lists internal ranges in a given project and location.
2671 ///
2672 /// # Example
2673 /// ```
2674 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2675 /// use google_cloud_gax::paginator::ItemPaginator as _;
2676 /// use google_cloud_networkconnectivity_v1::Result;
2677 /// async fn sample(
2678 /// client: &InternalRangeService, parent: &str
2679 /// ) -> Result<()> {
2680 /// let mut list = client.list_internal_ranges()
2681 /// .set_parent(parent)
2682 /// .by_item();
2683 /// while let Some(item) = list.next().await.transpose()? {
2684 /// println!("{:?}", item);
2685 /// }
2686 /// Ok(())
2687 /// }
2688 /// ```
2689 pub fn list_internal_ranges(
2690 &self,
2691 ) -> super::builder::internal_range_service::ListInternalRanges {
2692 super::builder::internal_range_service::ListInternalRanges::new(self.inner.clone())
2693 }
2694
2695 /// Gets details of a single internal range.
2696 ///
2697 /// # Example
2698 /// ```
2699 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2700 /// use google_cloud_networkconnectivity_v1::Result;
2701 /// async fn sample(
2702 /// client: &InternalRangeService, name: &str
2703 /// ) -> Result<()> {
2704 /// let response = client.get_internal_range()
2705 /// .set_name(name)
2706 /// .send().await?;
2707 /// println!("response {:?}", response);
2708 /// Ok(())
2709 /// }
2710 /// ```
2711 pub fn get_internal_range(&self) -> super::builder::internal_range_service::GetInternalRange {
2712 super::builder::internal_range_service::GetInternalRange::new(self.inner.clone())
2713 }
2714
2715 /// Creates a new internal range in a given project and location.
2716 ///
2717 /// # Long running operations
2718 ///
2719 /// This method is used to start, and/or poll a [long-running Operation].
2720 /// The [Working with long-running operations] chapter in the [user guide]
2721 /// covers these operations in detail.
2722 ///
2723 /// [long-running operation]: https://google.aip.dev/151
2724 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2725 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2726 ///
2727 /// # Example
2728 /// ```
2729 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2730 /// use google_cloud_lro::Poller;
2731 /// use google_cloud_networkconnectivity_v1::model::InternalRange;
2732 /// use google_cloud_networkconnectivity_v1::Result;
2733 /// async fn sample(
2734 /// client: &InternalRangeService, parent: &str
2735 /// ) -> Result<()> {
2736 /// let response = client.create_internal_range()
2737 /// .set_parent(parent)
2738 /// .set_internal_range(
2739 /// InternalRange::new()/* set fields */
2740 /// )
2741 /// .poller().until_done().await?;
2742 /// println!("response {:?}", response);
2743 /// Ok(())
2744 /// }
2745 /// ```
2746 pub fn create_internal_range(
2747 &self,
2748 ) -> super::builder::internal_range_service::CreateInternalRange {
2749 super::builder::internal_range_service::CreateInternalRange::new(self.inner.clone())
2750 }
2751
2752 /// Updates the parameters of a single internal range.
2753 ///
2754 /// # Long running operations
2755 ///
2756 /// This method is used to start, and/or poll a [long-running Operation].
2757 /// The [Working with long-running operations] chapter in the [user guide]
2758 /// covers these operations in detail.
2759 ///
2760 /// [long-running operation]: https://google.aip.dev/151
2761 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2762 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2763 ///
2764 /// # Example
2765 /// ```
2766 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2767 /// use google_cloud_lro::Poller;
2768 /// # extern crate wkt as google_cloud_wkt;
2769 /// use google_cloud_wkt::FieldMask;
2770 /// use google_cloud_networkconnectivity_v1::model::InternalRange;
2771 /// use google_cloud_networkconnectivity_v1::Result;
2772 /// async fn sample(
2773 /// client: &InternalRangeService, name: &str
2774 /// ) -> Result<()> {
2775 /// let response = client.update_internal_range()
2776 /// .set_internal_range(
2777 /// InternalRange::new().set_name(name)/* set fields */
2778 /// )
2779 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2780 /// .poller().until_done().await?;
2781 /// println!("response {:?}", response);
2782 /// Ok(())
2783 /// }
2784 /// ```
2785 pub fn update_internal_range(
2786 &self,
2787 ) -> super::builder::internal_range_service::UpdateInternalRange {
2788 super::builder::internal_range_service::UpdateInternalRange::new(self.inner.clone())
2789 }
2790
2791 /// Deletes a single internal range.
2792 ///
2793 /// # Long running operations
2794 ///
2795 /// This method is used to start, and/or poll a [long-running Operation].
2796 /// The [Working with long-running operations] chapter in the [user guide]
2797 /// covers these operations in detail.
2798 ///
2799 /// [long-running operation]: https://google.aip.dev/151
2800 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2801 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2802 ///
2803 /// # Example
2804 /// ```
2805 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2806 /// use google_cloud_lro::Poller;
2807 /// use google_cloud_networkconnectivity_v1::Result;
2808 /// async fn sample(
2809 /// client: &InternalRangeService, name: &str
2810 /// ) -> Result<()> {
2811 /// client.delete_internal_range()
2812 /// .set_name(name)
2813 /// .poller().until_done().await?;
2814 /// Ok(())
2815 /// }
2816 /// ```
2817 pub fn delete_internal_range(
2818 &self,
2819 ) -> super::builder::internal_range_service::DeleteInternalRange {
2820 super::builder::internal_range_service::DeleteInternalRange::new(self.inner.clone())
2821 }
2822
2823 /// Lists information about the supported locations for this service.
2824 ///
2825 /// # Example
2826 /// ```
2827 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2828 /// use google_cloud_gax::paginator::ItemPaginator as _;
2829 /// use google_cloud_networkconnectivity_v1::Result;
2830 /// async fn sample(
2831 /// client: &InternalRangeService
2832 /// ) -> Result<()> {
2833 /// let mut list = client.list_locations()
2834 /// /* set fields */
2835 /// .by_item();
2836 /// while let Some(item) = list.next().await.transpose()? {
2837 /// println!("{:?}", item);
2838 /// }
2839 /// Ok(())
2840 /// }
2841 /// ```
2842 pub fn list_locations(&self) -> super::builder::internal_range_service::ListLocations {
2843 super::builder::internal_range_service::ListLocations::new(self.inner.clone())
2844 }
2845
2846 /// Gets information about a location.
2847 ///
2848 /// # Example
2849 /// ```
2850 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2851 /// use google_cloud_networkconnectivity_v1::Result;
2852 /// async fn sample(
2853 /// client: &InternalRangeService
2854 /// ) -> Result<()> {
2855 /// let response = client.get_location()
2856 /// /* set fields */
2857 /// .send().await?;
2858 /// println!("response {:?}", response);
2859 /// Ok(())
2860 /// }
2861 /// ```
2862 pub fn get_location(&self) -> super::builder::internal_range_service::GetLocation {
2863 super::builder::internal_range_service::GetLocation::new(self.inner.clone())
2864 }
2865
2866 /// Sets the access control policy on the specified resource. Replaces
2867 /// any existing policy.
2868 ///
2869 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2870 /// errors.
2871 ///
2872 /// # Example
2873 /// ```
2874 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2875 /// use google_cloud_networkconnectivity_v1::Result;
2876 /// async fn sample(
2877 /// client: &InternalRangeService
2878 /// ) -> Result<()> {
2879 /// let response = client.set_iam_policy()
2880 /// /* set fields */
2881 /// .send().await?;
2882 /// println!("response {:?}", response);
2883 /// Ok(())
2884 /// }
2885 /// ```
2886 pub fn set_iam_policy(&self) -> super::builder::internal_range_service::SetIamPolicy {
2887 super::builder::internal_range_service::SetIamPolicy::new(self.inner.clone())
2888 }
2889
2890 /// Gets the access control policy for a resource. Returns an empty policy
2891 /// if the resource exists and does not have a policy set.
2892 ///
2893 /// # Example
2894 /// ```
2895 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2896 /// use google_cloud_networkconnectivity_v1::Result;
2897 /// async fn sample(
2898 /// client: &InternalRangeService
2899 /// ) -> Result<()> {
2900 /// let response = client.get_iam_policy()
2901 /// /* set fields */
2902 /// .send().await?;
2903 /// println!("response {:?}", response);
2904 /// Ok(())
2905 /// }
2906 /// ```
2907 pub fn get_iam_policy(&self) -> super::builder::internal_range_service::GetIamPolicy {
2908 super::builder::internal_range_service::GetIamPolicy::new(self.inner.clone())
2909 }
2910
2911 /// Returns permissions that a caller has on the specified resource. If the
2912 /// resource does not exist, this will return an empty set of
2913 /// permissions, not a `NOT_FOUND` error.
2914 ///
2915 /// Note: This operation is designed to be used for building
2916 /// permission-aware UIs and command-line tools, not for authorization
2917 /// checking. This operation may "fail open" without warning.
2918 ///
2919 /// # Example
2920 /// ```
2921 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2922 /// use google_cloud_networkconnectivity_v1::Result;
2923 /// async fn sample(
2924 /// client: &InternalRangeService
2925 /// ) -> Result<()> {
2926 /// let response = client.test_iam_permissions()
2927 /// /* set fields */
2928 /// .send().await?;
2929 /// println!("response {:?}", response);
2930 /// Ok(())
2931 /// }
2932 /// ```
2933 pub fn test_iam_permissions(
2934 &self,
2935 ) -> super::builder::internal_range_service::TestIamPermissions {
2936 super::builder::internal_range_service::TestIamPermissions::new(self.inner.clone())
2937 }
2938
2939 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2940 ///
2941 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2942 ///
2943 /// # Example
2944 /// ```
2945 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2946 /// use google_cloud_gax::paginator::ItemPaginator as _;
2947 /// use google_cloud_networkconnectivity_v1::Result;
2948 /// async fn sample(
2949 /// client: &InternalRangeService
2950 /// ) -> Result<()> {
2951 /// let mut list = client.list_operations()
2952 /// /* set fields */
2953 /// .by_item();
2954 /// while let Some(item) = list.next().await.transpose()? {
2955 /// println!("{:?}", item);
2956 /// }
2957 /// Ok(())
2958 /// }
2959 /// ```
2960 pub fn list_operations(&self) -> super::builder::internal_range_service::ListOperations {
2961 super::builder::internal_range_service::ListOperations::new(self.inner.clone())
2962 }
2963
2964 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2965 ///
2966 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2967 ///
2968 /// # Example
2969 /// ```
2970 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2971 /// use google_cloud_networkconnectivity_v1::Result;
2972 /// async fn sample(
2973 /// client: &InternalRangeService
2974 /// ) -> Result<()> {
2975 /// let response = client.get_operation()
2976 /// /* set fields */
2977 /// .send().await?;
2978 /// println!("response {:?}", response);
2979 /// Ok(())
2980 /// }
2981 /// ```
2982 pub fn get_operation(&self) -> super::builder::internal_range_service::GetOperation {
2983 super::builder::internal_range_service::GetOperation::new(self.inner.clone())
2984 }
2985
2986 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2987 ///
2988 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2989 ///
2990 /// # Example
2991 /// ```
2992 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
2993 /// use google_cloud_networkconnectivity_v1::Result;
2994 /// async fn sample(
2995 /// client: &InternalRangeService
2996 /// ) -> Result<()> {
2997 /// client.delete_operation()
2998 /// /* set fields */
2999 /// .send().await?;
3000 /// Ok(())
3001 /// }
3002 /// ```
3003 pub fn delete_operation(&self) -> super::builder::internal_range_service::DeleteOperation {
3004 super::builder::internal_range_service::DeleteOperation::new(self.inner.clone())
3005 }
3006
3007 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3008 ///
3009 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3010 ///
3011 /// # Example
3012 /// ```
3013 /// # use google_cloud_networkconnectivity_v1::client::InternalRangeService;
3014 /// use google_cloud_networkconnectivity_v1::Result;
3015 /// async fn sample(
3016 /// client: &InternalRangeService
3017 /// ) -> Result<()> {
3018 /// client.cancel_operation()
3019 /// /* set fields */
3020 /// .send().await?;
3021 /// Ok(())
3022 /// }
3023 /// ```
3024 pub fn cancel_operation(&self) -> super::builder::internal_range_service::CancelOperation {
3025 super::builder::internal_range_service::CancelOperation::new(self.inner.clone())
3026 }
3027}
3028
3029/// Implements a client for the Network Connectivity API.
3030///
3031/// # Example
3032/// ```
3033/// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3034/// use google_cloud_gax::paginator::ItemPaginator as _;
3035/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
3036/// let client = PolicyBasedRoutingService::builder().build().await?;
3037/// let parent = "parent_value";
3038/// let mut list = client.list_policy_based_routes()
3039/// .set_parent(parent)
3040/// .by_item();
3041/// while let Some(item) = list.next().await.transpose()? {
3042/// println!("{:?}", item);
3043/// }
3044/// # Ok(()) }
3045/// ```
3046///
3047/// # Service Description
3048///
3049/// Policy-Based Routing allows GCP customers to specify flexibile routing
3050/// policies for Layer 4 traffic traversing through the connected service.
3051///
3052/// # Configuration
3053///
3054/// To configure `PolicyBasedRoutingService` use the `with_*` methods in the type returned
3055/// by [builder()][PolicyBasedRoutingService::builder]. The default configuration should
3056/// work for most applications. Common configuration changes include
3057///
3058/// * [with_endpoint()]: by default this client uses the global default endpoint
3059/// (`https://networkconnectivity.googleapis.com`). Applications using regional
3060/// endpoints or running in restricted networks (e.g. a network configured
3061// with [Private Google Access with VPC Service Controls]) may want to
3062/// override this default.
3063/// * [with_credentials()]: by default this client uses
3064/// [Application Default Credentials]. Applications using custom
3065/// authentication may need to override this default.
3066///
3067/// [with_endpoint()]: super::builder::policy_based_routing_service::ClientBuilder::with_endpoint
3068/// [with_credentials()]: super::builder::policy_based_routing_service::ClientBuilder::with_credentials
3069/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3070/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3071///
3072/// # Pooling and Cloning
3073///
3074/// `PolicyBasedRoutingService` holds a connection pool internally, it is advised to
3075/// create one and reuse it. You do not need to wrap `PolicyBasedRoutingService` in
3076/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3077/// already uses an `Arc` internally.
3078#[derive(Clone, Debug)]
3079pub struct PolicyBasedRoutingService {
3080 inner: std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
3081}
3082
3083impl PolicyBasedRoutingService {
3084 /// Returns a builder for [PolicyBasedRoutingService].
3085 ///
3086 /// ```
3087 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3088 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3089 /// let client = PolicyBasedRoutingService::builder().build().await?;
3090 /// # Ok(()) }
3091 /// ```
3092 pub fn builder() -> super::builder::policy_based_routing_service::ClientBuilder {
3093 crate::new_client_builder(super::builder::policy_based_routing_service::client::Factory)
3094 }
3095
3096 /// Creates a new client from the provided stub.
3097 ///
3098 /// The most common case for calling this function is in tests mocking the
3099 /// client's behavior.
3100 pub fn from_stub<T>(stub: T) -> Self
3101 where
3102 T: super::stub::PolicyBasedRoutingService + 'static,
3103 {
3104 Self {
3105 inner: std::sync::Arc::new(stub),
3106 }
3107 }
3108
3109 pub(crate) async fn new(
3110 config: gaxi::options::ClientConfig,
3111 ) -> crate::ClientBuilderResult<Self> {
3112 let inner = Self::build_inner(config).await?;
3113 Ok(Self { inner })
3114 }
3115
3116 async fn build_inner(
3117 conf: gaxi::options::ClientConfig,
3118 ) -> crate::ClientBuilderResult<
3119 std::sync::Arc<dyn super::stub::dynamic::PolicyBasedRoutingService>,
3120 > {
3121 if gaxi::options::tracing_enabled(&conf) {
3122 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3123 }
3124 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3125 }
3126
3127 async fn build_transport(
3128 conf: gaxi::options::ClientConfig,
3129 ) -> crate::ClientBuilderResult<impl super::stub::PolicyBasedRoutingService> {
3130 super::transport::PolicyBasedRoutingService::new(conf).await
3131 }
3132
3133 async fn build_with_tracing(
3134 conf: gaxi::options::ClientConfig,
3135 ) -> crate::ClientBuilderResult<impl super::stub::PolicyBasedRoutingService> {
3136 Self::build_transport(conf)
3137 .await
3138 .map(super::tracing::PolicyBasedRoutingService::new)
3139 }
3140
3141 /// Lists policy-based routes in a given project and location.
3142 ///
3143 /// # Example
3144 /// ```
3145 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3146 /// use google_cloud_gax::paginator::ItemPaginator as _;
3147 /// use google_cloud_networkconnectivity_v1::Result;
3148 /// async fn sample(
3149 /// client: &PolicyBasedRoutingService, parent: &str
3150 /// ) -> Result<()> {
3151 /// let mut list = client.list_policy_based_routes()
3152 /// .set_parent(parent)
3153 /// .by_item();
3154 /// while let Some(item) = list.next().await.transpose()? {
3155 /// println!("{:?}", item);
3156 /// }
3157 /// Ok(())
3158 /// }
3159 /// ```
3160 pub fn list_policy_based_routes(
3161 &self,
3162 ) -> super::builder::policy_based_routing_service::ListPolicyBasedRoutes {
3163 super::builder::policy_based_routing_service::ListPolicyBasedRoutes::new(self.inner.clone())
3164 }
3165
3166 /// Gets details of a single policy-based route.
3167 ///
3168 /// # Example
3169 /// ```
3170 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3171 /// use google_cloud_networkconnectivity_v1::Result;
3172 /// async fn sample(
3173 /// client: &PolicyBasedRoutingService, name: &str
3174 /// ) -> Result<()> {
3175 /// let response = client.get_policy_based_route()
3176 /// .set_name(name)
3177 /// .send().await?;
3178 /// println!("response {:?}", response);
3179 /// Ok(())
3180 /// }
3181 /// ```
3182 pub fn get_policy_based_route(
3183 &self,
3184 ) -> super::builder::policy_based_routing_service::GetPolicyBasedRoute {
3185 super::builder::policy_based_routing_service::GetPolicyBasedRoute::new(self.inner.clone())
3186 }
3187
3188 /// Creates a new policy-based route in a given project and location.
3189 ///
3190 /// # Long running operations
3191 ///
3192 /// This method is used to start, and/or poll a [long-running Operation].
3193 /// The [Working with long-running operations] chapter in the [user guide]
3194 /// covers these operations in detail.
3195 ///
3196 /// [long-running operation]: https://google.aip.dev/151
3197 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3198 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3199 ///
3200 /// # Example
3201 /// ```
3202 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3203 /// use google_cloud_lro::Poller;
3204 /// use google_cloud_networkconnectivity_v1::model::PolicyBasedRoute;
3205 /// use google_cloud_networkconnectivity_v1::Result;
3206 /// async fn sample(
3207 /// client: &PolicyBasedRoutingService, parent: &str
3208 /// ) -> Result<()> {
3209 /// let response = client.create_policy_based_route()
3210 /// .set_parent(parent)
3211 /// .set_policy_based_route(
3212 /// PolicyBasedRoute::new()/* set fields */
3213 /// )
3214 /// .poller().until_done().await?;
3215 /// println!("response {:?}", response);
3216 /// Ok(())
3217 /// }
3218 /// ```
3219 pub fn create_policy_based_route(
3220 &self,
3221 ) -> super::builder::policy_based_routing_service::CreatePolicyBasedRoute {
3222 super::builder::policy_based_routing_service::CreatePolicyBasedRoute::new(
3223 self.inner.clone(),
3224 )
3225 }
3226
3227 /// Deletes a single policy-based route.
3228 ///
3229 /// # Long running operations
3230 ///
3231 /// This method is used to start, and/or poll a [long-running Operation].
3232 /// The [Working with long-running operations] chapter in the [user guide]
3233 /// covers these operations in detail.
3234 ///
3235 /// [long-running operation]: https://google.aip.dev/151
3236 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3237 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3238 ///
3239 /// # Example
3240 /// ```
3241 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3242 /// use google_cloud_lro::Poller;
3243 /// use google_cloud_networkconnectivity_v1::Result;
3244 /// async fn sample(
3245 /// client: &PolicyBasedRoutingService, name: &str
3246 /// ) -> Result<()> {
3247 /// client.delete_policy_based_route()
3248 /// .set_name(name)
3249 /// .poller().until_done().await?;
3250 /// Ok(())
3251 /// }
3252 /// ```
3253 pub fn delete_policy_based_route(
3254 &self,
3255 ) -> super::builder::policy_based_routing_service::DeletePolicyBasedRoute {
3256 super::builder::policy_based_routing_service::DeletePolicyBasedRoute::new(
3257 self.inner.clone(),
3258 )
3259 }
3260
3261 /// Lists information about the supported locations for this service.
3262 ///
3263 /// # Example
3264 /// ```
3265 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3266 /// use google_cloud_gax::paginator::ItemPaginator as _;
3267 /// use google_cloud_networkconnectivity_v1::Result;
3268 /// async fn sample(
3269 /// client: &PolicyBasedRoutingService
3270 /// ) -> Result<()> {
3271 /// let mut list = client.list_locations()
3272 /// /* set fields */
3273 /// .by_item();
3274 /// while let Some(item) = list.next().await.transpose()? {
3275 /// println!("{:?}", item);
3276 /// }
3277 /// Ok(())
3278 /// }
3279 /// ```
3280 pub fn list_locations(&self) -> super::builder::policy_based_routing_service::ListLocations {
3281 super::builder::policy_based_routing_service::ListLocations::new(self.inner.clone())
3282 }
3283
3284 /// Gets information about a location.
3285 ///
3286 /// # Example
3287 /// ```
3288 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3289 /// use google_cloud_networkconnectivity_v1::Result;
3290 /// async fn sample(
3291 /// client: &PolicyBasedRoutingService
3292 /// ) -> Result<()> {
3293 /// let response = client.get_location()
3294 /// /* set fields */
3295 /// .send().await?;
3296 /// println!("response {:?}", response);
3297 /// Ok(())
3298 /// }
3299 /// ```
3300 pub fn get_location(&self) -> super::builder::policy_based_routing_service::GetLocation {
3301 super::builder::policy_based_routing_service::GetLocation::new(self.inner.clone())
3302 }
3303
3304 /// Sets the access control policy on the specified resource. Replaces
3305 /// any existing policy.
3306 ///
3307 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3308 /// errors.
3309 ///
3310 /// # Example
3311 /// ```
3312 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3313 /// use google_cloud_networkconnectivity_v1::Result;
3314 /// async fn sample(
3315 /// client: &PolicyBasedRoutingService
3316 /// ) -> Result<()> {
3317 /// let response = client.set_iam_policy()
3318 /// /* set fields */
3319 /// .send().await?;
3320 /// println!("response {:?}", response);
3321 /// Ok(())
3322 /// }
3323 /// ```
3324 pub fn set_iam_policy(&self) -> super::builder::policy_based_routing_service::SetIamPolicy {
3325 super::builder::policy_based_routing_service::SetIamPolicy::new(self.inner.clone())
3326 }
3327
3328 /// Gets the access control policy for a resource. Returns an empty policy
3329 /// if the resource exists and does not have a policy set.
3330 ///
3331 /// # Example
3332 /// ```
3333 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3334 /// use google_cloud_networkconnectivity_v1::Result;
3335 /// async fn sample(
3336 /// client: &PolicyBasedRoutingService
3337 /// ) -> Result<()> {
3338 /// let response = client.get_iam_policy()
3339 /// /* set fields */
3340 /// .send().await?;
3341 /// println!("response {:?}", response);
3342 /// Ok(())
3343 /// }
3344 /// ```
3345 pub fn get_iam_policy(&self) -> super::builder::policy_based_routing_service::GetIamPolicy {
3346 super::builder::policy_based_routing_service::GetIamPolicy::new(self.inner.clone())
3347 }
3348
3349 /// Returns permissions that a caller has on the specified resource. If the
3350 /// resource does not exist, this will return an empty set of
3351 /// permissions, not a `NOT_FOUND` error.
3352 ///
3353 /// Note: This operation is designed to be used for building
3354 /// permission-aware UIs and command-line tools, not for authorization
3355 /// checking. This operation may "fail open" without warning.
3356 ///
3357 /// # Example
3358 /// ```
3359 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3360 /// use google_cloud_networkconnectivity_v1::Result;
3361 /// async fn sample(
3362 /// client: &PolicyBasedRoutingService
3363 /// ) -> Result<()> {
3364 /// let response = client.test_iam_permissions()
3365 /// /* set fields */
3366 /// .send().await?;
3367 /// println!("response {:?}", response);
3368 /// Ok(())
3369 /// }
3370 /// ```
3371 pub fn test_iam_permissions(
3372 &self,
3373 ) -> super::builder::policy_based_routing_service::TestIamPermissions {
3374 super::builder::policy_based_routing_service::TestIamPermissions::new(self.inner.clone())
3375 }
3376
3377 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3378 ///
3379 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3380 ///
3381 /// # Example
3382 /// ```
3383 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3384 /// use google_cloud_gax::paginator::ItemPaginator as _;
3385 /// use google_cloud_networkconnectivity_v1::Result;
3386 /// async fn sample(
3387 /// client: &PolicyBasedRoutingService
3388 /// ) -> Result<()> {
3389 /// let mut list = client.list_operations()
3390 /// /* set fields */
3391 /// .by_item();
3392 /// while let Some(item) = list.next().await.transpose()? {
3393 /// println!("{:?}", item);
3394 /// }
3395 /// Ok(())
3396 /// }
3397 /// ```
3398 pub fn list_operations(&self) -> super::builder::policy_based_routing_service::ListOperations {
3399 super::builder::policy_based_routing_service::ListOperations::new(self.inner.clone())
3400 }
3401
3402 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3403 ///
3404 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3405 ///
3406 /// # Example
3407 /// ```
3408 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3409 /// use google_cloud_networkconnectivity_v1::Result;
3410 /// async fn sample(
3411 /// client: &PolicyBasedRoutingService
3412 /// ) -> Result<()> {
3413 /// let response = client.get_operation()
3414 /// /* set fields */
3415 /// .send().await?;
3416 /// println!("response {:?}", response);
3417 /// Ok(())
3418 /// }
3419 /// ```
3420 pub fn get_operation(&self) -> super::builder::policy_based_routing_service::GetOperation {
3421 super::builder::policy_based_routing_service::GetOperation::new(self.inner.clone())
3422 }
3423
3424 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3425 ///
3426 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3427 ///
3428 /// # Example
3429 /// ```
3430 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3431 /// use google_cloud_networkconnectivity_v1::Result;
3432 /// async fn sample(
3433 /// client: &PolicyBasedRoutingService
3434 /// ) -> Result<()> {
3435 /// client.delete_operation()
3436 /// /* set fields */
3437 /// .send().await?;
3438 /// Ok(())
3439 /// }
3440 /// ```
3441 pub fn delete_operation(
3442 &self,
3443 ) -> super::builder::policy_based_routing_service::DeleteOperation {
3444 super::builder::policy_based_routing_service::DeleteOperation::new(self.inner.clone())
3445 }
3446
3447 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3448 ///
3449 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3450 ///
3451 /// # Example
3452 /// ```
3453 /// # use google_cloud_networkconnectivity_v1::client::PolicyBasedRoutingService;
3454 /// use google_cloud_networkconnectivity_v1::Result;
3455 /// async fn sample(
3456 /// client: &PolicyBasedRoutingService
3457 /// ) -> Result<()> {
3458 /// client.cancel_operation()
3459 /// /* set fields */
3460 /// .send().await?;
3461 /// Ok(())
3462 /// }
3463 /// ```
3464 pub fn cancel_operation(
3465 &self,
3466 ) -> super::builder::policy_based_routing_service::CancelOperation {
3467 super::builder::policy_based_routing_service::CancelOperation::new(self.inner.clone())
3468 }
3469}