Skip to main content

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