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/// # use google_cloud_networksecurity_v1::client::AddressGroupService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26///     let client = AddressGroupService::builder().build().await?;
27///     let parent = "parent_value";
28///     let mut list = client.list_address_groups()
29///         .set_parent(parent)
30///         .by_item();
31///     while let Some(item) = list.next().await.transpose()? {
32///         println!("{:?}", item);
33///     }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// AddressGroup is a resource that manages a collection of IP or Domain Names,
40/// it can be used in Firewall Policy to represent allow or deny traffic from
41/// all the IP or Domain Names from the Address Group.
42///
43/// # Configuration
44///
45/// To configure `AddressGroupService` use the `with_*` methods in the type returned
46/// by [builder()][AddressGroupService::builder]. The default configuration should
47/// work for most applications. Common configuration changes include
48///
49/// * [with_endpoint()]: by default this client uses the global default endpoint
50///   (`https://networksecurity.googleapis.com`). Applications using regional
51///   endpoints or running in restricted networks (e.g. a network configured
52//    with [Private Google Access with VPC Service Controls]) may want to
53///   override this default.
54/// * [with_credentials()]: by default this client uses
55///   [Application Default Credentials]. Applications using custom
56///   authentication may need to override this default.
57///
58/// [with_endpoint()]: super::builder::address_group_service::ClientBuilder::with_endpoint
59/// [with_credentials()]: super::builder::address_group_service::ClientBuilder::with_credentials
60/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
61/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
62///
63/// # Pooling and Cloning
64///
65/// `AddressGroupService` holds a connection pool internally, it is advised to
66/// create one and reuse it. You do not need to wrap `AddressGroupService` in
67/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
68/// already uses an `Arc` internally.
69#[derive(Clone, Debug)]
70pub struct AddressGroupService {
71    inner: std::sync::Arc<dyn super::stub::dynamic::AddressGroupService>,
72}
73
74impl AddressGroupService {
75    /// Returns a builder for [AddressGroupService].
76    ///
77    /// ```
78    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
79    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
80    /// let client = AddressGroupService::builder().build().await?;
81    /// # Ok(()) }
82    /// ```
83    pub fn builder() -> super::builder::address_group_service::ClientBuilder {
84        crate::new_client_builder(super::builder::address_group_service::client::Factory)
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::AddressGroupService + '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    ) -> crate::ClientBuilderResult<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    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AddressGroupService>>
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    ) -> crate::ClientBuilderResult<impl super::stub::AddressGroupService> {
120        super::transport::AddressGroupService::new(conf).await
121    }
122
123    async fn build_with_tracing(
124        conf: gaxi::options::ClientConfig,
125    ) -> crate::ClientBuilderResult<impl super::stub::AddressGroupService> {
126        Self::build_transport(conf)
127            .await
128            .map(super::tracing::AddressGroupService::new)
129    }
130
131    /// Lists address groups in a given project and location.
132    ///
133    /// # Example
134    /// ```
135    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
136    /// use google_cloud_gax::paginator::ItemPaginator as _;
137    /// use google_cloud_networksecurity_v1::Result;
138    /// async fn sample(
139    ///    client: &AddressGroupService, parent: &str
140    /// ) -> Result<()> {
141    ///     let mut list = client.list_address_groups()
142    ///         .set_parent(parent)
143    ///         .by_item();
144    ///     while let Some(item) = list.next().await.transpose()? {
145    ///         println!("{:?}", item);
146    ///     }
147    ///     Ok(())
148    /// }
149    /// ```
150    pub fn list_address_groups(&self) -> super::builder::address_group_service::ListAddressGroups {
151        super::builder::address_group_service::ListAddressGroups::new(self.inner.clone())
152    }
153
154    /// Gets details of a single address group.
155    ///
156    /// # Example
157    /// ```
158    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
159    /// use google_cloud_networksecurity_v1::Result;
160    /// async fn sample(
161    ///    client: &AddressGroupService, name: &str
162    /// ) -> Result<()> {
163    ///     let response = client.get_address_group()
164    ///         .set_name(name)
165    ///         .send().await?;
166    ///     println!("response {:?}", response);
167    ///     Ok(())
168    /// }
169    /// ```
170    pub fn get_address_group(&self) -> super::builder::address_group_service::GetAddressGroup {
171        super::builder::address_group_service::GetAddressGroup::new(self.inner.clone())
172    }
173
174    /// Creates a new address group in a given project and location.
175    ///
176    /// # Long running operations
177    ///
178    /// This method is used to start, and/or poll a [long-running Operation].
179    /// The [Working with long-running operations] chapter in the [user guide]
180    /// covers these operations in detail.
181    ///
182    /// [long-running operation]: https://google.aip.dev/151
183    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
184    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
185    ///
186    /// # Example
187    /// ```
188    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
189    /// use google_cloud_lro::Poller;
190    /// use google_cloud_networksecurity_v1::model::AddressGroup;
191    /// use google_cloud_networksecurity_v1::Result;
192    /// async fn sample(
193    ///    client: &AddressGroupService, parent: &str
194    /// ) -> Result<()> {
195    ///     let response = client.create_address_group()
196    ///         .set_parent(parent)
197    ///         .set_address_group(
198    ///             AddressGroup::new()/* set fields */
199    ///         )
200    ///         .poller().until_done().await?;
201    ///     println!("response {:?}", response);
202    ///     Ok(())
203    /// }
204    /// ```
205    pub fn create_address_group(
206        &self,
207    ) -> super::builder::address_group_service::CreateAddressGroup {
208        super::builder::address_group_service::CreateAddressGroup::new(self.inner.clone())
209    }
210
211    /// Updates the parameters of a single address group.
212    ///
213    /// # Long running operations
214    ///
215    /// This method is used to start, and/or poll a [long-running Operation].
216    /// The [Working with long-running operations] chapter in the [user guide]
217    /// covers these operations in detail.
218    ///
219    /// [long-running operation]: https://google.aip.dev/151
220    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
221    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
222    ///
223    /// # Example
224    /// ```
225    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
226    /// use google_cloud_lro::Poller;
227    /// # extern crate wkt as google_cloud_wkt;
228    /// use google_cloud_wkt::FieldMask;
229    /// use google_cloud_networksecurity_v1::model::AddressGroup;
230    /// use google_cloud_networksecurity_v1::Result;
231    /// async fn sample(
232    ///    client: &AddressGroupService, name: &str
233    /// ) -> Result<()> {
234    ///     let response = client.update_address_group()
235    ///         .set_address_group(
236    ///             AddressGroup::new().set_name(name)/* set fields */
237    ///         )
238    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
239    ///         .poller().until_done().await?;
240    ///     println!("response {:?}", response);
241    ///     Ok(())
242    /// }
243    /// ```
244    pub fn update_address_group(
245        &self,
246    ) -> super::builder::address_group_service::UpdateAddressGroup {
247        super::builder::address_group_service::UpdateAddressGroup::new(self.inner.clone())
248    }
249
250    /// Adds items to an address group.
251    ///
252    /// # Long running operations
253    ///
254    /// This method is used to start, and/or poll a [long-running Operation].
255    /// The [Working with long-running operations] chapter in the [user guide]
256    /// covers these operations in detail.
257    ///
258    /// [long-running operation]: https://google.aip.dev/151
259    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
260    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
261    ///
262    /// # Example
263    /// ```
264    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
265    /// use google_cloud_lro::Poller;
266    /// use google_cloud_networksecurity_v1::Result;
267    /// async fn sample(
268    ///    client: &AddressGroupService
269    /// ) -> Result<()> {
270    ///     let response = client.add_address_group_items()
271    ///         /* set fields */
272    ///         .poller().until_done().await?;
273    ///     println!("response {:?}", response);
274    ///     Ok(())
275    /// }
276    /// ```
277    pub fn add_address_group_items(
278        &self,
279    ) -> super::builder::address_group_service::AddAddressGroupItems {
280        super::builder::address_group_service::AddAddressGroupItems::new(self.inner.clone())
281    }
282
283    /// Removes items from an address group.
284    ///
285    /// # Long running operations
286    ///
287    /// This method is used to start, and/or poll a [long-running Operation].
288    /// The [Working with long-running operations] chapter in the [user guide]
289    /// covers these operations in detail.
290    ///
291    /// [long-running operation]: https://google.aip.dev/151
292    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
293    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
294    ///
295    /// # Example
296    /// ```
297    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
298    /// use google_cloud_lro::Poller;
299    /// use google_cloud_networksecurity_v1::Result;
300    /// async fn sample(
301    ///    client: &AddressGroupService
302    /// ) -> Result<()> {
303    ///     let response = client.remove_address_group_items()
304    ///         /* set fields */
305    ///         .poller().until_done().await?;
306    ///     println!("response {:?}", response);
307    ///     Ok(())
308    /// }
309    /// ```
310    pub fn remove_address_group_items(
311        &self,
312    ) -> super::builder::address_group_service::RemoveAddressGroupItems {
313        super::builder::address_group_service::RemoveAddressGroupItems::new(self.inner.clone())
314    }
315
316    /// Clones items from one address group to another.
317    ///
318    /// # Long running operations
319    ///
320    /// This method is used to start, and/or poll a [long-running Operation].
321    /// The [Working with long-running operations] chapter in the [user guide]
322    /// covers these operations in detail.
323    ///
324    /// [long-running operation]: https://google.aip.dev/151
325    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
326    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
327    ///
328    /// # Example
329    /// ```
330    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
331    /// use google_cloud_lro::Poller;
332    /// use google_cloud_networksecurity_v1::Result;
333    /// async fn sample(
334    ///    client: &AddressGroupService
335    /// ) -> Result<()> {
336    ///     let response = client.clone_address_group_items()
337    ///         /* set fields */
338    ///         .poller().until_done().await?;
339    ///     println!("response {:?}", response);
340    ///     Ok(())
341    /// }
342    /// ```
343    pub fn clone_address_group_items(
344        &self,
345    ) -> super::builder::address_group_service::CloneAddressGroupItems {
346        super::builder::address_group_service::CloneAddressGroupItems::new(self.inner.clone())
347    }
348
349    /// Deletes a single address group.
350    ///
351    /// # Long running operations
352    ///
353    /// This method is used to start, and/or poll a [long-running Operation].
354    /// The [Working with long-running operations] chapter in the [user guide]
355    /// covers these operations in detail.
356    ///
357    /// [long-running operation]: https://google.aip.dev/151
358    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
359    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
360    ///
361    /// # Example
362    /// ```
363    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
364    /// use google_cloud_lro::Poller;
365    /// use google_cloud_networksecurity_v1::Result;
366    /// async fn sample(
367    ///    client: &AddressGroupService, name: &str
368    /// ) -> Result<()> {
369    ///     client.delete_address_group()
370    ///         .set_name(name)
371    ///         .poller().until_done().await?;
372    ///     Ok(())
373    /// }
374    /// ```
375    pub fn delete_address_group(
376        &self,
377    ) -> super::builder::address_group_service::DeleteAddressGroup {
378        super::builder::address_group_service::DeleteAddressGroup::new(self.inner.clone())
379    }
380
381    /// Lists references of an address group.
382    ///
383    /// # Example
384    /// ```
385    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
386    /// use google_cloud_gax::paginator::ItemPaginator as _;
387    /// use google_cloud_networksecurity_v1::Result;
388    /// async fn sample(
389    ///    client: &AddressGroupService
390    /// ) -> Result<()> {
391    ///     let mut list = client.list_address_group_references()
392    ///         /* set fields */
393    ///         .by_item();
394    ///     while let Some(item) = list.next().await.transpose()? {
395    ///         println!("{:?}", item);
396    ///     }
397    ///     Ok(())
398    /// }
399    /// ```
400    pub fn list_address_group_references(
401        &self,
402    ) -> super::builder::address_group_service::ListAddressGroupReferences {
403        super::builder::address_group_service::ListAddressGroupReferences::new(self.inner.clone())
404    }
405
406    /// Lists information about the supported locations for this service.
407    ///
408    /// # Example
409    /// ```
410    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
411    /// use google_cloud_gax::paginator::ItemPaginator as _;
412    /// use google_cloud_networksecurity_v1::Result;
413    /// async fn sample(
414    ///    client: &AddressGroupService
415    /// ) -> Result<()> {
416    ///     let mut list = client.list_locations()
417    ///         /* set fields */
418    ///         .by_item();
419    ///     while let Some(item) = list.next().await.transpose()? {
420    ///         println!("{:?}", item);
421    ///     }
422    ///     Ok(())
423    /// }
424    /// ```
425    pub fn list_locations(&self) -> super::builder::address_group_service::ListLocations {
426        super::builder::address_group_service::ListLocations::new(self.inner.clone())
427    }
428
429    /// Gets information about a location.
430    ///
431    /// # Example
432    /// ```
433    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
434    /// use google_cloud_networksecurity_v1::Result;
435    /// async fn sample(
436    ///    client: &AddressGroupService
437    /// ) -> Result<()> {
438    ///     let response = client.get_location()
439    ///         /* set fields */
440    ///         .send().await?;
441    ///     println!("response {:?}", response);
442    ///     Ok(())
443    /// }
444    /// ```
445    pub fn get_location(&self) -> super::builder::address_group_service::GetLocation {
446        super::builder::address_group_service::GetLocation::new(self.inner.clone())
447    }
448
449    /// Sets the access control policy on the specified resource. Replaces
450    /// any existing policy.
451    ///
452    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
453    /// errors.
454    ///
455    /// # Example
456    /// ```
457    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
458    /// use google_cloud_networksecurity_v1::Result;
459    /// async fn sample(
460    ///    client: &AddressGroupService
461    /// ) -> Result<()> {
462    ///     let response = client.set_iam_policy()
463    ///         /* set fields */
464    ///         .send().await?;
465    ///     println!("response {:?}", response);
466    ///     Ok(())
467    /// }
468    /// ```
469    pub fn set_iam_policy(&self) -> super::builder::address_group_service::SetIamPolicy {
470        super::builder::address_group_service::SetIamPolicy::new(self.inner.clone())
471    }
472
473    /// Gets the access control policy for a resource. Returns an empty policy
474    /// if the resource exists and does not have a policy set.
475    ///
476    /// # Example
477    /// ```
478    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
479    /// use google_cloud_networksecurity_v1::Result;
480    /// async fn sample(
481    ///    client: &AddressGroupService
482    /// ) -> Result<()> {
483    ///     let response = client.get_iam_policy()
484    ///         /* set fields */
485    ///         .send().await?;
486    ///     println!("response {:?}", response);
487    ///     Ok(())
488    /// }
489    /// ```
490    pub fn get_iam_policy(&self) -> super::builder::address_group_service::GetIamPolicy {
491        super::builder::address_group_service::GetIamPolicy::new(self.inner.clone())
492    }
493
494    /// Returns permissions that a caller has on the specified resource. If the
495    /// resource does not exist, this will return an empty set of
496    /// permissions, not a `NOT_FOUND` error.
497    ///
498    /// Note: This operation is designed to be used for building
499    /// permission-aware UIs and command-line tools, not for authorization
500    /// checking. This operation may "fail open" without warning.
501    ///
502    /// # Example
503    /// ```
504    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
505    /// use google_cloud_networksecurity_v1::Result;
506    /// async fn sample(
507    ///    client: &AddressGroupService
508    /// ) -> Result<()> {
509    ///     let response = client.test_iam_permissions()
510    ///         /* set fields */
511    ///         .send().await?;
512    ///     println!("response {:?}", response);
513    ///     Ok(())
514    /// }
515    /// ```
516    pub fn test_iam_permissions(
517        &self,
518    ) -> super::builder::address_group_service::TestIamPermissions {
519        super::builder::address_group_service::TestIamPermissions::new(self.inner.clone())
520    }
521
522    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
523    ///
524    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
525    ///
526    /// # Example
527    /// ```
528    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
529    /// use google_cloud_gax::paginator::ItemPaginator as _;
530    /// use google_cloud_networksecurity_v1::Result;
531    /// async fn sample(
532    ///    client: &AddressGroupService
533    /// ) -> Result<()> {
534    ///     let mut list = client.list_operations()
535    ///         /* set fields */
536    ///         .by_item();
537    ///     while let Some(item) = list.next().await.transpose()? {
538    ///         println!("{:?}", item);
539    ///     }
540    ///     Ok(())
541    /// }
542    /// ```
543    pub fn list_operations(&self) -> super::builder::address_group_service::ListOperations {
544        super::builder::address_group_service::ListOperations::new(self.inner.clone())
545    }
546
547    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
548    ///
549    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
550    ///
551    /// # Example
552    /// ```
553    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
554    /// use google_cloud_networksecurity_v1::Result;
555    /// async fn sample(
556    ///    client: &AddressGroupService
557    /// ) -> Result<()> {
558    ///     let response = client.get_operation()
559    ///         /* set fields */
560    ///         .send().await?;
561    ///     println!("response {:?}", response);
562    ///     Ok(())
563    /// }
564    /// ```
565    pub fn get_operation(&self) -> super::builder::address_group_service::GetOperation {
566        super::builder::address_group_service::GetOperation::new(self.inner.clone())
567    }
568
569    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
570    ///
571    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
572    ///
573    /// # Example
574    /// ```
575    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
576    /// use google_cloud_networksecurity_v1::Result;
577    /// async fn sample(
578    ///    client: &AddressGroupService
579    /// ) -> Result<()> {
580    ///     client.delete_operation()
581    ///         /* set fields */
582    ///         .send().await?;
583    ///     Ok(())
584    /// }
585    /// ```
586    pub fn delete_operation(&self) -> super::builder::address_group_service::DeleteOperation {
587        super::builder::address_group_service::DeleteOperation::new(self.inner.clone())
588    }
589
590    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
591    ///
592    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
593    ///
594    /// # Example
595    /// ```
596    /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
597    /// use google_cloud_networksecurity_v1::Result;
598    /// async fn sample(
599    ///    client: &AddressGroupService
600    /// ) -> Result<()> {
601    ///     client.cancel_operation()
602    ///         /* set fields */
603    ///         .send().await?;
604    ///     Ok(())
605    /// }
606    /// ```
607    pub fn cancel_operation(&self) -> super::builder::address_group_service::CancelOperation {
608        super::builder::address_group_service::CancelOperation::new(self.inner.clone())
609    }
610}
611
612/// Implements a client for the Network Security API.
613///
614/// # Example
615/// ```
616/// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
617/// use google_cloud_gax::paginator::ItemPaginator as _;
618/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
619///     let client = OrganizationAddressGroupService::builder().build().await?;
620///     let parent = "parent_value";
621///     let mut list = client.list_address_groups()
622///         .set_parent(parent)
623///         .by_item();
624///     while let Some(item) = list.next().await.transpose()? {
625///         println!("{:?}", item);
626///     }
627/// # Ok(()) }
628/// ```
629///
630/// # Service Description
631///
632/// Organization AddressGroup is created under organization. Requests against
633/// Organization AddressGroup will use project from request credential for
634/// activation/quota/visibility check.
635///
636/// # Configuration
637///
638/// To configure `OrganizationAddressGroupService` use the `with_*` methods in the type returned
639/// by [builder()][OrganizationAddressGroupService::builder]. The default configuration should
640/// work for most applications. Common configuration changes include
641///
642/// * [with_endpoint()]: by default this client uses the global default endpoint
643///   (`https://networksecurity.googleapis.com`). Applications using regional
644///   endpoints or running in restricted networks (e.g. a network configured
645//    with [Private Google Access with VPC Service Controls]) may want to
646///   override this default.
647/// * [with_credentials()]: by default this client uses
648///   [Application Default Credentials]. Applications using custom
649///   authentication may need to override this default.
650///
651/// [with_endpoint()]: super::builder::organization_address_group_service::ClientBuilder::with_endpoint
652/// [with_credentials()]: super::builder::organization_address_group_service::ClientBuilder::with_credentials
653/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
654/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
655///
656/// # Pooling and Cloning
657///
658/// `OrganizationAddressGroupService` holds a connection pool internally, it is advised to
659/// create one and reuse it. You do not need to wrap `OrganizationAddressGroupService` in
660/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
661/// already uses an `Arc` internally.
662#[derive(Clone, Debug)]
663pub struct OrganizationAddressGroupService {
664    inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
665}
666
667impl OrganizationAddressGroupService {
668    /// Returns a builder for [OrganizationAddressGroupService].
669    ///
670    /// ```
671    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
672    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
673    /// let client = OrganizationAddressGroupService::builder().build().await?;
674    /// # Ok(()) }
675    /// ```
676    pub fn builder() -> super::builder::organization_address_group_service::ClientBuilder {
677        crate::new_client_builder(
678            super::builder::organization_address_group_service::client::Factory,
679        )
680    }
681
682    /// Creates a new client from the provided stub.
683    ///
684    /// The most common case for calling this function is in tests mocking the
685    /// client's behavior.
686    pub fn from_stub<T>(stub: T) -> Self
687    where
688        T: super::stub::OrganizationAddressGroupService + 'static,
689    {
690        Self {
691            inner: std::sync::Arc::new(stub),
692        }
693    }
694
695    pub(crate) async fn new(
696        config: gaxi::options::ClientConfig,
697    ) -> crate::ClientBuilderResult<Self> {
698        let inner = Self::build_inner(config).await?;
699        Ok(Self { inner })
700    }
701
702    async fn build_inner(
703        conf: gaxi::options::ClientConfig,
704    ) -> crate::ClientBuilderResult<
705        std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
706    > {
707        if gaxi::options::tracing_enabled(&conf) {
708            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
709        }
710        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
711    }
712
713    async fn build_transport(
714        conf: gaxi::options::ClientConfig,
715    ) -> crate::ClientBuilderResult<impl super::stub::OrganizationAddressGroupService> {
716        super::transport::OrganizationAddressGroupService::new(conf).await
717    }
718
719    async fn build_with_tracing(
720        conf: gaxi::options::ClientConfig,
721    ) -> crate::ClientBuilderResult<impl super::stub::OrganizationAddressGroupService> {
722        Self::build_transport(conf)
723            .await
724            .map(super::tracing::OrganizationAddressGroupService::new)
725    }
726
727    /// Lists address groups in a given project and location.
728    ///
729    /// # Example
730    /// ```
731    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
732    /// use google_cloud_gax::paginator::ItemPaginator as _;
733    /// use google_cloud_networksecurity_v1::Result;
734    /// async fn sample(
735    ///    client: &OrganizationAddressGroupService, parent: &str
736    /// ) -> Result<()> {
737    ///     let mut list = client.list_address_groups()
738    ///         .set_parent(parent)
739    ///         .by_item();
740    ///     while let Some(item) = list.next().await.transpose()? {
741    ///         println!("{:?}", item);
742    ///     }
743    ///     Ok(())
744    /// }
745    /// ```
746    pub fn list_address_groups(
747        &self,
748    ) -> super::builder::organization_address_group_service::ListAddressGroups {
749        super::builder::organization_address_group_service::ListAddressGroups::new(
750            self.inner.clone(),
751        )
752    }
753
754    /// Gets details of a single address group.
755    ///
756    /// # Example
757    /// ```
758    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
759    /// use google_cloud_networksecurity_v1::Result;
760    /// async fn sample(
761    ///    client: &OrganizationAddressGroupService, name: &str
762    /// ) -> Result<()> {
763    ///     let response = client.get_address_group()
764    ///         .set_name(name)
765    ///         .send().await?;
766    ///     println!("response {:?}", response);
767    ///     Ok(())
768    /// }
769    /// ```
770    pub fn get_address_group(
771        &self,
772    ) -> super::builder::organization_address_group_service::GetAddressGroup {
773        super::builder::organization_address_group_service::GetAddressGroup::new(self.inner.clone())
774    }
775
776    /// Creates a new address group in a given project and location.
777    ///
778    /// # Long running operations
779    ///
780    /// This method is used to start, and/or poll a [long-running Operation].
781    /// The [Working with long-running operations] chapter in the [user guide]
782    /// covers these operations in detail.
783    ///
784    /// [long-running operation]: https://google.aip.dev/151
785    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
786    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
787    ///
788    /// # Example
789    /// ```
790    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
791    /// use google_cloud_lro::Poller;
792    /// use google_cloud_networksecurity_v1::model::AddressGroup;
793    /// use google_cloud_networksecurity_v1::Result;
794    /// async fn sample(
795    ///    client: &OrganizationAddressGroupService, parent: &str
796    /// ) -> Result<()> {
797    ///     let response = client.create_address_group()
798    ///         .set_parent(parent)
799    ///         .set_address_group(
800    ///             AddressGroup::new()/* set fields */
801    ///         )
802    ///         .poller().until_done().await?;
803    ///     println!("response {:?}", response);
804    ///     Ok(())
805    /// }
806    /// ```
807    pub fn create_address_group(
808        &self,
809    ) -> super::builder::organization_address_group_service::CreateAddressGroup {
810        super::builder::organization_address_group_service::CreateAddressGroup::new(
811            self.inner.clone(),
812        )
813    }
814
815    /// Updates parameters of an address group.
816    ///
817    /// # Long running operations
818    ///
819    /// This method is used to start, and/or poll a [long-running Operation].
820    /// The [Working with long-running operations] chapter in the [user guide]
821    /// covers these operations in detail.
822    ///
823    /// [long-running operation]: https://google.aip.dev/151
824    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
825    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
826    ///
827    /// # Example
828    /// ```
829    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
830    /// use google_cloud_lro::Poller;
831    /// # extern crate wkt as google_cloud_wkt;
832    /// use google_cloud_wkt::FieldMask;
833    /// use google_cloud_networksecurity_v1::model::AddressGroup;
834    /// use google_cloud_networksecurity_v1::Result;
835    /// async fn sample(
836    ///    client: &OrganizationAddressGroupService, name: &str
837    /// ) -> Result<()> {
838    ///     let response = client.update_address_group()
839    ///         .set_address_group(
840    ///             AddressGroup::new().set_name(name)/* set fields */
841    ///         )
842    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
843    ///         .poller().until_done().await?;
844    ///     println!("response {:?}", response);
845    ///     Ok(())
846    /// }
847    /// ```
848    pub fn update_address_group(
849        &self,
850    ) -> super::builder::organization_address_group_service::UpdateAddressGroup {
851        super::builder::organization_address_group_service::UpdateAddressGroup::new(
852            self.inner.clone(),
853        )
854    }
855
856    /// Adds items to an address group.
857    ///
858    /// # Long running operations
859    ///
860    /// This method is used to start, and/or poll a [long-running Operation].
861    /// The [Working with long-running operations] chapter in the [user guide]
862    /// covers these operations in detail.
863    ///
864    /// [long-running operation]: https://google.aip.dev/151
865    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
866    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
867    ///
868    /// # Example
869    /// ```
870    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
871    /// use google_cloud_lro::Poller;
872    /// use google_cloud_networksecurity_v1::Result;
873    /// async fn sample(
874    ///    client: &OrganizationAddressGroupService
875    /// ) -> Result<()> {
876    ///     let response = client.add_address_group_items()
877    ///         /* set fields */
878    ///         .poller().until_done().await?;
879    ///     println!("response {:?}", response);
880    ///     Ok(())
881    /// }
882    /// ```
883    pub fn add_address_group_items(
884        &self,
885    ) -> super::builder::organization_address_group_service::AddAddressGroupItems {
886        super::builder::organization_address_group_service::AddAddressGroupItems::new(
887            self.inner.clone(),
888        )
889    }
890
891    /// Removes items from an address group.
892    ///
893    /// # Long running operations
894    ///
895    /// This method is used to start, and/or poll a [long-running Operation].
896    /// The [Working with long-running operations] chapter in the [user guide]
897    /// covers these operations in detail.
898    ///
899    /// [long-running operation]: https://google.aip.dev/151
900    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
901    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
902    ///
903    /// # Example
904    /// ```
905    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
906    /// use google_cloud_lro::Poller;
907    /// use google_cloud_networksecurity_v1::Result;
908    /// async fn sample(
909    ///    client: &OrganizationAddressGroupService
910    /// ) -> Result<()> {
911    ///     let response = client.remove_address_group_items()
912    ///         /* set fields */
913    ///         .poller().until_done().await?;
914    ///     println!("response {:?}", response);
915    ///     Ok(())
916    /// }
917    /// ```
918    pub fn remove_address_group_items(
919        &self,
920    ) -> super::builder::organization_address_group_service::RemoveAddressGroupItems {
921        super::builder::organization_address_group_service::RemoveAddressGroupItems::new(
922            self.inner.clone(),
923        )
924    }
925
926    /// Clones items from one address group to another.
927    ///
928    /// # Long running operations
929    ///
930    /// This method is used to start, and/or poll a [long-running Operation].
931    /// The [Working with long-running operations] chapter in the [user guide]
932    /// covers these operations in detail.
933    ///
934    /// [long-running operation]: https://google.aip.dev/151
935    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
936    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
937    ///
938    /// # Example
939    /// ```
940    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
941    /// use google_cloud_lro::Poller;
942    /// use google_cloud_networksecurity_v1::Result;
943    /// async fn sample(
944    ///    client: &OrganizationAddressGroupService
945    /// ) -> Result<()> {
946    ///     let response = client.clone_address_group_items()
947    ///         /* set fields */
948    ///         .poller().until_done().await?;
949    ///     println!("response {:?}", response);
950    ///     Ok(())
951    /// }
952    /// ```
953    pub fn clone_address_group_items(
954        &self,
955    ) -> super::builder::organization_address_group_service::CloneAddressGroupItems {
956        super::builder::organization_address_group_service::CloneAddressGroupItems::new(
957            self.inner.clone(),
958        )
959    }
960
961    /// Deletes an address group.
962    ///
963    /// # Long running operations
964    ///
965    /// This method is used to start, and/or poll a [long-running Operation].
966    /// The [Working with long-running operations] chapter in the [user guide]
967    /// covers these operations in detail.
968    ///
969    /// [long-running operation]: https://google.aip.dev/151
970    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
971    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
972    ///
973    /// # Example
974    /// ```
975    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
976    /// use google_cloud_lro::Poller;
977    /// use google_cloud_networksecurity_v1::Result;
978    /// async fn sample(
979    ///    client: &OrganizationAddressGroupService, name: &str
980    /// ) -> Result<()> {
981    ///     client.delete_address_group()
982    ///         .set_name(name)
983    ///         .poller().until_done().await?;
984    ///     Ok(())
985    /// }
986    /// ```
987    pub fn delete_address_group(
988        &self,
989    ) -> super::builder::organization_address_group_service::DeleteAddressGroup {
990        super::builder::organization_address_group_service::DeleteAddressGroup::new(
991            self.inner.clone(),
992        )
993    }
994
995    /// Lists references of an address group.
996    ///
997    /// # Example
998    /// ```
999    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1000    /// use google_cloud_gax::paginator::ItemPaginator as _;
1001    /// use google_cloud_networksecurity_v1::Result;
1002    /// async fn sample(
1003    ///    client: &OrganizationAddressGroupService
1004    /// ) -> Result<()> {
1005    ///     let mut list = client.list_address_group_references()
1006    ///         /* set fields */
1007    ///         .by_item();
1008    ///     while let Some(item) = list.next().await.transpose()? {
1009    ///         println!("{:?}", item);
1010    ///     }
1011    ///     Ok(())
1012    /// }
1013    /// ```
1014    pub fn list_address_group_references(
1015        &self,
1016    ) -> super::builder::organization_address_group_service::ListAddressGroupReferences {
1017        super::builder::organization_address_group_service::ListAddressGroupReferences::new(
1018            self.inner.clone(),
1019        )
1020    }
1021
1022    /// Lists information about the supported locations for this service.
1023    ///
1024    /// # Example
1025    /// ```
1026    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1027    /// use google_cloud_gax::paginator::ItemPaginator as _;
1028    /// use google_cloud_networksecurity_v1::Result;
1029    /// async fn sample(
1030    ///    client: &OrganizationAddressGroupService
1031    /// ) -> Result<()> {
1032    ///     let mut list = client.list_locations()
1033    ///         /* set fields */
1034    ///         .by_item();
1035    ///     while let Some(item) = list.next().await.transpose()? {
1036    ///         println!("{:?}", item);
1037    ///     }
1038    ///     Ok(())
1039    /// }
1040    /// ```
1041    pub fn list_locations(
1042        &self,
1043    ) -> super::builder::organization_address_group_service::ListLocations {
1044        super::builder::organization_address_group_service::ListLocations::new(self.inner.clone())
1045    }
1046
1047    /// Gets information about a location.
1048    ///
1049    /// # Example
1050    /// ```
1051    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1052    /// use google_cloud_networksecurity_v1::Result;
1053    /// async fn sample(
1054    ///    client: &OrganizationAddressGroupService
1055    /// ) -> Result<()> {
1056    ///     let response = client.get_location()
1057    ///         /* set fields */
1058    ///         .send().await?;
1059    ///     println!("response {:?}", response);
1060    ///     Ok(())
1061    /// }
1062    /// ```
1063    pub fn get_location(&self) -> super::builder::organization_address_group_service::GetLocation {
1064        super::builder::organization_address_group_service::GetLocation::new(self.inner.clone())
1065    }
1066
1067    /// Sets the access control policy on the specified resource. Replaces
1068    /// any existing policy.
1069    ///
1070    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1071    /// errors.
1072    ///
1073    /// # Example
1074    /// ```
1075    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1076    /// use google_cloud_networksecurity_v1::Result;
1077    /// async fn sample(
1078    ///    client: &OrganizationAddressGroupService
1079    /// ) -> Result<()> {
1080    ///     let response = client.set_iam_policy()
1081    ///         /* set fields */
1082    ///         .send().await?;
1083    ///     println!("response {:?}", response);
1084    ///     Ok(())
1085    /// }
1086    /// ```
1087    pub fn set_iam_policy(
1088        &self,
1089    ) -> super::builder::organization_address_group_service::SetIamPolicy {
1090        super::builder::organization_address_group_service::SetIamPolicy::new(self.inner.clone())
1091    }
1092
1093    /// Gets the access control policy for a resource. Returns an empty policy
1094    /// if the resource exists and does not have a policy set.
1095    ///
1096    /// # Example
1097    /// ```
1098    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1099    /// use google_cloud_networksecurity_v1::Result;
1100    /// async fn sample(
1101    ///    client: &OrganizationAddressGroupService
1102    /// ) -> Result<()> {
1103    ///     let response = client.get_iam_policy()
1104    ///         /* set fields */
1105    ///         .send().await?;
1106    ///     println!("response {:?}", response);
1107    ///     Ok(())
1108    /// }
1109    /// ```
1110    pub fn get_iam_policy(
1111        &self,
1112    ) -> super::builder::organization_address_group_service::GetIamPolicy {
1113        super::builder::organization_address_group_service::GetIamPolicy::new(self.inner.clone())
1114    }
1115
1116    /// Returns permissions that a caller has on the specified resource. If the
1117    /// resource does not exist, this will return an empty set of
1118    /// permissions, not a `NOT_FOUND` error.
1119    ///
1120    /// Note: This operation is designed to be used for building
1121    /// permission-aware UIs and command-line tools, not for authorization
1122    /// checking. This operation may "fail open" without warning.
1123    ///
1124    /// # Example
1125    /// ```
1126    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1127    /// use google_cloud_networksecurity_v1::Result;
1128    /// async fn sample(
1129    ///    client: &OrganizationAddressGroupService
1130    /// ) -> Result<()> {
1131    ///     let response = client.test_iam_permissions()
1132    ///         /* set fields */
1133    ///         .send().await?;
1134    ///     println!("response {:?}", response);
1135    ///     Ok(())
1136    /// }
1137    /// ```
1138    pub fn test_iam_permissions(
1139        &self,
1140    ) -> super::builder::organization_address_group_service::TestIamPermissions {
1141        super::builder::organization_address_group_service::TestIamPermissions::new(
1142            self.inner.clone(),
1143        )
1144    }
1145
1146    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1147    ///
1148    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1149    ///
1150    /// # Example
1151    /// ```
1152    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1153    /// use google_cloud_gax::paginator::ItemPaginator as _;
1154    /// use google_cloud_networksecurity_v1::Result;
1155    /// async fn sample(
1156    ///    client: &OrganizationAddressGroupService
1157    /// ) -> Result<()> {
1158    ///     let mut list = client.list_operations()
1159    ///         /* set fields */
1160    ///         .by_item();
1161    ///     while let Some(item) = list.next().await.transpose()? {
1162    ///         println!("{:?}", item);
1163    ///     }
1164    ///     Ok(())
1165    /// }
1166    /// ```
1167    pub fn list_operations(
1168        &self,
1169    ) -> super::builder::organization_address_group_service::ListOperations {
1170        super::builder::organization_address_group_service::ListOperations::new(self.inner.clone())
1171    }
1172
1173    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1174    ///
1175    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1176    ///
1177    /// # Example
1178    /// ```
1179    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1180    /// use google_cloud_networksecurity_v1::Result;
1181    /// async fn sample(
1182    ///    client: &OrganizationAddressGroupService
1183    /// ) -> Result<()> {
1184    ///     let response = client.get_operation()
1185    ///         /* set fields */
1186    ///         .send().await?;
1187    ///     println!("response {:?}", response);
1188    ///     Ok(())
1189    /// }
1190    /// ```
1191    pub fn get_operation(
1192        &self,
1193    ) -> super::builder::organization_address_group_service::GetOperation {
1194        super::builder::organization_address_group_service::GetOperation::new(self.inner.clone())
1195    }
1196
1197    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1198    ///
1199    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1200    ///
1201    /// # Example
1202    /// ```
1203    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1204    /// use google_cloud_networksecurity_v1::Result;
1205    /// async fn sample(
1206    ///    client: &OrganizationAddressGroupService
1207    /// ) -> Result<()> {
1208    ///     client.delete_operation()
1209    ///         /* set fields */
1210    ///         .send().await?;
1211    ///     Ok(())
1212    /// }
1213    /// ```
1214    pub fn delete_operation(
1215        &self,
1216    ) -> super::builder::organization_address_group_service::DeleteOperation {
1217        super::builder::organization_address_group_service::DeleteOperation::new(self.inner.clone())
1218    }
1219
1220    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1221    ///
1222    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1223    ///
1224    /// # Example
1225    /// ```
1226    /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1227    /// use google_cloud_networksecurity_v1::Result;
1228    /// async fn sample(
1229    ///    client: &OrganizationAddressGroupService
1230    /// ) -> Result<()> {
1231    ///     client.cancel_operation()
1232    ///         /* set fields */
1233    ///         .send().await?;
1234    ///     Ok(())
1235    /// }
1236    /// ```
1237    pub fn cancel_operation(
1238        &self,
1239    ) -> super::builder::organization_address_group_service::CancelOperation {
1240        super::builder::organization_address_group_service::CancelOperation::new(self.inner.clone())
1241    }
1242}
1243
1244/// Implements a client for the Network Security API.
1245///
1246/// # Example
1247/// ```
1248/// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1249/// use google_cloud_gax::paginator::ItemPaginator as _;
1250/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
1251///     let client = NetworkSecurity::builder().build().await?;
1252///     let parent = "parent_value";
1253///     let mut list = client.list_authorization_policies()
1254///         .set_parent(parent)
1255///         .by_item();
1256///     while let Some(item) = list.next().await.transpose()? {
1257///         println!("{:?}", item);
1258///     }
1259/// # Ok(()) }
1260/// ```
1261///
1262/// # Service Description
1263///
1264/// Network Security API provides resources to configure authentication and
1265/// authorization policies. Refer to per API resource documentation for more
1266/// information.
1267///
1268/// # Configuration
1269///
1270/// To configure `NetworkSecurity` use the `with_*` methods in the type returned
1271/// by [builder()][NetworkSecurity::builder]. The default configuration should
1272/// work for most applications. Common configuration changes include
1273///
1274/// * [with_endpoint()]: by default this client uses the global default endpoint
1275///   (`https://networksecurity.googleapis.com`). Applications using regional
1276///   endpoints or running in restricted networks (e.g. a network configured
1277//    with [Private Google Access with VPC Service Controls]) may want to
1278///   override this default.
1279/// * [with_credentials()]: by default this client uses
1280///   [Application Default Credentials]. Applications using custom
1281///   authentication may need to override this default.
1282///
1283/// [with_endpoint()]: super::builder::network_security::ClientBuilder::with_endpoint
1284/// [with_credentials()]: super::builder::network_security::ClientBuilder::with_credentials
1285/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1286/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1287///
1288/// # Pooling and Cloning
1289///
1290/// `NetworkSecurity` holds a connection pool internally, it is advised to
1291/// create one and reuse it. You do not need to wrap `NetworkSecurity` in
1292/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1293/// already uses an `Arc` internally.
1294#[derive(Clone, Debug)]
1295pub struct NetworkSecurity {
1296    inner: std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>,
1297}
1298
1299impl NetworkSecurity {
1300    /// Returns a builder for [NetworkSecurity].
1301    ///
1302    /// ```
1303    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1304    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1305    /// let client = NetworkSecurity::builder().build().await?;
1306    /// # Ok(()) }
1307    /// ```
1308    pub fn builder() -> super::builder::network_security::ClientBuilder {
1309        crate::new_client_builder(super::builder::network_security::client::Factory)
1310    }
1311
1312    /// Creates a new client from the provided stub.
1313    ///
1314    /// The most common case for calling this function is in tests mocking the
1315    /// client's behavior.
1316    pub fn from_stub<T>(stub: T) -> Self
1317    where
1318        T: super::stub::NetworkSecurity + 'static,
1319    {
1320        Self {
1321            inner: std::sync::Arc::new(stub),
1322        }
1323    }
1324
1325    pub(crate) async fn new(
1326        config: gaxi::options::ClientConfig,
1327    ) -> crate::ClientBuilderResult<Self> {
1328        let inner = Self::build_inner(config).await?;
1329        Ok(Self { inner })
1330    }
1331
1332    async fn build_inner(
1333        conf: gaxi::options::ClientConfig,
1334    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>> {
1335        if gaxi::options::tracing_enabled(&conf) {
1336            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1337        }
1338        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1339    }
1340
1341    async fn build_transport(
1342        conf: gaxi::options::ClientConfig,
1343    ) -> crate::ClientBuilderResult<impl super::stub::NetworkSecurity> {
1344        super::transport::NetworkSecurity::new(conf).await
1345    }
1346
1347    async fn build_with_tracing(
1348        conf: gaxi::options::ClientConfig,
1349    ) -> crate::ClientBuilderResult<impl super::stub::NetworkSecurity> {
1350        Self::build_transport(conf)
1351            .await
1352            .map(super::tracing::NetworkSecurity::new)
1353    }
1354
1355    /// Lists AuthorizationPolicies in a given project and location.
1356    ///
1357    /// # Example
1358    /// ```
1359    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1360    /// use google_cloud_gax::paginator::ItemPaginator as _;
1361    /// use google_cloud_networksecurity_v1::Result;
1362    /// async fn sample(
1363    ///    client: &NetworkSecurity, parent: &str
1364    /// ) -> Result<()> {
1365    ///     let mut list = client.list_authorization_policies()
1366    ///         .set_parent(parent)
1367    ///         .by_item();
1368    ///     while let Some(item) = list.next().await.transpose()? {
1369    ///         println!("{:?}", item);
1370    ///     }
1371    ///     Ok(())
1372    /// }
1373    /// ```
1374    pub fn list_authorization_policies(
1375        &self,
1376    ) -> super::builder::network_security::ListAuthorizationPolicies {
1377        super::builder::network_security::ListAuthorizationPolicies::new(self.inner.clone())
1378    }
1379
1380    /// Gets details of a single AuthorizationPolicy.
1381    ///
1382    /// # Example
1383    /// ```
1384    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1385    /// use google_cloud_networksecurity_v1::Result;
1386    /// async fn sample(
1387    ///    client: &NetworkSecurity, name: &str
1388    /// ) -> Result<()> {
1389    ///     let response = client.get_authorization_policy()
1390    ///         .set_name(name)
1391    ///         .send().await?;
1392    ///     println!("response {:?}", response);
1393    ///     Ok(())
1394    /// }
1395    /// ```
1396    pub fn get_authorization_policy(
1397        &self,
1398    ) -> super::builder::network_security::GetAuthorizationPolicy {
1399        super::builder::network_security::GetAuthorizationPolicy::new(self.inner.clone())
1400    }
1401
1402    /// Creates a new AuthorizationPolicy in a given project and location.
1403    ///
1404    /// # Long running operations
1405    ///
1406    /// This method is used to start, and/or poll a [long-running Operation].
1407    /// The [Working with long-running operations] chapter in the [user guide]
1408    /// covers these operations in detail.
1409    ///
1410    /// [long-running operation]: https://google.aip.dev/151
1411    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1412    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1413    ///
1414    /// # Example
1415    /// ```
1416    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1417    /// use google_cloud_lro::Poller;
1418    /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1419    /// use google_cloud_networksecurity_v1::Result;
1420    /// async fn sample(
1421    ///    client: &NetworkSecurity, parent: &str
1422    /// ) -> Result<()> {
1423    ///     let response = client.create_authorization_policy()
1424    ///         .set_parent(parent)
1425    ///         .set_authorization_policy(
1426    ///             AuthorizationPolicy::new()/* set fields */
1427    ///         )
1428    ///         .poller().until_done().await?;
1429    ///     println!("response {:?}", response);
1430    ///     Ok(())
1431    /// }
1432    /// ```
1433    pub fn create_authorization_policy(
1434        &self,
1435    ) -> super::builder::network_security::CreateAuthorizationPolicy {
1436        super::builder::network_security::CreateAuthorizationPolicy::new(self.inner.clone())
1437    }
1438
1439    /// Updates the parameters of a single AuthorizationPolicy.
1440    ///
1441    /// # Long running operations
1442    ///
1443    /// This method is used to start, and/or poll a [long-running Operation].
1444    /// The [Working with long-running operations] chapter in the [user guide]
1445    /// covers these operations in detail.
1446    ///
1447    /// [long-running operation]: https://google.aip.dev/151
1448    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1449    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1450    ///
1451    /// # Example
1452    /// ```
1453    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1454    /// use google_cloud_lro::Poller;
1455    /// # extern crate wkt as google_cloud_wkt;
1456    /// use google_cloud_wkt::FieldMask;
1457    /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
1458    /// use google_cloud_networksecurity_v1::Result;
1459    /// async fn sample(
1460    ///    client: &NetworkSecurity, name: &str
1461    /// ) -> Result<()> {
1462    ///     let response = client.update_authorization_policy()
1463    ///         .set_authorization_policy(
1464    ///             AuthorizationPolicy::new().set_name(name)/* set fields */
1465    ///         )
1466    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1467    ///         .poller().until_done().await?;
1468    ///     println!("response {:?}", response);
1469    ///     Ok(())
1470    /// }
1471    /// ```
1472    pub fn update_authorization_policy(
1473        &self,
1474    ) -> super::builder::network_security::UpdateAuthorizationPolicy {
1475        super::builder::network_security::UpdateAuthorizationPolicy::new(self.inner.clone())
1476    }
1477
1478    /// Deletes a single AuthorizationPolicy.
1479    ///
1480    /// # Long running operations
1481    ///
1482    /// This method is used to start, and/or poll a [long-running Operation].
1483    /// The [Working with long-running operations] chapter in the [user guide]
1484    /// covers these operations in detail.
1485    ///
1486    /// [long-running operation]: https://google.aip.dev/151
1487    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1488    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1489    ///
1490    /// # Example
1491    /// ```
1492    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1493    /// use google_cloud_lro::Poller;
1494    /// use google_cloud_networksecurity_v1::Result;
1495    /// async fn sample(
1496    ///    client: &NetworkSecurity, name: &str
1497    /// ) -> Result<()> {
1498    ///     client.delete_authorization_policy()
1499    ///         .set_name(name)
1500    ///         .poller().until_done().await?;
1501    ///     Ok(())
1502    /// }
1503    /// ```
1504    pub fn delete_authorization_policy(
1505        &self,
1506    ) -> super::builder::network_security::DeleteAuthorizationPolicy {
1507        super::builder::network_security::DeleteAuthorizationPolicy::new(self.inner.clone())
1508    }
1509
1510    /// Lists ServerTlsPolicies in a given project and location.
1511    ///
1512    /// # Example
1513    /// ```
1514    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1515    /// use google_cloud_gax::paginator::ItemPaginator as _;
1516    /// use google_cloud_networksecurity_v1::Result;
1517    /// async fn sample(
1518    ///    client: &NetworkSecurity, parent: &str
1519    /// ) -> Result<()> {
1520    ///     let mut list = client.list_server_tls_policies()
1521    ///         .set_parent(parent)
1522    ///         .by_item();
1523    ///     while let Some(item) = list.next().await.transpose()? {
1524    ///         println!("{:?}", item);
1525    ///     }
1526    ///     Ok(())
1527    /// }
1528    /// ```
1529    pub fn list_server_tls_policies(
1530        &self,
1531    ) -> super::builder::network_security::ListServerTlsPolicies {
1532        super::builder::network_security::ListServerTlsPolicies::new(self.inner.clone())
1533    }
1534
1535    /// Gets details of a single ServerTlsPolicy.
1536    ///
1537    /// # Example
1538    /// ```
1539    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1540    /// use google_cloud_networksecurity_v1::Result;
1541    /// async fn sample(
1542    ///    client: &NetworkSecurity, name: &str
1543    /// ) -> Result<()> {
1544    ///     let response = client.get_server_tls_policy()
1545    ///         .set_name(name)
1546    ///         .send().await?;
1547    ///     println!("response {:?}", response);
1548    ///     Ok(())
1549    /// }
1550    /// ```
1551    pub fn get_server_tls_policy(&self) -> super::builder::network_security::GetServerTlsPolicy {
1552        super::builder::network_security::GetServerTlsPolicy::new(self.inner.clone())
1553    }
1554
1555    /// Creates a new ServerTlsPolicy in a given project and location.
1556    ///
1557    /// # Long running operations
1558    ///
1559    /// This method is used to start, and/or poll a [long-running Operation].
1560    /// The [Working with long-running operations] chapter in the [user guide]
1561    /// covers these operations in detail.
1562    ///
1563    /// [long-running operation]: https://google.aip.dev/151
1564    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1565    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1566    ///
1567    /// # Example
1568    /// ```
1569    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1570    /// use google_cloud_lro::Poller;
1571    /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
1572    /// use google_cloud_networksecurity_v1::Result;
1573    /// async fn sample(
1574    ///    client: &NetworkSecurity, parent: &str
1575    /// ) -> Result<()> {
1576    ///     let response = client.create_server_tls_policy()
1577    ///         .set_parent(parent)
1578    ///         .set_server_tls_policy(
1579    ///             ServerTlsPolicy::new()/* set fields */
1580    ///         )
1581    ///         .poller().until_done().await?;
1582    ///     println!("response {:?}", response);
1583    ///     Ok(())
1584    /// }
1585    /// ```
1586    pub fn create_server_tls_policy(
1587        &self,
1588    ) -> super::builder::network_security::CreateServerTlsPolicy {
1589        super::builder::network_security::CreateServerTlsPolicy::new(self.inner.clone())
1590    }
1591
1592    /// Updates the parameters of a single ServerTlsPolicy.
1593    ///
1594    /// # Long running operations
1595    ///
1596    /// This method is used to start, and/or poll a [long-running Operation].
1597    /// The [Working with long-running operations] chapter in the [user guide]
1598    /// covers these operations in detail.
1599    ///
1600    /// [long-running operation]: https://google.aip.dev/151
1601    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1602    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1603    ///
1604    /// # Example
1605    /// ```
1606    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1607    /// use google_cloud_lro::Poller;
1608    /// # extern crate wkt as google_cloud_wkt;
1609    /// use google_cloud_wkt::FieldMask;
1610    /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
1611    /// use google_cloud_networksecurity_v1::Result;
1612    /// async fn sample(
1613    ///    client: &NetworkSecurity, name: &str
1614    /// ) -> Result<()> {
1615    ///     let response = client.update_server_tls_policy()
1616    ///         .set_server_tls_policy(
1617    ///             ServerTlsPolicy::new().set_name(name)/* set fields */
1618    ///         )
1619    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1620    ///         .poller().until_done().await?;
1621    ///     println!("response {:?}", response);
1622    ///     Ok(())
1623    /// }
1624    /// ```
1625    pub fn update_server_tls_policy(
1626        &self,
1627    ) -> super::builder::network_security::UpdateServerTlsPolicy {
1628        super::builder::network_security::UpdateServerTlsPolicy::new(self.inner.clone())
1629    }
1630
1631    /// Deletes a single ServerTlsPolicy.
1632    ///
1633    /// # Long running operations
1634    ///
1635    /// This method is used to start, and/or poll a [long-running Operation].
1636    /// The [Working with long-running operations] chapter in the [user guide]
1637    /// covers these operations in detail.
1638    ///
1639    /// [long-running operation]: https://google.aip.dev/151
1640    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1641    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1642    ///
1643    /// # Example
1644    /// ```
1645    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1646    /// use google_cloud_lro::Poller;
1647    /// use google_cloud_networksecurity_v1::Result;
1648    /// async fn sample(
1649    ///    client: &NetworkSecurity, name: &str
1650    /// ) -> Result<()> {
1651    ///     client.delete_server_tls_policy()
1652    ///         .set_name(name)
1653    ///         .poller().until_done().await?;
1654    ///     Ok(())
1655    /// }
1656    /// ```
1657    pub fn delete_server_tls_policy(
1658        &self,
1659    ) -> super::builder::network_security::DeleteServerTlsPolicy {
1660        super::builder::network_security::DeleteServerTlsPolicy::new(self.inner.clone())
1661    }
1662
1663    /// Lists ClientTlsPolicies in a given project and location.
1664    ///
1665    /// # Example
1666    /// ```
1667    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1668    /// use google_cloud_gax::paginator::ItemPaginator as _;
1669    /// use google_cloud_networksecurity_v1::Result;
1670    /// async fn sample(
1671    ///    client: &NetworkSecurity, parent: &str
1672    /// ) -> Result<()> {
1673    ///     let mut list = client.list_client_tls_policies()
1674    ///         .set_parent(parent)
1675    ///         .by_item();
1676    ///     while let Some(item) = list.next().await.transpose()? {
1677    ///         println!("{:?}", item);
1678    ///     }
1679    ///     Ok(())
1680    /// }
1681    /// ```
1682    pub fn list_client_tls_policies(
1683        &self,
1684    ) -> super::builder::network_security::ListClientTlsPolicies {
1685        super::builder::network_security::ListClientTlsPolicies::new(self.inner.clone())
1686    }
1687
1688    /// Gets details of a single ClientTlsPolicy.
1689    ///
1690    /// # Example
1691    /// ```
1692    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1693    /// use google_cloud_networksecurity_v1::Result;
1694    /// async fn sample(
1695    ///    client: &NetworkSecurity, name: &str
1696    /// ) -> Result<()> {
1697    ///     let response = client.get_client_tls_policy()
1698    ///         .set_name(name)
1699    ///         .send().await?;
1700    ///     println!("response {:?}", response);
1701    ///     Ok(())
1702    /// }
1703    /// ```
1704    pub fn get_client_tls_policy(&self) -> super::builder::network_security::GetClientTlsPolicy {
1705        super::builder::network_security::GetClientTlsPolicy::new(self.inner.clone())
1706    }
1707
1708    /// Creates a new ClientTlsPolicy in a given project and location.
1709    ///
1710    /// # Long running operations
1711    ///
1712    /// This method is used to start, and/or poll a [long-running Operation].
1713    /// The [Working with long-running operations] chapter in the [user guide]
1714    /// covers these operations in detail.
1715    ///
1716    /// [long-running operation]: https://google.aip.dev/151
1717    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1718    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1719    ///
1720    /// # Example
1721    /// ```
1722    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1723    /// use google_cloud_lro::Poller;
1724    /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
1725    /// use google_cloud_networksecurity_v1::Result;
1726    /// async fn sample(
1727    ///    client: &NetworkSecurity, parent: &str
1728    /// ) -> Result<()> {
1729    ///     let response = client.create_client_tls_policy()
1730    ///         .set_parent(parent)
1731    ///         .set_client_tls_policy(
1732    ///             ClientTlsPolicy::new()/* set fields */
1733    ///         )
1734    ///         .poller().until_done().await?;
1735    ///     println!("response {:?}", response);
1736    ///     Ok(())
1737    /// }
1738    /// ```
1739    pub fn create_client_tls_policy(
1740        &self,
1741    ) -> super::builder::network_security::CreateClientTlsPolicy {
1742        super::builder::network_security::CreateClientTlsPolicy::new(self.inner.clone())
1743    }
1744
1745    /// Updates the parameters of a single ClientTlsPolicy.
1746    ///
1747    /// # Long running operations
1748    ///
1749    /// This method is used to start, and/or poll a [long-running Operation].
1750    /// The [Working with long-running operations] chapter in the [user guide]
1751    /// covers these operations in detail.
1752    ///
1753    /// [long-running operation]: https://google.aip.dev/151
1754    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1755    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1756    ///
1757    /// # Example
1758    /// ```
1759    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1760    /// use google_cloud_lro::Poller;
1761    /// # extern crate wkt as google_cloud_wkt;
1762    /// use google_cloud_wkt::FieldMask;
1763    /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
1764    /// use google_cloud_networksecurity_v1::Result;
1765    /// async fn sample(
1766    ///    client: &NetworkSecurity, name: &str
1767    /// ) -> Result<()> {
1768    ///     let response = client.update_client_tls_policy()
1769    ///         .set_client_tls_policy(
1770    ///             ClientTlsPolicy::new().set_name(name)/* set fields */
1771    ///         )
1772    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1773    ///         .poller().until_done().await?;
1774    ///     println!("response {:?}", response);
1775    ///     Ok(())
1776    /// }
1777    /// ```
1778    pub fn update_client_tls_policy(
1779        &self,
1780    ) -> super::builder::network_security::UpdateClientTlsPolicy {
1781        super::builder::network_security::UpdateClientTlsPolicy::new(self.inner.clone())
1782    }
1783
1784    /// Deletes a single ClientTlsPolicy.
1785    ///
1786    /// # Long running operations
1787    ///
1788    /// This method is used to start, and/or poll a [long-running Operation].
1789    /// The [Working with long-running operations] chapter in the [user guide]
1790    /// covers these operations in detail.
1791    ///
1792    /// [long-running operation]: https://google.aip.dev/151
1793    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1794    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1795    ///
1796    /// # Example
1797    /// ```
1798    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1799    /// use google_cloud_lro::Poller;
1800    /// use google_cloud_networksecurity_v1::Result;
1801    /// async fn sample(
1802    ///    client: &NetworkSecurity, name: &str
1803    /// ) -> Result<()> {
1804    ///     client.delete_client_tls_policy()
1805    ///         .set_name(name)
1806    ///         .poller().until_done().await?;
1807    ///     Ok(())
1808    /// }
1809    /// ```
1810    pub fn delete_client_tls_policy(
1811        &self,
1812    ) -> super::builder::network_security::DeleteClientTlsPolicy {
1813        super::builder::network_security::DeleteClientTlsPolicy::new(self.inner.clone())
1814    }
1815
1816    /// Lists information about the supported locations for this service.
1817    ///
1818    /// # Example
1819    /// ```
1820    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1821    /// use google_cloud_gax::paginator::ItemPaginator as _;
1822    /// use google_cloud_networksecurity_v1::Result;
1823    /// async fn sample(
1824    ///    client: &NetworkSecurity
1825    /// ) -> Result<()> {
1826    ///     let mut list = client.list_locations()
1827    ///         /* set fields */
1828    ///         .by_item();
1829    ///     while let Some(item) = list.next().await.transpose()? {
1830    ///         println!("{:?}", item);
1831    ///     }
1832    ///     Ok(())
1833    /// }
1834    /// ```
1835    pub fn list_locations(&self) -> super::builder::network_security::ListLocations {
1836        super::builder::network_security::ListLocations::new(self.inner.clone())
1837    }
1838
1839    /// Gets information about a location.
1840    ///
1841    /// # Example
1842    /// ```
1843    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1844    /// use google_cloud_networksecurity_v1::Result;
1845    /// async fn sample(
1846    ///    client: &NetworkSecurity
1847    /// ) -> Result<()> {
1848    ///     let response = client.get_location()
1849    ///         /* set fields */
1850    ///         .send().await?;
1851    ///     println!("response {:?}", response);
1852    ///     Ok(())
1853    /// }
1854    /// ```
1855    pub fn get_location(&self) -> super::builder::network_security::GetLocation {
1856        super::builder::network_security::GetLocation::new(self.inner.clone())
1857    }
1858
1859    /// Sets the access control policy on the specified resource. Replaces
1860    /// any existing policy.
1861    ///
1862    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1863    /// errors.
1864    ///
1865    /// # Example
1866    /// ```
1867    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1868    /// use google_cloud_networksecurity_v1::Result;
1869    /// async fn sample(
1870    ///    client: &NetworkSecurity
1871    /// ) -> Result<()> {
1872    ///     let response = client.set_iam_policy()
1873    ///         /* set fields */
1874    ///         .send().await?;
1875    ///     println!("response {:?}", response);
1876    ///     Ok(())
1877    /// }
1878    /// ```
1879    pub fn set_iam_policy(&self) -> super::builder::network_security::SetIamPolicy {
1880        super::builder::network_security::SetIamPolicy::new(self.inner.clone())
1881    }
1882
1883    /// Gets the access control policy for a resource. Returns an empty policy
1884    /// if the resource exists and does not have a policy set.
1885    ///
1886    /// # Example
1887    /// ```
1888    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1889    /// use google_cloud_networksecurity_v1::Result;
1890    /// async fn sample(
1891    ///    client: &NetworkSecurity
1892    /// ) -> Result<()> {
1893    ///     let response = client.get_iam_policy()
1894    ///         /* set fields */
1895    ///         .send().await?;
1896    ///     println!("response {:?}", response);
1897    ///     Ok(())
1898    /// }
1899    /// ```
1900    pub fn get_iam_policy(&self) -> super::builder::network_security::GetIamPolicy {
1901        super::builder::network_security::GetIamPolicy::new(self.inner.clone())
1902    }
1903
1904    /// Returns permissions that a caller has on the specified resource. If the
1905    /// resource does not exist, this will return an empty set of
1906    /// permissions, not a `NOT_FOUND` error.
1907    ///
1908    /// Note: This operation is designed to be used for building
1909    /// permission-aware UIs and command-line tools, not for authorization
1910    /// checking. This operation may "fail open" without warning.
1911    ///
1912    /// # Example
1913    /// ```
1914    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1915    /// use google_cloud_networksecurity_v1::Result;
1916    /// async fn sample(
1917    ///    client: &NetworkSecurity
1918    /// ) -> Result<()> {
1919    ///     let response = client.test_iam_permissions()
1920    ///         /* set fields */
1921    ///         .send().await?;
1922    ///     println!("response {:?}", response);
1923    ///     Ok(())
1924    /// }
1925    /// ```
1926    pub fn test_iam_permissions(&self) -> super::builder::network_security::TestIamPermissions {
1927        super::builder::network_security::TestIamPermissions::new(self.inner.clone())
1928    }
1929
1930    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1931    ///
1932    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1933    ///
1934    /// # Example
1935    /// ```
1936    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1937    /// use google_cloud_gax::paginator::ItemPaginator as _;
1938    /// use google_cloud_networksecurity_v1::Result;
1939    /// async fn sample(
1940    ///    client: &NetworkSecurity
1941    /// ) -> Result<()> {
1942    ///     let mut list = client.list_operations()
1943    ///         /* set fields */
1944    ///         .by_item();
1945    ///     while let Some(item) = list.next().await.transpose()? {
1946    ///         println!("{:?}", item);
1947    ///     }
1948    ///     Ok(())
1949    /// }
1950    /// ```
1951    pub fn list_operations(&self) -> super::builder::network_security::ListOperations {
1952        super::builder::network_security::ListOperations::new(self.inner.clone())
1953    }
1954
1955    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1956    ///
1957    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1958    ///
1959    /// # Example
1960    /// ```
1961    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1962    /// use google_cloud_networksecurity_v1::Result;
1963    /// async fn sample(
1964    ///    client: &NetworkSecurity
1965    /// ) -> Result<()> {
1966    ///     let response = client.get_operation()
1967    ///         /* set fields */
1968    ///         .send().await?;
1969    ///     println!("response {:?}", response);
1970    ///     Ok(())
1971    /// }
1972    /// ```
1973    pub fn get_operation(&self) -> super::builder::network_security::GetOperation {
1974        super::builder::network_security::GetOperation::new(self.inner.clone())
1975    }
1976
1977    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1978    ///
1979    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1980    ///
1981    /// # Example
1982    /// ```
1983    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
1984    /// use google_cloud_networksecurity_v1::Result;
1985    /// async fn sample(
1986    ///    client: &NetworkSecurity
1987    /// ) -> Result<()> {
1988    ///     client.delete_operation()
1989    ///         /* set fields */
1990    ///         .send().await?;
1991    ///     Ok(())
1992    /// }
1993    /// ```
1994    pub fn delete_operation(&self) -> super::builder::network_security::DeleteOperation {
1995        super::builder::network_security::DeleteOperation::new(self.inner.clone())
1996    }
1997
1998    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1999    ///
2000    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2001    ///
2002    /// # Example
2003    /// ```
2004    /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
2005    /// use google_cloud_networksecurity_v1::Result;
2006    /// async fn sample(
2007    ///    client: &NetworkSecurity
2008    /// ) -> Result<()> {
2009    ///     client.cancel_operation()
2010    ///         /* set fields */
2011    ///         .send().await?;
2012    ///     Ok(())
2013    /// }
2014    /// ```
2015    pub fn cancel_operation(&self) -> super::builder::network_security::CancelOperation {
2016        super::builder::network_security::CancelOperation::new(self.inner.clone())
2017    }
2018}