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/// # tokio_test::block_on(async {
24/// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
25/// let client = ReachabilityService::builder().build().await?;
26/// // use `client` to make requests to the Network Management API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// The Reachability service in the Google Cloud Network Management API provides
33/// services that analyze the reachability within a single Google Virtual Private
34/// Cloud (VPC) network, between peered VPC networks, between VPC and on-premises
35/// networks, or between VPC networks and internet hosts. A reachability analysis
36/// is based on Google Cloud network configurations.
37///
38/// You can use the analysis results to verify these configurations and
39/// to troubleshoot connectivity issues.
40///
41/// # Configuration
42///
43/// To configure `ReachabilityService` use the `with_*` methods in the type returned
44/// by [builder()][ReachabilityService::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://networkmanagement.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::reachability_service::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::reachability_service::ClientBuilder::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/// `ReachabilityService` holds a connection pool internally, it is advised to
64/// create one and the reuse it. You do not need to wrap `ReachabilityService` 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 ReachabilityService {
69 inner: std::sync::Arc<dyn super::stub::dynamic::ReachabilityService>,
70}
71
72impl ReachabilityService {
73 /// Returns a builder for [ReachabilityService].
74 ///
75 /// ```
76 /// # tokio_test::block_on(async {
77 /// # use google_cloud_networkmanagement_v1::client::ReachabilityService;
78 /// let client = ReachabilityService::builder().build().await?;
79 /// # gax::client_builder::Result::<()>::Ok(()) });
80 /// ```
81 pub fn builder() -> super::builder::reachability_service::ClientBuilder {
82 gax::client_builder::internal::new_builder(
83 super::builder::reachability_service::client::Factory,
84 )
85 }
86
87 /// Creates a new client from the provided stub.
88 ///
89 /// The most common case for calling this function is in tests mocking the
90 /// client's behavior.
91 pub fn from_stub<T>(stub: T) -> Self
92 where
93 T: super::stub::ReachabilityService + 'static,
94 {
95 Self {
96 inner: std::sync::Arc::new(stub),
97 }
98 }
99
100 pub(crate) async fn new(
101 config: gaxi::options::ClientConfig,
102 ) -> gax::client_builder::Result<Self> {
103 let inner = Self::build_inner(config).await?;
104 Ok(Self { inner })
105 }
106
107 async fn build_inner(
108 conf: gaxi::options::ClientConfig,
109 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ReachabilityService>>
110 {
111 if gaxi::options::tracing_enabled(&conf) {
112 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
113 }
114 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
115 }
116
117 async fn build_transport(
118 conf: gaxi::options::ClientConfig,
119 ) -> gax::client_builder::Result<impl super::stub::ReachabilityService> {
120 super::transport::ReachabilityService::new(conf).await
121 }
122
123 async fn build_with_tracing(
124 conf: gaxi::options::ClientConfig,
125 ) -> gax::client_builder::Result<impl super::stub::ReachabilityService> {
126 Self::build_transport(conf)
127 .await
128 .map(super::tracing::ReachabilityService::new)
129 }
130
131 /// Lists all Connectivity Tests owned by a project.
132 pub fn list_connectivity_tests(
133 &self,
134 ) -> super::builder::reachability_service::ListConnectivityTests {
135 super::builder::reachability_service::ListConnectivityTests::new(self.inner.clone())
136 }
137
138 /// Gets the details of a specific Connectivity Test.
139 pub fn get_connectivity_test(
140 &self,
141 ) -> super::builder::reachability_service::GetConnectivityTest {
142 super::builder::reachability_service::GetConnectivityTest::new(self.inner.clone())
143 }
144
145 /// Creates a new Connectivity Test.
146 /// After you create a test, the reachability analysis is performed as part
147 /// of the long running operation, which completes when the analysis completes.
148 ///
149 /// If the endpoint specifications in `ConnectivityTest` are invalid
150 /// (for example, containing non-existent resources in the network, or you
151 /// don't have read permissions to the network configurations of listed
152 /// projects), then the reachability result returns a value of `UNKNOWN`.
153 ///
154 /// If the endpoint specifications in `ConnectivityTest` are
155 /// incomplete, the reachability result returns a value of
156 /// \<code\>AMBIGUOUS\</code\>. For more information,
157 /// see the Connectivity Test documentation.
158 ///
159 /// # Long running operations
160 ///
161 /// This method is used to start, and/or poll a [long-running Operation].
162 /// The [Working with long-running operations] chapter in the [user guide]
163 /// covers these operations in detail.
164 ///
165 /// [long-running operation]: https://google.aip.dev/151
166 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
167 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
168 pub fn create_connectivity_test(
169 &self,
170 ) -> super::builder::reachability_service::CreateConnectivityTest {
171 super::builder::reachability_service::CreateConnectivityTest::new(self.inner.clone())
172 }
173
174 /// Updates the configuration of an existing `ConnectivityTest`.
175 /// After you update a test, the reachability analysis is performed as part
176 /// of the long running operation, which completes when the analysis completes.
177 /// The Reachability state in the test resource is updated with the new result.
178 ///
179 /// If the endpoint specifications in `ConnectivityTest` are invalid
180 /// (for example, they contain non-existent resources in the network, or the
181 /// user does not have read permissions to the network configurations of
182 /// listed projects), then the reachability result returns a value of
183 /// \<code\>UNKNOWN\</code\>.
184 ///
185 /// If the endpoint specifications in `ConnectivityTest` are incomplete, the
186 /// reachability result returns a value of `AMBIGUOUS`. See the documentation
187 /// in `ConnectivityTest` for more details.
188 ///
189 /// # Long running operations
190 ///
191 /// This method is used to start, and/or poll a [long-running Operation].
192 /// The [Working with long-running operations] chapter in the [user guide]
193 /// covers these operations in detail.
194 ///
195 /// [long-running operation]: https://google.aip.dev/151
196 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
197 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
198 pub fn update_connectivity_test(
199 &self,
200 ) -> super::builder::reachability_service::UpdateConnectivityTest {
201 super::builder::reachability_service::UpdateConnectivityTest::new(self.inner.clone())
202 }
203
204 /// Rerun an existing `ConnectivityTest`.
205 /// After the user triggers the rerun, the reachability analysis is performed
206 /// as part of the long running operation, which completes when the analysis
207 /// completes.
208 ///
209 /// Even though the test configuration remains the same, the reachability
210 /// result may change due to underlying network configuration changes.
211 ///
212 /// If the endpoint specifications in `ConnectivityTest` become invalid (for
213 /// example, specified resources are deleted in the network, or you lost
214 /// read permissions to the network configurations of listed projects), then
215 /// the reachability result returns a value of `UNKNOWN`.
216 ///
217 /// # Long running operations
218 ///
219 /// This method is used to start, and/or poll a [long-running Operation].
220 /// The [Working with long-running operations] chapter in the [user guide]
221 /// covers these operations in detail.
222 ///
223 /// [long-running operation]: https://google.aip.dev/151
224 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
225 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
226 pub fn rerun_connectivity_test(
227 &self,
228 ) -> super::builder::reachability_service::RerunConnectivityTest {
229 super::builder::reachability_service::RerunConnectivityTest::new(self.inner.clone())
230 }
231
232 /// Deletes a specific `ConnectivityTest`.
233 ///
234 /// # Long running operations
235 ///
236 /// This method is used to start, and/or poll a [long-running Operation].
237 /// The [Working with long-running operations] chapter in the [user guide]
238 /// covers these operations in detail.
239 ///
240 /// [long-running operation]: https://google.aip.dev/151
241 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
242 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
243 pub fn delete_connectivity_test(
244 &self,
245 ) -> super::builder::reachability_service::DeleteConnectivityTest {
246 super::builder::reachability_service::DeleteConnectivityTest::new(self.inner.clone())
247 }
248
249 /// Lists information about the supported locations for this service.
250 pub fn list_locations(&self) -> super::builder::reachability_service::ListLocations {
251 super::builder::reachability_service::ListLocations::new(self.inner.clone())
252 }
253
254 /// Gets information about a location.
255 pub fn get_location(&self) -> super::builder::reachability_service::GetLocation {
256 super::builder::reachability_service::GetLocation::new(self.inner.clone())
257 }
258
259 /// Sets the access control policy on the specified resource. Replaces
260 /// any existing policy.
261 ///
262 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
263 /// errors.
264 pub fn set_iam_policy(&self) -> super::builder::reachability_service::SetIamPolicy {
265 super::builder::reachability_service::SetIamPolicy::new(self.inner.clone())
266 }
267
268 /// Gets the access control policy for a resource. Returns an empty policy
269 /// if the resource exists and does not have a policy set.
270 pub fn get_iam_policy(&self) -> super::builder::reachability_service::GetIamPolicy {
271 super::builder::reachability_service::GetIamPolicy::new(self.inner.clone())
272 }
273
274 /// Returns permissions that a caller has on the specified resource. If the
275 /// resource does not exist, this will return an empty set of
276 /// permissions, not a `NOT_FOUND` error.
277 ///
278 /// Note: This operation is designed to be used for building
279 /// permission-aware UIs and command-line tools, not for authorization
280 /// checking. This operation may "fail open" without warning.
281 pub fn test_iam_permissions(&self) -> super::builder::reachability_service::TestIamPermissions {
282 super::builder::reachability_service::TestIamPermissions::new(self.inner.clone())
283 }
284
285 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
286 ///
287 /// [google.longrunning.Operations]: longrunning::client::Operations
288 pub fn list_operations(&self) -> super::builder::reachability_service::ListOperations {
289 super::builder::reachability_service::ListOperations::new(self.inner.clone())
290 }
291
292 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
293 ///
294 /// [google.longrunning.Operations]: longrunning::client::Operations
295 pub fn get_operation(&self) -> super::builder::reachability_service::GetOperation {
296 super::builder::reachability_service::GetOperation::new(self.inner.clone())
297 }
298
299 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
300 ///
301 /// [google.longrunning.Operations]: longrunning::client::Operations
302 pub fn delete_operation(&self) -> super::builder::reachability_service::DeleteOperation {
303 super::builder::reachability_service::DeleteOperation::new(self.inner.clone())
304 }
305
306 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
307 ///
308 /// [google.longrunning.Operations]: longrunning::client::Operations
309 pub fn cancel_operation(&self) -> super::builder::reachability_service::CancelOperation {
310 super::builder::reachability_service::CancelOperation::new(self.inner.clone())
311 }
312}
313
314/// Implements a client for the Network Management API.
315///
316/// # Example
317/// ```
318/// # tokio_test::block_on(async {
319/// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
320/// let client = VpcFlowLogsService::builder().build().await?;
321/// // use `client` to make requests to the Network Management API.
322/// # gax::client_builder::Result::<()>::Ok(()) });
323/// ```
324///
325/// # Service Description
326///
327/// The VPC Flow Logs service in the Google Cloud Network Management API provides
328/// configurations that generate Flow Logs. The service and the configuration
329/// resources created using this service are global.
330///
331/// # Configuration
332///
333/// To configure `VpcFlowLogsService` use the `with_*` methods in the type returned
334/// by [builder()][VpcFlowLogsService::builder]. The default configuration should
335/// work for most applications. Common configuration changes include
336///
337/// * [with_endpoint()]: by default this client uses the global default endpoint
338/// (`https://networkmanagement.googleapis.com`). Applications using regional
339/// endpoints or running in restricted networks (e.g. a network configured
340// with [Private Google Access with VPC Service Controls]) may want to
341/// override this default.
342/// * [with_credentials()]: by default this client uses
343/// [Application Default Credentials]. Applications using custom
344/// authentication may need to override this default.
345///
346/// [with_endpoint()]: super::builder::vpc_flow_logs_service::ClientBuilder::with_endpoint
347/// [with_credentials()]: super::builder::vpc_flow_logs_service::ClientBuilder::credentials
348/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
349/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
350///
351/// # Pooling and Cloning
352///
353/// `VpcFlowLogsService` holds a connection pool internally, it is advised to
354/// create one and the reuse it. You do not need to wrap `VpcFlowLogsService` in
355/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
356/// already uses an `Arc` internally.
357#[derive(Clone, Debug)]
358pub struct VpcFlowLogsService {
359 inner: std::sync::Arc<dyn super::stub::dynamic::VpcFlowLogsService>,
360}
361
362impl VpcFlowLogsService {
363 /// Returns a builder for [VpcFlowLogsService].
364 ///
365 /// ```
366 /// # tokio_test::block_on(async {
367 /// # use google_cloud_networkmanagement_v1::client::VpcFlowLogsService;
368 /// let client = VpcFlowLogsService::builder().build().await?;
369 /// # gax::client_builder::Result::<()>::Ok(()) });
370 /// ```
371 pub fn builder() -> super::builder::vpc_flow_logs_service::ClientBuilder {
372 gax::client_builder::internal::new_builder(
373 super::builder::vpc_flow_logs_service::client::Factory,
374 )
375 }
376
377 /// Creates a new client from the provided stub.
378 ///
379 /// The most common case for calling this function is in tests mocking the
380 /// client's behavior.
381 pub fn from_stub<T>(stub: T) -> Self
382 where
383 T: super::stub::VpcFlowLogsService + 'static,
384 {
385 Self {
386 inner: std::sync::Arc::new(stub),
387 }
388 }
389
390 pub(crate) async fn new(
391 config: gaxi::options::ClientConfig,
392 ) -> gax::client_builder::Result<Self> {
393 let inner = Self::build_inner(config).await?;
394 Ok(Self { inner })
395 }
396
397 async fn build_inner(
398 conf: gaxi::options::ClientConfig,
399 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VpcFlowLogsService>>
400 {
401 if gaxi::options::tracing_enabled(&conf) {
402 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
403 }
404 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
405 }
406
407 async fn build_transport(
408 conf: gaxi::options::ClientConfig,
409 ) -> gax::client_builder::Result<impl super::stub::VpcFlowLogsService> {
410 super::transport::VpcFlowLogsService::new(conf).await
411 }
412
413 async fn build_with_tracing(
414 conf: gaxi::options::ClientConfig,
415 ) -> gax::client_builder::Result<impl super::stub::VpcFlowLogsService> {
416 Self::build_transport(conf)
417 .await
418 .map(super::tracing::VpcFlowLogsService::new)
419 }
420
421 /// Lists all `VpcFlowLogsConfigs` in a given project.
422 pub fn list_vpc_flow_logs_configs(
423 &self,
424 ) -> super::builder::vpc_flow_logs_service::ListVpcFlowLogsConfigs {
425 super::builder::vpc_flow_logs_service::ListVpcFlowLogsConfigs::new(self.inner.clone())
426 }
427
428 /// Gets the details of a specific `VpcFlowLogsConfig`.
429 pub fn get_vpc_flow_logs_config(
430 &self,
431 ) -> super::builder::vpc_flow_logs_service::GetVpcFlowLogsConfig {
432 super::builder::vpc_flow_logs_service::GetVpcFlowLogsConfig::new(self.inner.clone())
433 }
434
435 /// Creates a new `VpcFlowLogsConfig`.
436 /// If a configuration with the exact same settings already exists (even if the
437 /// ID is different), the creation fails.
438 /// Notes:
439 ///
440 /// 1. Creating a configuration with `state=DISABLED` will fail
441 /// 1. The following fields are not considered as settings for the purpose
442 /// of the check mentioned above, therefore - creating another configuration
443 /// with the same fields but different values for the following fields will
444 /// fail as well:
445 /// * name
446 /// * create_time
447 /// * update_time
448 /// * labels
449 /// * description
450 ///
451 /// # Long running operations
452 ///
453 /// This method is used to start, and/or poll a [long-running Operation].
454 /// The [Working with long-running operations] chapter in the [user guide]
455 /// covers these operations in detail.
456 ///
457 /// [long-running operation]: https://google.aip.dev/151
458 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
459 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
460 pub fn create_vpc_flow_logs_config(
461 &self,
462 ) -> super::builder::vpc_flow_logs_service::CreateVpcFlowLogsConfig {
463 super::builder::vpc_flow_logs_service::CreateVpcFlowLogsConfig::new(self.inner.clone())
464 }
465
466 /// Updates an existing `VpcFlowLogsConfig`.
467 /// If a configuration with the exact same settings already exists (even if the
468 /// ID is different), the creation fails.
469 /// Notes:
470 ///
471 /// 1. Updating a configuration with `state=DISABLED` will fail.
472 /// 1. The following fields are not considered as settings for the purpose
473 /// of the check mentioned above, therefore - updating another configuration
474 /// with the same fields but different values for the following fields will
475 /// fail as well:
476 /// * name
477 /// * create_time
478 /// * update_time
479 /// * labels
480 /// * description
481 ///
482 /// # Long running operations
483 ///
484 /// This method is used to start, and/or poll a [long-running Operation].
485 /// The [Working with long-running operations] chapter in the [user guide]
486 /// covers these operations in detail.
487 ///
488 /// [long-running operation]: https://google.aip.dev/151
489 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
490 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
491 pub fn update_vpc_flow_logs_config(
492 &self,
493 ) -> super::builder::vpc_flow_logs_service::UpdateVpcFlowLogsConfig {
494 super::builder::vpc_flow_logs_service::UpdateVpcFlowLogsConfig::new(self.inner.clone())
495 }
496
497 /// Deletes a specific `VpcFlowLogsConfig`.
498 ///
499 /// # Long running operations
500 ///
501 /// This method is used to start, and/or poll a [long-running Operation].
502 /// The [Working with long-running operations] chapter in the [user guide]
503 /// covers these operations in detail.
504 ///
505 /// [long-running operation]: https://google.aip.dev/151
506 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
507 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
508 pub fn delete_vpc_flow_logs_config(
509 &self,
510 ) -> super::builder::vpc_flow_logs_service::DeleteVpcFlowLogsConfig {
511 super::builder::vpc_flow_logs_service::DeleteVpcFlowLogsConfig::new(self.inner.clone())
512 }
513
514 /// QueryOrgVpcFlowLogsConfigs returns a list of all organization-level VPC
515 /// Flow Logs configurations applicable to the specified project.
516 pub fn query_org_vpc_flow_logs_configs(
517 &self,
518 ) -> super::builder::vpc_flow_logs_service::QueryOrgVpcFlowLogsConfigs {
519 super::builder::vpc_flow_logs_service::QueryOrgVpcFlowLogsConfigs::new(self.inner.clone())
520 }
521
522 /// ShowEffectiveFlowLogsConfigs returns a list of all VPC Flow Logs
523 /// configurations applicable to a specified resource.
524 pub fn show_effective_flow_logs_configs(
525 &self,
526 ) -> super::builder::vpc_flow_logs_service::ShowEffectiveFlowLogsConfigs {
527 super::builder::vpc_flow_logs_service::ShowEffectiveFlowLogsConfigs::new(self.inner.clone())
528 }
529
530 /// Lists information about the supported locations for this service.
531 pub fn list_locations(&self) -> super::builder::vpc_flow_logs_service::ListLocations {
532 super::builder::vpc_flow_logs_service::ListLocations::new(self.inner.clone())
533 }
534
535 /// Gets information about a location.
536 pub fn get_location(&self) -> super::builder::vpc_flow_logs_service::GetLocation {
537 super::builder::vpc_flow_logs_service::GetLocation::new(self.inner.clone())
538 }
539
540 /// Sets the access control policy on the specified resource. Replaces
541 /// any existing policy.
542 ///
543 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
544 /// errors.
545 pub fn set_iam_policy(&self) -> super::builder::vpc_flow_logs_service::SetIamPolicy {
546 super::builder::vpc_flow_logs_service::SetIamPolicy::new(self.inner.clone())
547 }
548
549 /// Gets the access control policy for a resource. Returns an empty policy
550 /// if the resource exists and does not have a policy set.
551 pub fn get_iam_policy(&self) -> super::builder::vpc_flow_logs_service::GetIamPolicy {
552 super::builder::vpc_flow_logs_service::GetIamPolicy::new(self.inner.clone())
553 }
554
555 /// Returns permissions that a caller has on the specified resource. If the
556 /// resource does not exist, this will return an empty set of
557 /// permissions, not a `NOT_FOUND` error.
558 ///
559 /// Note: This operation is designed to be used for building
560 /// permission-aware UIs and command-line tools, not for authorization
561 /// checking. This operation may "fail open" without warning.
562 pub fn test_iam_permissions(
563 &self,
564 ) -> super::builder::vpc_flow_logs_service::TestIamPermissions {
565 super::builder::vpc_flow_logs_service::TestIamPermissions::new(self.inner.clone())
566 }
567
568 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
569 ///
570 /// [google.longrunning.Operations]: longrunning::client::Operations
571 pub fn list_operations(&self) -> super::builder::vpc_flow_logs_service::ListOperations {
572 super::builder::vpc_flow_logs_service::ListOperations::new(self.inner.clone())
573 }
574
575 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
576 ///
577 /// [google.longrunning.Operations]: longrunning::client::Operations
578 pub fn get_operation(&self) -> super::builder::vpc_flow_logs_service::GetOperation {
579 super::builder::vpc_flow_logs_service::GetOperation::new(self.inner.clone())
580 }
581
582 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
583 ///
584 /// [google.longrunning.Operations]: longrunning::client::Operations
585 pub fn delete_operation(&self) -> super::builder::vpc_flow_logs_service::DeleteOperation {
586 super::builder::vpc_flow_logs_service::DeleteOperation::new(self.inner.clone())
587 }
588
589 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
590 ///
591 /// [google.longrunning.Operations]: longrunning::client::Operations
592 pub fn cancel_operation(&self) -> super::builder::vpc_flow_logs_service::CancelOperation {
593 super::builder::vpc_flow_logs_service::CancelOperation::new(self.inner.clone())
594 }
595}
596
597/// Implements a client for the Network Management API.
598///
599/// # Example
600/// ```
601/// # tokio_test::block_on(async {
602/// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
603/// let client = OrganizationVpcFlowLogsService::builder().build().await?;
604/// // use `client` to make requests to the Network Management API.
605/// # gax::client_builder::Result::<()>::Ok(()) });
606/// ```
607///
608/// # Service Description
609///
610/// The VPC Flow Logs organization service in the Google Cloud Network Management
611/// API provides organization level configurations that generate Flow Logs. The
612/// service and the configuration resources created using this service are
613/// global.
614///
615/// # Configuration
616///
617/// To configure `OrganizationVpcFlowLogsService` use the `with_*` methods in the type returned
618/// by [builder()][OrganizationVpcFlowLogsService::builder]. The default configuration should
619/// work for most applications. Common configuration changes include
620///
621/// * [with_endpoint()]: by default this client uses the global default endpoint
622/// (`https://networkmanagement.googleapis.com`). Applications using regional
623/// endpoints or running in restricted networks (e.g. a network configured
624// with [Private Google Access with VPC Service Controls]) may want to
625/// override this default.
626/// * [with_credentials()]: by default this client uses
627/// [Application Default Credentials]. Applications using custom
628/// authentication may need to override this default.
629///
630/// [with_endpoint()]: super::builder::organization_vpc_flow_logs_service::ClientBuilder::with_endpoint
631/// [with_credentials()]: super::builder::organization_vpc_flow_logs_service::ClientBuilder::credentials
632/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
633/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
634///
635/// # Pooling and Cloning
636///
637/// `OrganizationVpcFlowLogsService` holds a connection pool internally, it is advised to
638/// create one and the reuse it. You do not need to wrap `OrganizationVpcFlowLogsService` in
639/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
640/// already uses an `Arc` internally.
641#[derive(Clone, Debug)]
642pub struct OrganizationVpcFlowLogsService {
643 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationVpcFlowLogsService>,
644}
645
646impl OrganizationVpcFlowLogsService {
647 /// Returns a builder for [OrganizationVpcFlowLogsService].
648 ///
649 /// ```
650 /// # tokio_test::block_on(async {
651 /// # use google_cloud_networkmanagement_v1::client::OrganizationVpcFlowLogsService;
652 /// let client = OrganizationVpcFlowLogsService::builder().build().await?;
653 /// # gax::client_builder::Result::<()>::Ok(()) });
654 /// ```
655 pub fn builder() -> super::builder::organization_vpc_flow_logs_service::ClientBuilder {
656 gax::client_builder::internal::new_builder(
657 super::builder::organization_vpc_flow_logs_service::client::Factory,
658 )
659 }
660
661 /// Creates a new client from the provided stub.
662 ///
663 /// The most common case for calling this function is in tests mocking the
664 /// client's behavior.
665 pub fn from_stub<T>(stub: T) -> Self
666 where
667 T: super::stub::OrganizationVpcFlowLogsService + 'static,
668 {
669 Self {
670 inner: std::sync::Arc::new(stub),
671 }
672 }
673
674 pub(crate) async fn new(
675 config: gaxi::options::ClientConfig,
676 ) -> gax::client_builder::Result<Self> {
677 let inner = Self::build_inner(config).await?;
678 Ok(Self { inner })
679 }
680
681 async fn build_inner(
682 conf: gaxi::options::ClientConfig,
683 ) -> gax::client_builder::Result<
684 std::sync::Arc<dyn super::stub::dynamic::OrganizationVpcFlowLogsService>,
685 > {
686 if gaxi::options::tracing_enabled(&conf) {
687 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
688 }
689 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
690 }
691
692 async fn build_transport(
693 conf: gaxi::options::ClientConfig,
694 ) -> gax::client_builder::Result<impl super::stub::OrganizationVpcFlowLogsService> {
695 super::transport::OrganizationVpcFlowLogsService::new(conf).await
696 }
697
698 async fn build_with_tracing(
699 conf: gaxi::options::ClientConfig,
700 ) -> gax::client_builder::Result<impl super::stub::OrganizationVpcFlowLogsService> {
701 Self::build_transport(conf)
702 .await
703 .map(super::tracing::OrganizationVpcFlowLogsService::new)
704 }
705
706 /// Lists all `VpcFlowLogsConfigs` in a given organization.
707 pub fn list_vpc_flow_logs_configs(
708 &self,
709 ) -> super::builder::organization_vpc_flow_logs_service::ListVpcFlowLogsConfigs {
710 super::builder::organization_vpc_flow_logs_service::ListVpcFlowLogsConfigs::new(
711 self.inner.clone(),
712 )
713 }
714
715 /// Gets the details of a specific `VpcFlowLogsConfig`.
716 pub fn get_vpc_flow_logs_config(
717 &self,
718 ) -> super::builder::organization_vpc_flow_logs_service::GetVpcFlowLogsConfig {
719 super::builder::organization_vpc_flow_logs_service::GetVpcFlowLogsConfig::new(
720 self.inner.clone(),
721 )
722 }
723
724 /// Creates a new `VpcFlowLogsConfig`.
725 /// If a configuration with the exact same settings already exists (even if the
726 /// ID is different), the creation fails.
727 /// Notes:
728 ///
729 /// 1. Creating a configuration with `state=DISABLED` will fail
730 /// 1. The following fields are not considered as settings for the purpose
731 /// of the check mentioned above, therefore - creating another configuration
732 /// with the same fields but different values for the following fields will
733 /// fail as well:
734 /// * name
735 /// * create_time
736 /// * update_time
737 /// * labels
738 /// * description
739 ///
740 /// # Long running operations
741 ///
742 /// This method is used to start, and/or poll a [long-running Operation].
743 /// The [Working with long-running operations] chapter in the [user guide]
744 /// covers these operations in detail.
745 ///
746 /// [long-running operation]: https://google.aip.dev/151
747 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
748 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
749 pub fn create_vpc_flow_logs_config(
750 &self,
751 ) -> super::builder::organization_vpc_flow_logs_service::CreateVpcFlowLogsConfig {
752 super::builder::organization_vpc_flow_logs_service::CreateVpcFlowLogsConfig::new(
753 self.inner.clone(),
754 )
755 }
756
757 /// Updates an existing `VpcFlowLogsConfig`.
758 /// If a configuration with the exact same settings already exists (even if the
759 /// ID is different), the creation fails.
760 /// Notes:
761 ///
762 /// 1. Updating a configuration with `state=DISABLED` will fail
763 /// 1. The following fields are not considered as settings for the purpose
764 /// of the check mentioned above, therefore - updating another configuration
765 /// with the same fields but different values for the following fields will
766 /// fail as well:
767 /// * name
768 /// * create_time
769 /// * update_time
770 /// * labels
771 /// * description
772 ///
773 /// # Long running operations
774 ///
775 /// This method is used to start, and/or poll a [long-running Operation].
776 /// The [Working with long-running operations] chapter in the [user guide]
777 /// covers these operations in detail.
778 ///
779 /// [long-running operation]: https://google.aip.dev/151
780 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
781 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
782 pub fn update_vpc_flow_logs_config(
783 &self,
784 ) -> super::builder::organization_vpc_flow_logs_service::UpdateVpcFlowLogsConfig {
785 super::builder::organization_vpc_flow_logs_service::UpdateVpcFlowLogsConfig::new(
786 self.inner.clone(),
787 )
788 }
789
790 /// Deletes a specific `VpcFlowLogsConfig`.
791 ///
792 /// # Long running operations
793 ///
794 /// This method is used to start, and/or poll a [long-running Operation].
795 /// The [Working with long-running operations] chapter in the [user guide]
796 /// covers these operations in detail.
797 ///
798 /// [long-running operation]: https://google.aip.dev/151
799 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
800 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
801 pub fn delete_vpc_flow_logs_config(
802 &self,
803 ) -> super::builder::organization_vpc_flow_logs_service::DeleteVpcFlowLogsConfig {
804 super::builder::organization_vpc_flow_logs_service::DeleteVpcFlowLogsConfig::new(
805 self.inner.clone(),
806 )
807 }
808
809 /// Lists information about the supported locations for this service.
810 pub fn list_locations(
811 &self,
812 ) -> super::builder::organization_vpc_flow_logs_service::ListLocations {
813 super::builder::organization_vpc_flow_logs_service::ListLocations::new(self.inner.clone())
814 }
815
816 /// Gets information about a location.
817 pub fn get_location(&self) -> super::builder::organization_vpc_flow_logs_service::GetLocation {
818 super::builder::organization_vpc_flow_logs_service::GetLocation::new(self.inner.clone())
819 }
820
821 /// Sets the access control policy on the specified resource. Replaces
822 /// any existing policy.
823 ///
824 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
825 /// errors.
826 pub fn set_iam_policy(
827 &self,
828 ) -> super::builder::organization_vpc_flow_logs_service::SetIamPolicy {
829 super::builder::organization_vpc_flow_logs_service::SetIamPolicy::new(self.inner.clone())
830 }
831
832 /// Gets the access control policy for a resource. Returns an empty policy
833 /// if the resource exists and does not have a policy set.
834 pub fn get_iam_policy(
835 &self,
836 ) -> super::builder::organization_vpc_flow_logs_service::GetIamPolicy {
837 super::builder::organization_vpc_flow_logs_service::GetIamPolicy::new(self.inner.clone())
838 }
839
840 /// Returns permissions that a caller has on the specified resource. If the
841 /// resource does not exist, this will return an empty set of
842 /// permissions, not a `NOT_FOUND` error.
843 ///
844 /// Note: This operation is designed to be used for building
845 /// permission-aware UIs and command-line tools, not for authorization
846 /// checking. This operation may "fail open" without warning.
847 pub fn test_iam_permissions(
848 &self,
849 ) -> super::builder::organization_vpc_flow_logs_service::TestIamPermissions {
850 super::builder::organization_vpc_flow_logs_service::TestIamPermissions::new(
851 self.inner.clone(),
852 )
853 }
854
855 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
856 ///
857 /// [google.longrunning.Operations]: longrunning::client::Operations
858 pub fn list_operations(
859 &self,
860 ) -> super::builder::organization_vpc_flow_logs_service::ListOperations {
861 super::builder::organization_vpc_flow_logs_service::ListOperations::new(self.inner.clone())
862 }
863
864 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
865 ///
866 /// [google.longrunning.Operations]: longrunning::client::Operations
867 pub fn get_operation(
868 &self,
869 ) -> super::builder::organization_vpc_flow_logs_service::GetOperation {
870 super::builder::organization_vpc_flow_logs_service::GetOperation::new(self.inner.clone())
871 }
872
873 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
874 ///
875 /// [google.longrunning.Operations]: longrunning::client::Operations
876 pub fn delete_operation(
877 &self,
878 ) -> super::builder::organization_vpc_flow_logs_service::DeleteOperation {
879 super::builder::organization_vpc_flow_logs_service::DeleteOperation::new(self.inner.clone())
880 }
881
882 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
883 ///
884 /// [google.longrunning.Operations]: longrunning::client::Operations
885 pub fn cancel_operation(
886 &self,
887 ) -> super::builder::organization_vpc_flow_logs_service::CancelOperation {
888 super::builder::organization_vpc_flow_logs_service::CancelOperation::new(self.inner.clone())
889 }
890}