google_cloud_networksecurity_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 Security API.
20///
21/// # Example
22/// ```
23/// # tokio_test::block_on(async {
24/// # use google_cloud_networksecurity_v1::client::AddressGroupService;
25/// let client = AddressGroupService::builder().build().await?;
26/// // use `client` to make requests to the Network Security API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// AddressGroup is a resource that manages a collection of IP or Domain Names,
33/// it can be used in Firewall Policy to represent allow or deny traffic from
34/// all the IP or Domain Names from the Address Group.
35///
36/// # Configuration
37///
38/// To configure `AddressGroupService` use the `with_*` methods in the type returned
39/// by [builder()][AddressGroupService::builder]. The default configuration should
40/// work for most applications. Common configuration changes include
41///
42/// * [with_endpoint()]: by default this client uses the global default endpoint
43/// (`https://networksecurity.googleapis.com`). Applications using regional
44/// endpoints or running in restricted networks (e.g. a network configured
45// with [Private Google Access with VPC Service Controls]) may want to
46/// override this default.
47/// * [with_credentials()]: by default this client uses
48/// [Application Default Credentials]. Applications using custom
49/// authentication may need to override this default.
50///
51/// [with_endpoint()]: super::builder::address_group_service::ClientBuilder::with_endpoint
52/// [with_credentials()]: super::builder::address_group_service::ClientBuilder::credentials
53/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
54/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
55///
56/// # Pooling and Cloning
57///
58/// `AddressGroupService` holds a connection pool internally, it is advised to
59/// create one and the reuse it. You do not need to wrap `AddressGroupService` in
60/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
61/// already uses an `Arc` internally.
62#[derive(Clone, Debug)]
63pub struct AddressGroupService {
64 inner: std::sync::Arc<dyn super::stub::dynamic::AddressGroupService>,
65}
66
67impl AddressGroupService {
68 /// Returns a builder for [AddressGroupService].
69 ///
70 /// ```
71 /// # tokio_test::block_on(async {
72 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
73 /// let client = AddressGroupService::builder().build().await?;
74 /// # gax::client_builder::Result::<()>::Ok(()) });
75 /// ```
76 pub fn builder() -> super::builder::address_group_service::ClientBuilder {
77 gax::client_builder::internal::new_builder(
78 super::builder::address_group_service::client::Factory,
79 )
80 }
81
82 /// Creates a new client from the provided stub.
83 ///
84 /// The most common case for calling this function is in tests mocking the
85 /// client's behavior.
86 pub fn from_stub<T>(stub: T) -> Self
87 where
88 T: super::stub::AddressGroupService + 'static,
89 {
90 Self {
91 inner: std::sync::Arc::new(stub),
92 }
93 }
94
95 pub(crate) async fn new(
96 config: gaxi::options::ClientConfig,
97 ) -> gax::client_builder::Result<Self> {
98 let inner = Self::build_inner(config).await?;
99 Ok(Self { inner })
100 }
101
102 async fn build_inner(
103 conf: gaxi::options::ClientConfig,
104 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::AddressGroupService>>
105 {
106 if gaxi::options::tracing_enabled(&conf) {
107 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
108 }
109 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
110 }
111
112 async fn build_transport(
113 conf: gaxi::options::ClientConfig,
114 ) -> gax::client_builder::Result<impl super::stub::AddressGroupService> {
115 super::transport::AddressGroupService::new(conf).await
116 }
117
118 async fn build_with_tracing(
119 conf: gaxi::options::ClientConfig,
120 ) -> gax::client_builder::Result<impl super::stub::AddressGroupService> {
121 Self::build_transport(conf)
122 .await
123 .map(super::tracing::AddressGroupService::new)
124 }
125
126 /// Lists address groups in a given project and location.
127 pub fn list_address_groups(&self) -> super::builder::address_group_service::ListAddressGroups {
128 super::builder::address_group_service::ListAddressGroups::new(self.inner.clone())
129 }
130
131 /// Gets details of a single address group.
132 pub fn get_address_group(&self) -> super::builder::address_group_service::GetAddressGroup {
133 super::builder::address_group_service::GetAddressGroup::new(self.inner.clone())
134 }
135
136 /// Creates a new address group in a given project and location.
137 ///
138 /// # Long running operations
139 ///
140 /// This method is used to start, and/or poll a [long-running Operation].
141 /// The [Working with long-running operations] chapter in the [user guide]
142 /// covers these operations in detail.
143 ///
144 /// [long-running operation]: https://google.aip.dev/151
145 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
146 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
147 pub fn create_address_group(
148 &self,
149 ) -> super::builder::address_group_service::CreateAddressGroup {
150 super::builder::address_group_service::CreateAddressGroup::new(self.inner.clone())
151 }
152
153 /// Updates the parameters of a single address group.
154 ///
155 /// # Long running operations
156 ///
157 /// This method is used to start, and/or poll a [long-running Operation].
158 /// The [Working with long-running operations] chapter in the [user guide]
159 /// covers these operations in detail.
160 ///
161 /// [long-running operation]: https://google.aip.dev/151
162 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
163 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
164 pub fn update_address_group(
165 &self,
166 ) -> super::builder::address_group_service::UpdateAddressGroup {
167 super::builder::address_group_service::UpdateAddressGroup::new(self.inner.clone())
168 }
169
170 /// Adds items to an address group.
171 ///
172 /// # Long running operations
173 ///
174 /// This method is used to start, and/or poll a [long-running Operation].
175 /// The [Working with long-running operations] chapter in the [user guide]
176 /// covers these operations in detail.
177 ///
178 /// [long-running operation]: https://google.aip.dev/151
179 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
180 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
181 pub fn add_address_group_items(
182 &self,
183 ) -> super::builder::address_group_service::AddAddressGroupItems {
184 super::builder::address_group_service::AddAddressGroupItems::new(self.inner.clone())
185 }
186
187 /// Removes items from an address group.
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 remove_address_group_items(
199 &self,
200 ) -> super::builder::address_group_service::RemoveAddressGroupItems {
201 super::builder::address_group_service::RemoveAddressGroupItems::new(self.inner.clone())
202 }
203
204 /// Clones items from one address group to another.
205 ///
206 /// # Long running operations
207 ///
208 /// This method is used to start, and/or poll a [long-running Operation].
209 /// The [Working with long-running operations] chapter in the [user guide]
210 /// covers these operations in detail.
211 ///
212 /// [long-running operation]: https://google.aip.dev/151
213 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
214 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
215 pub fn clone_address_group_items(
216 &self,
217 ) -> super::builder::address_group_service::CloneAddressGroupItems {
218 super::builder::address_group_service::CloneAddressGroupItems::new(self.inner.clone())
219 }
220
221 /// Deletes a single address group.
222 ///
223 /// # Long running operations
224 ///
225 /// This method is used to start, and/or poll a [long-running Operation].
226 /// The [Working with long-running operations] chapter in the [user guide]
227 /// covers these operations in detail.
228 ///
229 /// [long-running operation]: https://google.aip.dev/151
230 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
231 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
232 pub fn delete_address_group(
233 &self,
234 ) -> super::builder::address_group_service::DeleteAddressGroup {
235 super::builder::address_group_service::DeleteAddressGroup::new(self.inner.clone())
236 }
237
238 /// Lists references of an address group.
239 pub fn list_address_group_references(
240 &self,
241 ) -> super::builder::address_group_service::ListAddressGroupReferences {
242 super::builder::address_group_service::ListAddressGroupReferences::new(self.inner.clone())
243 }
244
245 /// Lists information about the supported locations for this service.
246 pub fn list_locations(&self) -> super::builder::address_group_service::ListLocations {
247 super::builder::address_group_service::ListLocations::new(self.inner.clone())
248 }
249
250 /// Gets information about a location.
251 pub fn get_location(&self) -> super::builder::address_group_service::GetLocation {
252 super::builder::address_group_service::GetLocation::new(self.inner.clone())
253 }
254
255 /// Sets the access control policy on the specified resource. Replaces
256 /// any existing policy.
257 ///
258 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
259 /// errors.
260 pub fn set_iam_policy(&self) -> super::builder::address_group_service::SetIamPolicy {
261 super::builder::address_group_service::SetIamPolicy::new(self.inner.clone())
262 }
263
264 /// Gets the access control policy for a resource. Returns an empty policy
265 /// if the resource exists and does not have a policy set.
266 pub fn get_iam_policy(&self) -> super::builder::address_group_service::GetIamPolicy {
267 super::builder::address_group_service::GetIamPolicy::new(self.inner.clone())
268 }
269
270 /// Returns permissions that a caller has on the specified resource. If the
271 /// resource does not exist, this will return an empty set of
272 /// permissions, not a `NOT_FOUND` error.
273 ///
274 /// Note: This operation is designed to be used for building
275 /// permission-aware UIs and command-line tools, not for authorization
276 /// checking. This operation may "fail open" without warning.
277 pub fn test_iam_permissions(
278 &self,
279 ) -> super::builder::address_group_service::TestIamPermissions {
280 super::builder::address_group_service::TestIamPermissions::new(self.inner.clone())
281 }
282
283 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
284 ///
285 /// [google.longrunning.Operations]: longrunning::client::Operations
286 pub fn list_operations(&self) -> super::builder::address_group_service::ListOperations {
287 super::builder::address_group_service::ListOperations::new(self.inner.clone())
288 }
289
290 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
291 ///
292 /// [google.longrunning.Operations]: longrunning::client::Operations
293 pub fn get_operation(&self) -> super::builder::address_group_service::GetOperation {
294 super::builder::address_group_service::GetOperation::new(self.inner.clone())
295 }
296
297 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
298 ///
299 /// [google.longrunning.Operations]: longrunning::client::Operations
300 pub fn delete_operation(&self) -> super::builder::address_group_service::DeleteOperation {
301 super::builder::address_group_service::DeleteOperation::new(self.inner.clone())
302 }
303
304 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
305 ///
306 /// [google.longrunning.Operations]: longrunning::client::Operations
307 pub fn cancel_operation(&self) -> super::builder::address_group_service::CancelOperation {
308 super::builder::address_group_service::CancelOperation::new(self.inner.clone())
309 }
310}
311
312/// Implements a client for the Network Security API.
313///
314/// # Example
315/// ```
316/// # tokio_test::block_on(async {
317/// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
318/// let client = OrganizationAddressGroupService::builder().build().await?;
319/// // use `client` to make requests to the Network Security API.
320/// # gax::client_builder::Result::<()>::Ok(()) });
321/// ```
322///
323/// # Service Description
324///
325/// Organization AddressGroup is created under organization. Requests against
326/// Organization AddressGroup will use project from request credential for
327/// activation/quota/visibility check.
328///
329/// # Configuration
330///
331/// To configure `OrganizationAddressGroupService` use the `with_*` methods in the type returned
332/// by [builder()][OrganizationAddressGroupService::builder]. The default configuration should
333/// work for most applications. Common configuration changes include
334///
335/// * [with_endpoint()]: by default this client uses the global default endpoint
336/// (`https://networksecurity.googleapis.com`). Applications using regional
337/// endpoints or running in restricted networks (e.g. a network configured
338// with [Private Google Access with VPC Service Controls]) may want to
339/// override this default.
340/// * [with_credentials()]: by default this client uses
341/// [Application Default Credentials]. Applications using custom
342/// authentication may need to override this default.
343///
344/// [with_endpoint()]: super::builder::organization_address_group_service::ClientBuilder::with_endpoint
345/// [with_credentials()]: super::builder::organization_address_group_service::ClientBuilder::credentials
346/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
347/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
348///
349/// # Pooling and Cloning
350///
351/// `OrganizationAddressGroupService` holds a connection pool internally, it is advised to
352/// create one and the reuse it. You do not need to wrap `OrganizationAddressGroupService` in
353/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
354/// already uses an `Arc` internally.
355#[derive(Clone, Debug)]
356pub struct OrganizationAddressGroupService {
357 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
358}
359
360impl OrganizationAddressGroupService {
361 /// Returns a builder for [OrganizationAddressGroupService].
362 ///
363 /// ```
364 /// # tokio_test::block_on(async {
365 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
366 /// let client = OrganizationAddressGroupService::builder().build().await?;
367 /// # gax::client_builder::Result::<()>::Ok(()) });
368 /// ```
369 pub fn builder() -> super::builder::organization_address_group_service::ClientBuilder {
370 gax::client_builder::internal::new_builder(
371 super::builder::organization_address_group_service::client::Factory,
372 )
373 }
374
375 /// Creates a new client from the provided stub.
376 ///
377 /// The most common case for calling this function is in tests mocking the
378 /// client's behavior.
379 pub fn from_stub<T>(stub: T) -> Self
380 where
381 T: super::stub::OrganizationAddressGroupService + 'static,
382 {
383 Self {
384 inner: std::sync::Arc::new(stub),
385 }
386 }
387
388 pub(crate) async fn new(
389 config: gaxi::options::ClientConfig,
390 ) -> gax::client_builder::Result<Self> {
391 let inner = Self::build_inner(config).await?;
392 Ok(Self { inner })
393 }
394
395 async fn build_inner(
396 conf: gaxi::options::ClientConfig,
397 ) -> gax::client_builder::Result<
398 std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
399 > {
400 if gaxi::options::tracing_enabled(&conf) {
401 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
402 }
403 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
404 }
405
406 async fn build_transport(
407 conf: gaxi::options::ClientConfig,
408 ) -> gax::client_builder::Result<impl super::stub::OrganizationAddressGroupService> {
409 super::transport::OrganizationAddressGroupService::new(conf).await
410 }
411
412 async fn build_with_tracing(
413 conf: gaxi::options::ClientConfig,
414 ) -> gax::client_builder::Result<impl super::stub::OrganizationAddressGroupService> {
415 Self::build_transport(conf)
416 .await
417 .map(super::tracing::OrganizationAddressGroupService::new)
418 }
419
420 /// Lists address groups in a given project and location.
421 pub fn list_address_groups(
422 &self,
423 ) -> super::builder::organization_address_group_service::ListAddressGroups {
424 super::builder::organization_address_group_service::ListAddressGroups::new(
425 self.inner.clone(),
426 )
427 }
428
429 /// Gets details of a single address group.
430 pub fn get_address_group(
431 &self,
432 ) -> super::builder::organization_address_group_service::GetAddressGroup {
433 super::builder::organization_address_group_service::GetAddressGroup::new(self.inner.clone())
434 }
435
436 /// Creates a new address group in a given project and location.
437 ///
438 /// # Long running operations
439 ///
440 /// This method is used to start, and/or poll a [long-running Operation].
441 /// The [Working with long-running operations] chapter in the [user guide]
442 /// covers these operations in detail.
443 ///
444 /// [long-running operation]: https://google.aip.dev/151
445 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
446 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
447 pub fn create_address_group(
448 &self,
449 ) -> super::builder::organization_address_group_service::CreateAddressGroup {
450 super::builder::organization_address_group_service::CreateAddressGroup::new(
451 self.inner.clone(),
452 )
453 }
454
455 /// Updates parameters of an address group.
456 ///
457 /// # Long running operations
458 ///
459 /// This method is used to start, and/or poll a [long-running Operation].
460 /// The [Working with long-running operations] chapter in the [user guide]
461 /// covers these operations in detail.
462 ///
463 /// [long-running operation]: https://google.aip.dev/151
464 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
465 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
466 pub fn update_address_group(
467 &self,
468 ) -> super::builder::organization_address_group_service::UpdateAddressGroup {
469 super::builder::organization_address_group_service::UpdateAddressGroup::new(
470 self.inner.clone(),
471 )
472 }
473
474 /// Adds items to an address group.
475 ///
476 /// # Long running operations
477 ///
478 /// This method is used to start, and/or poll a [long-running Operation].
479 /// The [Working with long-running operations] chapter in the [user guide]
480 /// covers these operations in detail.
481 ///
482 /// [long-running operation]: https://google.aip.dev/151
483 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
484 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
485 pub fn add_address_group_items(
486 &self,
487 ) -> super::builder::organization_address_group_service::AddAddressGroupItems {
488 super::builder::organization_address_group_service::AddAddressGroupItems::new(
489 self.inner.clone(),
490 )
491 }
492
493 /// Removes items from an address group.
494 ///
495 /// # Long running operations
496 ///
497 /// This method is used to start, and/or poll a [long-running Operation].
498 /// The [Working with long-running operations] chapter in the [user guide]
499 /// covers these operations in detail.
500 ///
501 /// [long-running operation]: https://google.aip.dev/151
502 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
503 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
504 pub fn remove_address_group_items(
505 &self,
506 ) -> super::builder::organization_address_group_service::RemoveAddressGroupItems {
507 super::builder::organization_address_group_service::RemoveAddressGroupItems::new(
508 self.inner.clone(),
509 )
510 }
511
512 /// Clones items from one address group to another.
513 ///
514 /// # Long running operations
515 ///
516 /// This method is used to start, and/or poll a [long-running Operation].
517 /// The [Working with long-running operations] chapter in the [user guide]
518 /// covers these operations in detail.
519 ///
520 /// [long-running operation]: https://google.aip.dev/151
521 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
522 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
523 pub fn clone_address_group_items(
524 &self,
525 ) -> super::builder::organization_address_group_service::CloneAddressGroupItems {
526 super::builder::organization_address_group_service::CloneAddressGroupItems::new(
527 self.inner.clone(),
528 )
529 }
530
531 /// Deletes an address group.
532 ///
533 /// # Long running operations
534 ///
535 /// This method is used to start, and/or poll a [long-running Operation].
536 /// The [Working with long-running operations] chapter in the [user guide]
537 /// covers these operations in detail.
538 ///
539 /// [long-running operation]: https://google.aip.dev/151
540 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
541 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
542 pub fn delete_address_group(
543 &self,
544 ) -> super::builder::organization_address_group_service::DeleteAddressGroup {
545 super::builder::organization_address_group_service::DeleteAddressGroup::new(
546 self.inner.clone(),
547 )
548 }
549
550 /// Lists references of an address group.
551 pub fn list_address_group_references(
552 &self,
553 ) -> super::builder::organization_address_group_service::ListAddressGroupReferences {
554 super::builder::organization_address_group_service::ListAddressGroupReferences::new(
555 self.inner.clone(),
556 )
557 }
558
559 /// Lists information about the supported locations for this service.
560 pub fn list_locations(
561 &self,
562 ) -> super::builder::organization_address_group_service::ListLocations {
563 super::builder::organization_address_group_service::ListLocations::new(self.inner.clone())
564 }
565
566 /// Gets information about a location.
567 pub fn get_location(&self) -> super::builder::organization_address_group_service::GetLocation {
568 super::builder::organization_address_group_service::GetLocation::new(self.inner.clone())
569 }
570
571 /// Sets the access control policy on the specified resource. Replaces
572 /// any existing policy.
573 ///
574 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
575 /// errors.
576 pub fn set_iam_policy(
577 &self,
578 ) -> super::builder::organization_address_group_service::SetIamPolicy {
579 super::builder::organization_address_group_service::SetIamPolicy::new(self.inner.clone())
580 }
581
582 /// Gets the access control policy for a resource. Returns an empty policy
583 /// if the resource exists and does not have a policy set.
584 pub fn get_iam_policy(
585 &self,
586 ) -> super::builder::organization_address_group_service::GetIamPolicy {
587 super::builder::organization_address_group_service::GetIamPolicy::new(self.inner.clone())
588 }
589
590 /// Returns permissions that a caller has on the specified resource. If the
591 /// resource does not exist, this will return an empty set of
592 /// permissions, not a `NOT_FOUND` error.
593 ///
594 /// Note: This operation is designed to be used for building
595 /// permission-aware UIs and command-line tools, not for authorization
596 /// checking. This operation may "fail open" without warning.
597 pub fn test_iam_permissions(
598 &self,
599 ) -> super::builder::organization_address_group_service::TestIamPermissions {
600 super::builder::organization_address_group_service::TestIamPermissions::new(
601 self.inner.clone(),
602 )
603 }
604
605 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
606 ///
607 /// [google.longrunning.Operations]: longrunning::client::Operations
608 pub fn list_operations(
609 &self,
610 ) -> super::builder::organization_address_group_service::ListOperations {
611 super::builder::organization_address_group_service::ListOperations::new(self.inner.clone())
612 }
613
614 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
615 ///
616 /// [google.longrunning.Operations]: longrunning::client::Operations
617 pub fn get_operation(
618 &self,
619 ) -> super::builder::organization_address_group_service::GetOperation {
620 super::builder::organization_address_group_service::GetOperation::new(self.inner.clone())
621 }
622
623 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
624 ///
625 /// [google.longrunning.Operations]: longrunning::client::Operations
626 pub fn delete_operation(
627 &self,
628 ) -> super::builder::organization_address_group_service::DeleteOperation {
629 super::builder::organization_address_group_service::DeleteOperation::new(self.inner.clone())
630 }
631
632 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
633 ///
634 /// [google.longrunning.Operations]: longrunning::client::Operations
635 pub fn cancel_operation(
636 &self,
637 ) -> super::builder::organization_address_group_service::CancelOperation {
638 super::builder::organization_address_group_service::CancelOperation::new(self.inner.clone())
639 }
640}
641
642/// Implements a client for the Network Security API.
643///
644/// # Example
645/// ```
646/// # tokio_test::block_on(async {
647/// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
648/// let client = NetworkSecurity::builder().build().await?;
649/// // use `client` to make requests to the Network Security API.
650/// # gax::client_builder::Result::<()>::Ok(()) });
651/// ```
652///
653/// # Service Description
654///
655/// Network Security API provides resources to configure authentication and
656/// authorization policies. Refer to per API resource documentation for more
657/// information.
658///
659/// # Configuration
660///
661/// To configure `NetworkSecurity` use the `with_*` methods in the type returned
662/// by [builder()][NetworkSecurity::builder]. The default configuration should
663/// work for most applications. Common configuration changes include
664///
665/// * [with_endpoint()]: by default this client uses the global default endpoint
666/// (`https://networksecurity.googleapis.com`). Applications using regional
667/// endpoints or running in restricted networks (e.g. a network configured
668// with [Private Google Access with VPC Service Controls]) may want to
669/// override this default.
670/// * [with_credentials()]: by default this client uses
671/// [Application Default Credentials]. Applications using custom
672/// authentication may need to override this default.
673///
674/// [with_endpoint()]: super::builder::network_security::ClientBuilder::with_endpoint
675/// [with_credentials()]: super::builder::network_security::ClientBuilder::credentials
676/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
677/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
678///
679/// # Pooling and Cloning
680///
681/// `NetworkSecurity` holds a connection pool internally, it is advised to
682/// create one and the reuse it. You do not need to wrap `NetworkSecurity` in
683/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
684/// already uses an `Arc` internally.
685#[derive(Clone, Debug)]
686pub struct NetworkSecurity {
687 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>,
688}
689
690impl NetworkSecurity {
691 /// Returns a builder for [NetworkSecurity].
692 ///
693 /// ```
694 /// # tokio_test::block_on(async {
695 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
696 /// let client = NetworkSecurity::builder().build().await?;
697 /// # gax::client_builder::Result::<()>::Ok(()) });
698 /// ```
699 pub fn builder() -> super::builder::network_security::ClientBuilder {
700 gax::client_builder::internal::new_builder(
701 super::builder::network_security::client::Factory,
702 )
703 }
704
705 /// Creates a new client from the provided stub.
706 ///
707 /// The most common case for calling this function is in tests mocking the
708 /// client's behavior.
709 pub fn from_stub<T>(stub: T) -> Self
710 where
711 T: super::stub::NetworkSecurity + 'static,
712 {
713 Self {
714 inner: std::sync::Arc::new(stub),
715 }
716 }
717
718 pub(crate) async fn new(
719 config: gaxi::options::ClientConfig,
720 ) -> gax::client_builder::Result<Self> {
721 let inner = Self::build_inner(config).await?;
722 Ok(Self { inner })
723 }
724
725 async fn build_inner(
726 conf: gaxi::options::ClientConfig,
727 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>>
728 {
729 if gaxi::options::tracing_enabled(&conf) {
730 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
731 }
732 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
733 }
734
735 async fn build_transport(
736 conf: gaxi::options::ClientConfig,
737 ) -> gax::client_builder::Result<impl super::stub::NetworkSecurity> {
738 super::transport::NetworkSecurity::new(conf).await
739 }
740
741 async fn build_with_tracing(
742 conf: gaxi::options::ClientConfig,
743 ) -> gax::client_builder::Result<impl super::stub::NetworkSecurity> {
744 Self::build_transport(conf)
745 .await
746 .map(super::tracing::NetworkSecurity::new)
747 }
748
749 /// Lists AuthorizationPolicies in a given project and location.
750 pub fn list_authorization_policies(
751 &self,
752 ) -> super::builder::network_security::ListAuthorizationPolicies {
753 super::builder::network_security::ListAuthorizationPolicies::new(self.inner.clone())
754 }
755
756 /// Gets details of a single AuthorizationPolicy.
757 pub fn get_authorization_policy(
758 &self,
759 ) -> super::builder::network_security::GetAuthorizationPolicy {
760 super::builder::network_security::GetAuthorizationPolicy::new(self.inner.clone())
761 }
762
763 /// Creates a new AuthorizationPolicy in a given project and location.
764 ///
765 /// # Long running operations
766 ///
767 /// This method is used to start, and/or poll a [long-running Operation].
768 /// The [Working with long-running operations] chapter in the [user guide]
769 /// covers these operations in detail.
770 ///
771 /// [long-running operation]: https://google.aip.dev/151
772 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
773 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
774 pub fn create_authorization_policy(
775 &self,
776 ) -> super::builder::network_security::CreateAuthorizationPolicy {
777 super::builder::network_security::CreateAuthorizationPolicy::new(self.inner.clone())
778 }
779
780 /// Updates the parameters of a single AuthorizationPolicy.
781 ///
782 /// # Long running operations
783 ///
784 /// This method is used to start, and/or poll a [long-running Operation].
785 /// The [Working with long-running operations] chapter in the [user guide]
786 /// covers these operations in detail.
787 ///
788 /// [long-running operation]: https://google.aip.dev/151
789 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
790 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
791 pub fn update_authorization_policy(
792 &self,
793 ) -> super::builder::network_security::UpdateAuthorizationPolicy {
794 super::builder::network_security::UpdateAuthorizationPolicy::new(self.inner.clone())
795 }
796
797 /// Deletes a single AuthorizationPolicy.
798 ///
799 /// # Long running operations
800 ///
801 /// This method is used to start, and/or poll a [long-running Operation].
802 /// The [Working with long-running operations] chapter in the [user guide]
803 /// covers these operations in detail.
804 ///
805 /// [long-running operation]: https://google.aip.dev/151
806 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
807 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
808 pub fn delete_authorization_policy(
809 &self,
810 ) -> super::builder::network_security::DeleteAuthorizationPolicy {
811 super::builder::network_security::DeleteAuthorizationPolicy::new(self.inner.clone())
812 }
813
814 /// Lists ServerTlsPolicies in a given project and location.
815 pub fn list_server_tls_policies(
816 &self,
817 ) -> super::builder::network_security::ListServerTlsPolicies {
818 super::builder::network_security::ListServerTlsPolicies::new(self.inner.clone())
819 }
820
821 /// Gets details of a single ServerTlsPolicy.
822 pub fn get_server_tls_policy(&self) -> super::builder::network_security::GetServerTlsPolicy {
823 super::builder::network_security::GetServerTlsPolicy::new(self.inner.clone())
824 }
825
826 /// Creates a new ServerTlsPolicy in a given project and location.
827 ///
828 /// # Long running operations
829 ///
830 /// This method is used to start, and/or poll a [long-running Operation].
831 /// The [Working with long-running operations] chapter in the [user guide]
832 /// covers these operations in detail.
833 ///
834 /// [long-running operation]: https://google.aip.dev/151
835 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
836 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
837 pub fn create_server_tls_policy(
838 &self,
839 ) -> super::builder::network_security::CreateServerTlsPolicy {
840 super::builder::network_security::CreateServerTlsPolicy::new(self.inner.clone())
841 }
842
843 /// Updates the parameters of a single ServerTlsPolicy.
844 ///
845 /// # Long running operations
846 ///
847 /// This method is used to start, and/or poll a [long-running Operation].
848 /// The [Working with long-running operations] chapter in the [user guide]
849 /// covers these operations in detail.
850 ///
851 /// [long-running operation]: https://google.aip.dev/151
852 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
853 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
854 pub fn update_server_tls_policy(
855 &self,
856 ) -> super::builder::network_security::UpdateServerTlsPolicy {
857 super::builder::network_security::UpdateServerTlsPolicy::new(self.inner.clone())
858 }
859
860 /// Deletes a single ServerTlsPolicy.
861 ///
862 /// # Long running operations
863 ///
864 /// This method is used to start, and/or poll a [long-running Operation].
865 /// The [Working with long-running operations] chapter in the [user guide]
866 /// covers these operations in detail.
867 ///
868 /// [long-running operation]: https://google.aip.dev/151
869 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
870 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
871 pub fn delete_server_tls_policy(
872 &self,
873 ) -> super::builder::network_security::DeleteServerTlsPolicy {
874 super::builder::network_security::DeleteServerTlsPolicy::new(self.inner.clone())
875 }
876
877 /// Lists ClientTlsPolicies in a given project and location.
878 pub fn list_client_tls_policies(
879 &self,
880 ) -> super::builder::network_security::ListClientTlsPolicies {
881 super::builder::network_security::ListClientTlsPolicies::new(self.inner.clone())
882 }
883
884 /// Gets details of a single ClientTlsPolicy.
885 pub fn get_client_tls_policy(&self) -> super::builder::network_security::GetClientTlsPolicy {
886 super::builder::network_security::GetClientTlsPolicy::new(self.inner.clone())
887 }
888
889 /// Creates a new ClientTlsPolicy in a given project and location.
890 ///
891 /// # Long running operations
892 ///
893 /// This method is used to start, and/or poll a [long-running Operation].
894 /// The [Working with long-running operations] chapter in the [user guide]
895 /// covers these operations in detail.
896 ///
897 /// [long-running operation]: https://google.aip.dev/151
898 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
899 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
900 pub fn create_client_tls_policy(
901 &self,
902 ) -> super::builder::network_security::CreateClientTlsPolicy {
903 super::builder::network_security::CreateClientTlsPolicy::new(self.inner.clone())
904 }
905
906 /// Updates the parameters of a single ClientTlsPolicy.
907 ///
908 /// # Long running operations
909 ///
910 /// This method is used to start, and/or poll a [long-running Operation].
911 /// The [Working with long-running operations] chapter in the [user guide]
912 /// covers these operations in detail.
913 ///
914 /// [long-running operation]: https://google.aip.dev/151
915 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
916 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
917 pub fn update_client_tls_policy(
918 &self,
919 ) -> super::builder::network_security::UpdateClientTlsPolicy {
920 super::builder::network_security::UpdateClientTlsPolicy::new(self.inner.clone())
921 }
922
923 /// Deletes a single ClientTlsPolicy.
924 ///
925 /// # Long running operations
926 ///
927 /// This method is used to start, and/or poll a [long-running Operation].
928 /// The [Working with long-running operations] chapter in the [user guide]
929 /// covers these operations in detail.
930 ///
931 /// [long-running operation]: https://google.aip.dev/151
932 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
933 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
934 pub fn delete_client_tls_policy(
935 &self,
936 ) -> super::builder::network_security::DeleteClientTlsPolicy {
937 super::builder::network_security::DeleteClientTlsPolicy::new(self.inner.clone())
938 }
939
940 /// Lists information about the supported locations for this service.
941 pub fn list_locations(&self) -> super::builder::network_security::ListLocations {
942 super::builder::network_security::ListLocations::new(self.inner.clone())
943 }
944
945 /// Gets information about a location.
946 pub fn get_location(&self) -> super::builder::network_security::GetLocation {
947 super::builder::network_security::GetLocation::new(self.inner.clone())
948 }
949
950 /// Sets the access control policy on the specified resource. Replaces
951 /// any existing policy.
952 ///
953 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
954 /// errors.
955 pub fn set_iam_policy(&self) -> super::builder::network_security::SetIamPolicy {
956 super::builder::network_security::SetIamPolicy::new(self.inner.clone())
957 }
958
959 /// Gets the access control policy for a resource. Returns an empty policy
960 /// if the resource exists and does not have a policy set.
961 pub fn get_iam_policy(&self) -> super::builder::network_security::GetIamPolicy {
962 super::builder::network_security::GetIamPolicy::new(self.inner.clone())
963 }
964
965 /// Returns permissions that a caller has on the specified resource. If the
966 /// resource does not exist, this will return an empty set of
967 /// permissions, not a `NOT_FOUND` error.
968 ///
969 /// Note: This operation is designed to be used for building
970 /// permission-aware UIs and command-line tools, not for authorization
971 /// checking. This operation may "fail open" without warning.
972 pub fn test_iam_permissions(&self) -> super::builder::network_security::TestIamPermissions {
973 super::builder::network_security::TestIamPermissions::new(self.inner.clone())
974 }
975
976 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
977 ///
978 /// [google.longrunning.Operations]: longrunning::client::Operations
979 pub fn list_operations(&self) -> super::builder::network_security::ListOperations {
980 super::builder::network_security::ListOperations::new(self.inner.clone())
981 }
982
983 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
984 ///
985 /// [google.longrunning.Operations]: longrunning::client::Operations
986 pub fn get_operation(&self) -> super::builder::network_security::GetOperation {
987 super::builder::network_security::GetOperation::new(self.inner.clone())
988 }
989
990 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
991 ///
992 /// [google.longrunning.Operations]: longrunning::client::Operations
993 pub fn delete_operation(&self) -> super::builder::network_security::DeleteOperation {
994 super::builder::network_security::DeleteOperation::new(self.inner.clone())
995 }
996
997 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
998 ///
999 /// [google.longrunning.Operations]: longrunning::client::Operations
1000 pub fn cancel_operation(&self) -> super::builder::network_security::CancelOperation {
1001 super::builder::network_security::CancelOperation::new(self.inner.clone())
1002 }
1003}