google_cloud_networkmanagement_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 Management API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26/// let client = ReachabilityService::builder().build().await?;
27/// let parent = "parent_value";
28/// let mut list = client.list_connectivity_tests()
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 Reachability service in the Google Cloud Network Management API provides
40/// services that analyze the reachability within a single Google Virtual Private
41/// Cloud (VPC) network, between peered VPC networks, between VPC and on-premises
42/// networks, or between VPC networks and internet hosts. A reachability analysis
43/// is based on Google Cloud network configurations.
44///
45/// You can use the analysis results to verify these configurations and
46/// to troubleshoot connectivity issues.
47///
48/// # Configuration
49///
50/// To configure `ReachabilityService` use the `with_*` methods in the type returned
51/// by [builder()][ReachabilityService::builder]. The default configuration should
52/// work for most applications. Common configuration changes include
53///
54/// * [with_endpoint()]: by default this client uses the global default endpoint
55/// (`https://networkmanagement.googleapis.com`). Applications using regional
56/// endpoints or running in restricted networks (e.g. a network configured
57// with [Private Google Access with VPC Service Controls]) may want to
58/// override this default.
59/// * [with_credentials()]: by default this client uses
60/// [Application Default Credentials]. Applications using custom
61/// authentication may need to override this default.
62///
63/// [with_endpoint()]: super::builder::reachability_service::ClientBuilder::with_endpoint
64/// [with_credentials()]: super::builder::reachability_service::ClientBuilder::with_credentials
65/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
66/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
67///
68/// # Pooling and Cloning
69///
70/// `ReachabilityService` holds a connection pool internally, it is advised to
71/// create one and reuse it. You do not need to wrap `ReachabilityService` in
72/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
73/// already uses an `Arc` internally.
74#[derive(Clone, Debug)]
75pub struct ReachabilityService {
76 inner: std::sync::Arc<dyn super::stub::dynamic::ReachabilityService>,
77}
78
79impl ReachabilityService {
80 /// Returns a builder for [ReachabilityService].
81 ///
82 /// ```
83 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
84 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
85 /// let client = ReachabilityService::builder().build().await?;
86 /// # Ok(()) }
87 /// ```
88 pub fn builder() -> super::builder::reachability_service::ClientBuilder {
89 crate::new_client_builder(super::builder::reachability_service::client::Factory)
90 }
91
92 /// Creates a new client from the provided stub.
93 ///
94 /// The most common case for calling this function is in tests mocking the
95 /// client's behavior.
96 pub fn from_stub<T>(stub: T) -> Self
97 where
98 T: super::stub::ReachabilityService + 'static,
99 {
100 Self {
101 inner: std::sync::Arc::new(stub),
102 }
103 }
104
105 pub(crate) async fn new(
106 config: gaxi::options::ClientConfig,
107 ) -> crate::ClientBuilderResult<Self> {
108 let inner = Self::build_inner(config).await?;
109 Ok(Self { inner })
110 }
111
112 async fn build_inner(
113 conf: gaxi::options::ClientConfig,
114 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReachabilityService>>
115 {
116 if gaxi::options::tracing_enabled(&conf) {
117 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
118 }
119 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
120 }
121
122 async fn build_transport(
123 conf: gaxi::options::ClientConfig,
124 ) -> crate::ClientBuilderResult<impl super::stub::ReachabilityService> {
125 super::transport::ReachabilityService::new(conf).await
126 }
127
128 async fn build_with_tracing(
129 conf: gaxi::options::ClientConfig,
130 ) -> crate::ClientBuilderResult<impl super::stub::ReachabilityService> {
131 Self::build_transport(conf)
132 .await
133 .map(super::tracing::ReachabilityService::new)
134 }
135
136 /// Lists all Connectivity Tests owned by a project.
137 ///
138 /// # Example
139 /// ```
140 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
141 /// use google_cloud_gax::paginator::ItemPaginator as _;
142 /// use google_cloud_networkmanagement_v1::Result;
143 /// async fn sample(
144 /// client: &ReachabilityService, parent: &str
145 /// ) -> Result<()> {
146 /// let mut list = client.list_connectivity_tests()
147 /// .set_parent(parent)
148 /// .by_item();
149 /// while let Some(item) = list.next().await.transpose()? {
150 /// println!("{:?}", item);
151 /// }
152 /// Ok(())
153 /// }
154 /// ```
155 pub fn list_connectivity_tests(
156 &self,
157 ) -> super::builder::reachability_service::ListConnectivityTests {
158 super::builder::reachability_service::ListConnectivityTests::new(self.inner.clone())
159 }
160
161 /// Gets the details of a specific Connectivity Test.
162 ///
163 /// # Example
164 /// ```
165 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
166 /// use google_cloud_networkmanagement_v1::Result;
167 /// async fn sample(
168 /// client: &ReachabilityService, name: &str
169 /// ) -> Result<()> {
170 /// let response = client.get_connectivity_test()
171 /// .set_name(name)
172 /// .send().await?;
173 /// println!("response {:?}", response);
174 /// Ok(())
175 /// }
176 /// ```
177 pub fn get_connectivity_test(
178 &self,
179 ) -> super::builder::reachability_service::GetConnectivityTest {
180 super::builder::reachability_service::GetConnectivityTest::new(self.inner.clone())
181 }
182
183 /// Creates a new Connectivity Test.
184 /// After you create a test, the reachability analysis is performed as part
185 /// of the long running operation, which completes when the analysis completes.
186 ///
187 /// If the endpoint specifications in `ConnectivityTest` are invalid
188 /// (for example, containing non-existent resources in the network, or you
189 /// don't have read permissions to the network configurations of listed
190 /// projects), then the reachability result returns a value of `UNKNOWN`.
191 ///
192 /// If the endpoint specifications in `ConnectivityTest` are
193 /// incomplete, the reachability result returns a value of
194 /// \<code\>AMBIGUOUS\</code\>. For more information,
195 /// see the Connectivity Test documentation.
196 ///
197 /// # Long running operations
198 ///
199 /// This method is used to start, and/or poll a [long-running Operation].
200 /// The [Working with long-running operations] chapter in the [user guide]
201 /// covers these operations in detail.
202 ///
203 /// [long-running operation]: https://google.aip.dev/151
204 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
205 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
206 ///
207 /// # Example
208 /// ```
209 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
210 /// use google_cloud_lro::Poller;
211 /// use google_cloud_networkmanagement_v1::model::ConnectivityTest;
212 /// use google_cloud_networkmanagement_v1::Result;
213 /// async fn sample(
214 /// client: &ReachabilityService, parent: &str
215 /// ) -> Result<()> {
216 /// let response = client.create_connectivity_test()
217 /// .set_parent(parent)
218 /// .set_resource(
219 /// ConnectivityTest::new()/* set fields */
220 /// )
221 /// .poller().until_done().await?;
222 /// println!("response {:?}", response);
223 /// Ok(())
224 /// }
225 /// ```
226 pub fn create_connectivity_test(
227 &self,
228 ) -> super::builder::reachability_service::CreateConnectivityTest {
229 super::builder::reachability_service::CreateConnectivityTest::new(self.inner.clone())
230 }
231
232 /// Updates the configuration of an existing `ConnectivityTest`.
233 /// After you update a test, the reachability analysis is performed as part
234 /// of the long running operation, which completes when the analysis completes.
235 /// The Reachability state in the test resource is updated with the new result.
236 ///
237 /// If the endpoint specifications in `ConnectivityTest` are invalid
238 /// (for example, they contain non-existent resources in the network, or the
239 /// user does not have read permissions to the network configurations of
240 /// listed projects), then the reachability result returns a value of
241 /// \<code\>UNKNOWN\</code\>.
242 ///
243 /// If the endpoint specifications in `ConnectivityTest` are incomplete, the
244 /// reachability result returns a value of `AMBIGUOUS`. See the documentation
245 /// in `ConnectivityTest` for more details.
246 ///
247 /// # Long running operations
248 ///
249 /// This method is used to start, and/or poll a [long-running Operation].
250 /// The [Working with long-running operations] chapter in the [user guide]
251 /// covers these operations in detail.
252 ///
253 /// [long-running operation]: https://google.aip.dev/151
254 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
255 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
256 ///
257 /// # Example
258 /// ```
259 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
260 /// use google_cloud_lro::Poller;
261 /// # extern crate wkt as google_cloud_wkt;
262 /// use google_cloud_wkt::FieldMask;
263 /// use google_cloud_networkmanagement_v1::model::ConnectivityTest;
264 /// use google_cloud_networkmanagement_v1::Result;
265 /// async fn sample(
266 /// client: &ReachabilityService, name: &str
267 /// ) -> Result<()> {
268 /// let response = client.update_connectivity_test()
269 /// .set_resource(
270 /// ConnectivityTest::new().set_name(name)/* set fields */
271 /// )
272 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
273 /// .poller().until_done().await?;
274 /// println!("response {:?}", response);
275 /// Ok(())
276 /// }
277 /// ```
278 pub fn update_connectivity_test(
279 &self,
280 ) -> super::builder::reachability_service::UpdateConnectivityTest {
281 super::builder::reachability_service::UpdateConnectivityTest::new(self.inner.clone())
282 }
283
284 /// Rerun an existing `ConnectivityTest`.
285 /// After the user triggers the rerun, the reachability analysis is performed
286 /// as part of the long running operation, which completes when the analysis
287 /// completes.
288 ///
289 /// Even though the test configuration remains the same, the reachability
290 /// result may change due to underlying network configuration changes.
291 ///
292 /// If the endpoint specifications in `ConnectivityTest` become invalid (for
293 /// example, specified resources are deleted in the network, or you lost
294 /// read permissions to the network configurations of listed projects), then
295 /// the reachability result returns a value of `UNKNOWN`.
296 ///
297 /// # Long running operations
298 ///
299 /// This method is used to start, and/or poll a [long-running Operation].
300 /// The [Working with long-running operations] chapter in the [user guide]
301 /// covers these operations in detail.
302 ///
303 /// [long-running operation]: https://google.aip.dev/151
304 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
305 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
306 ///
307 /// # Example
308 /// ```
309 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
310 /// use google_cloud_lro::Poller;
311 /// use google_cloud_networkmanagement_v1::Result;
312 /// async fn sample(
313 /// client: &ReachabilityService
314 /// ) -> Result<()> {
315 /// let response = client.rerun_connectivity_test()
316 /// /* set fields */
317 /// .poller().until_done().await?;
318 /// println!("response {:?}", response);
319 /// Ok(())
320 /// }
321 /// ```
322 pub fn rerun_connectivity_test(
323 &self,
324 ) -> super::builder::reachability_service::RerunConnectivityTest {
325 super::builder::reachability_service::RerunConnectivityTest::new(self.inner.clone())
326 }
327
328 /// Deletes a specific `ConnectivityTest`.
329 ///
330 /// # Long running operations
331 ///
332 /// This method is used to start, and/or poll a [long-running Operation].
333 /// The [Working with long-running operations] chapter in the [user guide]
334 /// covers these operations in detail.
335 ///
336 /// [long-running operation]: https://google.aip.dev/151
337 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
338 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
339 ///
340 /// # Example
341 /// ```
342 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
343 /// use google_cloud_lro::Poller;
344 /// use google_cloud_networkmanagement_v1::Result;
345 /// async fn sample(
346 /// client: &ReachabilityService, name: &str
347 /// ) -> Result<()> {
348 /// client.delete_connectivity_test()
349 /// .set_name(name)
350 /// .poller().until_done().await?;
351 /// Ok(())
352 /// }
353 /// ```
354 pub fn delete_connectivity_test(
355 &self,
356 ) -> super::builder::reachability_service::DeleteConnectivityTest {
357 super::builder::reachability_service::DeleteConnectivityTest::new(self.inner.clone())
358 }
359
360 /// Lists information about the supported locations for this service.
361 /// This method can be called in two ways:
362 ///
363 /// * **List all public locations:** Use the path `GET /v1/locations`.
364 /// * **List project-visible locations:** Use the path
365 /// `GET /v1/projects/{project_id}/locations`. This may include public
366 /// locations as well as private or other locations specifically visible
367 /// to the project.
368 ///
369 /// # Example
370 /// ```
371 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
372 /// use google_cloud_gax::paginator::ItemPaginator as _;
373 /// use google_cloud_networkmanagement_v1::Result;
374 /// async fn sample(
375 /// client: &ReachabilityService
376 /// ) -> Result<()> {
377 /// let mut list = client.list_locations()
378 /// /* set fields */
379 /// .by_item();
380 /// while let Some(item) = list.next().await.transpose()? {
381 /// println!("{:?}", item);
382 /// }
383 /// Ok(())
384 /// }
385 /// ```
386 pub fn list_locations(&self) -> super::builder::reachability_service::ListLocations {
387 super::builder::reachability_service::ListLocations::new(self.inner.clone())
388 }
389
390 /// Gets information about a location.
391 ///
392 /// # Example
393 /// ```
394 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
395 /// use google_cloud_networkmanagement_v1::Result;
396 /// async fn sample(
397 /// client: &ReachabilityService
398 /// ) -> Result<()> {
399 /// let response = client.get_location()
400 /// /* set fields */
401 /// .send().await?;
402 /// println!("response {:?}", response);
403 /// Ok(())
404 /// }
405 /// ```
406 pub fn get_location(&self) -> super::builder::reachability_service::GetLocation {
407 super::builder::reachability_service::GetLocation::new(self.inner.clone())
408 }
409
410 /// Sets the access control policy on the specified resource. Replaces
411 /// any existing policy.
412 ///
413 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
414 /// errors.
415 ///
416 /// # Example
417 /// ```
418 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
419 /// use google_cloud_networkmanagement_v1::Result;
420 /// async fn sample(
421 /// client: &ReachabilityService
422 /// ) -> Result<()> {
423 /// let response = client.set_iam_policy()
424 /// /* set fields */
425 /// .send().await?;
426 /// println!("response {:?}", response);
427 /// Ok(())
428 /// }
429 /// ```
430 pub fn set_iam_policy(&self) -> super::builder::reachability_service::SetIamPolicy {
431 super::builder::reachability_service::SetIamPolicy::new(self.inner.clone())
432 }
433
434 /// Gets the access control policy for a resource. Returns an empty policy
435 /// if the resource exists and does not have a policy set.
436 ///
437 /// # Example
438 /// ```
439 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
440 /// use google_cloud_networkmanagement_v1::Result;
441 /// async fn sample(
442 /// client: &ReachabilityService
443 /// ) -> Result<()> {
444 /// let response = client.get_iam_policy()
445 /// /* set fields */
446 /// .send().await?;
447 /// println!("response {:?}", response);
448 /// Ok(())
449 /// }
450 /// ```
451 pub fn get_iam_policy(&self) -> super::builder::reachability_service::GetIamPolicy {
452 super::builder::reachability_service::GetIamPolicy::new(self.inner.clone())
453 }
454
455 /// Returns permissions that a caller has on the specified resource. If the
456 /// resource does not exist, this will return an empty set of
457 /// permissions, not a `NOT_FOUND` error.
458 ///
459 /// Note: This operation is designed to be used for building
460 /// permission-aware UIs and command-line tools, not for authorization
461 /// checking. This operation may "fail open" without warning.
462 ///
463 /// # Example
464 /// ```
465 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
466 /// use google_cloud_networkmanagement_v1::Result;
467 /// async fn sample(
468 /// client: &ReachabilityService
469 /// ) -> Result<()> {
470 /// let response = client.test_iam_permissions()
471 /// /* set fields */
472 /// .send().await?;
473 /// println!("response {:?}", response);
474 /// Ok(())
475 /// }
476 /// ```
477 pub fn test_iam_permissions(&self) -> super::builder::reachability_service::TestIamPermissions {
478 super::builder::reachability_service::TestIamPermissions::new(self.inner.clone())
479 }
480
481 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
482 ///
483 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
484 ///
485 /// # Example
486 /// ```
487 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
488 /// use google_cloud_gax::paginator::ItemPaginator as _;
489 /// use google_cloud_networkmanagement_v1::Result;
490 /// async fn sample(
491 /// client: &ReachabilityService
492 /// ) -> Result<()> {
493 /// let mut list = client.list_operations()
494 /// /* set fields */
495 /// .by_item();
496 /// while let Some(item) = list.next().await.transpose()? {
497 /// println!("{:?}", item);
498 /// }
499 /// Ok(())
500 /// }
501 /// ```
502 pub fn list_operations(&self) -> super::builder::reachability_service::ListOperations {
503 super::builder::reachability_service::ListOperations::new(self.inner.clone())
504 }
505
506 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
507 ///
508 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
509 ///
510 /// # Example
511 /// ```
512 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
513 /// use google_cloud_networkmanagement_v1::Result;
514 /// async fn sample(
515 /// client: &ReachabilityService
516 /// ) -> Result<()> {
517 /// let response = client.get_operation()
518 /// /* set fields */
519 /// .send().await?;
520 /// println!("response {:?}", response);
521 /// Ok(())
522 /// }
523 /// ```
524 pub fn get_operation(&self) -> super::builder::reachability_service::GetOperation {
525 super::builder::reachability_service::GetOperation::new(self.inner.clone())
526 }
527
528 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
529 ///
530 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
531 ///
532 /// # Example
533 /// ```
534 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
535 /// use google_cloud_networkmanagement_v1::Result;
536 /// async fn sample(
537 /// client: &ReachabilityService
538 /// ) -> Result<()> {
539 /// client.delete_operation()
540 /// /* set fields */
541 /// .send().await?;
542 /// Ok(())
543 /// }
544 /// ```
545 pub fn delete_operation(&self) -> super::builder::reachability_service::DeleteOperation {
546 super::builder::reachability_service::DeleteOperation::new(self.inner.clone())
547 }
548
549 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
550 ///
551 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
552 ///
553 /// # Example
554 /// ```
555 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
556 /// use google_cloud_networkmanagement_v1::Result;
557 /// async fn sample(
558 /// client: &ReachabilityService
559 /// ) -> Result<()> {
560 /// client.cancel_operation()
561 /// /* set fields */
562 /// .send().await?;
563 /// Ok(())
564 /// }
565 /// ```
566 pub fn cancel_operation(&self) -> super::builder::reachability_service::CancelOperation {
567 super::builder::reachability_service::CancelOperation::new(self.inner.clone())
568 }
569}
570
571/// Implements a client for the Network Management API.
572///
573/// # Example
574/// ```
575/// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
576/// use google_cloud_gax::paginator::ItemPaginator as _;
577/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
578/// let client = VpcFlowLogsService::builder().build().await?;
579/// let parent = "parent_value";
580/// let mut list = client.list_vpc_flow_logs_configs()
581/// .set_parent(parent)
582/// .by_item();
583/// while let Some(item) = list.next().await.transpose()? {
584/// println!("{:?}", item);
585/// }
586/// # Ok(()) }
587/// ```
588///
589/// # Service Description
590///
591/// The VPC Flow Logs service in the Google Cloud Network Management API provides
592/// configurations that generate Flow Logs. The service and the configuration
593/// resources created using this service are global.
594///
595/// # Configuration
596///
597/// To configure `VpcFlowLogsService` use the `with_*` methods in the type returned
598/// by [builder()][VpcFlowLogsService::builder]. The default configuration should
599/// work for most applications. Common configuration changes include
600///
601/// * [with_endpoint()]: by default this client uses the global default endpoint
602/// (`https://networkmanagement.googleapis.com`). Applications using regional
603/// endpoints or running in restricted networks (e.g. a network configured
604// with [Private Google Access with VPC Service Controls]) may want to
605/// override this default.
606/// * [with_credentials()]: by default this client uses
607/// [Application Default Credentials]. Applications using custom
608/// authentication may need to override this default.
609///
610/// [with_endpoint()]: super::builder::vpc_flow_logs_service::ClientBuilder::with_endpoint
611/// [with_credentials()]: super::builder::vpc_flow_logs_service::ClientBuilder::with_credentials
612/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
613/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
614///
615/// # Pooling and Cloning
616///
617/// `VpcFlowLogsService` holds a connection pool internally, it is advised to
618/// create one and reuse it. You do not need to wrap `VpcFlowLogsService` in
619/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
620/// already uses an `Arc` internally.
621#[derive(Clone, Debug)]
622pub struct VpcFlowLogsService {
623 inner: std::sync::Arc<dyn super::stub::dynamic::VpcFlowLogsService>,
624}
625
626impl VpcFlowLogsService {
627 /// Returns a builder for [VpcFlowLogsService].
628 ///
629 /// ```
630 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
631 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
632 /// let client = VpcFlowLogsService::builder().build().await?;
633 /// # Ok(()) }
634 /// ```
635 pub fn builder() -> super::builder::vpc_flow_logs_service::ClientBuilder {
636 crate::new_client_builder(super::builder::vpc_flow_logs_service::client::Factory)
637 }
638
639 /// Creates a new client from the provided stub.
640 ///
641 /// The most common case for calling this function is in tests mocking the
642 /// client's behavior.
643 pub fn from_stub<T>(stub: T) -> Self
644 where
645 T: super::stub::VpcFlowLogsService + 'static,
646 {
647 Self {
648 inner: std::sync::Arc::new(stub),
649 }
650 }
651
652 pub(crate) async fn new(
653 config: gaxi::options::ClientConfig,
654 ) -> crate::ClientBuilderResult<Self> {
655 let inner = Self::build_inner(config).await?;
656 Ok(Self { inner })
657 }
658
659 async fn build_inner(
660 conf: gaxi::options::ClientConfig,
661 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VpcFlowLogsService>>
662 {
663 if gaxi::options::tracing_enabled(&conf) {
664 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
665 }
666 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
667 }
668
669 async fn build_transport(
670 conf: gaxi::options::ClientConfig,
671 ) -> crate::ClientBuilderResult<impl super::stub::VpcFlowLogsService> {
672 super::transport::VpcFlowLogsService::new(conf).await
673 }
674
675 async fn build_with_tracing(
676 conf: gaxi::options::ClientConfig,
677 ) -> crate::ClientBuilderResult<impl super::stub::VpcFlowLogsService> {
678 Self::build_transport(conf)
679 .await
680 .map(super::tracing::VpcFlowLogsService::new)
681 }
682
683 /// Lists all `VpcFlowLogsConfigs` in a given project.
684 ///
685 /// # Example
686 /// ```
687 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
688 /// use google_cloud_gax::paginator::ItemPaginator as _;
689 /// use google_cloud_networkmanagement_v1::Result;
690 /// async fn sample(
691 /// client: &VpcFlowLogsService, parent: &str
692 /// ) -> Result<()> {
693 /// let mut list = client.list_vpc_flow_logs_configs()
694 /// .set_parent(parent)
695 /// .by_item();
696 /// while let Some(item) = list.next().await.transpose()? {
697 /// println!("{:?}", item);
698 /// }
699 /// Ok(())
700 /// }
701 /// ```
702 pub fn list_vpc_flow_logs_configs(
703 &self,
704 ) -> super::builder::vpc_flow_logs_service::ListVpcFlowLogsConfigs {
705 super::builder::vpc_flow_logs_service::ListVpcFlowLogsConfigs::new(self.inner.clone())
706 }
707
708 /// Gets the details of a specific `VpcFlowLogsConfig`.
709 ///
710 /// # Example
711 /// ```
712 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
713 /// use google_cloud_networkmanagement_v1::Result;
714 /// async fn sample(
715 /// client: &VpcFlowLogsService, name: &str
716 /// ) -> Result<()> {
717 /// let response = client.get_vpc_flow_logs_config()
718 /// .set_name(name)
719 /// .send().await?;
720 /// println!("response {:?}", response);
721 /// Ok(())
722 /// }
723 /// ```
724 pub fn get_vpc_flow_logs_config(
725 &self,
726 ) -> super::builder::vpc_flow_logs_service::GetVpcFlowLogsConfig {
727 super::builder::vpc_flow_logs_service::GetVpcFlowLogsConfig::new(self.inner.clone())
728 }
729
730 /// Creates a new `VpcFlowLogsConfig`.
731 /// If a configuration with the exact same settings already exists (even if the
732 /// ID is different), the creation fails.
733 /// Notes:
734 ///
735 /// 1. Creating a configuration with `state=DISABLED` will fail
736 /// 1. The following fields are not considered as settings for the purpose
737 /// of the check mentioned above, therefore - creating another configuration
738 /// with the same fields but different values for the following fields will
739 /// fail as well:
740 /// * name
741 /// * create_time
742 /// * update_time
743 /// * labels
744 /// * description
745 ///
746 /// # Long running operations
747 ///
748 /// This method is used to start, and/or poll a [long-running Operation].
749 /// The [Working with long-running operations] chapter in the [user guide]
750 /// covers these operations in detail.
751 ///
752 /// [long-running operation]: https://google.aip.dev/151
753 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
754 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
755 ///
756 /// # Example
757 /// ```
758 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
759 /// use google_cloud_lro::Poller;
760 /// use google_cloud_networkmanagement_v1::model::VpcFlowLogsConfig;
761 /// use google_cloud_networkmanagement_v1::Result;
762 /// async fn sample(
763 /// client: &VpcFlowLogsService, parent: &str
764 /// ) -> Result<()> {
765 /// let response = client.create_vpc_flow_logs_config()
766 /// .set_parent(parent)
767 /// .set_vpc_flow_logs_config(
768 /// VpcFlowLogsConfig::new()/* set fields */
769 /// )
770 /// .poller().until_done().await?;
771 /// println!("response {:?}", response);
772 /// Ok(())
773 /// }
774 /// ```
775 pub fn create_vpc_flow_logs_config(
776 &self,
777 ) -> super::builder::vpc_flow_logs_service::CreateVpcFlowLogsConfig {
778 super::builder::vpc_flow_logs_service::CreateVpcFlowLogsConfig::new(self.inner.clone())
779 }
780
781 /// Updates an existing `VpcFlowLogsConfig`.
782 /// If a configuration with the exact same settings already exists (even if the
783 /// ID is different), the creation fails.
784 /// Notes:
785 ///
786 /// 1. Updating a configuration with `state=DISABLED` will fail.
787 /// 1. The following fields are not considered as settings for the purpose
788 /// of the check mentioned above, therefore - updating another configuration
789 /// with the same fields but different values for the following fields will
790 /// fail as well:
791 /// * name
792 /// * create_time
793 /// * update_time
794 /// * labels
795 /// * description
796 ///
797 /// # Long running operations
798 ///
799 /// This method is used to start, and/or poll a [long-running Operation].
800 /// The [Working with long-running operations] chapter in the [user guide]
801 /// covers these operations in detail.
802 ///
803 /// [long-running operation]: https://google.aip.dev/151
804 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
805 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
806 ///
807 /// # Example
808 /// ```
809 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
810 /// use google_cloud_lro::Poller;
811 /// # extern crate wkt as google_cloud_wkt;
812 /// use google_cloud_wkt::FieldMask;
813 /// use google_cloud_networkmanagement_v1::model::VpcFlowLogsConfig;
814 /// use google_cloud_networkmanagement_v1::Result;
815 /// async fn sample(
816 /// client: &VpcFlowLogsService, name: &str
817 /// ) -> Result<()> {
818 /// let response = client.update_vpc_flow_logs_config()
819 /// .set_vpc_flow_logs_config(
820 /// VpcFlowLogsConfig::new().set_name(name)/* set fields */
821 /// )
822 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
823 /// .poller().until_done().await?;
824 /// println!("response {:?}", response);
825 /// Ok(())
826 /// }
827 /// ```
828 pub fn update_vpc_flow_logs_config(
829 &self,
830 ) -> super::builder::vpc_flow_logs_service::UpdateVpcFlowLogsConfig {
831 super::builder::vpc_flow_logs_service::UpdateVpcFlowLogsConfig::new(self.inner.clone())
832 }
833
834 /// Deletes a specific `VpcFlowLogsConfig`.
835 ///
836 /// # Long running operations
837 ///
838 /// This method is used to start, and/or poll a [long-running Operation].
839 /// The [Working with long-running operations] chapter in the [user guide]
840 /// covers these operations in detail.
841 ///
842 /// [long-running operation]: https://google.aip.dev/151
843 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
844 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
845 ///
846 /// # Example
847 /// ```
848 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
849 /// use google_cloud_lro::Poller;
850 /// use google_cloud_networkmanagement_v1::Result;
851 /// async fn sample(
852 /// client: &VpcFlowLogsService, name: &str
853 /// ) -> Result<()> {
854 /// client.delete_vpc_flow_logs_config()
855 /// .set_name(name)
856 /// .poller().until_done().await?;
857 /// Ok(())
858 /// }
859 /// ```
860 pub fn delete_vpc_flow_logs_config(
861 &self,
862 ) -> super::builder::vpc_flow_logs_service::DeleteVpcFlowLogsConfig {
863 super::builder::vpc_flow_logs_service::DeleteVpcFlowLogsConfig::new(self.inner.clone())
864 }
865
866 /// QueryOrgVpcFlowLogsConfigs returns a list of all organization-level VPC
867 /// Flow Logs configurations applicable to the specified project.
868 ///
869 /// # Example
870 /// ```
871 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
872 /// use google_cloud_gax::paginator::ItemPaginator as _;
873 /// use google_cloud_networkmanagement_v1::Result;
874 /// async fn sample(
875 /// client: &VpcFlowLogsService
876 /// ) -> Result<()> {
877 /// let mut list = client.query_org_vpc_flow_logs_configs()
878 /// /* set fields */
879 /// .by_item();
880 /// while let Some(item) = list.next().await.transpose()? {
881 /// println!("{:?}", item);
882 /// }
883 /// Ok(())
884 /// }
885 /// ```
886 pub fn query_org_vpc_flow_logs_configs(
887 &self,
888 ) -> super::builder::vpc_flow_logs_service::QueryOrgVpcFlowLogsConfigs {
889 super::builder::vpc_flow_logs_service::QueryOrgVpcFlowLogsConfigs::new(self.inner.clone())
890 }
891
892 /// ShowEffectiveFlowLogsConfigs returns a list of all VPC Flow Logs
893 /// configurations applicable to a specified resource.
894 ///
895 /// # Example
896 /// ```
897 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
898 /// use google_cloud_gax::paginator::ItemPaginator as _;
899 /// use google_cloud_networkmanagement_v1::Result;
900 /// async fn sample(
901 /// client: &VpcFlowLogsService
902 /// ) -> Result<()> {
903 /// let mut list = client.show_effective_flow_logs_configs()
904 /// /* set fields */
905 /// .by_item();
906 /// while let Some(item) = list.next().await.transpose()? {
907 /// println!("{:?}", item);
908 /// }
909 /// Ok(())
910 /// }
911 /// ```
912 pub fn show_effective_flow_logs_configs(
913 &self,
914 ) -> super::builder::vpc_flow_logs_service::ShowEffectiveFlowLogsConfigs {
915 super::builder::vpc_flow_logs_service::ShowEffectiveFlowLogsConfigs::new(self.inner.clone())
916 }
917
918 /// Lists information about the supported locations for this service.
919 /// This method can be called in two ways:
920 ///
921 /// * **List all public locations:** Use the path `GET /v1/locations`.
922 /// * **List project-visible locations:** Use the path
923 /// `GET /v1/projects/{project_id}/locations`. This may include public
924 /// locations as well as private or other locations specifically visible
925 /// to the project.
926 ///
927 /// # Example
928 /// ```
929 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
930 /// use google_cloud_gax::paginator::ItemPaginator as _;
931 /// use google_cloud_networkmanagement_v1::Result;
932 /// async fn sample(
933 /// client: &VpcFlowLogsService
934 /// ) -> Result<()> {
935 /// let mut list = client.list_locations()
936 /// /* set fields */
937 /// .by_item();
938 /// while let Some(item) = list.next().await.transpose()? {
939 /// println!("{:?}", item);
940 /// }
941 /// Ok(())
942 /// }
943 /// ```
944 pub fn list_locations(&self) -> super::builder::vpc_flow_logs_service::ListLocations {
945 super::builder::vpc_flow_logs_service::ListLocations::new(self.inner.clone())
946 }
947
948 /// Gets information about a location.
949 ///
950 /// # Example
951 /// ```
952 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
953 /// use google_cloud_networkmanagement_v1::Result;
954 /// async fn sample(
955 /// client: &VpcFlowLogsService
956 /// ) -> Result<()> {
957 /// let response = client.get_location()
958 /// /* set fields */
959 /// .send().await?;
960 /// println!("response {:?}", response);
961 /// Ok(())
962 /// }
963 /// ```
964 pub fn get_location(&self) -> super::builder::vpc_flow_logs_service::GetLocation {
965 super::builder::vpc_flow_logs_service::GetLocation::new(self.inner.clone())
966 }
967
968 /// Sets the access control policy on the specified resource. Replaces
969 /// any existing policy.
970 ///
971 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
972 /// errors.
973 ///
974 /// # Example
975 /// ```
976 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
977 /// use google_cloud_networkmanagement_v1::Result;
978 /// async fn sample(
979 /// client: &VpcFlowLogsService
980 /// ) -> Result<()> {
981 /// let response = client.set_iam_policy()
982 /// /* set fields */
983 /// .send().await?;
984 /// println!("response {:?}", response);
985 /// Ok(())
986 /// }
987 /// ```
988 pub fn set_iam_policy(&self) -> super::builder::vpc_flow_logs_service::SetIamPolicy {
989 super::builder::vpc_flow_logs_service::SetIamPolicy::new(self.inner.clone())
990 }
991
992 /// Gets the access control policy for a resource. Returns an empty policy
993 /// if the resource exists and does not have a policy set.
994 ///
995 /// # Example
996 /// ```
997 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
998 /// use google_cloud_networkmanagement_v1::Result;
999 /// async fn sample(
1000 /// client: &VpcFlowLogsService
1001 /// ) -> Result<()> {
1002 /// let response = client.get_iam_policy()
1003 /// /* set fields */
1004 /// .send().await?;
1005 /// println!("response {:?}", response);
1006 /// Ok(())
1007 /// }
1008 /// ```
1009 pub fn get_iam_policy(&self) -> super::builder::vpc_flow_logs_service::GetIamPolicy {
1010 super::builder::vpc_flow_logs_service::GetIamPolicy::new(self.inner.clone())
1011 }
1012
1013 /// Returns permissions that a caller has on the specified resource. If the
1014 /// resource does not exist, this will return an empty set of
1015 /// permissions, not a `NOT_FOUND` error.
1016 ///
1017 /// Note: This operation is designed to be used for building
1018 /// permission-aware UIs and command-line tools, not for authorization
1019 /// checking. This operation may "fail open" without warning.
1020 ///
1021 /// # Example
1022 /// ```
1023 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
1024 /// use google_cloud_networkmanagement_v1::Result;
1025 /// async fn sample(
1026 /// client: &VpcFlowLogsService
1027 /// ) -> Result<()> {
1028 /// let response = client.test_iam_permissions()
1029 /// /* set fields */
1030 /// .send().await?;
1031 /// println!("response {:?}", response);
1032 /// Ok(())
1033 /// }
1034 /// ```
1035 pub fn test_iam_permissions(
1036 &self,
1037 ) -> super::builder::vpc_flow_logs_service::TestIamPermissions {
1038 super::builder::vpc_flow_logs_service::TestIamPermissions::new(self.inner.clone())
1039 }
1040
1041 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1042 ///
1043 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1044 ///
1045 /// # Example
1046 /// ```
1047 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
1048 /// use google_cloud_gax::paginator::ItemPaginator as _;
1049 /// use google_cloud_networkmanagement_v1::Result;
1050 /// async fn sample(
1051 /// client: &VpcFlowLogsService
1052 /// ) -> Result<()> {
1053 /// let mut list = client.list_operations()
1054 /// /* set fields */
1055 /// .by_item();
1056 /// while let Some(item) = list.next().await.transpose()? {
1057 /// println!("{:?}", item);
1058 /// }
1059 /// Ok(())
1060 /// }
1061 /// ```
1062 pub fn list_operations(&self) -> super::builder::vpc_flow_logs_service::ListOperations {
1063 super::builder::vpc_flow_logs_service::ListOperations::new(self.inner.clone())
1064 }
1065
1066 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1067 ///
1068 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1069 ///
1070 /// # Example
1071 /// ```
1072 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
1073 /// use google_cloud_networkmanagement_v1::Result;
1074 /// async fn sample(
1075 /// client: &VpcFlowLogsService
1076 /// ) -> Result<()> {
1077 /// let response = client.get_operation()
1078 /// /* set fields */
1079 /// .send().await?;
1080 /// println!("response {:?}", response);
1081 /// Ok(())
1082 /// }
1083 /// ```
1084 pub fn get_operation(&self) -> super::builder::vpc_flow_logs_service::GetOperation {
1085 super::builder::vpc_flow_logs_service::GetOperation::new(self.inner.clone())
1086 }
1087
1088 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1089 ///
1090 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1091 ///
1092 /// # Example
1093 /// ```
1094 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
1095 /// use google_cloud_networkmanagement_v1::Result;
1096 /// async fn sample(
1097 /// client: &VpcFlowLogsService
1098 /// ) -> Result<()> {
1099 /// client.delete_operation()
1100 /// /* set fields */
1101 /// .send().await?;
1102 /// Ok(())
1103 /// }
1104 /// ```
1105 pub fn delete_operation(&self) -> super::builder::vpc_flow_logs_service::DeleteOperation {
1106 super::builder::vpc_flow_logs_service::DeleteOperation::new(self.inner.clone())
1107 }
1108
1109 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1110 ///
1111 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1112 ///
1113 /// # Example
1114 /// ```
1115 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
1116 /// use google_cloud_networkmanagement_v1::Result;
1117 /// async fn sample(
1118 /// client: &VpcFlowLogsService
1119 /// ) -> Result<()> {
1120 /// client.cancel_operation()
1121 /// /* set fields */
1122 /// .send().await?;
1123 /// Ok(())
1124 /// }
1125 /// ```
1126 pub fn cancel_operation(&self) -> super::builder::vpc_flow_logs_service::CancelOperation {
1127 super::builder::vpc_flow_logs_service::CancelOperation::new(self.inner.clone())
1128 }
1129}
1130
1131/// Implements a client for the Network Management API.
1132///
1133/// # Example
1134/// ```
1135/// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1136/// use google_cloud_gax::paginator::ItemPaginator as _;
1137/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1138/// let client = OrganizationVpcFlowLogsService::builder().build().await?;
1139/// let parent = "parent_value";
1140/// let mut list = client.list_vpc_flow_logs_configs()
1141/// .set_parent(parent)
1142/// .by_item();
1143/// while let Some(item) = list.next().await.transpose()? {
1144/// println!("{:?}", item);
1145/// }
1146/// # Ok(()) }
1147/// ```
1148///
1149/// # Service Description
1150///
1151/// The VPC Flow Logs organization service in the Google Cloud Network Management
1152/// API provides organization level configurations that generate Flow Logs. The
1153/// service and the configuration resources created using this service are
1154/// global.
1155///
1156/// # Configuration
1157///
1158/// To configure `OrganizationVpcFlowLogsService` use the `with_*` methods in the type returned
1159/// by [builder()][OrganizationVpcFlowLogsService::builder]. The default configuration should
1160/// work for most applications. Common configuration changes include
1161///
1162/// * [with_endpoint()]: by default this client uses the global default endpoint
1163/// (`https://networkmanagement.googleapis.com`). Applications using regional
1164/// endpoints or running in restricted networks (e.g. a network configured
1165// with [Private Google Access with VPC Service Controls]) may want to
1166/// override this default.
1167/// * [with_credentials()]: by default this client uses
1168/// [Application Default Credentials]. Applications using custom
1169/// authentication may need to override this default.
1170///
1171/// [with_endpoint()]: super::builder::organization_vpc_flow_logs_service::ClientBuilder::with_endpoint
1172/// [with_credentials()]: super::builder::organization_vpc_flow_logs_service::ClientBuilder::with_credentials
1173/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1174/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1175///
1176/// # Pooling and Cloning
1177///
1178/// `OrganizationVpcFlowLogsService` holds a connection pool internally, it is advised to
1179/// create one and reuse it. You do not need to wrap `OrganizationVpcFlowLogsService` in
1180/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1181/// already uses an `Arc` internally.
1182#[derive(Clone, Debug)]
1183pub struct OrganizationVpcFlowLogsService {
1184 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationVpcFlowLogsService>,
1185}
1186
1187impl OrganizationVpcFlowLogsService {
1188 /// Returns a builder for [OrganizationVpcFlowLogsService].
1189 ///
1190 /// ```
1191 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1192 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1193 /// let client = OrganizationVpcFlowLogsService::builder().build().await?;
1194 /// # Ok(()) }
1195 /// ```
1196 pub fn builder() -> super::builder::organization_vpc_flow_logs_service::ClientBuilder {
1197 crate::new_client_builder(
1198 super::builder::organization_vpc_flow_logs_service::client::Factory,
1199 )
1200 }
1201
1202 /// Creates a new client from the provided stub.
1203 ///
1204 /// The most common case for calling this function is in tests mocking the
1205 /// client's behavior.
1206 pub fn from_stub<T>(stub: T) -> Self
1207 where
1208 T: super::stub::OrganizationVpcFlowLogsService + 'static,
1209 {
1210 Self {
1211 inner: std::sync::Arc::new(stub),
1212 }
1213 }
1214
1215 pub(crate) async fn new(
1216 config: gaxi::options::ClientConfig,
1217 ) -> crate::ClientBuilderResult<Self> {
1218 let inner = Self::build_inner(config).await?;
1219 Ok(Self { inner })
1220 }
1221
1222 async fn build_inner(
1223 conf: gaxi::options::ClientConfig,
1224 ) -> crate::ClientBuilderResult<
1225 std::sync::Arc<dyn super::stub::dynamic::OrganizationVpcFlowLogsService>,
1226 > {
1227 if gaxi::options::tracing_enabled(&conf) {
1228 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1229 }
1230 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1231 }
1232
1233 async fn build_transport(
1234 conf: gaxi::options::ClientConfig,
1235 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationVpcFlowLogsService> {
1236 super::transport::OrganizationVpcFlowLogsService::new(conf).await
1237 }
1238
1239 async fn build_with_tracing(
1240 conf: gaxi::options::ClientConfig,
1241 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationVpcFlowLogsService> {
1242 Self::build_transport(conf)
1243 .await
1244 .map(super::tracing::OrganizationVpcFlowLogsService::new)
1245 }
1246
1247 /// Lists all `VpcFlowLogsConfigs` in a given organization.
1248 ///
1249 /// # Example
1250 /// ```
1251 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1252 /// use google_cloud_gax::paginator::ItemPaginator as _;
1253 /// use google_cloud_networkmanagement_v1::Result;
1254 /// async fn sample(
1255 /// client: &OrganizationVpcFlowLogsService, parent: &str
1256 /// ) -> Result<()> {
1257 /// let mut list = client.list_vpc_flow_logs_configs()
1258 /// .set_parent(parent)
1259 /// .by_item();
1260 /// while let Some(item) = list.next().await.transpose()? {
1261 /// println!("{:?}", item);
1262 /// }
1263 /// Ok(())
1264 /// }
1265 /// ```
1266 pub fn list_vpc_flow_logs_configs(
1267 &self,
1268 ) -> super::builder::organization_vpc_flow_logs_service::ListVpcFlowLogsConfigs {
1269 super::builder::organization_vpc_flow_logs_service::ListVpcFlowLogsConfigs::new(
1270 self.inner.clone(),
1271 )
1272 }
1273
1274 /// Gets the details of a specific `VpcFlowLogsConfig`.
1275 ///
1276 /// # Example
1277 /// ```
1278 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1279 /// use google_cloud_networkmanagement_v1::Result;
1280 /// async fn sample(
1281 /// client: &OrganizationVpcFlowLogsService, name: &str
1282 /// ) -> Result<()> {
1283 /// let response = client.get_vpc_flow_logs_config()
1284 /// .set_name(name)
1285 /// .send().await?;
1286 /// println!("response {:?}", response);
1287 /// Ok(())
1288 /// }
1289 /// ```
1290 pub fn get_vpc_flow_logs_config(
1291 &self,
1292 ) -> super::builder::organization_vpc_flow_logs_service::GetVpcFlowLogsConfig {
1293 super::builder::organization_vpc_flow_logs_service::GetVpcFlowLogsConfig::new(
1294 self.inner.clone(),
1295 )
1296 }
1297
1298 /// Creates a new `VpcFlowLogsConfig`.
1299 /// If a configuration with the exact same settings already exists (even if the
1300 /// ID is different), the creation fails.
1301 /// Notes:
1302 ///
1303 /// 1. Creating a configuration with `state=DISABLED` will fail
1304 /// 1. The following fields are not considered as settings for the purpose
1305 /// of the check mentioned above, therefore - creating another configuration
1306 /// with the same fields but different values for the following fields will
1307 /// fail as well:
1308 /// * name
1309 /// * create_time
1310 /// * update_time
1311 /// * labels
1312 /// * description
1313 ///
1314 /// # Long running operations
1315 ///
1316 /// This method is used to start, and/or poll a [long-running Operation].
1317 /// The [Working with long-running operations] chapter in the [user guide]
1318 /// covers these operations in detail.
1319 ///
1320 /// [long-running operation]: https://google.aip.dev/151
1321 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1322 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1323 ///
1324 /// # Example
1325 /// ```
1326 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1327 /// use google_cloud_lro::Poller;
1328 /// use google_cloud_networkmanagement_v1::model::VpcFlowLogsConfig;
1329 /// use google_cloud_networkmanagement_v1::Result;
1330 /// async fn sample(
1331 /// client: &OrganizationVpcFlowLogsService, parent: &str
1332 /// ) -> Result<()> {
1333 /// let response = client.create_vpc_flow_logs_config()
1334 /// .set_parent(parent)
1335 /// .set_vpc_flow_logs_config(
1336 /// VpcFlowLogsConfig::new()/* set fields */
1337 /// )
1338 /// .poller().until_done().await?;
1339 /// println!("response {:?}", response);
1340 /// Ok(())
1341 /// }
1342 /// ```
1343 pub fn create_vpc_flow_logs_config(
1344 &self,
1345 ) -> super::builder::organization_vpc_flow_logs_service::CreateVpcFlowLogsConfig {
1346 super::builder::organization_vpc_flow_logs_service::CreateVpcFlowLogsConfig::new(
1347 self.inner.clone(),
1348 )
1349 }
1350
1351 /// Updates an existing `VpcFlowLogsConfig`.
1352 /// If a configuration with the exact same settings already exists (even if the
1353 /// ID is different), the creation fails.
1354 /// Notes:
1355 ///
1356 /// 1. Updating a configuration with `state=DISABLED` will fail
1357 /// 1. The following fields are not considered as settings for the purpose
1358 /// of the check mentioned above, therefore - updating another configuration
1359 /// with the same fields but different values for the following fields will
1360 /// fail as well:
1361 /// * name
1362 /// * create_time
1363 /// * update_time
1364 /// * labels
1365 /// * description
1366 ///
1367 /// # Long running operations
1368 ///
1369 /// This method is used to start, and/or poll a [long-running Operation].
1370 /// The [Working with long-running operations] chapter in the [user guide]
1371 /// covers these operations in detail.
1372 ///
1373 /// [long-running operation]: https://google.aip.dev/151
1374 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1375 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1376 ///
1377 /// # Example
1378 /// ```
1379 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1380 /// use google_cloud_lro::Poller;
1381 /// # extern crate wkt as google_cloud_wkt;
1382 /// use google_cloud_wkt::FieldMask;
1383 /// use google_cloud_networkmanagement_v1::model::VpcFlowLogsConfig;
1384 /// use google_cloud_networkmanagement_v1::Result;
1385 /// async fn sample(
1386 /// client: &OrganizationVpcFlowLogsService, name: &str
1387 /// ) -> Result<()> {
1388 /// let response = client.update_vpc_flow_logs_config()
1389 /// .set_vpc_flow_logs_config(
1390 /// VpcFlowLogsConfig::new().set_name(name)/* set fields */
1391 /// )
1392 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1393 /// .poller().until_done().await?;
1394 /// println!("response {:?}", response);
1395 /// Ok(())
1396 /// }
1397 /// ```
1398 pub fn update_vpc_flow_logs_config(
1399 &self,
1400 ) -> super::builder::organization_vpc_flow_logs_service::UpdateVpcFlowLogsConfig {
1401 super::builder::organization_vpc_flow_logs_service::UpdateVpcFlowLogsConfig::new(
1402 self.inner.clone(),
1403 )
1404 }
1405
1406 /// Deletes a specific `VpcFlowLogsConfig`.
1407 ///
1408 /// # Long running operations
1409 ///
1410 /// This method is used to start, and/or poll a [long-running Operation].
1411 /// The [Working with long-running operations] chapter in the [user guide]
1412 /// covers these operations in detail.
1413 ///
1414 /// [long-running operation]: https://google.aip.dev/151
1415 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1416 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1417 ///
1418 /// # Example
1419 /// ```
1420 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1421 /// use google_cloud_lro::Poller;
1422 /// use google_cloud_networkmanagement_v1::Result;
1423 /// async fn sample(
1424 /// client: &OrganizationVpcFlowLogsService, name: &str
1425 /// ) -> Result<()> {
1426 /// client.delete_vpc_flow_logs_config()
1427 /// .set_name(name)
1428 /// .poller().until_done().await?;
1429 /// Ok(())
1430 /// }
1431 /// ```
1432 pub fn delete_vpc_flow_logs_config(
1433 &self,
1434 ) -> super::builder::organization_vpc_flow_logs_service::DeleteVpcFlowLogsConfig {
1435 super::builder::organization_vpc_flow_logs_service::DeleteVpcFlowLogsConfig::new(
1436 self.inner.clone(),
1437 )
1438 }
1439
1440 /// Lists information about the supported locations for this service.
1441 /// This method can be called in two ways:
1442 ///
1443 /// * **List all public locations:** Use the path `GET /v1/locations`.
1444 /// * **List project-visible locations:** Use the path
1445 /// `GET /v1/projects/{project_id}/locations`. This may include public
1446 /// locations as well as private or other locations specifically visible
1447 /// to the project.
1448 ///
1449 /// # Example
1450 /// ```
1451 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1452 /// use google_cloud_gax::paginator::ItemPaginator as _;
1453 /// use google_cloud_networkmanagement_v1::Result;
1454 /// async fn sample(
1455 /// client: &OrganizationVpcFlowLogsService
1456 /// ) -> Result<()> {
1457 /// let mut list = client.list_locations()
1458 /// /* set fields */
1459 /// .by_item();
1460 /// while let Some(item) = list.next().await.transpose()? {
1461 /// println!("{:?}", item);
1462 /// }
1463 /// Ok(())
1464 /// }
1465 /// ```
1466 pub fn list_locations(
1467 &self,
1468 ) -> super::builder::organization_vpc_flow_logs_service::ListLocations {
1469 super::builder::organization_vpc_flow_logs_service::ListLocations::new(self.inner.clone())
1470 }
1471
1472 /// Gets information about a location.
1473 ///
1474 /// # Example
1475 /// ```
1476 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1477 /// use google_cloud_networkmanagement_v1::Result;
1478 /// async fn sample(
1479 /// client: &OrganizationVpcFlowLogsService
1480 /// ) -> Result<()> {
1481 /// let response = client.get_location()
1482 /// /* set fields */
1483 /// .send().await?;
1484 /// println!("response {:?}", response);
1485 /// Ok(())
1486 /// }
1487 /// ```
1488 pub fn get_location(&self) -> super::builder::organization_vpc_flow_logs_service::GetLocation {
1489 super::builder::organization_vpc_flow_logs_service::GetLocation::new(self.inner.clone())
1490 }
1491
1492 /// Sets the access control policy on the specified resource. Replaces
1493 /// any existing policy.
1494 ///
1495 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1496 /// errors.
1497 ///
1498 /// # Example
1499 /// ```
1500 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1501 /// use google_cloud_networkmanagement_v1::Result;
1502 /// async fn sample(
1503 /// client: &OrganizationVpcFlowLogsService
1504 /// ) -> Result<()> {
1505 /// let response = client.set_iam_policy()
1506 /// /* set fields */
1507 /// .send().await?;
1508 /// println!("response {:?}", response);
1509 /// Ok(())
1510 /// }
1511 /// ```
1512 pub fn set_iam_policy(
1513 &self,
1514 ) -> super::builder::organization_vpc_flow_logs_service::SetIamPolicy {
1515 super::builder::organization_vpc_flow_logs_service::SetIamPolicy::new(self.inner.clone())
1516 }
1517
1518 /// Gets the access control policy for a resource. Returns an empty policy
1519 /// if the resource exists and does not have a policy set.
1520 ///
1521 /// # Example
1522 /// ```
1523 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1524 /// use google_cloud_networkmanagement_v1::Result;
1525 /// async fn sample(
1526 /// client: &OrganizationVpcFlowLogsService
1527 /// ) -> Result<()> {
1528 /// let response = client.get_iam_policy()
1529 /// /* set fields */
1530 /// .send().await?;
1531 /// println!("response {:?}", response);
1532 /// Ok(())
1533 /// }
1534 /// ```
1535 pub fn get_iam_policy(
1536 &self,
1537 ) -> super::builder::organization_vpc_flow_logs_service::GetIamPolicy {
1538 super::builder::organization_vpc_flow_logs_service::GetIamPolicy::new(self.inner.clone())
1539 }
1540
1541 /// Returns permissions that a caller has on the specified resource. If the
1542 /// resource does not exist, this will return an empty set of
1543 /// permissions, not a `NOT_FOUND` error.
1544 ///
1545 /// Note: This operation is designed to be used for building
1546 /// permission-aware UIs and command-line tools, not for authorization
1547 /// checking. This operation may "fail open" without warning.
1548 ///
1549 /// # Example
1550 /// ```
1551 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1552 /// use google_cloud_networkmanagement_v1::Result;
1553 /// async fn sample(
1554 /// client: &OrganizationVpcFlowLogsService
1555 /// ) -> Result<()> {
1556 /// let response = client.test_iam_permissions()
1557 /// /* set fields */
1558 /// .send().await?;
1559 /// println!("response {:?}", response);
1560 /// Ok(())
1561 /// }
1562 /// ```
1563 pub fn test_iam_permissions(
1564 &self,
1565 ) -> super::builder::organization_vpc_flow_logs_service::TestIamPermissions {
1566 super::builder::organization_vpc_flow_logs_service::TestIamPermissions::new(
1567 self.inner.clone(),
1568 )
1569 }
1570
1571 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1572 ///
1573 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1574 ///
1575 /// # Example
1576 /// ```
1577 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1578 /// use google_cloud_gax::paginator::ItemPaginator as _;
1579 /// use google_cloud_networkmanagement_v1::Result;
1580 /// async fn sample(
1581 /// client: &OrganizationVpcFlowLogsService
1582 /// ) -> Result<()> {
1583 /// let mut list = client.list_operations()
1584 /// /* set fields */
1585 /// .by_item();
1586 /// while let Some(item) = list.next().await.transpose()? {
1587 /// println!("{:?}", item);
1588 /// }
1589 /// Ok(())
1590 /// }
1591 /// ```
1592 pub fn list_operations(
1593 &self,
1594 ) -> super::builder::organization_vpc_flow_logs_service::ListOperations {
1595 super::builder::organization_vpc_flow_logs_service::ListOperations::new(self.inner.clone())
1596 }
1597
1598 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1599 ///
1600 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1601 ///
1602 /// # Example
1603 /// ```
1604 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1605 /// use google_cloud_networkmanagement_v1::Result;
1606 /// async fn sample(
1607 /// client: &OrganizationVpcFlowLogsService
1608 /// ) -> Result<()> {
1609 /// let response = client.get_operation()
1610 /// /* set fields */
1611 /// .send().await?;
1612 /// println!("response {:?}", response);
1613 /// Ok(())
1614 /// }
1615 /// ```
1616 pub fn get_operation(
1617 &self,
1618 ) -> super::builder::organization_vpc_flow_logs_service::GetOperation {
1619 super::builder::organization_vpc_flow_logs_service::GetOperation::new(self.inner.clone())
1620 }
1621
1622 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1623 ///
1624 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1625 ///
1626 /// # Example
1627 /// ```
1628 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1629 /// use google_cloud_networkmanagement_v1::Result;
1630 /// async fn sample(
1631 /// client: &OrganizationVpcFlowLogsService
1632 /// ) -> Result<()> {
1633 /// client.delete_operation()
1634 /// /* set fields */
1635 /// .send().await?;
1636 /// Ok(())
1637 /// }
1638 /// ```
1639 pub fn delete_operation(
1640 &self,
1641 ) -> super::builder::organization_vpc_flow_logs_service::DeleteOperation {
1642 super::builder::organization_vpc_flow_logs_service::DeleteOperation::new(self.inner.clone())
1643 }
1644
1645 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1646 ///
1647 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1648 ///
1649 /// # Example
1650 /// ```
1651 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
1652 /// use google_cloud_networkmanagement_v1::Result;
1653 /// async fn sample(
1654 /// client: &OrganizationVpcFlowLogsService
1655 /// ) -> Result<()> {
1656 /// client.cancel_operation()
1657 /// /* set fields */
1658 /// .send().await?;
1659 /// Ok(())
1660 /// }
1661 /// ```
1662 pub fn cancel_operation(
1663 &self,
1664 ) -> super::builder::organization_vpc_flow_logs_service::CancelOperation {
1665 super::builder::organization_vpc_flow_logs_service::CancelOperation::new(self.inner.clone())
1666 }
1667}