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(
26/// parent: &str,
27/// ) -> anyhow::Result<()> {
28/// let client = AddressGroupService::builder().build().await?;
29/// let mut list = client.list_address_groups()
30/// .set_parent(parent)
31/// .by_item();
32/// while let Some(item) = list.next().await.transpose()? {
33/// println!("{:?}", item);
34/// }
35/// Ok(())
36/// }
37/// ```
38///
39/// # Service Description
40///
41/// AddressGroup is a resource that manages a collection of IP or Domain Names,
42/// it can be used in Firewall Policy to represent allow or deny traffic from
43/// all the IP or Domain Names from the Address Group.
44///
45/// # Configuration
46///
47/// To configure `AddressGroupService` use the `with_*` methods in the type returned
48/// by [builder()][AddressGroupService::builder]. The default configuration should
49/// work for most applications. Common configuration changes include
50///
51/// * [with_endpoint()]: by default this client uses the global default endpoint
52/// (`https://networksecurity.googleapis.com`). Applications using regional
53/// endpoints or running in restricted networks (e.g. a network configured
54// with [Private Google Access with VPC Service Controls]) may want to
55/// override this default.
56/// * [with_credentials()]: by default this client uses
57/// [Application Default Credentials]. Applications using custom
58/// authentication may need to override this default.
59///
60/// [with_endpoint()]: super::builder::address_group_service::ClientBuilder::with_endpoint
61/// [with_credentials()]: super::builder::address_group_service::ClientBuilder::with_credentials
62/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
63/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
64///
65/// # Pooling and Cloning
66///
67/// `AddressGroupService` holds a connection pool internally, it is advised to
68/// create one and reuse it. You do not need to wrap `AddressGroupService` in
69/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
70/// already uses an `Arc` internally.
71#[derive(Clone, Debug)]
72pub struct AddressGroupService {
73 inner: std::sync::Arc<dyn super::stub::dynamic::AddressGroupService>,
74}
75
76impl AddressGroupService {
77 /// Returns a builder for [AddressGroupService].
78 ///
79 /// ```
80 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
81 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
82 /// let client = AddressGroupService::builder().build().await?;
83 /// # Ok(()) }
84 /// ```
85 pub fn builder() -> super::builder::address_group_service::ClientBuilder {
86 crate::new_client_builder(super::builder::address_group_service::client::Factory)
87 }
88
89 /// Creates a new client from the provided stub.
90 ///
91 /// The most common case for calling this function is in tests mocking the
92 /// client's behavior.
93 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
94 where
95 T: super::stub::AddressGroupService + 'static,
96 {
97 Self { inner: stub.into() }
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, project_id: &str, location_id: &str, address_group_id: &str
162 /// ) -> Result<()> {
163 /// let response = client.get_address_group()
164 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
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, project_id: &str, location_id: &str
194 /// ) -> Result<()> {
195 /// let response = client.create_address_group()
196 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
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, project_id: &str, location_id: &str, address_group_id: &str
233 /// ) -> Result<()> {
234 /// let response = client.update_address_group()
235 /// .set_address_group(
236 /// AddressGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))/* 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, project_id: &str, location_id: &str, address_group_id: &str
368 /// ) -> Result<()> {
369 /// client.delete_address_group()
370 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
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 /// This method lists locations based on the resource scope provided in
409 /// the [ListLocationsRequest.name] field:
410 ///
411 /// * **Global locations**: If `name` is empty, the method lists the
412 /// public locations available to all projects. * **Project-specific
413 /// locations**: If `name` follows the format
414 /// `projects/{project}`, the method lists locations visible to that
415 /// specific project. This includes public, private, or other
416 /// project-specific locations enabled for the project.
417 ///
418 /// For gRPC and client library implementations, the resource name is
419 /// passed as the `name` field. For direct service calls, the resource
420 /// name is
421 /// incorporated into the request path based on the specific service
422 /// implementation and version.
423 ///
424 /// # Example
425 /// ```
426 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
427 /// use google_cloud_gax::paginator::ItemPaginator as _;
428 /// use google_cloud_networksecurity_v1::Result;
429 /// async fn sample(
430 /// client: &AddressGroupService
431 /// ) -> Result<()> {
432 /// let mut list = client.list_locations()
433 /// /* set fields */
434 /// .by_item();
435 /// while let Some(item) = list.next().await.transpose()? {
436 /// println!("{:?}", item);
437 /// }
438 /// Ok(())
439 /// }
440 /// ```
441 pub fn list_locations(&self) -> super::builder::address_group_service::ListLocations {
442 super::builder::address_group_service::ListLocations::new(self.inner.clone())
443 }
444
445 /// Gets information about a location.
446 ///
447 /// # Example
448 /// ```
449 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
450 /// use google_cloud_networksecurity_v1::Result;
451 /// async fn sample(
452 /// client: &AddressGroupService
453 /// ) -> Result<()> {
454 /// let response = client.get_location()
455 /// /* set fields */
456 /// .send().await?;
457 /// println!("response {:?}", response);
458 /// Ok(())
459 /// }
460 /// ```
461 pub fn get_location(&self) -> super::builder::address_group_service::GetLocation {
462 super::builder::address_group_service::GetLocation::new(self.inner.clone())
463 }
464
465 /// Sets the access control policy on the specified resource. Replaces
466 /// any existing policy.
467 ///
468 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
469 /// errors.
470 ///
471 /// # Example
472 /// ```
473 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
474 /// use google_cloud_networksecurity_v1::Result;
475 /// async fn sample(
476 /// client: &AddressGroupService
477 /// ) -> Result<()> {
478 /// let response = client.set_iam_policy()
479 /// /* set fields */
480 /// .send().await?;
481 /// println!("response {:?}", response);
482 /// Ok(())
483 /// }
484 /// ```
485 pub fn set_iam_policy(&self) -> super::builder::address_group_service::SetIamPolicy {
486 super::builder::address_group_service::SetIamPolicy::new(self.inner.clone())
487 }
488
489 /// Gets the access control policy for a resource. Returns an empty policy
490 /// if the resource exists and does not have a policy set.
491 ///
492 /// # Example
493 /// ```
494 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
495 /// use google_cloud_networksecurity_v1::Result;
496 /// async fn sample(
497 /// client: &AddressGroupService
498 /// ) -> Result<()> {
499 /// let response = client.get_iam_policy()
500 /// /* set fields */
501 /// .send().await?;
502 /// println!("response {:?}", response);
503 /// Ok(())
504 /// }
505 /// ```
506 pub fn get_iam_policy(&self) -> super::builder::address_group_service::GetIamPolicy {
507 super::builder::address_group_service::GetIamPolicy::new(self.inner.clone())
508 }
509
510 /// Returns permissions that a caller has on the specified resource. If the
511 /// resource does not exist, this will return an empty set of
512 /// permissions, not a `NOT_FOUND` error.
513 ///
514 /// Note: This operation is designed to be used for building
515 /// permission-aware UIs and command-line tools, not for authorization
516 /// checking. This operation may "fail open" without warning.
517 ///
518 /// # Example
519 /// ```
520 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
521 /// use google_cloud_networksecurity_v1::Result;
522 /// async fn sample(
523 /// client: &AddressGroupService
524 /// ) -> Result<()> {
525 /// let response = client.test_iam_permissions()
526 /// /* set fields */
527 /// .send().await?;
528 /// println!("response {:?}", response);
529 /// Ok(())
530 /// }
531 /// ```
532 pub fn test_iam_permissions(
533 &self,
534 ) -> super::builder::address_group_service::TestIamPermissions {
535 super::builder::address_group_service::TestIamPermissions::new(self.inner.clone())
536 }
537
538 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
539 ///
540 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
541 ///
542 /// # Example
543 /// ```
544 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
545 /// use google_cloud_gax::paginator::ItemPaginator as _;
546 /// use google_cloud_networksecurity_v1::Result;
547 /// async fn sample(
548 /// client: &AddressGroupService
549 /// ) -> Result<()> {
550 /// let mut list = client.list_operations()
551 /// /* set fields */
552 /// .by_item();
553 /// while let Some(item) = list.next().await.transpose()? {
554 /// println!("{:?}", item);
555 /// }
556 /// Ok(())
557 /// }
558 /// ```
559 pub fn list_operations(&self) -> super::builder::address_group_service::ListOperations {
560 super::builder::address_group_service::ListOperations::new(self.inner.clone())
561 }
562
563 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
564 ///
565 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
566 ///
567 /// # Example
568 /// ```
569 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
570 /// use google_cloud_networksecurity_v1::Result;
571 /// async fn sample(
572 /// client: &AddressGroupService
573 /// ) -> Result<()> {
574 /// let response = client.get_operation()
575 /// /* set fields */
576 /// .send().await?;
577 /// println!("response {:?}", response);
578 /// Ok(())
579 /// }
580 /// ```
581 pub fn get_operation(&self) -> super::builder::address_group_service::GetOperation {
582 super::builder::address_group_service::GetOperation::new(self.inner.clone())
583 }
584
585 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
586 ///
587 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
588 ///
589 /// # Example
590 /// ```
591 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
592 /// use google_cloud_networksecurity_v1::Result;
593 /// async fn sample(
594 /// client: &AddressGroupService
595 /// ) -> Result<()> {
596 /// client.delete_operation()
597 /// /* set fields */
598 /// .send().await?;
599 /// Ok(())
600 /// }
601 /// ```
602 pub fn delete_operation(&self) -> super::builder::address_group_service::DeleteOperation {
603 super::builder::address_group_service::DeleteOperation::new(self.inner.clone())
604 }
605
606 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
607 ///
608 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
609 ///
610 /// # Example
611 /// ```
612 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
613 /// use google_cloud_networksecurity_v1::Result;
614 /// async fn sample(
615 /// client: &AddressGroupService
616 /// ) -> Result<()> {
617 /// client.cancel_operation()
618 /// /* set fields */
619 /// .send().await?;
620 /// Ok(())
621 /// }
622 /// ```
623 pub fn cancel_operation(&self) -> super::builder::address_group_service::CancelOperation {
624 super::builder::address_group_service::CancelOperation::new(self.inner.clone())
625 }
626}
627
628/// Implements a client for the Network Security API.
629///
630/// # Example
631/// ```
632/// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
633/// use google_cloud_gax::paginator::ItemPaginator as _;
634/// async fn sample(
635/// parent: &str,
636/// ) -> anyhow::Result<()> {
637/// let client = OrganizationAddressGroupService::builder().build().await?;
638/// let mut list = client.list_address_groups()
639/// .set_parent(parent)
640/// .by_item();
641/// while let Some(item) = list.next().await.transpose()? {
642/// println!("{:?}", item);
643/// }
644/// Ok(())
645/// }
646/// ```
647///
648/// # Service Description
649///
650/// Organization AddressGroup is created under organization. Requests against
651/// Organization AddressGroup will use project from request credential for
652/// activation/quota/visibility check.
653///
654/// # Configuration
655///
656/// To configure `OrganizationAddressGroupService` use the `with_*` methods in the type returned
657/// by [builder()][OrganizationAddressGroupService::builder]. The default configuration should
658/// work for most applications. Common configuration changes include
659///
660/// * [with_endpoint()]: by default this client uses the global default endpoint
661/// (`https://networksecurity.googleapis.com`). Applications using regional
662/// endpoints or running in restricted networks (e.g. a network configured
663// with [Private Google Access with VPC Service Controls]) may want to
664/// override this default.
665/// * [with_credentials()]: by default this client uses
666/// [Application Default Credentials]. Applications using custom
667/// authentication may need to override this default.
668///
669/// [with_endpoint()]: super::builder::organization_address_group_service::ClientBuilder::with_endpoint
670/// [with_credentials()]: super::builder::organization_address_group_service::ClientBuilder::with_credentials
671/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
672/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
673///
674/// # Pooling and Cloning
675///
676/// `OrganizationAddressGroupService` holds a connection pool internally, it is advised to
677/// create one and reuse it. You do not need to wrap `OrganizationAddressGroupService` in
678/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
679/// already uses an `Arc` internally.
680#[derive(Clone, Debug)]
681pub struct OrganizationAddressGroupService {
682 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
683}
684
685impl OrganizationAddressGroupService {
686 /// Returns a builder for [OrganizationAddressGroupService].
687 ///
688 /// ```
689 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
690 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
691 /// let client = OrganizationAddressGroupService::builder().build().await?;
692 /// # Ok(()) }
693 /// ```
694 pub fn builder() -> super::builder::organization_address_group_service::ClientBuilder {
695 crate::new_client_builder(
696 super::builder::organization_address_group_service::client::Factory,
697 )
698 }
699
700 /// Creates a new client from the provided stub.
701 ///
702 /// The most common case for calling this function is in tests mocking the
703 /// client's behavior.
704 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
705 where
706 T: super::stub::OrganizationAddressGroupService + 'static,
707 {
708 Self { inner: stub.into() }
709 }
710
711 pub(crate) async fn new(
712 config: gaxi::options::ClientConfig,
713 ) -> crate::ClientBuilderResult<Self> {
714 let inner = Self::build_inner(config).await?;
715 Ok(Self { inner })
716 }
717
718 async fn build_inner(
719 conf: gaxi::options::ClientConfig,
720 ) -> crate::ClientBuilderResult<
721 std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
722 > {
723 if gaxi::options::tracing_enabled(&conf) {
724 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
725 }
726 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
727 }
728
729 async fn build_transport(
730 conf: gaxi::options::ClientConfig,
731 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationAddressGroupService> {
732 super::transport::OrganizationAddressGroupService::new(conf).await
733 }
734
735 async fn build_with_tracing(
736 conf: gaxi::options::ClientConfig,
737 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationAddressGroupService> {
738 Self::build_transport(conf)
739 .await
740 .map(super::tracing::OrganizationAddressGroupService::new)
741 }
742
743 /// Lists address groups in a given project and location.
744 ///
745 /// # Example
746 /// ```
747 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
748 /// use google_cloud_gax::paginator::ItemPaginator as _;
749 /// use google_cloud_networksecurity_v1::Result;
750 /// async fn sample(
751 /// client: &OrganizationAddressGroupService, parent: &str
752 /// ) -> Result<()> {
753 /// let mut list = client.list_address_groups()
754 /// .set_parent(parent)
755 /// .by_item();
756 /// while let Some(item) = list.next().await.transpose()? {
757 /// println!("{:?}", item);
758 /// }
759 /// Ok(())
760 /// }
761 /// ```
762 pub fn list_address_groups(
763 &self,
764 ) -> super::builder::organization_address_group_service::ListAddressGroups {
765 super::builder::organization_address_group_service::ListAddressGroups::new(
766 self.inner.clone(),
767 )
768 }
769
770 /// Gets details of a single address group.
771 ///
772 /// # Example
773 /// ```
774 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
775 /// use google_cloud_networksecurity_v1::Result;
776 /// async fn sample(
777 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
778 /// ) -> Result<()> {
779 /// let response = client.get_address_group()
780 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
781 /// .send().await?;
782 /// println!("response {:?}", response);
783 /// Ok(())
784 /// }
785 /// ```
786 pub fn get_address_group(
787 &self,
788 ) -> super::builder::organization_address_group_service::GetAddressGroup {
789 super::builder::organization_address_group_service::GetAddressGroup::new(self.inner.clone())
790 }
791
792 /// Creates a new address group in a given project and location.
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 ///
804 /// # Example
805 /// ```
806 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
807 /// use google_cloud_lro::Poller;
808 /// use google_cloud_networksecurity_v1::model::AddressGroup;
809 /// use google_cloud_networksecurity_v1::Result;
810 /// async fn sample(
811 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str
812 /// ) -> Result<()> {
813 /// let response = client.create_address_group()
814 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
815 /// .set_address_group(
816 /// AddressGroup::new()/* set fields */
817 /// )
818 /// .poller().until_done().await?;
819 /// println!("response {:?}", response);
820 /// Ok(())
821 /// }
822 /// ```
823 pub fn create_address_group(
824 &self,
825 ) -> super::builder::organization_address_group_service::CreateAddressGroup {
826 super::builder::organization_address_group_service::CreateAddressGroup::new(
827 self.inner.clone(),
828 )
829 }
830
831 /// Updates parameters of an address group.
832 ///
833 /// # Long running operations
834 ///
835 /// This method is used to start, and/or poll a [long-running Operation].
836 /// The [Working with long-running operations] chapter in the [user guide]
837 /// covers these operations in detail.
838 ///
839 /// [long-running operation]: https://google.aip.dev/151
840 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
841 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
842 ///
843 /// # Example
844 /// ```
845 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
846 /// use google_cloud_lro::Poller;
847 /// # extern crate wkt as google_cloud_wkt;
848 /// use google_cloud_wkt::FieldMask;
849 /// use google_cloud_networksecurity_v1::model::AddressGroup;
850 /// use google_cloud_networksecurity_v1::Result;
851 /// async fn sample(
852 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
853 /// ) -> Result<()> {
854 /// let response = client.update_address_group()
855 /// .set_address_group(
856 /// AddressGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))/* set fields */
857 /// )
858 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
859 /// .poller().until_done().await?;
860 /// println!("response {:?}", response);
861 /// Ok(())
862 /// }
863 /// ```
864 pub fn update_address_group(
865 &self,
866 ) -> super::builder::organization_address_group_service::UpdateAddressGroup {
867 super::builder::organization_address_group_service::UpdateAddressGroup::new(
868 self.inner.clone(),
869 )
870 }
871
872 /// Adds items to an address group.
873 ///
874 /// # Long running operations
875 ///
876 /// This method is used to start, and/or poll a [long-running Operation].
877 /// The [Working with long-running operations] chapter in the [user guide]
878 /// covers these operations in detail.
879 ///
880 /// [long-running operation]: https://google.aip.dev/151
881 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
882 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
883 ///
884 /// # Example
885 /// ```
886 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
887 /// use google_cloud_lro::Poller;
888 /// use google_cloud_networksecurity_v1::Result;
889 /// async fn sample(
890 /// client: &OrganizationAddressGroupService
891 /// ) -> Result<()> {
892 /// let response = client.add_address_group_items()
893 /// /* set fields */
894 /// .poller().until_done().await?;
895 /// println!("response {:?}", response);
896 /// Ok(())
897 /// }
898 /// ```
899 pub fn add_address_group_items(
900 &self,
901 ) -> super::builder::organization_address_group_service::AddAddressGroupItems {
902 super::builder::organization_address_group_service::AddAddressGroupItems::new(
903 self.inner.clone(),
904 )
905 }
906
907 /// Removes items from an address group.
908 ///
909 /// # Long running operations
910 ///
911 /// This method is used to start, and/or poll a [long-running Operation].
912 /// The [Working with long-running operations] chapter in the [user guide]
913 /// covers these operations in detail.
914 ///
915 /// [long-running operation]: https://google.aip.dev/151
916 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
917 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
918 ///
919 /// # Example
920 /// ```
921 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
922 /// use google_cloud_lro::Poller;
923 /// use google_cloud_networksecurity_v1::Result;
924 /// async fn sample(
925 /// client: &OrganizationAddressGroupService
926 /// ) -> Result<()> {
927 /// let response = client.remove_address_group_items()
928 /// /* set fields */
929 /// .poller().until_done().await?;
930 /// println!("response {:?}", response);
931 /// Ok(())
932 /// }
933 /// ```
934 pub fn remove_address_group_items(
935 &self,
936 ) -> super::builder::organization_address_group_service::RemoveAddressGroupItems {
937 super::builder::organization_address_group_service::RemoveAddressGroupItems::new(
938 self.inner.clone(),
939 )
940 }
941
942 /// Clones items from one address group to another.
943 ///
944 /// # Long running operations
945 ///
946 /// This method is used to start, and/or poll a [long-running Operation].
947 /// The [Working with long-running operations] chapter in the [user guide]
948 /// covers these operations in detail.
949 ///
950 /// [long-running operation]: https://google.aip.dev/151
951 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
952 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
953 ///
954 /// # Example
955 /// ```
956 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
957 /// use google_cloud_lro::Poller;
958 /// use google_cloud_networksecurity_v1::Result;
959 /// async fn sample(
960 /// client: &OrganizationAddressGroupService
961 /// ) -> Result<()> {
962 /// let response = client.clone_address_group_items()
963 /// /* set fields */
964 /// .poller().until_done().await?;
965 /// println!("response {:?}", response);
966 /// Ok(())
967 /// }
968 /// ```
969 pub fn clone_address_group_items(
970 &self,
971 ) -> super::builder::organization_address_group_service::CloneAddressGroupItems {
972 super::builder::organization_address_group_service::CloneAddressGroupItems::new(
973 self.inner.clone(),
974 )
975 }
976
977 /// Deletes an address group.
978 ///
979 /// # Long running operations
980 ///
981 /// This method is used to start, and/or poll a [long-running Operation].
982 /// The [Working with long-running operations] chapter in the [user guide]
983 /// covers these operations in detail.
984 ///
985 /// [long-running operation]: https://google.aip.dev/151
986 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
987 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
988 ///
989 /// # Example
990 /// ```
991 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
992 /// use google_cloud_lro::Poller;
993 /// use google_cloud_networksecurity_v1::Result;
994 /// async fn sample(
995 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
996 /// ) -> Result<()> {
997 /// client.delete_address_group()
998 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
999 /// .poller().until_done().await?;
1000 /// Ok(())
1001 /// }
1002 /// ```
1003 pub fn delete_address_group(
1004 &self,
1005 ) -> super::builder::organization_address_group_service::DeleteAddressGroup {
1006 super::builder::organization_address_group_service::DeleteAddressGroup::new(
1007 self.inner.clone(),
1008 )
1009 }
1010
1011 /// Lists references of an address group.
1012 ///
1013 /// # Example
1014 /// ```
1015 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1016 /// use google_cloud_gax::paginator::ItemPaginator as _;
1017 /// use google_cloud_networksecurity_v1::Result;
1018 /// async fn sample(
1019 /// client: &OrganizationAddressGroupService
1020 /// ) -> Result<()> {
1021 /// let mut list = client.list_address_group_references()
1022 /// /* set fields */
1023 /// .by_item();
1024 /// while let Some(item) = list.next().await.transpose()? {
1025 /// println!("{:?}", item);
1026 /// }
1027 /// Ok(())
1028 /// }
1029 /// ```
1030 pub fn list_address_group_references(
1031 &self,
1032 ) -> super::builder::organization_address_group_service::ListAddressGroupReferences {
1033 super::builder::organization_address_group_service::ListAddressGroupReferences::new(
1034 self.inner.clone(),
1035 )
1036 }
1037
1038 /// Lists information about the supported locations for this service.
1039 ///
1040 /// This method lists locations based on the resource scope provided in
1041 /// the [ListLocationsRequest.name] field:
1042 ///
1043 /// * **Global locations**: If `name` is empty, the method lists the
1044 /// public locations available to all projects. * **Project-specific
1045 /// locations**: If `name` follows the format
1046 /// `projects/{project}`, the method lists locations visible to that
1047 /// specific project. This includes public, private, or other
1048 /// project-specific locations enabled for the project.
1049 ///
1050 /// For gRPC and client library implementations, the resource name is
1051 /// passed as the `name` field. For direct service calls, the resource
1052 /// name is
1053 /// incorporated into the request path based on the specific service
1054 /// implementation and version.
1055 ///
1056 /// # Example
1057 /// ```
1058 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1059 /// use google_cloud_gax::paginator::ItemPaginator as _;
1060 /// use google_cloud_networksecurity_v1::Result;
1061 /// async fn sample(
1062 /// client: &OrganizationAddressGroupService
1063 /// ) -> Result<()> {
1064 /// let mut list = client.list_locations()
1065 /// /* set fields */
1066 /// .by_item();
1067 /// while let Some(item) = list.next().await.transpose()? {
1068 /// println!("{:?}", item);
1069 /// }
1070 /// Ok(())
1071 /// }
1072 /// ```
1073 pub fn list_locations(
1074 &self,
1075 ) -> super::builder::organization_address_group_service::ListLocations {
1076 super::builder::organization_address_group_service::ListLocations::new(self.inner.clone())
1077 }
1078
1079 /// Gets information about a location.
1080 ///
1081 /// # Example
1082 /// ```
1083 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1084 /// use google_cloud_networksecurity_v1::Result;
1085 /// async fn sample(
1086 /// client: &OrganizationAddressGroupService
1087 /// ) -> Result<()> {
1088 /// let response = client.get_location()
1089 /// /* set fields */
1090 /// .send().await?;
1091 /// println!("response {:?}", response);
1092 /// Ok(())
1093 /// }
1094 /// ```
1095 pub fn get_location(&self) -> super::builder::organization_address_group_service::GetLocation {
1096 super::builder::organization_address_group_service::GetLocation::new(self.inner.clone())
1097 }
1098
1099 /// Sets the access control policy on the specified resource. Replaces
1100 /// any existing policy.
1101 ///
1102 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1103 /// errors.
1104 ///
1105 /// # Example
1106 /// ```
1107 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1108 /// use google_cloud_networksecurity_v1::Result;
1109 /// async fn sample(
1110 /// client: &OrganizationAddressGroupService
1111 /// ) -> Result<()> {
1112 /// let response = client.set_iam_policy()
1113 /// /* set fields */
1114 /// .send().await?;
1115 /// println!("response {:?}", response);
1116 /// Ok(())
1117 /// }
1118 /// ```
1119 pub fn set_iam_policy(
1120 &self,
1121 ) -> super::builder::organization_address_group_service::SetIamPolicy {
1122 super::builder::organization_address_group_service::SetIamPolicy::new(self.inner.clone())
1123 }
1124
1125 /// Gets the access control policy for a resource. Returns an empty policy
1126 /// if the resource exists and does not have a policy set.
1127 ///
1128 /// # Example
1129 /// ```
1130 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1131 /// use google_cloud_networksecurity_v1::Result;
1132 /// async fn sample(
1133 /// client: &OrganizationAddressGroupService
1134 /// ) -> Result<()> {
1135 /// let response = client.get_iam_policy()
1136 /// /* set fields */
1137 /// .send().await?;
1138 /// println!("response {:?}", response);
1139 /// Ok(())
1140 /// }
1141 /// ```
1142 pub fn get_iam_policy(
1143 &self,
1144 ) -> super::builder::organization_address_group_service::GetIamPolicy {
1145 super::builder::organization_address_group_service::GetIamPolicy::new(self.inner.clone())
1146 }
1147
1148 /// Returns permissions that a caller has on the specified resource. If the
1149 /// resource does not exist, this will return an empty set of
1150 /// permissions, not a `NOT_FOUND` error.
1151 ///
1152 /// Note: This operation is designed to be used for building
1153 /// permission-aware UIs and command-line tools, not for authorization
1154 /// checking. This operation may "fail open" without warning.
1155 ///
1156 /// # Example
1157 /// ```
1158 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1159 /// use google_cloud_networksecurity_v1::Result;
1160 /// async fn sample(
1161 /// client: &OrganizationAddressGroupService
1162 /// ) -> Result<()> {
1163 /// let response = client.test_iam_permissions()
1164 /// /* set fields */
1165 /// .send().await?;
1166 /// println!("response {:?}", response);
1167 /// Ok(())
1168 /// }
1169 /// ```
1170 pub fn test_iam_permissions(
1171 &self,
1172 ) -> super::builder::organization_address_group_service::TestIamPermissions {
1173 super::builder::organization_address_group_service::TestIamPermissions::new(
1174 self.inner.clone(),
1175 )
1176 }
1177
1178 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1179 ///
1180 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1181 ///
1182 /// # Example
1183 /// ```
1184 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1185 /// use google_cloud_gax::paginator::ItemPaginator as _;
1186 /// use google_cloud_networksecurity_v1::Result;
1187 /// async fn sample(
1188 /// client: &OrganizationAddressGroupService
1189 /// ) -> Result<()> {
1190 /// let mut list = client.list_operations()
1191 /// /* set fields */
1192 /// .by_item();
1193 /// while let Some(item) = list.next().await.transpose()? {
1194 /// println!("{:?}", item);
1195 /// }
1196 /// Ok(())
1197 /// }
1198 /// ```
1199 pub fn list_operations(
1200 &self,
1201 ) -> super::builder::organization_address_group_service::ListOperations {
1202 super::builder::organization_address_group_service::ListOperations::new(self.inner.clone())
1203 }
1204
1205 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1206 ///
1207 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1208 ///
1209 /// # Example
1210 /// ```
1211 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1212 /// use google_cloud_networksecurity_v1::Result;
1213 /// async fn sample(
1214 /// client: &OrganizationAddressGroupService
1215 /// ) -> Result<()> {
1216 /// let response = client.get_operation()
1217 /// /* set fields */
1218 /// .send().await?;
1219 /// println!("response {:?}", response);
1220 /// Ok(())
1221 /// }
1222 /// ```
1223 pub fn get_operation(
1224 &self,
1225 ) -> super::builder::organization_address_group_service::GetOperation {
1226 super::builder::organization_address_group_service::GetOperation::new(self.inner.clone())
1227 }
1228
1229 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1230 ///
1231 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1232 ///
1233 /// # Example
1234 /// ```
1235 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1236 /// use google_cloud_networksecurity_v1::Result;
1237 /// async fn sample(
1238 /// client: &OrganizationAddressGroupService
1239 /// ) -> Result<()> {
1240 /// client.delete_operation()
1241 /// /* set fields */
1242 /// .send().await?;
1243 /// Ok(())
1244 /// }
1245 /// ```
1246 pub fn delete_operation(
1247 &self,
1248 ) -> super::builder::organization_address_group_service::DeleteOperation {
1249 super::builder::organization_address_group_service::DeleteOperation::new(self.inner.clone())
1250 }
1251
1252 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1253 ///
1254 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1255 ///
1256 /// # Example
1257 /// ```
1258 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1259 /// use google_cloud_networksecurity_v1::Result;
1260 /// async fn sample(
1261 /// client: &OrganizationAddressGroupService
1262 /// ) -> Result<()> {
1263 /// client.cancel_operation()
1264 /// /* set fields */
1265 /// .send().await?;
1266 /// Ok(())
1267 /// }
1268 /// ```
1269 pub fn cancel_operation(
1270 &self,
1271 ) -> super::builder::organization_address_group_service::CancelOperation {
1272 super::builder::organization_address_group_service::CancelOperation::new(self.inner.clone())
1273 }
1274}
1275
1276/// Implements a client for the Network Security API.
1277///
1278/// # Example
1279/// ```
1280/// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1281/// use google_cloud_gax::paginator::ItemPaginator as _;
1282/// async fn sample(
1283/// project_id: &str,
1284/// location_id: &str,
1285/// ) -> anyhow::Result<()> {
1286/// let client = DnsThreatDetectorService::builder().build().await?;
1287/// let mut list = client.list_dns_threat_detectors()
1288/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1289/// .by_item();
1290/// while let Some(item) = list.next().await.transpose()? {
1291/// println!("{:?}", item);
1292/// }
1293/// Ok(())
1294/// }
1295/// ```
1296///
1297/// # Service Description
1298///
1299/// The Network Security API for DNS Threat Detectors.
1300///
1301/// # Configuration
1302///
1303/// To configure `DnsThreatDetectorService` use the `with_*` methods in the type returned
1304/// by [builder()][DnsThreatDetectorService::builder]. The default configuration should
1305/// work for most applications. Common configuration changes include
1306///
1307/// * [with_endpoint()]: by default this client uses the global default endpoint
1308/// (`https://networksecurity.googleapis.com`). Applications using regional
1309/// endpoints or running in restricted networks (e.g. a network configured
1310// with [Private Google Access with VPC Service Controls]) may want to
1311/// override this default.
1312/// * [with_credentials()]: by default this client uses
1313/// [Application Default Credentials]. Applications using custom
1314/// authentication may need to override this default.
1315///
1316/// [with_endpoint()]: super::builder::dns_threat_detector_service::ClientBuilder::with_endpoint
1317/// [with_credentials()]: super::builder::dns_threat_detector_service::ClientBuilder::with_credentials
1318/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1319/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1320///
1321/// # Pooling and Cloning
1322///
1323/// `DnsThreatDetectorService` holds a connection pool internally, it is advised to
1324/// create one and reuse it. You do not need to wrap `DnsThreatDetectorService` in
1325/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1326/// already uses an `Arc` internally.
1327#[derive(Clone, Debug)]
1328pub struct DnsThreatDetectorService {
1329 inner: std::sync::Arc<dyn super::stub::dynamic::DnsThreatDetectorService>,
1330}
1331
1332impl DnsThreatDetectorService {
1333 /// Returns a builder for [DnsThreatDetectorService].
1334 ///
1335 /// ```
1336 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1337 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1338 /// let client = DnsThreatDetectorService::builder().build().await?;
1339 /// # Ok(()) }
1340 /// ```
1341 pub fn builder() -> super::builder::dns_threat_detector_service::ClientBuilder {
1342 crate::new_client_builder(super::builder::dns_threat_detector_service::client::Factory)
1343 }
1344
1345 /// Creates a new client from the provided stub.
1346 ///
1347 /// The most common case for calling this function is in tests mocking the
1348 /// client's behavior.
1349 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1350 where
1351 T: super::stub::DnsThreatDetectorService + 'static,
1352 {
1353 Self { inner: stub.into() }
1354 }
1355
1356 pub(crate) async fn new(
1357 config: gaxi::options::ClientConfig,
1358 ) -> crate::ClientBuilderResult<Self> {
1359 let inner = Self::build_inner(config).await?;
1360 Ok(Self { inner })
1361 }
1362
1363 async fn build_inner(
1364 conf: gaxi::options::ClientConfig,
1365 ) -> crate::ClientBuilderResult<
1366 std::sync::Arc<dyn super::stub::dynamic::DnsThreatDetectorService>,
1367 > {
1368 if gaxi::options::tracing_enabled(&conf) {
1369 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1370 }
1371 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1372 }
1373
1374 async fn build_transport(
1375 conf: gaxi::options::ClientConfig,
1376 ) -> crate::ClientBuilderResult<impl super::stub::DnsThreatDetectorService> {
1377 super::transport::DnsThreatDetectorService::new(conf).await
1378 }
1379
1380 async fn build_with_tracing(
1381 conf: gaxi::options::ClientConfig,
1382 ) -> crate::ClientBuilderResult<impl super::stub::DnsThreatDetectorService> {
1383 Self::build_transport(conf)
1384 .await
1385 .map(super::tracing::DnsThreatDetectorService::new)
1386 }
1387
1388 /// Lists DnsThreatDetectors in a given project and location.
1389 ///
1390 /// # Example
1391 /// ```
1392 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1393 /// use google_cloud_gax::paginator::ItemPaginator as _;
1394 /// use google_cloud_networksecurity_v1::Result;
1395 /// async fn sample(
1396 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str
1397 /// ) -> Result<()> {
1398 /// let mut list = client.list_dns_threat_detectors()
1399 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1400 /// .by_item();
1401 /// while let Some(item) = list.next().await.transpose()? {
1402 /// println!("{:?}", item);
1403 /// }
1404 /// Ok(())
1405 /// }
1406 /// ```
1407 pub fn list_dns_threat_detectors(
1408 &self,
1409 ) -> super::builder::dns_threat_detector_service::ListDnsThreatDetectors {
1410 super::builder::dns_threat_detector_service::ListDnsThreatDetectors::new(self.inner.clone())
1411 }
1412
1413 /// Gets the details of a single DnsThreatDetector.
1414 ///
1415 /// # Example
1416 /// ```
1417 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1418 /// use google_cloud_networksecurity_v1::Result;
1419 /// async fn sample(
1420 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str, dns_threat_detector_id: &str
1421 /// ) -> Result<()> {
1422 /// let response = client.get_dns_threat_detector()
1423 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dnsThreatDetectors/{dns_threat_detector_id}"))
1424 /// .send().await?;
1425 /// println!("response {:?}", response);
1426 /// Ok(())
1427 /// }
1428 /// ```
1429 pub fn get_dns_threat_detector(
1430 &self,
1431 ) -> super::builder::dns_threat_detector_service::GetDnsThreatDetector {
1432 super::builder::dns_threat_detector_service::GetDnsThreatDetector::new(self.inner.clone())
1433 }
1434
1435 /// Creates a new DnsThreatDetector in a given project and location.
1436 ///
1437 /// # Example
1438 /// ```
1439 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1440 /// use google_cloud_networksecurity_v1::model::DnsThreatDetector;
1441 /// use google_cloud_networksecurity_v1::Result;
1442 /// async fn sample(
1443 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str
1444 /// ) -> Result<()> {
1445 /// let response = client.create_dns_threat_detector()
1446 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1447 /// .set_dns_threat_detector(
1448 /// DnsThreatDetector::new()/* set fields */
1449 /// )
1450 /// .send().await?;
1451 /// println!("response {:?}", response);
1452 /// Ok(())
1453 /// }
1454 /// ```
1455 pub fn create_dns_threat_detector(
1456 &self,
1457 ) -> super::builder::dns_threat_detector_service::CreateDnsThreatDetector {
1458 super::builder::dns_threat_detector_service::CreateDnsThreatDetector::new(
1459 self.inner.clone(),
1460 )
1461 }
1462
1463 /// Updates a single DnsThreatDetector.
1464 ///
1465 /// # Example
1466 /// ```
1467 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1468 /// # extern crate wkt as google_cloud_wkt;
1469 /// use google_cloud_wkt::FieldMask;
1470 /// use google_cloud_networksecurity_v1::model::DnsThreatDetector;
1471 /// use google_cloud_networksecurity_v1::Result;
1472 /// async fn sample(
1473 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str, dns_threat_detector_id: &str
1474 /// ) -> Result<()> {
1475 /// let response = client.update_dns_threat_detector()
1476 /// .set_dns_threat_detector(
1477 /// DnsThreatDetector::new().set_name(format!("projects/{project_id}/locations/{location_id}/dnsThreatDetectors/{dns_threat_detector_id}"))/* set fields */
1478 /// )
1479 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1480 /// .send().await?;
1481 /// println!("response {:?}", response);
1482 /// Ok(())
1483 /// }
1484 /// ```
1485 pub fn update_dns_threat_detector(
1486 &self,
1487 ) -> super::builder::dns_threat_detector_service::UpdateDnsThreatDetector {
1488 super::builder::dns_threat_detector_service::UpdateDnsThreatDetector::new(
1489 self.inner.clone(),
1490 )
1491 }
1492
1493 /// Deletes a single DnsThreatDetector.
1494 ///
1495 /// # Example
1496 /// ```
1497 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1498 /// use google_cloud_networksecurity_v1::Result;
1499 /// async fn sample(
1500 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str, dns_threat_detector_id: &str
1501 /// ) -> Result<()> {
1502 /// client.delete_dns_threat_detector()
1503 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dnsThreatDetectors/{dns_threat_detector_id}"))
1504 /// .send().await?;
1505 /// Ok(())
1506 /// }
1507 /// ```
1508 pub fn delete_dns_threat_detector(
1509 &self,
1510 ) -> super::builder::dns_threat_detector_service::DeleteDnsThreatDetector {
1511 super::builder::dns_threat_detector_service::DeleteDnsThreatDetector::new(
1512 self.inner.clone(),
1513 )
1514 }
1515
1516 /// Lists information about the supported locations for this service.
1517 ///
1518 /// This method lists locations based on the resource scope provided in
1519 /// the [ListLocationsRequest.name] field:
1520 ///
1521 /// * **Global locations**: If `name` is empty, the method lists the
1522 /// public locations available to all projects. * **Project-specific
1523 /// locations**: If `name` follows the format
1524 /// `projects/{project}`, the method lists locations visible to that
1525 /// specific project. This includes public, private, or other
1526 /// project-specific locations enabled for the project.
1527 ///
1528 /// For gRPC and client library implementations, the resource name is
1529 /// passed as the `name` field. For direct service calls, the resource
1530 /// name is
1531 /// incorporated into the request path based on the specific service
1532 /// implementation and version.
1533 ///
1534 /// # Example
1535 /// ```
1536 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1537 /// use google_cloud_gax::paginator::ItemPaginator as _;
1538 /// use google_cloud_networksecurity_v1::Result;
1539 /// async fn sample(
1540 /// client: &DnsThreatDetectorService
1541 /// ) -> Result<()> {
1542 /// let mut list = client.list_locations()
1543 /// /* set fields */
1544 /// .by_item();
1545 /// while let Some(item) = list.next().await.transpose()? {
1546 /// println!("{:?}", item);
1547 /// }
1548 /// Ok(())
1549 /// }
1550 /// ```
1551 pub fn list_locations(&self) -> super::builder::dns_threat_detector_service::ListLocations {
1552 super::builder::dns_threat_detector_service::ListLocations::new(self.inner.clone())
1553 }
1554
1555 /// Gets information about a location.
1556 ///
1557 /// # Example
1558 /// ```
1559 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1560 /// use google_cloud_networksecurity_v1::Result;
1561 /// async fn sample(
1562 /// client: &DnsThreatDetectorService
1563 /// ) -> Result<()> {
1564 /// let response = client.get_location()
1565 /// /* set fields */
1566 /// .send().await?;
1567 /// println!("response {:?}", response);
1568 /// Ok(())
1569 /// }
1570 /// ```
1571 pub fn get_location(&self) -> super::builder::dns_threat_detector_service::GetLocation {
1572 super::builder::dns_threat_detector_service::GetLocation::new(self.inner.clone())
1573 }
1574
1575 /// Sets the access control policy on the specified resource. Replaces
1576 /// any existing policy.
1577 ///
1578 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1579 /// errors.
1580 ///
1581 /// # Example
1582 /// ```
1583 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1584 /// use google_cloud_networksecurity_v1::Result;
1585 /// async fn sample(
1586 /// client: &DnsThreatDetectorService
1587 /// ) -> Result<()> {
1588 /// let response = client.set_iam_policy()
1589 /// /* set fields */
1590 /// .send().await?;
1591 /// println!("response {:?}", response);
1592 /// Ok(())
1593 /// }
1594 /// ```
1595 pub fn set_iam_policy(&self) -> super::builder::dns_threat_detector_service::SetIamPolicy {
1596 super::builder::dns_threat_detector_service::SetIamPolicy::new(self.inner.clone())
1597 }
1598
1599 /// Gets the access control policy for a resource. Returns an empty policy
1600 /// if the resource exists and does not have a policy set.
1601 ///
1602 /// # Example
1603 /// ```
1604 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1605 /// use google_cloud_networksecurity_v1::Result;
1606 /// async fn sample(
1607 /// client: &DnsThreatDetectorService
1608 /// ) -> Result<()> {
1609 /// let response = client.get_iam_policy()
1610 /// /* set fields */
1611 /// .send().await?;
1612 /// println!("response {:?}", response);
1613 /// Ok(())
1614 /// }
1615 /// ```
1616 pub fn get_iam_policy(&self) -> super::builder::dns_threat_detector_service::GetIamPolicy {
1617 super::builder::dns_threat_detector_service::GetIamPolicy::new(self.inner.clone())
1618 }
1619
1620 /// Returns permissions that a caller has on the specified resource. If the
1621 /// resource does not exist, this will return an empty set of
1622 /// permissions, not a `NOT_FOUND` error.
1623 ///
1624 /// Note: This operation is designed to be used for building
1625 /// permission-aware UIs and command-line tools, not for authorization
1626 /// checking. This operation may "fail open" without warning.
1627 ///
1628 /// # Example
1629 /// ```
1630 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1631 /// use google_cloud_networksecurity_v1::Result;
1632 /// async fn sample(
1633 /// client: &DnsThreatDetectorService
1634 /// ) -> Result<()> {
1635 /// let response = client.test_iam_permissions()
1636 /// /* set fields */
1637 /// .send().await?;
1638 /// println!("response {:?}", response);
1639 /// Ok(())
1640 /// }
1641 /// ```
1642 pub fn test_iam_permissions(
1643 &self,
1644 ) -> super::builder::dns_threat_detector_service::TestIamPermissions {
1645 super::builder::dns_threat_detector_service::TestIamPermissions::new(self.inner.clone())
1646 }
1647
1648 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1649 ///
1650 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1651 ///
1652 /// # Example
1653 /// ```
1654 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1655 /// use google_cloud_gax::paginator::ItemPaginator as _;
1656 /// use google_cloud_networksecurity_v1::Result;
1657 /// async fn sample(
1658 /// client: &DnsThreatDetectorService
1659 /// ) -> Result<()> {
1660 /// let mut list = client.list_operations()
1661 /// /* set fields */
1662 /// .by_item();
1663 /// while let Some(item) = list.next().await.transpose()? {
1664 /// println!("{:?}", item);
1665 /// }
1666 /// Ok(())
1667 /// }
1668 /// ```
1669 pub fn list_operations(&self) -> super::builder::dns_threat_detector_service::ListOperations {
1670 super::builder::dns_threat_detector_service::ListOperations::new(self.inner.clone())
1671 }
1672
1673 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1674 ///
1675 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1676 ///
1677 /// # Example
1678 /// ```
1679 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1680 /// use google_cloud_networksecurity_v1::Result;
1681 /// async fn sample(
1682 /// client: &DnsThreatDetectorService
1683 /// ) -> Result<()> {
1684 /// let response = client.get_operation()
1685 /// /* set fields */
1686 /// .send().await?;
1687 /// println!("response {:?}", response);
1688 /// Ok(())
1689 /// }
1690 /// ```
1691 pub fn get_operation(&self) -> super::builder::dns_threat_detector_service::GetOperation {
1692 super::builder::dns_threat_detector_service::GetOperation::new(self.inner.clone())
1693 }
1694
1695 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1696 ///
1697 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1698 ///
1699 /// # Example
1700 /// ```
1701 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1702 /// use google_cloud_networksecurity_v1::Result;
1703 /// async fn sample(
1704 /// client: &DnsThreatDetectorService
1705 /// ) -> Result<()> {
1706 /// client.delete_operation()
1707 /// /* set fields */
1708 /// .send().await?;
1709 /// Ok(())
1710 /// }
1711 /// ```
1712 pub fn delete_operation(&self) -> super::builder::dns_threat_detector_service::DeleteOperation {
1713 super::builder::dns_threat_detector_service::DeleteOperation::new(self.inner.clone())
1714 }
1715
1716 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1717 ///
1718 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1719 ///
1720 /// # Example
1721 /// ```
1722 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1723 /// use google_cloud_networksecurity_v1::Result;
1724 /// async fn sample(
1725 /// client: &DnsThreatDetectorService
1726 /// ) -> Result<()> {
1727 /// client.cancel_operation()
1728 /// /* set fields */
1729 /// .send().await?;
1730 /// Ok(())
1731 /// }
1732 /// ```
1733 pub fn cancel_operation(&self) -> super::builder::dns_threat_detector_service::CancelOperation {
1734 super::builder::dns_threat_detector_service::CancelOperation::new(self.inner.clone())
1735 }
1736}
1737
1738/// Implements a client for the Network Security API.
1739///
1740/// # Example
1741/// ```
1742/// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1743/// use google_cloud_gax::paginator::ItemPaginator as _;
1744/// async fn sample(
1745/// organization_id: &str,
1746/// location_id: &str,
1747/// ) -> anyhow::Result<()> {
1748/// let client = FirewallActivation::builder().build().await?;
1749/// let mut list = client.list_firewall_endpoints()
1750/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1751/// .by_item();
1752/// while let Some(item) = list.next().await.transpose()? {
1753/// println!("{:?}", item);
1754/// }
1755/// Ok(())
1756/// }
1757/// ```
1758///
1759/// # Service Description
1760///
1761/// Service for managing Firewall Endpoints and Associations.
1762///
1763/// # Configuration
1764///
1765/// To configure `FirewallActivation` use the `with_*` methods in the type returned
1766/// by [builder()][FirewallActivation::builder]. The default configuration should
1767/// work for most applications. Common configuration changes include
1768///
1769/// * [with_endpoint()]: by default this client uses the global default endpoint
1770/// (`https://networksecurity.googleapis.com`). Applications using regional
1771/// endpoints or running in restricted networks (e.g. a network configured
1772// with [Private Google Access with VPC Service Controls]) may want to
1773/// override this default.
1774/// * [with_credentials()]: by default this client uses
1775/// [Application Default Credentials]. Applications using custom
1776/// authentication may need to override this default.
1777///
1778/// [with_endpoint()]: super::builder::firewall_activation::ClientBuilder::with_endpoint
1779/// [with_credentials()]: super::builder::firewall_activation::ClientBuilder::with_credentials
1780/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1781/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1782///
1783/// # Pooling and Cloning
1784///
1785/// `FirewallActivation` holds a connection pool internally, it is advised to
1786/// create one and reuse it. You do not need to wrap `FirewallActivation` in
1787/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1788/// already uses an `Arc` internally.
1789#[derive(Clone, Debug)]
1790pub struct FirewallActivation {
1791 inner: std::sync::Arc<dyn super::stub::dynamic::FirewallActivation>,
1792}
1793
1794impl FirewallActivation {
1795 /// Returns a builder for [FirewallActivation].
1796 ///
1797 /// ```
1798 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1799 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1800 /// let client = FirewallActivation::builder().build().await?;
1801 /// # Ok(()) }
1802 /// ```
1803 pub fn builder() -> super::builder::firewall_activation::ClientBuilder {
1804 crate::new_client_builder(super::builder::firewall_activation::client::Factory)
1805 }
1806
1807 /// Creates a new client from the provided stub.
1808 ///
1809 /// The most common case for calling this function is in tests mocking the
1810 /// client's behavior.
1811 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1812 where
1813 T: super::stub::FirewallActivation + 'static,
1814 {
1815 Self { inner: stub.into() }
1816 }
1817
1818 pub(crate) async fn new(
1819 config: gaxi::options::ClientConfig,
1820 ) -> crate::ClientBuilderResult<Self> {
1821 let inner = Self::build_inner(config).await?;
1822 Ok(Self { inner })
1823 }
1824
1825 async fn build_inner(
1826 conf: gaxi::options::ClientConfig,
1827 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FirewallActivation>>
1828 {
1829 if gaxi::options::tracing_enabled(&conf) {
1830 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1831 }
1832 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1833 }
1834
1835 async fn build_transport(
1836 conf: gaxi::options::ClientConfig,
1837 ) -> crate::ClientBuilderResult<impl super::stub::FirewallActivation> {
1838 super::transport::FirewallActivation::new(conf).await
1839 }
1840
1841 async fn build_with_tracing(
1842 conf: gaxi::options::ClientConfig,
1843 ) -> crate::ClientBuilderResult<impl super::stub::FirewallActivation> {
1844 Self::build_transport(conf)
1845 .await
1846 .map(super::tracing::FirewallActivation::new)
1847 }
1848
1849 /// Lists FirewallEndpoints in a given organization and location.
1850 ///
1851 /// # Example
1852 /// ```
1853 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1854 /// use google_cloud_gax::paginator::ItemPaginator as _;
1855 /// use google_cloud_networksecurity_v1::Result;
1856 /// async fn sample(
1857 /// client: &FirewallActivation, organization_id: &str, location_id: &str
1858 /// ) -> Result<()> {
1859 /// let mut list = client.list_firewall_endpoints()
1860 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1861 /// .by_item();
1862 /// while let Some(item) = list.next().await.transpose()? {
1863 /// println!("{:?}", item);
1864 /// }
1865 /// Ok(())
1866 /// }
1867 /// ```
1868 pub fn list_firewall_endpoints(
1869 &self,
1870 ) -> super::builder::firewall_activation::ListFirewallEndpoints {
1871 super::builder::firewall_activation::ListFirewallEndpoints::new(self.inner.clone())
1872 }
1873
1874 /// Gets details of a single org Endpoint.
1875 ///
1876 /// # Example
1877 /// ```
1878 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1879 /// use google_cloud_networksecurity_v1::Result;
1880 /// async fn sample(
1881 /// client: &FirewallActivation, organization_id: &str, location_id: &str, firewall_endpoint_id: &str
1882 /// ) -> Result<()> {
1883 /// let response = client.get_firewall_endpoint()
1884 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/firewallEndpoints/{firewall_endpoint_id}"))
1885 /// .send().await?;
1886 /// println!("response {:?}", response);
1887 /// Ok(())
1888 /// }
1889 /// ```
1890 pub fn get_firewall_endpoint(
1891 &self,
1892 ) -> super::builder::firewall_activation::GetFirewallEndpoint {
1893 super::builder::firewall_activation::GetFirewallEndpoint::new(self.inner.clone())
1894 }
1895
1896 /// Creates a new FirewallEndpoint in a given organization and location.
1897 ///
1898 /// # Long running operations
1899 ///
1900 /// This method is used to start, and/or poll a [long-running Operation].
1901 /// The [Working with long-running operations] chapter in the [user guide]
1902 /// covers these operations in detail.
1903 ///
1904 /// [long-running operation]: https://google.aip.dev/151
1905 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1906 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1907 ///
1908 /// # Example
1909 /// ```
1910 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1911 /// use google_cloud_lro::Poller;
1912 /// use google_cloud_networksecurity_v1::model::FirewallEndpoint;
1913 /// use google_cloud_networksecurity_v1::Result;
1914 /// async fn sample(
1915 /// client: &FirewallActivation, organization_id: &str, location_id: &str
1916 /// ) -> Result<()> {
1917 /// let response = client.create_firewall_endpoint()
1918 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1919 /// .set_firewall_endpoint(
1920 /// FirewallEndpoint::new()/* set fields */
1921 /// )
1922 /// .poller().until_done().await?;
1923 /// println!("response {:?}", response);
1924 /// Ok(())
1925 /// }
1926 /// ```
1927 pub fn create_firewall_endpoint(
1928 &self,
1929 ) -> super::builder::firewall_activation::CreateFirewallEndpoint {
1930 super::builder::firewall_activation::CreateFirewallEndpoint::new(self.inner.clone())
1931 }
1932
1933 /// Deletes a single org Endpoint.
1934 ///
1935 /// # Long running operations
1936 ///
1937 /// This method is used to start, and/or poll a [long-running Operation].
1938 /// The [Working with long-running operations] chapter in the [user guide]
1939 /// covers these operations in detail.
1940 ///
1941 /// [long-running operation]: https://google.aip.dev/151
1942 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1943 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1944 ///
1945 /// # Example
1946 /// ```
1947 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1948 /// use google_cloud_lro::Poller;
1949 /// use google_cloud_networksecurity_v1::Result;
1950 /// async fn sample(
1951 /// client: &FirewallActivation, organization_id: &str, location_id: &str, firewall_endpoint_id: &str
1952 /// ) -> Result<()> {
1953 /// client.delete_firewall_endpoint()
1954 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/firewallEndpoints/{firewall_endpoint_id}"))
1955 /// .poller().until_done().await?;
1956 /// Ok(())
1957 /// }
1958 /// ```
1959 pub fn delete_firewall_endpoint(
1960 &self,
1961 ) -> super::builder::firewall_activation::DeleteFirewallEndpoint {
1962 super::builder::firewall_activation::DeleteFirewallEndpoint::new(self.inner.clone())
1963 }
1964
1965 /// Update a single org Endpoint.
1966 ///
1967 /// # Long running operations
1968 ///
1969 /// This method is used to start, and/or poll a [long-running Operation].
1970 /// The [Working with long-running operations] chapter in the [user guide]
1971 /// covers these operations in detail.
1972 ///
1973 /// [long-running operation]: https://google.aip.dev/151
1974 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1975 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1976 ///
1977 /// # Example
1978 /// ```
1979 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1980 /// use google_cloud_lro::Poller;
1981 /// # extern crate wkt as google_cloud_wkt;
1982 /// use google_cloud_wkt::FieldMask;
1983 /// use google_cloud_networksecurity_v1::model::FirewallEndpoint;
1984 /// use google_cloud_networksecurity_v1::Result;
1985 /// async fn sample(
1986 /// client: &FirewallActivation, organization_id: &str, location_id: &str, firewall_endpoint_id: &str
1987 /// ) -> Result<()> {
1988 /// let response = client.update_firewall_endpoint()
1989 /// .set_firewall_endpoint(
1990 /// FirewallEndpoint::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/firewallEndpoints/{firewall_endpoint_id}"))/* set fields */
1991 /// )
1992 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1993 /// .poller().until_done().await?;
1994 /// println!("response {:?}", response);
1995 /// Ok(())
1996 /// }
1997 /// ```
1998 pub fn update_firewall_endpoint(
1999 &self,
2000 ) -> super::builder::firewall_activation::UpdateFirewallEndpoint {
2001 super::builder::firewall_activation::UpdateFirewallEndpoint::new(self.inner.clone())
2002 }
2003
2004 /// Lists Associations in a given project and location.
2005 ///
2006 /// # Example
2007 /// ```
2008 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2009 /// use google_cloud_gax::paginator::ItemPaginator as _;
2010 /// use google_cloud_networksecurity_v1::Result;
2011 /// async fn sample(
2012 /// client: &FirewallActivation, project_id: &str, location_id: &str
2013 /// ) -> Result<()> {
2014 /// let mut list = client.list_firewall_endpoint_associations()
2015 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2016 /// .by_item();
2017 /// while let Some(item) = list.next().await.transpose()? {
2018 /// println!("{:?}", item);
2019 /// }
2020 /// Ok(())
2021 /// }
2022 /// ```
2023 pub fn list_firewall_endpoint_associations(
2024 &self,
2025 ) -> super::builder::firewall_activation::ListFirewallEndpointAssociations {
2026 super::builder::firewall_activation::ListFirewallEndpointAssociations::new(
2027 self.inner.clone(),
2028 )
2029 }
2030
2031 /// Gets details of a single FirewallEndpointAssociation.
2032 ///
2033 /// # Example
2034 /// ```
2035 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2036 /// use google_cloud_networksecurity_v1::Result;
2037 /// async fn sample(
2038 /// client: &FirewallActivation, project_id: &str, location_id: &str, firewall_endpoint_association_id: &str
2039 /// ) -> Result<()> {
2040 /// let response = client.get_firewall_endpoint_association()
2041 /// .set_name(format!("projects/{project_id}/locations/{location_id}/firewallEndpointAssociations/{firewall_endpoint_association_id}"))
2042 /// .send().await?;
2043 /// println!("response {:?}", response);
2044 /// Ok(())
2045 /// }
2046 /// ```
2047 pub fn get_firewall_endpoint_association(
2048 &self,
2049 ) -> super::builder::firewall_activation::GetFirewallEndpointAssociation {
2050 super::builder::firewall_activation::GetFirewallEndpointAssociation::new(self.inner.clone())
2051 }
2052
2053 /// Creates a new FirewallEndpointAssociation in a given project and location.
2054 ///
2055 /// # Long running operations
2056 ///
2057 /// This method is used to start, and/or poll a [long-running Operation].
2058 /// The [Working with long-running operations] chapter in the [user guide]
2059 /// covers these operations in detail.
2060 ///
2061 /// [long-running operation]: https://google.aip.dev/151
2062 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2063 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2064 ///
2065 /// # Example
2066 /// ```
2067 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2068 /// use google_cloud_lro::Poller;
2069 /// use google_cloud_networksecurity_v1::model::FirewallEndpointAssociation;
2070 /// use google_cloud_networksecurity_v1::Result;
2071 /// async fn sample(
2072 /// client: &FirewallActivation, project_id: &str, location_id: &str
2073 /// ) -> Result<()> {
2074 /// let response = client.create_firewall_endpoint_association()
2075 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2076 /// .set_firewall_endpoint_association(
2077 /// FirewallEndpointAssociation::new()/* set fields */
2078 /// )
2079 /// .poller().until_done().await?;
2080 /// println!("response {:?}", response);
2081 /// Ok(())
2082 /// }
2083 /// ```
2084 pub fn create_firewall_endpoint_association(
2085 &self,
2086 ) -> super::builder::firewall_activation::CreateFirewallEndpointAssociation {
2087 super::builder::firewall_activation::CreateFirewallEndpointAssociation::new(
2088 self.inner.clone(),
2089 )
2090 }
2091
2092 /// Deletes a single FirewallEndpointAssociation.
2093 ///
2094 /// # Long running operations
2095 ///
2096 /// This method is used to start, and/or poll a [long-running Operation].
2097 /// The [Working with long-running operations] chapter in the [user guide]
2098 /// covers these operations in detail.
2099 ///
2100 /// [long-running operation]: https://google.aip.dev/151
2101 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2102 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2103 ///
2104 /// # Example
2105 /// ```
2106 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2107 /// use google_cloud_lro::Poller;
2108 /// use google_cloud_networksecurity_v1::Result;
2109 /// async fn sample(
2110 /// client: &FirewallActivation, project_id: &str, location_id: &str, firewall_endpoint_association_id: &str
2111 /// ) -> Result<()> {
2112 /// client.delete_firewall_endpoint_association()
2113 /// .set_name(format!("projects/{project_id}/locations/{location_id}/firewallEndpointAssociations/{firewall_endpoint_association_id}"))
2114 /// .poller().until_done().await?;
2115 /// Ok(())
2116 /// }
2117 /// ```
2118 pub fn delete_firewall_endpoint_association(
2119 &self,
2120 ) -> super::builder::firewall_activation::DeleteFirewallEndpointAssociation {
2121 super::builder::firewall_activation::DeleteFirewallEndpointAssociation::new(
2122 self.inner.clone(),
2123 )
2124 }
2125
2126 /// Update a single FirewallEndpointAssociation.
2127 ///
2128 /// # Long running operations
2129 ///
2130 /// This method is used to start, and/or poll a [long-running Operation].
2131 /// The [Working with long-running operations] chapter in the [user guide]
2132 /// covers these operations in detail.
2133 ///
2134 /// [long-running operation]: https://google.aip.dev/151
2135 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2136 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2137 ///
2138 /// # Example
2139 /// ```
2140 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2141 /// use google_cloud_lro::Poller;
2142 /// # extern crate wkt as google_cloud_wkt;
2143 /// use google_cloud_wkt::FieldMask;
2144 /// use google_cloud_networksecurity_v1::model::FirewallEndpointAssociation;
2145 /// use google_cloud_networksecurity_v1::Result;
2146 /// async fn sample(
2147 /// client: &FirewallActivation, project_id: &str, location_id: &str, firewall_endpoint_association_id: &str
2148 /// ) -> Result<()> {
2149 /// let response = client.update_firewall_endpoint_association()
2150 /// .set_firewall_endpoint_association(
2151 /// FirewallEndpointAssociation::new().set_name(format!("projects/{project_id}/locations/{location_id}/firewallEndpointAssociations/{firewall_endpoint_association_id}"))/* set fields */
2152 /// )
2153 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2154 /// .poller().until_done().await?;
2155 /// println!("response {:?}", response);
2156 /// Ok(())
2157 /// }
2158 /// ```
2159 pub fn update_firewall_endpoint_association(
2160 &self,
2161 ) -> super::builder::firewall_activation::UpdateFirewallEndpointAssociation {
2162 super::builder::firewall_activation::UpdateFirewallEndpointAssociation::new(
2163 self.inner.clone(),
2164 )
2165 }
2166
2167 /// Lists information about the supported locations for this service.
2168 ///
2169 /// This method lists locations based on the resource scope provided in
2170 /// the [ListLocationsRequest.name] field:
2171 ///
2172 /// * **Global locations**: If `name` is empty, the method lists the
2173 /// public locations available to all projects. * **Project-specific
2174 /// locations**: If `name` follows the format
2175 /// `projects/{project}`, the method lists locations visible to that
2176 /// specific project. This includes public, private, or other
2177 /// project-specific locations enabled for the project.
2178 ///
2179 /// For gRPC and client library implementations, the resource name is
2180 /// passed as the `name` field. For direct service calls, the resource
2181 /// name is
2182 /// incorporated into the request path based on the specific service
2183 /// implementation and version.
2184 ///
2185 /// # Example
2186 /// ```
2187 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2188 /// use google_cloud_gax::paginator::ItemPaginator as _;
2189 /// use google_cloud_networksecurity_v1::Result;
2190 /// async fn sample(
2191 /// client: &FirewallActivation
2192 /// ) -> Result<()> {
2193 /// let mut list = client.list_locations()
2194 /// /* set fields */
2195 /// .by_item();
2196 /// while let Some(item) = list.next().await.transpose()? {
2197 /// println!("{:?}", item);
2198 /// }
2199 /// Ok(())
2200 /// }
2201 /// ```
2202 pub fn list_locations(&self) -> super::builder::firewall_activation::ListLocations {
2203 super::builder::firewall_activation::ListLocations::new(self.inner.clone())
2204 }
2205
2206 /// Gets information about a location.
2207 ///
2208 /// # Example
2209 /// ```
2210 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2211 /// use google_cloud_networksecurity_v1::Result;
2212 /// async fn sample(
2213 /// client: &FirewallActivation
2214 /// ) -> Result<()> {
2215 /// let response = client.get_location()
2216 /// /* set fields */
2217 /// .send().await?;
2218 /// println!("response {:?}", response);
2219 /// Ok(())
2220 /// }
2221 /// ```
2222 pub fn get_location(&self) -> super::builder::firewall_activation::GetLocation {
2223 super::builder::firewall_activation::GetLocation::new(self.inner.clone())
2224 }
2225
2226 /// Sets the access control policy on the specified resource. Replaces
2227 /// any existing policy.
2228 ///
2229 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2230 /// errors.
2231 ///
2232 /// # Example
2233 /// ```
2234 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2235 /// use google_cloud_networksecurity_v1::Result;
2236 /// async fn sample(
2237 /// client: &FirewallActivation
2238 /// ) -> Result<()> {
2239 /// let response = client.set_iam_policy()
2240 /// /* set fields */
2241 /// .send().await?;
2242 /// println!("response {:?}", response);
2243 /// Ok(())
2244 /// }
2245 /// ```
2246 pub fn set_iam_policy(&self) -> super::builder::firewall_activation::SetIamPolicy {
2247 super::builder::firewall_activation::SetIamPolicy::new(self.inner.clone())
2248 }
2249
2250 /// Gets the access control policy for a resource. Returns an empty policy
2251 /// if the resource exists and does not have a policy set.
2252 ///
2253 /// # Example
2254 /// ```
2255 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2256 /// use google_cloud_networksecurity_v1::Result;
2257 /// async fn sample(
2258 /// client: &FirewallActivation
2259 /// ) -> Result<()> {
2260 /// let response = client.get_iam_policy()
2261 /// /* set fields */
2262 /// .send().await?;
2263 /// println!("response {:?}", response);
2264 /// Ok(())
2265 /// }
2266 /// ```
2267 pub fn get_iam_policy(&self) -> super::builder::firewall_activation::GetIamPolicy {
2268 super::builder::firewall_activation::GetIamPolicy::new(self.inner.clone())
2269 }
2270
2271 /// Returns permissions that a caller has on the specified resource. If the
2272 /// resource does not exist, this will return an empty set of
2273 /// permissions, not a `NOT_FOUND` error.
2274 ///
2275 /// Note: This operation is designed to be used for building
2276 /// permission-aware UIs and command-line tools, not for authorization
2277 /// checking. This operation may "fail open" without warning.
2278 ///
2279 /// # Example
2280 /// ```
2281 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2282 /// use google_cloud_networksecurity_v1::Result;
2283 /// async fn sample(
2284 /// client: &FirewallActivation
2285 /// ) -> Result<()> {
2286 /// let response = client.test_iam_permissions()
2287 /// /* set fields */
2288 /// .send().await?;
2289 /// println!("response {:?}", response);
2290 /// Ok(())
2291 /// }
2292 /// ```
2293 pub fn test_iam_permissions(&self) -> super::builder::firewall_activation::TestIamPermissions {
2294 super::builder::firewall_activation::TestIamPermissions::new(self.inner.clone())
2295 }
2296
2297 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2298 ///
2299 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2300 ///
2301 /// # Example
2302 /// ```
2303 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2304 /// use google_cloud_gax::paginator::ItemPaginator as _;
2305 /// use google_cloud_networksecurity_v1::Result;
2306 /// async fn sample(
2307 /// client: &FirewallActivation
2308 /// ) -> Result<()> {
2309 /// let mut list = client.list_operations()
2310 /// /* set fields */
2311 /// .by_item();
2312 /// while let Some(item) = list.next().await.transpose()? {
2313 /// println!("{:?}", item);
2314 /// }
2315 /// Ok(())
2316 /// }
2317 /// ```
2318 pub fn list_operations(&self) -> super::builder::firewall_activation::ListOperations {
2319 super::builder::firewall_activation::ListOperations::new(self.inner.clone())
2320 }
2321
2322 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2323 ///
2324 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2325 ///
2326 /// # Example
2327 /// ```
2328 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2329 /// use google_cloud_networksecurity_v1::Result;
2330 /// async fn sample(
2331 /// client: &FirewallActivation
2332 /// ) -> Result<()> {
2333 /// let response = client.get_operation()
2334 /// /* set fields */
2335 /// .send().await?;
2336 /// println!("response {:?}", response);
2337 /// Ok(())
2338 /// }
2339 /// ```
2340 pub fn get_operation(&self) -> super::builder::firewall_activation::GetOperation {
2341 super::builder::firewall_activation::GetOperation::new(self.inner.clone())
2342 }
2343
2344 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2345 ///
2346 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2347 ///
2348 /// # Example
2349 /// ```
2350 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2351 /// use google_cloud_networksecurity_v1::Result;
2352 /// async fn sample(
2353 /// client: &FirewallActivation
2354 /// ) -> Result<()> {
2355 /// client.delete_operation()
2356 /// /* set fields */
2357 /// .send().await?;
2358 /// Ok(())
2359 /// }
2360 /// ```
2361 pub fn delete_operation(&self) -> super::builder::firewall_activation::DeleteOperation {
2362 super::builder::firewall_activation::DeleteOperation::new(self.inner.clone())
2363 }
2364
2365 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2366 ///
2367 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2368 ///
2369 /// # Example
2370 /// ```
2371 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2372 /// use google_cloud_networksecurity_v1::Result;
2373 /// async fn sample(
2374 /// client: &FirewallActivation
2375 /// ) -> Result<()> {
2376 /// client.cancel_operation()
2377 /// /* set fields */
2378 /// .send().await?;
2379 /// Ok(())
2380 /// }
2381 /// ```
2382 pub fn cancel_operation(&self) -> super::builder::firewall_activation::CancelOperation {
2383 super::builder::firewall_activation::CancelOperation::new(self.inner.clone())
2384 }
2385}
2386
2387/// Implements a client for the Network Security API.
2388///
2389/// # Example
2390/// ```
2391/// # use google_cloud_networksecurity_v1::client::Intercept;
2392/// use google_cloud_gax::paginator::ItemPaginator as _;
2393/// async fn sample(
2394/// project_id: &str,
2395/// location_id: &str,
2396/// ) -> anyhow::Result<()> {
2397/// let client = Intercept::builder().build().await?;
2398/// let mut list = client.list_intercept_endpoint_groups()
2399/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2400/// .by_item();
2401/// while let Some(item) = list.next().await.transpose()? {
2402/// println!("{:?}", item);
2403/// }
2404/// Ok(())
2405/// }
2406/// ```
2407///
2408/// # Service Description
2409///
2410/// Service for Third-Party Packet Intercept (TPPI).
2411/// TPPI is the "in-band" flavor of the Network Security Integrations product.
2412///
2413/// # Configuration
2414///
2415/// To configure `Intercept` use the `with_*` methods in the type returned
2416/// by [builder()][Intercept::builder]. The default configuration should
2417/// work for most applications. Common configuration changes include
2418///
2419/// * [with_endpoint()]: by default this client uses the global default endpoint
2420/// (`https://networksecurity.googleapis.com`). Applications using regional
2421/// endpoints or running in restricted networks (e.g. a network configured
2422// with [Private Google Access with VPC Service Controls]) may want to
2423/// override this default.
2424/// * [with_credentials()]: by default this client uses
2425/// [Application Default Credentials]. Applications using custom
2426/// authentication may need to override this default.
2427///
2428/// [with_endpoint()]: super::builder::intercept::ClientBuilder::with_endpoint
2429/// [with_credentials()]: super::builder::intercept::ClientBuilder::with_credentials
2430/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2431/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2432///
2433/// # Pooling and Cloning
2434///
2435/// `Intercept` holds a connection pool internally, it is advised to
2436/// create one and reuse it. You do not need to wrap `Intercept` in
2437/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2438/// already uses an `Arc` internally.
2439#[derive(Clone, Debug)]
2440pub struct Intercept {
2441 inner: std::sync::Arc<dyn super::stub::dynamic::Intercept>,
2442}
2443
2444impl Intercept {
2445 /// Returns a builder for [Intercept].
2446 ///
2447 /// ```
2448 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2449 /// # use google_cloud_networksecurity_v1::client::Intercept;
2450 /// let client = Intercept::builder().build().await?;
2451 /// # Ok(()) }
2452 /// ```
2453 pub fn builder() -> super::builder::intercept::ClientBuilder {
2454 crate::new_client_builder(super::builder::intercept::client::Factory)
2455 }
2456
2457 /// Creates a new client from the provided stub.
2458 ///
2459 /// The most common case for calling this function is in tests mocking the
2460 /// client's behavior.
2461 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2462 where
2463 T: super::stub::Intercept + 'static,
2464 {
2465 Self { inner: stub.into() }
2466 }
2467
2468 pub(crate) async fn new(
2469 config: gaxi::options::ClientConfig,
2470 ) -> crate::ClientBuilderResult<Self> {
2471 let inner = Self::build_inner(config).await?;
2472 Ok(Self { inner })
2473 }
2474
2475 async fn build_inner(
2476 conf: gaxi::options::ClientConfig,
2477 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Intercept>> {
2478 if gaxi::options::tracing_enabled(&conf) {
2479 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2480 }
2481 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2482 }
2483
2484 async fn build_transport(
2485 conf: gaxi::options::ClientConfig,
2486 ) -> crate::ClientBuilderResult<impl super::stub::Intercept> {
2487 super::transport::Intercept::new(conf).await
2488 }
2489
2490 async fn build_with_tracing(
2491 conf: gaxi::options::ClientConfig,
2492 ) -> crate::ClientBuilderResult<impl super::stub::Intercept> {
2493 Self::build_transport(conf)
2494 .await
2495 .map(super::tracing::Intercept::new)
2496 }
2497
2498 /// Lists endpoint groups in a given project and location.
2499 /// See <https://google.aip.dev/132>.
2500 ///
2501 /// # Example
2502 /// ```
2503 /// # use google_cloud_networksecurity_v1::client::Intercept;
2504 /// use google_cloud_gax::paginator::ItemPaginator as _;
2505 /// use google_cloud_networksecurity_v1::Result;
2506 /// async fn sample(
2507 /// client: &Intercept, project_id: &str, location_id: &str
2508 /// ) -> Result<()> {
2509 /// let mut list = client.list_intercept_endpoint_groups()
2510 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2511 /// .by_item();
2512 /// while let Some(item) = list.next().await.transpose()? {
2513 /// println!("{:?}", item);
2514 /// }
2515 /// Ok(())
2516 /// }
2517 /// ```
2518 pub fn list_intercept_endpoint_groups(
2519 &self,
2520 ) -> super::builder::intercept::ListInterceptEndpointGroups {
2521 super::builder::intercept::ListInterceptEndpointGroups::new(self.inner.clone())
2522 }
2523
2524 /// Gets a specific endpoint group.
2525 /// See <https://google.aip.dev/131>.
2526 ///
2527 /// # Example
2528 /// ```
2529 /// # use google_cloud_networksecurity_v1::client::Intercept;
2530 /// use google_cloud_networksecurity_v1::Result;
2531 /// async fn sample(
2532 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_id: &str
2533 /// ) -> Result<()> {
2534 /// let response = client.get_intercept_endpoint_group()
2535 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroups/{intercept_endpoint_group_id}"))
2536 /// .send().await?;
2537 /// println!("response {:?}", response);
2538 /// Ok(())
2539 /// }
2540 /// ```
2541 pub fn get_intercept_endpoint_group(
2542 &self,
2543 ) -> super::builder::intercept::GetInterceptEndpointGroup {
2544 super::builder::intercept::GetInterceptEndpointGroup::new(self.inner.clone())
2545 }
2546
2547 /// Creates an endpoint group in a given project and location.
2548 /// See <https://google.aip.dev/133>.
2549 ///
2550 /// # Long running operations
2551 ///
2552 /// This method is used to start, and/or poll a [long-running Operation].
2553 /// The [Working with long-running operations] chapter in the [user guide]
2554 /// covers these operations in detail.
2555 ///
2556 /// [long-running operation]: https://google.aip.dev/151
2557 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2558 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2559 ///
2560 /// # Example
2561 /// ```
2562 /// # use google_cloud_networksecurity_v1::client::Intercept;
2563 /// use google_cloud_lro::Poller;
2564 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroup;
2565 /// use google_cloud_networksecurity_v1::Result;
2566 /// async fn sample(
2567 /// client: &Intercept, project_id: &str, location_id: &str
2568 /// ) -> Result<()> {
2569 /// let response = client.create_intercept_endpoint_group()
2570 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2571 /// .set_intercept_endpoint_group(
2572 /// InterceptEndpointGroup::new()/* set fields */
2573 /// )
2574 /// .poller().until_done().await?;
2575 /// println!("response {:?}", response);
2576 /// Ok(())
2577 /// }
2578 /// ```
2579 pub fn create_intercept_endpoint_group(
2580 &self,
2581 ) -> super::builder::intercept::CreateInterceptEndpointGroup {
2582 super::builder::intercept::CreateInterceptEndpointGroup::new(self.inner.clone())
2583 }
2584
2585 /// Updates an endpoint group.
2586 /// See <https://google.aip.dev/134>.
2587 ///
2588 /// # Long running operations
2589 ///
2590 /// This method is used to start, and/or poll a [long-running Operation].
2591 /// The [Working with long-running operations] chapter in the [user guide]
2592 /// covers these operations in detail.
2593 ///
2594 /// [long-running operation]: https://google.aip.dev/151
2595 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2596 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2597 ///
2598 /// # Example
2599 /// ```
2600 /// # use google_cloud_networksecurity_v1::client::Intercept;
2601 /// use google_cloud_lro::Poller;
2602 /// # extern crate wkt as google_cloud_wkt;
2603 /// use google_cloud_wkt::FieldMask;
2604 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroup;
2605 /// use google_cloud_networksecurity_v1::Result;
2606 /// async fn sample(
2607 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_id: &str
2608 /// ) -> Result<()> {
2609 /// let response = client.update_intercept_endpoint_group()
2610 /// .set_intercept_endpoint_group(
2611 /// InterceptEndpointGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroups/{intercept_endpoint_group_id}"))/* set fields */
2612 /// )
2613 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2614 /// .poller().until_done().await?;
2615 /// println!("response {:?}", response);
2616 /// Ok(())
2617 /// }
2618 /// ```
2619 pub fn update_intercept_endpoint_group(
2620 &self,
2621 ) -> super::builder::intercept::UpdateInterceptEndpointGroup {
2622 super::builder::intercept::UpdateInterceptEndpointGroup::new(self.inner.clone())
2623 }
2624
2625 /// Deletes an endpoint group.
2626 /// See <https://google.aip.dev/135>.
2627 ///
2628 /// # Long running operations
2629 ///
2630 /// This method is used to start, and/or poll a [long-running Operation].
2631 /// The [Working with long-running operations] chapter in the [user guide]
2632 /// covers these operations in detail.
2633 ///
2634 /// [long-running operation]: https://google.aip.dev/151
2635 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2636 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2637 ///
2638 /// # Example
2639 /// ```
2640 /// # use google_cloud_networksecurity_v1::client::Intercept;
2641 /// use google_cloud_lro::Poller;
2642 /// use google_cloud_networksecurity_v1::Result;
2643 /// async fn sample(
2644 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_id: &str
2645 /// ) -> Result<()> {
2646 /// client.delete_intercept_endpoint_group()
2647 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroups/{intercept_endpoint_group_id}"))
2648 /// .poller().until_done().await?;
2649 /// Ok(())
2650 /// }
2651 /// ```
2652 pub fn delete_intercept_endpoint_group(
2653 &self,
2654 ) -> super::builder::intercept::DeleteInterceptEndpointGroup {
2655 super::builder::intercept::DeleteInterceptEndpointGroup::new(self.inner.clone())
2656 }
2657
2658 /// Lists associations in a given project and location.
2659 /// See <https://google.aip.dev/132>.
2660 ///
2661 /// # Example
2662 /// ```
2663 /// # use google_cloud_networksecurity_v1::client::Intercept;
2664 /// use google_cloud_gax::paginator::ItemPaginator as _;
2665 /// use google_cloud_networksecurity_v1::Result;
2666 /// async fn sample(
2667 /// client: &Intercept, project_id: &str, location_id: &str
2668 /// ) -> Result<()> {
2669 /// let mut list = client.list_intercept_endpoint_group_associations()
2670 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2671 /// .by_item();
2672 /// while let Some(item) = list.next().await.transpose()? {
2673 /// println!("{:?}", item);
2674 /// }
2675 /// Ok(())
2676 /// }
2677 /// ```
2678 pub fn list_intercept_endpoint_group_associations(
2679 &self,
2680 ) -> super::builder::intercept::ListInterceptEndpointGroupAssociations {
2681 super::builder::intercept::ListInterceptEndpointGroupAssociations::new(self.inner.clone())
2682 }
2683
2684 /// Gets a specific association.
2685 /// See <https://google.aip.dev/131>.
2686 ///
2687 /// # Example
2688 /// ```
2689 /// # use google_cloud_networksecurity_v1::client::Intercept;
2690 /// use google_cloud_networksecurity_v1::Result;
2691 /// async fn sample(
2692 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_association_id: &str
2693 /// ) -> Result<()> {
2694 /// let response = client.get_intercept_endpoint_group_association()
2695 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association_id}"))
2696 /// .send().await?;
2697 /// println!("response {:?}", response);
2698 /// Ok(())
2699 /// }
2700 /// ```
2701 pub fn get_intercept_endpoint_group_association(
2702 &self,
2703 ) -> super::builder::intercept::GetInterceptEndpointGroupAssociation {
2704 super::builder::intercept::GetInterceptEndpointGroupAssociation::new(self.inner.clone())
2705 }
2706
2707 /// Creates an association in a given project and location.
2708 /// See <https://google.aip.dev/133>.
2709 ///
2710 /// # Long running operations
2711 ///
2712 /// This method is used to start, and/or poll a [long-running Operation].
2713 /// The [Working with long-running operations] chapter in the [user guide]
2714 /// covers these operations in detail.
2715 ///
2716 /// [long-running operation]: https://google.aip.dev/151
2717 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2718 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2719 ///
2720 /// # Example
2721 /// ```
2722 /// # use google_cloud_networksecurity_v1::client::Intercept;
2723 /// use google_cloud_lro::Poller;
2724 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroupAssociation;
2725 /// use google_cloud_networksecurity_v1::Result;
2726 /// async fn sample(
2727 /// client: &Intercept, project_id: &str, location_id: &str
2728 /// ) -> Result<()> {
2729 /// let response = client.create_intercept_endpoint_group_association()
2730 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2731 /// .set_intercept_endpoint_group_association(
2732 /// InterceptEndpointGroupAssociation::new()/* set fields */
2733 /// )
2734 /// .poller().until_done().await?;
2735 /// println!("response {:?}", response);
2736 /// Ok(())
2737 /// }
2738 /// ```
2739 pub fn create_intercept_endpoint_group_association(
2740 &self,
2741 ) -> super::builder::intercept::CreateInterceptEndpointGroupAssociation {
2742 super::builder::intercept::CreateInterceptEndpointGroupAssociation::new(self.inner.clone())
2743 }
2744
2745 /// Updates an association.
2746 /// See <https://google.aip.dev/134>.
2747 ///
2748 /// # Long running operations
2749 ///
2750 /// This method is used to start, and/or poll a [long-running Operation].
2751 /// The [Working with long-running operations] chapter in the [user guide]
2752 /// covers these operations in detail.
2753 ///
2754 /// [long-running operation]: https://google.aip.dev/151
2755 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2756 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2757 ///
2758 /// # Example
2759 /// ```
2760 /// # use google_cloud_networksecurity_v1::client::Intercept;
2761 /// use google_cloud_lro::Poller;
2762 /// # extern crate wkt as google_cloud_wkt;
2763 /// use google_cloud_wkt::FieldMask;
2764 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroupAssociation;
2765 /// use google_cloud_networksecurity_v1::Result;
2766 /// async fn sample(
2767 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_association_id: &str
2768 /// ) -> Result<()> {
2769 /// let response = client.update_intercept_endpoint_group_association()
2770 /// .set_intercept_endpoint_group_association(
2771 /// InterceptEndpointGroupAssociation::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association_id}"))/* set fields */
2772 /// )
2773 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2774 /// .poller().until_done().await?;
2775 /// println!("response {:?}", response);
2776 /// Ok(())
2777 /// }
2778 /// ```
2779 pub fn update_intercept_endpoint_group_association(
2780 &self,
2781 ) -> super::builder::intercept::UpdateInterceptEndpointGroupAssociation {
2782 super::builder::intercept::UpdateInterceptEndpointGroupAssociation::new(self.inner.clone())
2783 }
2784
2785 /// Deletes an association.
2786 /// See <https://google.aip.dev/135>.
2787 ///
2788 /// # Long running operations
2789 ///
2790 /// This method is used to start, and/or poll a [long-running Operation].
2791 /// The [Working with long-running operations] chapter in the [user guide]
2792 /// covers these operations in detail.
2793 ///
2794 /// [long-running operation]: https://google.aip.dev/151
2795 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2796 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2797 ///
2798 /// # Example
2799 /// ```
2800 /// # use google_cloud_networksecurity_v1::client::Intercept;
2801 /// use google_cloud_lro::Poller;
2802 /// use google_cloud_networksecurity_v1::Result;
2803 /// async fn sample(
2804 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_association_id: &str
2805 /// ) -> Result<()> {
2806 /// client.delete_intercept_endpoint_group_association()
2807 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association_id}"))
2808 /// .poller().until_done().await?;
2809 /// Ok(())
2810 /// }
2811 /// ```
2812 pub fn delete_intercept_endpoint_group_association(
2813 &self,
2814 ) -> super::builder::intercept::DeleteInterceptEndpointGroupAssociation {
2815 super::builder::intercept::DeleteInterceptEndpointGroupAssociation::new(self.inner.clone())
2816 }
2817
2818 /// Lists deployment groups in a given project and location.
2819 /// See <https://google.aip.dev/132>.
2820 ///
2821 /// # Example
2822 /// ```
2823 /// # use google_cloud_networksecurity_v1::client::Intercept;
2824 /// use google_cloud_gax::paginator::ItemPaginator as _;
2825 /// use google_cloud_networksecurity_v1::Result;
2826 /// async fn sample(
2827 /// client: &Intercept, project_id: &str, location_id: &str
2828 /// ) -> Result<()> {
2829 /// let mut list = client.list_intercept_deployment_groups()
2830 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2831 /// .by_item();
2832 /// while let Some(item) = list.next().await.transpose()? {
2833 /// println!("{:?}", item);
2834 /// }
2835 /// Ok(())
2836 /// }
2837 /// ```
2838 pub fn list_intercept_deployment_groups(
2839 &self,
2840 ) -> super::builder::intercept::ListInterceptDeploymentGroups {
2841 super::builder::intercept::ListInterceptDeploymentGroups::new(self.inner.clone())
2842 }
2843
2844 /// Gets a specific deployment group.
2845 /// See <https://google.aip.dev/131>.
2846 ///
2847 /// # Example
2848 /// ```
2849 /// # use google_cloud_networksecurity_v1::client::Intercept;
2850 /// use google_cloud_networksecurity_v1::Result;
2851 /// async fn sample(
2852 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_group_id: &str
2853 /// ) -> Result<()> {
2854 /// let response = client.get_intercept_deployment_group()
2855 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeploymentGroups/{intercept_deployment_group_id}"))
2856 /// .send().await?;
2857 /// println!("response {:?}", response);
2858 /// Ok(())
2859 /// }
2860 /// ```
2861 pub fn get_intercept_deployment_group(
2862 &self,
2863 ) -> super::builder::intercept::GetInterceptDeploymentGroup {
2864 super::builder::intercept::GetInterceptDeploymentGroup::new(self.inner.clone())
2865 }
2866
2867 /// Creates a deployment group in a given project and location.
2868 /// See <https://google.aip.dev/133>.
2869 ///
2870 /// # Long running operations
2871 ///
2872 /// This method is used to start, and/or poll a [long-running Operation].
2873 /// The [Working with long-running operations] chapter in the [user guide]
2874 /// covers these operations in detail.
2875 ///
2876 /// [long-running operation]: https://google.aip.dev/151
2877 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2878 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2879 ///
2880 /// # Example
2881 /// ```
2882 /// # use google_cloud_networksecurity_v1::client::Intercept;
2883 /// use google_cloud_lro::Poller;
2884 /// use google_cloud_networksecurity_v1::model::InterceptDeploymentGroup;
2885 /// use google_cloud_networksecurity_v1::Result;
2886 /// async fn sample(
2887 /// client: &Intercept, project_id: &str, location_id: &str
2888 /// ) -> Result<()> {
2889 /// let response = client.create_intercept_deployment_group()
2890 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2891 /// .set_intercept_deployment_group(
2892 /// InterceptDeploymentGroup::new()/* set fields */
2893 /// )
2894 /// .poller().until_done().await?;
2895 /// println!("response {:?}", response);
2896 /// Ok(())
2897 /// }
2898 /// ```
2899 pub fn create_intercept_deployment_group(
2900 &self,
2901 ) -> super::builder::intercept::CreateInterceptDeploymentGroup {
2902 super::builder::intercept::CreateInterceptDeploymentGroup::new(self.inner.clone())
2903 }
2904
2905 /// Updates a deployment group.
2906 /// See <https://google.aip.dev/134>.
2907 ///
2908 /// # Long running operations
2909 ///
2910 /// This method is used to start, and/or poll a [long-running Operation].
2911 /// The [Working with long-running operations] chapter in the [user guide]
2912 /// covers these operations in detail.
2913 ///
2914 /// [long-running operation]: https://google.aip.dev/151
2915 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2916 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2917 ///
2918 /// # Example
2919 /// ```
2920 /// # use google_cloud_networksecurity_v1::client::Intercept;
2921 /// use google_cloud_lro::Poller;
2922 /// # extern crate wkt as google_cloud_wkt;
2923 /// use google_cloud_wkt::FieldMask;
2924 /// use google_cloud_networksecurity_v1::model::InterceptDeploymentGroup;
2925 /// use google_cloud_networksecurity_v1::Result;
2926 /// async fn sample(
2927 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_group_id: &str
2928 /// ) -> Result<()> {
2929 /// let response = client.update_intercept_deployment_group()
2930 /// .set_intercept_deployment_group(
2931 /// InterceptDeploymentGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeploymentGroups/{intercept_deployment_group_id}"))/* set fields */
2932 /// )
2933 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2934 /// .poller().until_done().await?;
2935 /// println!("response {:?}", response);
2936 /// Ok(())
2937 /// }
2938 /// ```
2939 pub fn update_intercept_deployment_group(
2940 &self,
2941 ) -> super::builder::intercept::UpdateInterceptDeploymentGroup {
2942 super::builder::intercept::UpdateInterceptDeploymentGroup::new(self.inner.clone())
2943 }
2944
2945 /// Deletes a deployment group.
2946 /// See <https://google.aip.dev/135>.
2947 ///
2948 /// # Long running operations
2949 ///
2950 /// This method is used to start, and/or poll a [long-running Operation].
2951 /// The [Working with long-running operations] chapter in the [user guide]
2952 /// covers these operations in detail.
2953 ///
2954 /// [long-running operation]: https://google.aip.dev/151
2955 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2956 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2957 ///
2958 /// # Example
2959 /// ```
2960 /// # use google_cloud_networksecurity_v1::client::Intercept;
2961 /// use google_cloud_lro::Poller;
2962 /// use google_cloud_networksecurity_v1::Result;
2963 /// async fn sample(
2964 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_group_id: &str
2965 /// ) -> Result<()> {
2966 /// client.delete_intercept_deployment_group()
2967 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeploymentGroups/{intercept_deployment_group_id}"))
2968 /// .poller().until_done().await?;
2969 /// Ok(())
2970 /// }
2971 /// ```
2972 pub fn delete_intercept_deployment_group(
2973 &self,
2974 ) -> super::builder::intercept::DeleteInterceptDeploymentGroup {
2975 super::builder::intercept::DeleteInterceptDeploymentGroup::new(self.inner.clone())
2976 }
2977
2978 /// Lists deployments in a given project and location.
2979 /// See <https://google.aip.dev/132>.
2980 ///
2981 /// # Example
2982 /// ```
2983 /// # use google_cloud_networksecurity_v1::client::Intercept;
2984 /// use google_cloud_gax::paginator::ItemPaginator as _;
2985 /// use google_cloud_networksecurity_v1::Result;
2986 /// async fn sample(
2987 /// client: &Intercept, project_id: &str, location_id: &str
2988 /// ) -> Result<()> {
2989 /// let mut list = client.list_intercept_deployments()
2990 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2991 /// .by_item();
2992 /// while let Some(item) = list.next().await.transpose()? {
2993 /// println!("{:?}", item);
2994 /// }
2995 /// Ok(())
2996 /// }
2997 /// ```
2998 pub fn list_intercept_deployments(
2999 &self,
3000 ) -> super::builder::intercept::ListInterceptDeployments {
3001 super::builder::intercept::ListInterceptDeployments::new(self.inner.clone())
3002 }
3003
3004 /// Gets a specific deployment.
3005 /// See <https://google.aip.dev/131>.
3006 ///
3007 /// # Example
3008 /// ```
3009 /// # use google_cloud_networksecurity_v1::client::Intercept;
3010 /// use google_cloud_networksecurity_v1::Result;
3011 /// async fn sample(
3012 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_id: &str
3013 /// ) -> Result<()> {
3014 /// let response = client.get_intercept_deployment()
3015 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeployments/{intercept_deployment_id}"))
3016 /// .send().await?;
3017 /// println!("response {:?}", response);
3018 /// Ok(())
3019 /// }
3020 /// ```
3021 pub fn get_intercept_deployment(&self) -> super::builder::intercept::GetInterceptDeployment {
3022 super::builder::intercept::GetInterceptDeployment::new(self.inner.clone())
3023 }
3024
3025 /// Creates a deployment in a given project and location.
3026 /// See <https://google.aip.dev/133>.
3027 ///
3028 /// # Long running operations
3029 ///
3030 /// This method is used to start, and/or poll a [long-running Operation].
3031 /// The [Working with long-running operations] chapter in the [user guide]
3032 /// covers these operations in detail.
3033 ///
3034 /// [long-running operation]: https://google.aip.dev/151
3035 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3036 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3037 ///
3038 /// # Example
3039 /// ```
3040 /// # use google_cloud_networksecurity_v1::client::Intercept;
3041 /// use google_cloud_lro::Poller;
3042 /// use google_cloud_networksecurity_v1::model::InterceptDeployment;
3043 /// use google_cloud_networksecurity_v1::Result;
3044 /// async fn sample(
3045 /// client: &Intercept, project_id: &str, location_id: &str
3046 /// ) -> Result<()> {
3047 /// let response = client.create_intercept_deployment()
3048 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3049 /// .set_intercept_deployment(
3050 /// InterceptDeployment::new()/* set fields */
3051 /// )
3052 /// .poller().until_done().await?;
3053 /// println!("response {:?}", response);
3054 /// Ok(())
3055 /// }
3056 /// ```
3057 pub fn create_intercept_deployment(
3058 &self,
3059 ) -> super::builder::intercept::CreateInterceptDeployment {
3060 super::builder::intercept::CreateInterceptDeployment::new(self.inner.clone())
3061 }
3062
3063 /// Updates a deployment.
3064 /// See <https://google.aip.dev/134>.
3065 ///
3066 /// # Long running operations
3067 ///
3068 /// This method is used to start, and/or poll a [long-running Operation].
3069 /// The [Working with long-running operations] chapter in the [user guide]
3070 /// covers these operations in detail.
3071 ///
3072 /// [long-running operation]: https://google.aip.dev/151
3073 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3074 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3075 ///
3076 /// # Example
3077 /// ```
3078 /// # use google_cloud_networksecurity_v1::client::Intercept;
3079 /// use google_cloud_lro::Poller;
3080 /// # extern crate wkt as google_cloud_wkt;
3081 /// use google_cloud_wkt::FieldMask;
3082 /// use google_cloud_networksecurity_v1::model::InterceptDeployment;
3083 /// use google_cloud_networksecurity_v1::Result;
3084 /// async fn sample(
3085 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_id: &str
3086 /// ) -> Result<()> {
3087 /// let response = client.update_intercept_deployment()
3088 /// .set_intercept_deployment(
3089 /// InterceptDeployment::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeployments/{intercept_deployment_id}"))/* set fields */
3090 /// )
3091 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3092 /// .poller().until_done().await?;
3093 /// println!("response {:?}", response);
3094 /// Ok(())
3095 /// }
3096 /// ```
3097 pub fn update_intercept_deployment(
3098 &self,
3099 ) -> super::builder::intercept::UpdateInterceptDeployment {
3100 super::builder::intercept::UpdateInterceptDeployment::new(self.inner.clone())
3101 }
3102
3103 /// Deletes a deployment.
3104 /// See <https://google.aip.dev/135>.
3105 ///
3106 /// # Long running operations
3107 ///
3108 /// This method is used to start, and/or poll a [long-running Operation].
3109 /// The [Working with long-running operations] chapter in the [user guide]
3110 /// covers these operations in detail.
3111 ///
3112 /// [long-running operation]: https://google.aip.dev/151
3113 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3114 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3115 ///
3116 /// # Example
3117 /// ```
3118 /// # use google_cloud_networksecurity_v1::client::Intercept;
3119 /// use google_cloud_lro::Poller;
3120 /// use google_cloud_networksecurity_v1::Result;
3121 /// async fn sample(
3122 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_id: &str
3123 /// ) -> Result<()> {
3124 /// client.delete_intercept_deployment()
3125 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeployments/{intercept_deployment_id}"))
3126 /// .poller().until_done().await?;
3127 /// Ok(())
3128 /// }
3129 /// ```
3130 pub fn delete_intercept_deployment(
3131 &self,
3132 ) -> super::builder::intercept::DeleteInterceptDeployment {
3133 super::builder::intercept::DeleteInterceptDeployment::new(self.inner.clone())
3134 }
3135
3136 /// Lists information about the supported locations for this service.
3137 ///
3138 /// This method lists locations based on the resource scope provided in
3139 /// the [ListLocationsRequest.name] field:
3140 ///
3141 /// * **Global locations**: If `name` is empty, the method lists the
3142 /// public locations available to all projects. * **Project-specific
3143 /// locations**: If `name` follows the format
3144 /// `projects/{project}`, the method lists locations visible to that
3145 /// specific project. This includes public, private, or other
3146 /// project-specific locations enabled for the project.
3147 ///
3148 /// For gRPC and client library implementations, the resource name is
3149 /// passed as the `name` field. For direct service calls, the resource
3150 /// name is
3151 /// incorporated into the request path based on the specific service
3152 /// implementation and version.
3153 ///
3154 /// # Example
3155 /// ```
3156 /// # use google_cloud_networksecurity_v1::client::Intercept;
3157 /// use google_cloud_gax::paginator::ItemPaginator as _;
3158 /// use google_cloud_networksecurity_v1::Result;
3159 /// async fn sample(
3160 /// client: &Intercept
3161 /// ) -> Result<()> {
3162 /// let mut list = client.list_locations()
3163 /// /* set fields */
3164 /// .by_item();
3165 /// while let Some(item) = list.next().await.transpose()? {
3166 /// println!("{:?}", item);
3167 /// }
3168 /// Ok(())
3169 /// }
3170 /// ```
3171 pub fn list_locations(&self) -> super::builder::intercept::ListLocations {
3172 super::builder::intercept::ListLocations::new(self.inner.clone())
3173 }
3174
3175 /// Gets information about a location.
3176 ///
3177 /// # Example
3178 /// ```
3179 /// # use google_cloud_networksecurity_v1::client::Intercept;
3180 /// use google_cloud_networksecurity_v1::Result;
3181 /// async fn sample(
3182 /// client: &Intercept
3183 /// ) -> Result<()> {
3184 /// let response = client.get_location()
3185 /// /* set fields */
3186 /// .send().await?;
3187 /// println!("response {:?}", response);
3188 /// Ok(())
3189 /// }
3190 /// ```
3191 pub fn get_location(&self) -> super::builder::intercept::GetLocation {
3192 super::builder::intercept::GetLocation::new(self.inner.clone())
3193 }
3194
3195 /// Sets the access control policy on the specified resource. Replaces
3196 /// any existing policy.
3197 ///
3198 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3199 /// errors.
3200 ///
3201 /// # Example
3202 /// ```
3203 /// # use google_cloud_networksecurity_v1::client::Intercept;
3204 /// use google_cloud_networksecurity_v1::Result;
3205 /// async fn sample(
3206 /// client: &Intercept
3207 /// ) -> Result<()> {
3208 /// let response = client.set_iam_policy()
3209 /// /* set fields */
3210 /// .send().await?;
3211 /// println!("response {:?}", response);
3212 /// Ok(())
3213 /// }
3214 /// ```
3215 pub fn set_iam_policy(&self) -> super::builder::intercept::SetIamPolicy {
3216 super::builder::intercept::SetIamPolicy::new(self.inner.clone())
3217 }
3218
3219 /// Gets the access control policy for a resource. Returns an empty policy
3220 /// if the resource exists and does not have a policy set.
3221 ///
3222 /// # Example
3223 /// ```
3224 /// # use google_cloud_networksecurity_v1::client::Intercept;
3225 /// use google_cloud_networksecurity_v1::Result;
3226 /// async fn sample(
3227 /// client: &Intercept
3228 /// ) -> Result<()> {
3229 /// let response = client.get_iam_policy()
3230 /// /* set fields */
3231 /// .send().await?;
3232 /// println!("response {:?}", response);
3233 /// Ok(())
3234 /// }
3235 /// ```
3236 pub fn get_iam_policy(&self) -> super::builder::intercept::GetIamPolicy {
3237 super::builder::intercept::GetIamPolicy::new(self.inner.clone())
3238 }
3239
3240 /// Returns permissions that a caller has on the specified resource. If the
3241 /// resource does not exist, this will return an empty set of
3242 /// permissions, not a `NOT_FOUND` error.
3243 ///
3244 /// Note: This operation is designed to be used for building
3245 /// permission-aware UIs and command-line tools, not for authorization
3246 /// checking. This operation may "fail open" without warning.
3247 ///
3248 /// # Example
3249 /// ```
3250 /// # use google_cloud_networksecurity_v1::client::Intercept;
3251 /// use google_cloud_networksecurity_v1::Result;
3252 /// async fn sample(
3253 /// client: &Intercept
3254 /// ) -> Result<()> {
3255 /// let response = client.test_iam_permissions()
3256 /// /* set fields */
3257 /// .send().await?;
3258 /// println!("response {:?}", response);
3259 /// Ok(())
3260 /// }
3261 /// ```
3262 pub fn test_iam_permissions(&self) -> super::builder::intercept::TestIamPermissions {
3263 super::builder::intercept::TestIamPermissions::new(self.inner.clone())
3264 }
3265
3266 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3267 ///
3268 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3269 ///
3270 /// # Example
3271 /// ```
3272 /// # use google_cloud_networksecurity_v1::client::Intercept;
3273 /// use google_cloud_gax::paginator::ItemPaginator as _;
3274 /// use google_cloud_networksecurity_v1::Result;
3275 /// async fn sample(
3276 /// client: &Intercept
3277 /// ) -> Result<()> {
3278 /// let mut list = client.list_operations()
3279 /// /* set fields */
3280 /// .by_item();
3281 /// while let Some(item) = list.next().await.transpose()? {
3282 /// println!("{:?}", item);
3283 /// }
3284 /// Ok(())
3285 /// }
3286 /// ```
3287 pub fn list_operations(&self) -> super::builder::intercept::ListOperations {
3288 super::builder::intercept::ListOperations::new(self.inner.clone())
3289 }
3290
3291 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3292 ///
3293 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3294 ///
3295 /// # Example
3296 /// ```
3297 /// # use google_cloud_networksecurity_v1::client::Intercept;
3298 /// use google_cloud_networksecurity_v1::Result;
3299 /// async fn sample(
3300 /// client: &Intercept
3301 /// ) -> Result<()> {
3302 /// let response = client.get_operation()
3303 /// /* set fields */
3304 /// .send().await?;
3305 /// println!("response {:?}", response);
3306 /// Ok(())
3307 /// }
3308 /// ```
3309 pub fn get_operation(&self) -> super::builder::intercept::GetOperation {
3310 super::builder::intercept::GetOperation::new(self.inner.clone())
3311 }
3312
3313 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3314 ///
3315 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3316 ///
3317 /// # Example
3318 /// ```
3319 /// # use google_cloud_networksecurity_v1::client::Intercept;
3320 /// use google_cloud_networksecurity_v1::Result;
3321 /// async fn sample(
3322 /// client: &Intercept
3323 /// ) -> Result<()> {
3324 /// client.delete_operation()
3325 /// /* set fields */
3326 /// .send().await?;
3327 /// Ok(())
3328 /// }
3329 /// ```
3330 pub fn delete_operation(&self) -> super::builder::intercept::DeleteOperation {
3331 super::builder::intercept::DeleteOperation::new(self.inner.clone())
3332 }
3333
3334 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3335 ///
3336 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3337 ///
3338 /// # Example
3339 /// ```
3340 /// # use google_cloud_networksecurity_v1::client::Intercept;
3341 /// use google_cloud_networksecurity_v1::Result;
3342 /// async fn sample(
3343 /// client: &Intercept
3344 /// ) -> Result<()> {
3345 /// client.cancel_operation()
3346 /// /* set fields */
3347 /// .send().await?;
3348 /// Ok(())
3349 /// }
3350 /// ```
3351 pub fn cancel_operation(&self) -> super::builder::intercept::CancelOperation {
3352 super::builder::intercept::CancelOperation::new(self.inner.clone())
3353 }
3354}
3355
3356/// Implements a client for the Network Security API.
3357///
3358/// # Example
3359/// ```
3360/// # use google_cloud_networksecurity_v1::client::Mirroring;
3361/// use google_cloud_gax::paginator::ItemPaginator as _;
3362/// async fn sample(
3363/// project_id: &str,
3364/// location_id: &str,
3365/// ) -> anyhow::Result<()> {
3366/// let client = Mirroring::builder().build().await?;
3367/// let mut list = client.list_mirroring_endpoint_groups()
3368/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3369/// .by_item();
3370/// while let Some(item) = list.next().await.transpose()? {
3371/// println!("{:?}", item);
3372/// }
3373/// Ok(())
3374/// }
3375/// ```
3376///
3377/// # Service Description
3378///
3379/// PM2 is the "out-of-band" flavor of the Network Security Integrations product.
3380///
3381/// # Configuration
3382///
3383/// To configure `Mirroring` use the `with_*` methods in the type returned
3384/// by [builder()][Mirroring::builder]. The default configuration should
3385/// work for most applications. Common configuration changes include
3386///
3387/// * [with_endpoint()]: by default this client uses the global default endpoint
3388/// (`https://networksecurity.googleapis.com`). Applications using regional
3389/// endpoints or running in restricted networks (e.g. a network configured
3390// with [Private Google Access with VPC Service Controls]) may want to
3391/// override this default.
3392/// * [with_credentials()]: by default this client uses
3393/// [Application Default Credentials]. Applications using custom
3394/// authentication may need to override this default.
3395///
3396/// [with_endpoint()]: super::builder::mirroring::ClientBuilder::with_endpoint
3397/// [with_credentials()]: super::builder::mirroring::ClientBuilder::with_credentials
3398/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3399/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3400///
3401/// # Pooling and Cloning
3402///
3403/// `Mirroring` holds a connection pool internally, it is advised to
3404/// create one and reuse it. You do not need to wrap `Mirroring` in
3405/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3406/// already uses an `Arc` internally.
3407#[derive(Clone, Debug)]
3408pub struct Mirroring {
3409 inner: std::sync::Arc<dyn super::stub::dynamic::Mirroring>,
3410}
3411
3412impl Mirroring {
3413 /// Returns a builder for [Mirroring].
3414 ///
3415 /// ```
3416 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3417 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3418 /// let client = Mirroring::builder().build().await?;
3419 /// # Ok(()) }
3420 /// ```
3421 pub fn builder() -> super::builder::mirroring::ClientBuilder {
3422 crate::new_client_builder(super::builder::mirroring::client::Factory)
3423 }
3424
3425 /// Creates a new client from the provided stub.
3426 ///
3427 /// The most common case for calling this function is in tests mocking the
3428 /// client's behavior.
3429 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3430 where
3431 T: super::stub::Mirroring + 'static,
3432 {
3433 Self { inner: stub.into() }
3434 }
3435
3436 pub(crate) async fn new(
3437 config: gaxi::options::ClientConfig,
3438 ) -> crate::ClientBuilderResult<Self> {
3439 let inner = Self::build_inner(config).await?;
3440 Ok(Self { inner })
3441 }
3442
3443 async fn build_inner(
3444 conf: gaxi::options::ClientConfig,
3445 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Mirroring>> {
3446 if gaxi::options::tracing_enabled(&conf) {
3447 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3448 }
3449 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3450 }
3451
3452 async fn build_transport(
3453 conf: gaxi::options::ClientConfig,
3454 ) -> crate::ClientBuilderResult<impl super::stub::Mirroring> {
3455 super::transport::Mirroring::new(conf).await
3456 }
3457
3458 async fn build_with_tracing(
3459 conf: gaxi::options::ClientConfig,
3460 ) -> crate::ClientBuilderResult<impl super::stub::Mirroring> {
3461 Self::build_transport(conf)
3462 .await
3463 .map(super::tracing::Mirroring::new)
3464 }
3465
3466 /// Lists endpoint groups in a given project and location.
3467 /// See <https://google.aip.dev/132>.
3468 ///
3469 /// # Example
3470 /// ```
3471 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3472 /// use google_cloud_gax::paginator::ItemPaginator as _;
3473 /// use google_cloud_networksecurity_v1::Result;
3474 /// async fn sample(
3475 /// client: &Mirroring, project_id: &str, location_id: &str
3476 /// ) -> Result<()> {
3477 /// let mut list = client.list_mirroring_endpoint_groups()
3478 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3479 /// .by_item();
3480 /// while let Some(item) = list.next().await.transpose()? {
3481 /// println!("{:?}", item);
3482 /// }
3483 /// Ok(())
3484 /// }
3485 /// ```
3486 pub fn list_mirroring_endpoint_groups(
3487 &self,
3488 ) -> super::builder::mirroring::ListMirroringEndpointGroups {
3489 super::builder::mirroring::ListMirroringEndpointGroups::new(self.inner.clone())
3490 }
3491
3492 /// Gets a specific endpoint group.
3493 /// See <https://google.aip.dev/131>.
3494 ///
3495 /// # Example
3496 /// ```
3497 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3498 /// use google_cloud_networksecurity_v1::Result;
3499 /// async fn sample(
3500 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_id: &str
3501 /// ) -> Result<()> {
3502 /// let response = client.get_mirroring_endpoint_group()
3503 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroups/{mirroring_endpoint_group_id}"))
3504 /// .send().await?;
3505 /// println!("response {:?}", response);
3506 /// Ok(())
3507 /// }
3508 /// ```
3509 pub fn get_mirroring_endpoint_group(
3510 &self,
3511 ) -> super::builder::mirroring::GetMirroringEndpointGroup {
3512 super::builder::mirroring::GetMirroringEndpointGroup::new(self.inner.clone())
3513 }
3514
3515 /// Creates an endpoint group in a given project and location.
3516 /// See <https://google.aip.dev/133>.
3517 ///
3518 /// # Long running operations
3519 ///
3520 /// This method is used to start, and/or poll a [long-running Operation].
3521 /// The [Working with long-running operations] chapter in the [user guide]
3522 /// covers these operations in detail.
3523 ///
3524 /// [long-running operation]: https://google.aip.dev/151
3525 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3526 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3527 ///
3528 /// # Example
3529 /// ```
3530 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3531 /// use google_cloud_lro::Poller;
3532 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroup;
3533 /// use google_cloud_networksecurity_v1::Result;
3534 /// async fn sample(
3535 /// client: &Mirroring, project_id: &str, location_id: &str
3536 /// ) -> Result<()> {
3537 /// let response = client.create_mirroring_endpoint_group()
3538 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3539 /// .set_mirroring_endpoint_group(
3540 /// MirroringEndpointGroup::new()/* set fields */
3541 /// )
3542 /// .poller().until_done().await?;
3543 /// println!("response {:?}", response);
3544 /// Ok(())
3545 /// }
3546 /// ```
3547 pub fn create_mirroring_endpoint_group(
3548 &self,
3549 ) -> super::builder::mirroring::CreateMirroringEndpointGroup {
3550 super::builder::mirroring::CreateMirroringEndpointGroup::new(self.inner.clone())
3551 }
3552
3553 /// Updates an endpoint group.
3554 /// See <https://google.aip.dev/134>.
3555 ///
3556 /// # Long running operations
3557 ///
3558 /// This method is used to start, and/or poll a [long-running Operation].
3559 /// The [Working with long-running operations] chapter in the [user guide]
3560 /// covers these operations in detail.
3561 ///
3562 /// [long-running operation]: https://google.aip.dev/151
3563 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3564 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3565 ///
3566 /// # Example
3567 /// ```
3568 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3569 /// use google_cloud_lro::Poller;
3570 /// # extern crate wkt as google_cloud_wkt;
3571 /// use google_cloud_wkt::FieldMask;
3572 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroup;
3573 /// use google_cloud_networksecurity_v1::Result;
3574 /// async fn sample(
3575 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_id: &str
3576 /// ) -> Result<()> {
3577 /// let response = client.update_mirroring_endpoint_group()
3578 /// .set_mirroring_endpoint_group(
3579 /// MirroringEndpointGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroups/{mirroring_endpoint_group_id}"))/* set fields */
3580 /// )
3581 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3582 /// .poller().until_done().await?;
3583 /// println!("response {:?}", response);
3584 /// Ok(())
3585 /// }
3586 /// ```
3587 pub fn update_mirroring_endpoint_group(
3588 &self,
3589 ) -> super::builder::mirroring::UpdateMirroringEndpointGroup {
3590 super::builder::mirroring::UpdateMirroringEndpointGroup::new(self.inner.clone())
3591 }
3592
3593 /// Deletes an endpoint group.
3594 /// See <https://google.aip.dev/135>.
3595 ///
3596 /// # Long running operations
3597 ///
3598 /// This method is used to start, and/or poll a [long-running Operation].
3599 /// The [Working with long-running operations] chapter in the [user guide]
3600 /// covers these operations in detail.
3601 ///
3602 /// [long-running operation]: https://google.aip.dev/151
3603 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3604 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3605 ///
3606 /// # Example
3607 /// ```
3608 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3609 /// use google_cloud_lro::Poller;
3610 /// use google_cloud_networksecurity_v1::Result;
3611 /// async fn sample(
3612 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_id: &str
3613 /// ) -> Result<()> {
3614 /// client.delete_mirroring_endpoint_group()
3615 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroups/{mirroring_endpoint_group_id}"))
3616 /// .poller().until_done().await?;
3617 /// Ok(())
3618 /// }
3619 /// ```
3620 pub fn delete_mirroring_endpoint_group(
3621 &self,
3622 ) -> super::builder::mirroring::DeleteMirroringEndpointGroup {
3623 super::builder::mirroring::DeleteMirroringEndpointGroup::new(self.inner.clone())
3624 }
3625
3626 /// Lists associations in a given project and location.
3627 /// See <https://google.aip.dev/132>.
3628 ///
3629 /// # Example
3630 /// ```
3631 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3632 /// use google_cloud_gax::paginator::ItemPaginator as _;
3633 /// use google_cloud_networksecurity_v1::Result;
3634 /// async fn sample(
3635 /// client: &Mirroring, project_id: &str, location_id: &str
3636 /// ) -> Result<()> {
3637 /// let mut list = client.list_mirroring_endpoint_group_associations()
3638 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3639 /// .by_item();
3640 /// while let Some(item) = list.next().await.transpose()? {
3641 /// println!("{:?}", item);
3642 /// }
3643 /// Ok(())
3644 /// }
3645 /// ```
3646 pub fn list_mirroring_endpoint_group_associations(
3647 &self,
3648 ) -> super::builder::mirroring::ListMirroringEndpointGroupAssociations {
3649 super::builder::mirroring::ListMirroringEndpointGroupAssociations::new(self.inner.clone())
3650 }
3651
3652 /// Gets a specific association.
3653 /// See <https://google.aip.dev/131>.
3654 ///
3655 /// # Example
3656 /// ```
3657 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3658 /// use google_cloud_networksecurity_v1::Result;
3659 /// async fn sample(
3660 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_association_id: &str
3661 /// ) -> Result<()> {
3662 /// let response = client.get_mirroring_endpoint_group_association()
3663 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association_id}"))
3664 /// .send().await?;
3665 /// println!("response {:?}", response);
3666 /// Ok(())
3667 /// }
3668 /// ```
3669 pub fn get_mirroring_endpoint_group_association(
3670 &self,
3671 ) -> super::builder::mirroring::GetMirroringEndpointGroupAssociation {
3672 super::builder::mirroring::GetMirroringEndpointGroupAssociation::new(self.inner.clone())
3673 }
3674
3675 /// Creates an association in a given project and location.
3676 /// See <https://google.aip.dev/133>.
3677 ///
3678 /// # Long running operations
3679 ///
3680 /// This method is used to start, and/or poll a [long-running Operation].
3681 /// The [Working with long-running operations] chapter in the [user guide]
3682 /// covers these operations in detail.
3683 ///
3684 /// [long-running operation]: https://google.aip.dev/151
3685 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3686 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3687 ///
3688 /// # Example
3689 /// ```
3690 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3691 /// use google_cloud_lro::Poller;
3692 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroupAssociation;
3693 /// use google_cloud_networksecurity_v1::Result;
3694 /// async fn sample(
3695 /// client: &Mirroring, project_id: &str, location_id: &str
3696 /// ) -> Result<()> {
3697 /// let response = client.create_mirroring_endpoint_group_association()
3698 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3699 /// .set_mirroring_endpoint_group_association(
3700 /// MirroringEndpointGroupAssociation::new()/* set fields */
3701 /// )
3702 /// .poller().until_done().await?;
3703 /// println!("response {:?}", response);
3704 /// Ok(())
3705 /// }
3706 /// ```
3707 pub fn create_mirroring_endpoint_group_association(
3708 &self,
3709 ) -> super::builder::mirroring::CreateMirroringEndpointGroupAssociation {
3710 super::builder::mirroring::CreateMirroringEndpointGroupAssociation::new(self.inner.clone())
3711 }
3712
3713 /// Updates an association.
3714 /// See <https://google.aip.dev/134>.
3715 ///
3716 /// # Long running operations
3717 ///
3718 /// This method is used to start, and/or poll a [long-running Operation].
3719 /// The [Working with long-running operations] chapter in the [user guide]
3720 /// covers these operations in detail.
3721 ///
3722 /// [long-running operation]: https://google.aip.dev/151
3723 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3724 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3725 ///
3726 /// # Example
3727 /// ```
3728 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3729 /// use google_cloud_lro::Poller;
3730 /// # extern crate wkt as google_cloud_wkt;
3731 /// use google_cloud_wkt::FieldMask;
3732 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroupAssociation;
3733 /// use google_cloud_networksecurity_v1::Result;
3734 /// async fn sample(
3735 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_association_id: &str
3736 /// ) -> Result<()> {
3737 /// let response = client.update_mirroring_endpoint_group_association()
3738 /// .set_mirroring_endpoint_group_association(
3739 /// MirroringEndpointGroupAssociation::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association_id}"))/* set fields */
3740 /// )
3741 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3742 /// .poller().until_done().await?;
3743 /// println!("response {:?}", response);
3744 /// Ok(())
3745 /// }
3746 /// ```
3747 pub fn update_mirroring_endpoint_group_association(
3748 &self,
3749 ) -> super::builder::mirroring::UpdateMirroringEndpointGroupAssociation {
3750 super::builder::mirroring::UpdateMirroringEndpointGroupAssociation::new(self.inner.clone())
3751 }
3752
3753 /// Deletes an association.
3754 /// See <https://google.aip.dev/135>.
3755 ///
3756 /// # Long running operations
3757 ///
3758 /// This method is used to start, and/or poll a [long-running Operation].
3759 /// The [Working with long-running operations] chapter in the [user guide]
3760 /// covers these operations in detail.
3761 ///
3762 /// [long-running operation]: https://google.aip.dev/151
3763 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3764 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3765 ///
3766 /// # Example
3767 /// ```
3768 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3769 /// use google_cloud_lro::Poller;
3770 /// use google_cloud_networksecurity_v1::Result;
3771 /// async fn sample(
3772 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_association_id: &str
3773 /// ) -> Result<()> {
3774 /// client.delete_mirroring_endpoint_group_association()
3775 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association_id}"))
3776 /// .poller().until_done().await?;
3777 /// Ok(())
3778 /// }
3779 /// ```
3780 pub fn delete_mirroring_endpoint_group_association(
3781 &self,
3782 ) -> super::builder::mirroring::DeleteMirroringEndpointGroupAssociation {
3783 super::builder::mirroring::DeleteMirroringEndpointGroupAssociation::new(self.inner.clone())
3784 }
3785
3786 /// Lists deployment groups in a given project and location.
3787 /// See <https://google.aip.dev/132>.
3788 ///
3789 /// # Example
3790 /// ```
3791 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3792 /// use google_cloud_gax::paginator::ItemPaginator as _;
3793 /// use google_cloud_networksecurity_v1::Result;
3794 /// async fn sample(
3795 /// client: &Mirroring, project_id: &str, location_id: &str
3796 /// ) -> Result<()> {
3797 /// let mut list = client.list_mirroring_deployment_groups()
3798 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3799 /// .by_item();
3800 /// while let Some(item) = list.next().await.transpose()? {
3801 /// println!("{:?}", item);
3802 /// }
3803 /// Ok(())
3804 /// }
3805 /// ```
3806 pub fn list_mirroring_deployment_groups(
3807 &self,
3808 ) -> super::builder::mirroring::ListMirroringDeploymentGroups {
3809 super::builder::mirroring::ListMirroringDeploymentGroups::new(self.inner.clone())
3810 }
3811
3812 /// Gets a specific deployment group.
3813 /// See <https://google.aip.dev/131>.
3814 ///
3815 /// # Example
3816 /// ```
3817 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3818 /// use google_cloud_networksecurity_v1::Result;
3819 /// async fn sample(
3820 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_group_id: &str
3821 /// ) -> Result<()> {
3822 /// let response = client.get_mirroring_deployment_group()
3823 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeploymentGroups/{mirroring_deployment_group_id}"))
3824 /// .send().await?;
3825 /// println!("response {:?}", response);
3826 /// Ok(())
3827 /// }
3828 /// ```
3829 pub fn get_mirroring_deployment_group(
3830 &self,
3831 ) -> super::builder::mirroring::GetMirroringDeploymentGroup {
3832 super::builder::mirroring::GetMirroringDeploymentGroup::new(self.inner.clone())
3833 }
3834
3835 /// Creates a deployment group in a given project and location.
3836 /// See <https://google.aip.dev/133>.
3837 ///
3838 /// # Long running operations
3839 ///
3840 /// This method is used to start, and/or poll a [long-running Operation].
3841 /// The [Working with long-running operations] chapter in the [user guide]
3842 /// covers these operations in detail.
3843 ///
3844 /// [long-running operation]: https://google.aip.dev/151
3845 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3846 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3847 ///
3848 /// # Example
3849 /// ```
3850 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3851 /// use google_cloud_lro::Poller;
3852 /// use google_cloud_networksecurity_v1::model::MirroringDeploymentGroup;
3853 /// use google_cloud_networksecurity_v1::Result;
3854 /// async fn sample(
3855 /// client: &Mirroring, project_id: &str, location_id: &str
3856 /// ) -> Result<()> {
3857 /// let response = client.create_mirroring_deployment_group()
3858 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3859 /// .set_mirroring_deployment_group(
3860 /// MirroringDeploymentGroup::new()/* set fields */
3861 /// )
3862 /// .poller().until_done().await?;
3863 /// println!("response {:?}", response);
3864 /// Ok(())
3865 /// }
3866 /// ```
3867 pub fn create_mirroring_deployment_group(
3868 &self,
3869 ) -> super::builder::mirroring::CreateMirroringDeploymentGroup {
3870 super::builder::mirroring::CreateMirroringDeploymentGroup::new(self.inner.clone())
3871 }
3872
3873 /// Updates a deployment group.
3874 /// See <https://google.aip.dev/134>.
3875 ///
3876 /// # Long running operations
3877 ///
3878 /// This method is used to start, and/or poll a [long-running Operation].
3879 /// The [Working with long-running operations] chapter in the [user guide]
3880 /// covers these operations in detail.
3881 ///
3882 /// [long-running operation]: https://google.aip.dev/151
3883 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3884 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3885 ///
3886 /// # Example
3887 /// ```
3888 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3889 /// use google_cloud_lro::Poller;
3890 /// # extern crate wkt as google_cloud_wkt;
3891 /// use google_cloud_wkt::FieldMask;
3892 /// use google_cloud_networksecurity_v1::model::MirroringDeploymentGroup;
3893 /// use google_cloud_networksecurity_v1::Result;
3894 /// async fn sample(
3895 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_group_id: &str
3896 /// ) -> Result<()> {
3897 /// let response = client.update_mirroring_deployment_group()
3898 /// .set_mirroring_deployment_group(
3899 /// MirroringDeploymentGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeploymentGroups/{mirroring_deployment_group_id}"))/* set fields */
3900 /// )
3901 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3902 /// .poller().until_done().await?;
3903 /// println!("response {:?}", response);
3904 /// Ok(())
3905 /// }
3906 /// ```
3907 pub fn update_mirroring_deployment_group(
3908 &self,
3909 ) -> super::builder::mirroring::UpdateMirroringDeploymentGroup {
3910 super::builder::mirroring::UpdateMirroringDeploymentGroup::new(self.inner.clone())
3911 }
3912
3913 /// Deletes a deployment group.
3914 /// See <https://google.aip.dev/135>.
3915 ///
3916 /// # Long running operations
3917 ///
3918 /// This method is used to start, and/or poll a [long-running Operation].
3919 /// The [Working with long-running operations] chapter in the [user guide]
3920 /// covers these operations in detail.
3921 ///
3922 /// [long-running operation]: https://google.aip.dev/151
3923 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3924 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3925 ///
3926 /// # Example
3927 /// ```
3928 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3929 /// use google_cloud_lro::Poller;
3930 /// use google_cloud_networksecurity_v1::Result;
3931 /// async fn sample(
3932 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_group_id: &str
3933 /// ) -> Result<()> {
3934 /// client.delete_mirroring_deployment_group()
3935 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeploymentGroups/{mirroring_deployment_group_id}"))
3936 /// .poller().until_done().await?;
3937 /// Ok(())
3938 /// }
3939 /// ```
3940 pub fn delete_mirroring_deployment_group(
3941 &self,
3942 ) -> super::builder::mirroring::DeleteMirroringDeploymentGroup {
3943 super::builder::mirroring::DeleteMirroringDeploymentGroup::new(self.inner.clone())
3944 }
3945
3946 /// Lists deployments in a given project and location.
3947 /// See <https://google.aip.dev/132>.
3948 ///
3949 /// # Example
3950 /// ```
3951 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3952 /// use google_cloud_gax::paginator::ItemPaginator as _;
3953 /// use google_cloud_networksecurity_v1::Result;
3954 /// async fn sample(
3955 /// client: &Mirroring, project_id: &str, location_id: &str
3956 /// ) -> Result<()> {
3957 /// let mut list = client.list_mirroring_deployments()
3958 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3959 /// .by_item();
3960 /// while let Some(item) = list.next().await.transpose()? {
3961 /// println!("{:?}", item);
3962 /// }
3963 /// Ok(())
3964 /// }
3965 /// ```
3966 pub fn list_mirroring_deployments(
3967 &self,
3968 ) -> super::builder::mirroring::ListMirroringDeployments {
3969 super::builder::mirroring::ListMirroringDeployments::new(self.inner.clone())
3970 }
3971
3972 /// Gets a specific deployment.
3973 /// See <https://google.aip.dev/131>.
3974 ///
3975 /// # Example
3976 /// ```
3977 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3978 /// use google_cloud_networksecurity_v1::Result;
3979 /// async fn sample(
3980 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_id: &str
3981 /// ) -> Result<()> {
3982 /// let response = client.get_mirroring_deployment()
3983 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeployments/{mirroring_deployment_id}"))
3984 /// .send().await?;
3985 /// println!("response {:?}", response);
3986 /// Ok(())
3987 /// }
3988 /// ```
3989 pub fn get_mirroring_deployment(&self) -> super::builder::mirroring::GetMirroringDeployment {
3990 super::builder::mirroring::GetMirroringDeployment::new(self.inner.clone())
3991 }
3992
3993 /// Creates a deployment in a given project and location.
3994 /// See <https://google.aip.dev/133>.
3995 ///
3996 /// # Long running operations
3997 ///
3998 /// This method is used to start, and/or poll a [long-running Operation].
3999 /// The [Working with long-running operations] chapter in the [user guide]
4000 /// covers these operations in detail.
4001 ///
4002 /// [long-running operation]: https://google.aip.dev/151
4003 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4004 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4005 ///
4006 /// # Example
4007 /// ```
4008 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4009 /// use google_cloud_lro::Poller;
4010 /// use google_cloud_networksecurity_v1::model::MirroringDeployment;
4011 /// use google_cloud_networksecurity_v1::Result;
4012 /// async fn sample(
4013 /// client: &Mirroring, project_id: &str, location_id: &str
4014 /// ) -> Result<()> {
4015 /// let response = client.create_mirroring_deployment()
4016 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4017 /// .set_mirroring_deployment(
4018 /// MirroringDeployment::new()/* set fields */
4019 /// )
4020 /// .poller().until_done().await?;
4021 /// println!("response {:?}", response);
4022 /// Ok(())
4023 /// }
4024 /// ```
4025 pub fn create_mirroring_deployment(
4026 &self,
4027 ) -> super::builder::mirroring::CreateMirroringDeployment {
4028 super::builder::mirroring::CreateMirroringDeployment::new(self.inner.clone())
4029 }
4030
4031 /// Updates a deployment.
4032 /// See <https://google.aip.dev/134>.
4033 ///
4034 /// # Long running operations
4035 ///
4036 /// This method is used to start, and/or poll a [long-running Operation].
4037 /// The [Working with long-running operations] chapter in the [user guide]
4038 /// covers these operations in detail.
4039 ///
4040 /// [long-running operation]: https://google.aip.dev/151
4041 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4042 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4043 ///
4044 /// # Example
4045 /// ```
4046 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4047 /// use google_cloud_lro::Poller;
4048 /// # extern crate wkt as google_cloud_wkt;
4049 /// use google_cloud_wkt::FieldMask;
4050 /// use google_cloud_networksecurity_v1::model::MirroringDeployment;
4051 /// use google_cloud_networksecurity_v1::Result;
4052 /// async fn sample(
4053 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_id: &str
4054 /// ) -> Result<()> {
4055 /// let response = client.update_mirroring_deployment()
4056 /// .set_mirroring_deployment(
4057 /// MirroringDeployment::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeployments/{mirroring_deployment_id}"))/* set fields */
4058 /// )
4059 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4060 /// .poller().until_done().await?;
4061 /// println!("response {:?}", response);
4062 /// Ok(())
4063 /// }
4064 /// ```
4065 pub fn update_mirroring_deployment(
4066 &self,
4067 ) -> super::builder::mirroring::UpdateMirroringDeployment {
4068 super::builder::mirroring::UpdateMirroringDeployment::new(self.inner.clone())
4069 }
4070
4071 /// Deletes a deployment.
4072 /// See <https://google.aip.dev/135>.
4073 ///
4074 /// # Long running operations
4075 ///
4076 /// This method is used to start, and/or poll a [long-running Operation].
4077 /// The [Working with long-running operations] chapter in the [user guide]
4078 /// covers these operations in detail.
4079 ///
4080 /// [long-running operation]: https://google.aip.dev/151
4081 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4082 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4083 ///
4084 /// # Example
4085 /// ```
4086 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4087 /// use google_cloud_lro::Poller;
4088 /// use google_cloud_networksecurity_v1::Result;
4089 /// async fn sample(
4090 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_id: &str
4091 /// ) -> Result<()> {
4092 /// client.delete_mirroring_deployment()
4093 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeployments/{mirroring_deployment_id}"))
4094 /// .poller().until_done().await?;
4095 /// Ok(())
4096 /// }
4097 /// ```
4098 pub fn delete_mirroring_deployment(
4099 &self,
4100 ) -> super::builder::mirroring::DeleteMirroringDeployment {
4101 super::builder::mirroring::DeleteMirroringDeployment::new(self.inner.clone())
4102 }
4103
4104 /// Lists information about the supported locations for this service.
4105 ///
4106 /// This method lists locations based on the resource scope provided in
4107 /// the [ListLocationsRequest.name] field:
4108 ///
4109 /// * **Global locations**: If `name` is empty, the method lists the
4110 /// public locations available to all projects. * **Project-specific
4111 /// locations**: If `name` follows the format
4112 /// `projects/{project}`, the method lists locations visible to that
4113 /// specific project. This includes public, private, or other
4114 /// project-specific locations enabled for the project.
4115 ///
4116 /// For gRPC and client library implementations, the resource name is
4117 /// passed as the `name` field. For direct service calls, the resource
4118 /// name is
4119 /// incorporated into the request path based on the specific service
4120 /// implementation and version.
4121 ///
4122 /// # Example
4123 /// ```
4124 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4125 /// use google_cloud_gax::paginator::ItemPaginator as _;
4126 /// use google_cloud_networksecurity_v1::Result;
4127 /// async fn sample(
4128 /// client: &Mirroring
4129 /// ) -> Result<()> {
4130 /// let mut list = client.list_locations()
4131 /// /* set fields */
4132 /// .by_item();
4133 /// while let Some(item) = list.next().await.transpose()? {
4134 /// println!("{:?}", item);
4135 /// }
4136 /// Ok(())
4137 /// }
4138 /// ```
4139 pub fn list_locations(&self) -> super::builder::mirroring::ListLocations {
4140 super::builder::mirroring::ListLocations::new(self.inner.clone())
4141 }
4142
4143 /// Gets information about a location.
4144 ///
4145 /// # Example
4146 /// ```
4147 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4148 /// use google_cloud_networksecurity_v1::Result;
4149 /// async fn sample(
4150 /// client: &Mirroring
4151 /// ) -> Result<()> {
4152 /// let response = client.get_location()
4153 /// /* set fields */
4154 /// .send().await?;
4155 /// println!("response {:?}", response);
4156 /// Ok(())
4157 /// }
4158 /// ```
4159 pub fn get_location(&self) -> super::builder::mirroring::GetLocation {
4160 super::builder::mirroring::GetLocation::new(self.inner.clone())
4161 }
4162
4163 /// Sets the access control policy on the specified resource. Replaces
4164 /// any existing policy.
4165 ///
4166 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4167 /// errors.
4168 ///
4169 /// # Example
4170 /// ```
4171 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4172 /// use google_cloud_networksecurity_v1::Result;
4173 /// async fn sample(
4174 /// client: &Mirroring
4175 /// ) -> Result<()> {
4176 /// let response = client.set_iam_policy()
4177 /// /* set fields */
4178 /// .send().await?;
4179 /// println!("response {:?}", response);
4180 /// Ok(())
4181 /// }
4182 /// ```
4183 pub fn set_iam_policy(&self) -> super::builder::mirroring::SetIamPolicy {
4184 super::builder::mirroring::SetIamPolicy::new(self.inner.clone())
4185 }
4186
4187 /// Gets the access control policy for a resource. Returns an empty policy
4188 /// if the resource exists and does not have a policy set.
4189 ///
4190 /// # Example
4191 /// ```
4192 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4193 /// use google_cloud_networksecurity_v1::Result;
4194 /// async fn sample(
4195 /// client: &Mirroring
4196 /// ) -> Result<()> {
4197 /// let response = client.get_iam_policy()
4198 /// /* set fields */
4199 /// .send().await?;
4200 /// println!("response {:?}", response);
4201 /// Ok(())
4202 /// }
4203 /// ```
4204 pub fn get_iam_policy(&self) -> super::builder::mirroring::GetIamPolicy {
4205 super::builder::mirroring::GetIamPolicy::new(self.inner.clone())
4206 }
4207
4208 /// Returns permissions that a caller has on the specified resource. If the
4209 /// resource does not exist, this will return an empty set of
4210 /// permissions, not a `NOT_FOUND` error.
4211 ///
4212 /// Note: This operation is designed to be used for building
4213 /// permission-aware UIs and command-line tools, not for authorization
4214 /// checking. This operation may "fail open" without warning.
4215 ///
4216 /// # Example
4217 /// ```
4218 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4219 /// use google_cloud_networksecurity_v1::Result;
4220 /// async fn sample(
4221 /// client: &Mirroring
4222 /// ) -> Result<()> {
4223 /// let response = client.test_iam_permissions()
4224 /// /* set fields */
4225 /// .send().await?;
4226 /// println!("response {:?}", response);
4227 /// Ok(())
4228 /// }
4229 /// ```
4230 pub fn test_iam_permissions(&self) -> super::builder::mirroring::TestIamPermissions {
4231 super::builder::mirroring::TestIamPermissions::new(self.inner.clone())
4232 }
4233
4234 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4235 ///
4236 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4237 ///
4238 /// # Example
4239 /// ```
4240 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4241 /// use google_cloud_gax::paginator::ItemPaginator as _;
4242 /// use google_cloud_networksecurity_v1::Result;
4243 /// async fn sample(
4244 /// client: &Mirroring
4245 /// ) -> Result<()> {
4246 /// let mut list = client.list_operations()
4247 /// /* set fields */
4248 /// .by_item();
4249 /// while let Some(item) = list.next().await.transpose()? {
4250 /// println!("{:?}", item);
4251 /// }
4252 /// Ok(())
4253 /// }
4254 /// ```
4255 pub fn list_operations(&self) -> super::builder::mirroring::ListOperations {
4256 super::builder::mirroring::ListOperations::new(self.inner.clone())
4257 }
4258
4259 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4260 ///
4261 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4262 ///
4263 /// # Example
4264 /// ```
4265 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4266 /// use google_cloud_networksecurity_v1::Result;
4267 /// async fn sample(
4268 /// client: &Mirroring
4269 /// ) -> Result<()> {
4270 /// let response = client.get_operation()
4271 /// /* set fields */
4272 /// .send().await?;
4273 /// println!("response {:?}", response);
4274 /// Ok(())
4275 /// }
4276 /// ```
4277 pub fn get_operation(&self) -> super::builder::mirroring::GetOperation {
4278 super::builder::mirroring::GetOperation::new(self.inner.clone())
4279 }
4280
4281 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4282 ///
4283 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4284 ///
4285 /// # Example
4286 /// ```
4287 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4288 /// use google_cloud_networksecurity_v1::Result;
4289 /// async fn sample(
4290 /// client: &Mirroring
4291 /// ) -> Result<()> {
4292 /// client.delete_operation()
4293 /// /* set fields */
4294 /// .send().await?;
4295 /// Ok(())
4296 /// }
4297 /// ```
4298 pub fn delete_operation(&self) -> super::builder::mirroring::DeleteOperation {
4299 super::builder::mirroring::DeleteOperation::new(self.inner.clone())
4300 }
4301
4302 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4303 ///
4304 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4305 ///
4306 /// # Example
4307 /// ```
4308 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4309 /// use google_cloud_networksecurity_v1::Result;
4310 /// async fn sample(
4311 /// client: &Mirroring
4312 /// ) -> Result<()> {
4313 /// client.cancel_operation()
4314 /// /* set fields */
4315 /// .send().await?;
4316 /// Ok(())
4317 /// }
4318 /// ```
4319 pub fn cancel_operation(&self) -> super::builder::mirroring::CancelOperation {
4320 super::builder::mirroring::CancelOperation::new(self.inner.clone())
4321 }
4322}
4323
4324/// Implements a client for the Network Security API.
4325///
4326/// # Example
4327/// ```
4328/// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4329/// use google_cloud_gax::paginator::ItemPaginator as _;
4330/// async fn sample(
4331/// parent: &str,
4332/// ) -> anyhow::Result<()> {
4333/// let client = NetworkSecurity::builder().build().await?;
4334/// let mut list = client.list_authorization_policies()
4335/// .set_parent(parent)
4336/// .by_item();
4337/// while let Some(item) = list.next().await.transpose()? {
4338/// println!("{:?}", item);
4339/// }
4340/// Ok(())
4341/// }
4342/// ```
4343///
4344/// # Service Description
4345///
4346/// Network Security API provides resources to configure authentication and
4347/// authorization policies. Refer to per API resource documentation for more
4348/// information.
4349///
4350/// # Configuration
4351///
4352/// To configure `NetworkSecurity` use the `with_*` methods in the type returned
4353/// by [builder()][NetworkSecurity::builder]. The default configuration should
4354/// work for most applications. Common configuration changes include
4355///
4356/// * [with_endpoint()]: by default this client uses the global default endpoint
4357/// (`https://networksecurity.googleapis.com`). Applications using regional
4358/// endpoints or running in restricted networks (e.g. a network configured
4359// with [Private Google Access with VPC Service Controls]) may want to
4360/// override this default.
4361/// * [with_credentials()]: by default this client uses
4362/// [Application Default Credentials]. Applications using custom
4363/// authentication may need to override this default.
4364///
4365/// [with_endpoint()]: super::builder::network_security::ClientBuilder::with_endpoint
4366/// [with_credentials()]: super::builder::network_security::ClientBuilder::with_credentials
4367/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4368/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4369///
4370/// # Pooling and Cloning
4371///
4372/// `NetworkSecurity` holds a connection pool internally, it is advised to
4373/// create one and reuse it. You do not need to wrap `NetworkSecurity` in
4374/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4375/// already uses an `Arc` internally.
4376#[derive(Clone, Debug)]
4377pub struct NetworkSecurity {
4378 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>,
4379}
4380
4381impl NetworkSecurity {
4382 /// Returns a builder for [NetworkSecurity].
4383 ///
4384 /// ```
4385 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4386 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4387 /// let client = NetworkSecurity::builder().build().await?;
4388 /// # Ok(()) }
4389 /// ```
4390 pub fn builder() -> super::builder::network_security::ClientBuilder {
4391 crate::new_client_builder(super::builder::network_security::client::Factory)
4392 }
4393
4394 /// Creates a new client from the provided stub.
4395 ///
4396 /// The most common case for calling this function is in tests mocking the
4397 /// client's behavior.
4398 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4399 where
4400 T: super::stub::NetworkSecurity + 'static,
4401 {
4402 Self { inner: stub.into() }
4403 }
4404
4405 pub(crate) async fn new(
4406 config: gaxi::options::ClientConfig,
4407 ) -> crate::ClientBuilderResult<Self> {
4408 let inner = Self::build_inner(config).await?;
4409 Ok(Self { inner })
4410 }
4411
4412 async fn build_inner(
4413 conf: gaxi::options::ClientConfig,
4414 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>> {
4415 if gaxi::options::tracing_enabled(&conf) {
4416 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4417 }
4418 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4419 }
4420
4421 async fn build_transport(
4422 conf: gaxi::options::ClientConfig,
4423 ) -> crate::ClientBuilderResult<impl super::stub::NetworkSecurity> {
4424 super::transport::NetworkSecurity::new(conf).await
4425 }
4426
4427 async fn build_with_tracing(
4428 conf: gaxi::options::ClientConfig,
4429 ) -> crate::ClientBuilderResult<impl super::stub::NetworkSecurity> {
4430 Self::build_transport(conf)
4431 .await
4432 .map(super::tracing::NetworkSecurity::new)
4433 }
4434
4435 /// Lists AuthorizationPolicies in a given project and location.
4436 ///
4437 /// # Example
4438 /// ```
4439 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4440 /// use google_cloud_gax::paginator::ItemPaginator as _;
4441 /// use google_cloud_networksecurity_v1::Result;
4442 /// async fn sample(
4443 /// client: &NetworkSecurity, parent: &str
4444 /// ) -> Result<()> {
4445 /// let mut list = client.list_authorization_policies()
4446 /// .set_parent(parent)
4447 /// .by_item();
4448 /// while let Some(item) = list.next().await.transpose()? {
4449 /// println!("{:?}", item);
4450 /// }
4451 /// Ok(())
4452 /// }
4453 /// ```
4454 pub fn list_authorization_policies(
4455 &self,
4456 ) -> super::builder::network_security::ListAuthorizationPolicies {
4457 super::builder::network_security::ListAuthorizationPolicies::new(self.inner.clone())
4458 }
4459
4460 /// Gets details of a single AuthorizationPolicy.
4461 ///
4462 /// # Example
4463 /// ```
4464 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4465 /// use google_cloud_networksecurity_v1::Result;
4466 /// async fn sample(
4467 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authorization_policy_id: &str
4468 /// ) -> Result<()> {
4469 /// let response = client.get_authorization_policy()
4470 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authorizationPolicies/{authorization_policy_id}"))
4471 /// .send().await?;
4472 /// println!("response {:?}", response);
4473 /// Ok(())
4474 /// }
4475 /// ```
4476 pub fn get_authorization_policy(
4477 &self,
4478 ) -> super::builder::network_security::GetAuthorizationPolicy {
4479 super::builder::network_security::GetAuthorizationPolicy::new(self.inner.clone())
4480 }
4481
4482 /// Creates a new AuthorizationPolicy in a given project and location.
4483 ///
4484 /// # Long running operations
4485 ///
4486 /// This method is used to start, and/or poll a [long-running Operation].
4487 /// The [Working with long-running operations] chapter in the [user guide]
4488 /// covers these operations in detail.
4489 ///
4490 /// [long-running operation]: https://google.aip.dev/151
4491 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4492 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4493 ///
4494 /// # Example
4495 /// ```
4496 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4497 /// use google_cloud_lro::Poller;
4498 /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
4499 /// use google_cloud_networksecurity_v1::Result;
4500 /// async fn sample(
4501 /// client: &NetworkSecurity, project_id: &str, location_id: &str
4502 /// ) -> Result<()> {
4503 /// let response = client.create_authorization_policy()
4504 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4505 /// .set_authorization_policy(
4506 /// AuthorizationPolicy::new()/* set fields */
4507 /// )
4508 /// .poller().until_done().await?;
4509 /// println!("response {:?}", response);
4510 /// Ok(())
4511 /// }
4512 /// ```
4513 pub fn create_authorization_policy(
4514 &self,
4515 ) -> super::builder::network_security::CreateAuthorizationPolicy {
4516 super::builder::network_security::CreateAuthorizationPolicy::new(self.inner.clone())
4517 }
4518
4519 /// Updates the parameters of a single AuthorizationPolicy.
4520 ///
4521 /// # Long running operations
4522 ///
4523 /// This method is used to start, and/or poll a [long-running Operation].
4524 /// The [Working with long-running operations] chapter in the [user guide]
4525 /// covers these operations in detail.
4526 ///
4527 /// [long-running operation]: https://google.aip.dev/151
4528 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4529 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4530 ///
4531 /// # Example
4532 /// ```
4533 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4534 /// use google_cloud_lro::Poller;
4535 /// # extern crate wkt as google_cloud_wkt;
4536 /// use google_cloud_wkt::FieldMask;
4537 /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
4538 /// use google_cloud_networksecurity_v1::Result;
4539 /// async fn sample(
4540 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authorization_policy_id: &str
4541 /// ) -> Result<()> {
4542 /// let response = client.update_authorization_policy()
4543 /// .set_authorization_policy(
4544 /// AuthorizationPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/authorizationPolicies/{authorization_policy_id}"))/* set fields */
4545 /// )
4546 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4547 /// .poller().until_done().await?;
4548 /// println!("response {:?}", response);
4549 /// Ok(())
4550 /// }
4551 /// ```
4552 pub fn update_authorization_policy(
4553 &self,
4554 ) -> super::builder::network_security::UpdateAuthorizationPolicy {
4555 super::builder::network_security::UpdateAuthorizationPolicy::new(self.inner.clone())
4556 }
4557
4558 /// Deletes a single AuthorizationPolicy.
4559 ///
4560 /// # Long running operations
4561 ///
4562 /// This method is used to start, and/or poll a [long-running Operation].
4563 /// The [Working with long-running operations] chapter in the [user guide]
4564 /// covers these operations in detail.
4565 ///
4566 /// [long-running operation]: https://google.aip.dev/151
4567 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4568 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4569 ///
4570 /// # Example
4571 /// ```
4572 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4573 /// use google_cloud_lro::Poller;
4574 /// use google_cloud_networksecurity_v1::Result;
4575 /// async fn sample(
4576 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authorization_policy_id: &str
4577 /// ) -> Result<()> {
4578 /// client.delete_authorization_policy()
4579 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authorizationPolicies/{authorization_policy_id}"))
4580 /// .poller().until_done().await?;
4581 /// Ok(())
4582 /// }
4583 /// ```
4584 pub fn delete_authorization_policy(
4585 &self,
4586 ) -> super::builder::network_security::DeleteAuthorizationPolicy {
4587 super::builder::network_security::DeleteAuthorizationPolicy::new(self.inner.clone())
4588 }
4589
4590 /// Lists BackendAuthenticationConfigs in a given project and location.
4591 ///
4592 /// # Example
4593 /// ```
4594 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4595 /// use google_cloud_gax::paginator::ItemPaginator as _;
4596 /// use google_cloud_networksecurity_v1::Result;
4597 /// async fn sample(
4598 /// client: &NetworkSecurity, parent: &str
4599 /// ) -> Result<()> {
4600 /// let mut list = client.list_backend_authentication_configs()
4601 /// .set_parent(parent)
4602 /// .by_item();
4603 /// while let Some(item) = list.next().await.transpose()? {
4604 /// println!("{:?}", item);
4605 /// }
4606 /// Ok(())
4607 /// }
4608 /// ```
4609 pub fn list_backend_authentication_configs(
4610 &self,
4611 ) -> super::builder::network_security::ListBackendAuthenticationConfigs {
4612 super::builder::network_security::ListBackendAuthenticationConfigs::new(self.inner.clone())
4613 }
4614
4615 /// Gets details of a single BackendAuthenticationConfig to
4616 /// BackendAuthenticationConfig.
4617 ///
4618 /// # Example
4619 /// ```
4620 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4621 /// use google_cloud_networksecurity_v1::Result;
4622 /// async fn sample(
4623 /// client: &NetworkSecurity, project_id: &str, location_id: &str, backend_authentication_config_id: &str
4624 /// ) -> Result<()> {
4625 /// let response = client.get_backend_authentication_config()
4626 /// .set_name(format!("projects/{project_id}/locations/{location_id}/backendAuthenticationConfigs/{backend_authentication_config_id}"))
4627 /// .send().await?;
4628 /// println!("response {:?}", response);
4629 /// Ok(())
4630 /// }
4631 /// ```
4632 pub fn get_backend_authentication_config(
4633 &self,
4634 ) -> super::builder::network_security::GetBackendAuthenticationConfig {
4635 super::builder::network_security::GetBackendAuthenticationConfig::new(self.inner.clone())
4636 }
4637
4638 /// Creates a new BackendAuthenticationConfig in a given project and location.
4639 ///
4640 /// # Long running operations
4641 ///
4642 /// This method is used to start, and/or poll a [long-running Operation].
4643 /// The [Working with long-running operations] chapter in the [user guide]
4644 /// covers these operations in detail.
4645 ///
4646 /// [long-running operation]: https://google.aip.dev/151
4647 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4648 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4649 ///
4650 /// # Example
4651 /// ```
4652 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4653 /// use google_cloud_lro::Poller;
4654 /// use google_cloud_networksecurity_v1::model::BackendAuthenticationConfig;
4655 /// use google_cloud_networksecurity_v1::Result;
4656 /// async fn sample(
4657 /// client: &NetworkSecurity, project_id: &str, location_id: &str
4658 /// ) -> Result<()> {
4659 /// let response = client.create_backend_authentication_config()
4660 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4661 /// .set_backend_authentication_config(
4662 /// BackendAuthenticationConfig::new()/* set fields */
4663 /// )
4664 /// .poller().until_done().await?;
4665 /// println!("response {:?}", response);
4666 /// Ok(())
4667 /// }
4668 /// ```
4669 pub fn create_backend_authentication_config(
4670 &self,
4671 ) -> super::builder::network_security::CreateBackendAuthenticationConfig {
4672 super::builder::network_security::CreateBackendAuthenticationConfig::new(self.inner.clone())
4673 }
4674
4675 /// Updates the parameters of a single BackendAuthenticationConfig to
4676 /// BackendAuthenticationConfig.
4677 ///
4678 /// # Long running operations
4679 ///
4680 /// This method is used to start, and/or poll a [long-running Operation].
4681 /// The [Working with long-running operations] chapter in the [user guide]
4682 /// covers these operations in detail.
4683 ///
4684 /// [long-running operation]: https://google.aip.dev/151
4685 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4686 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4687 ///
4688 /// # Example
4689 /// ```
4690 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4691 /// use google_cloud_lro::Poller;
4692 /// # extern crate wkt as google_cloud_wkt;
4693 /// use google_cloud_wkt::FieldMask;
4694 /// use google_cloud_networksecurity_v1::model::BackendAuthenticationConfig;
4695 /// use google_cloud_networksecurity_v1::Result;
4696 /// async fn sample(
4697 /// client: &NetworkSecurity, project_id: &str, location_id: &str, backend_authentication_config_id: &str
4698 /// ) -> Result<()> {
4699 /// let response = client.update_backend_authentication_config()
4700 /// .set_backend_authentication_config(
4701 /// BackendAuthenticationConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/backendAuthenticationConfigs/{backend_authentication_config_id}"))/* set fields */
4702 /// )
4703 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4704 /// .poller().until_done().await?;
4705 /// println!("response {:?}", response);
4706 /// Ok(())
4707 /// }
4708 /// ```
4709 pub fn update_backend_authentication_config(
4710 &self,
4711 ) -> super::builder::network_security::UpdateBackendAuthenticationConfig {
4712 super::builder::network_security::UpdateBackendAuthenticationConfig::new(self.inner.clone())
4713 }
4714
4715 /// Deletes a single BackendAuthenticationConfig to
4716 /// BackendAuthenticationConfig.
4717 ///
4718 /// # Long running operations
4719 ///
4720 /// This method is used to start, and/or poll a [long-running Operation].
4721 /// The [Working with long-running operations] chapter in the [user guide]
4722 /// covers these operations in detail.
4723 ///
4724 /// [long-running operation]: https://google.aip.dev/151
4725 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4726 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4727 ///
4728 /// # Example
4729 /// ```
4730 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4731 /// use google_cloud_lro::Poller;
4732 /// use google_cloud_networksecurity_v1::Result;
4733 /// async fn sample(
4734 /// client: &NetworkSecurity, project_id: &str, location_id: &str, backend_authentication_config_id: &str
4735 /// ) -> Result<()> {
4736 /// client.delete_backend_authentication_config()
4737 /// .set_name(format!("projects/{project_id}/locations/{location_id}/backendAuthenticationConfigs/{backend_authentication_config_id}"))
4738 /// .poller().until_done().await?;
4739 /// Ok(())
4740 /// }
4741 /// ```
4742 pub fn delete_backend_authentication_config(
4743 &self,
4744 ) -> super::builder::network_security::DeleteBackendAuthenticationConfig {
4745 super::builder::network_security::DeleteBackendAuthenticationConfig::new(self.inner.clone())
4746 }
4747
4748 /// Lists ServerTlsPolicies in a given project and location.
4749 ///
4750 /// # Example
4751 /// ```
4752 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4753 /// use google_cloud_gax::paginator::ItemPaginator as _;
4754 /// use google_cloud_networksecurity_v1::Result;
4755 /// async fn sample(
4756 /// client: &NetworkSecurity, parent: &str
4757 /// ) -> Result<()> {
4758 /// let mut list = client.list_server_tls_policies()
4759 /// .set_parent(parent)
4760 /// .by_item();
4761 /// while let Some(item) = list.next().await.transpose()? {
4762 /// println!("{:?}", item);
4763 /// }
4764 /// Ok(())
4765 /// }
4766 /// ```
4767 pub fn list_server_tls_policies(
4768 &self,
4769 ) -> super::builder::network_security::ListServerTlsPolicies {
4770 super::builder::network_security::ListServerTlsPolicies::new(self.inner.clone())
4771 }
4772
4773 /// Gets details of a single ServerTlsPolicy.
4774 ///
4775 /// # Example
4776 /// ```
4777 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4778 /// use google_cloud_networksecurity_v1::Result;
4779 /// async fn sample(
4780 /// client: &NetworkSecurity, project_id: &str, location_id: &str, server_tls_policy_id: &str
4781 /// ) -> Result<()> {
4782 /// let response = client.get_server_tls_policy()
4783 /// .set_name(format!("projects/{project_id}/locations/{location_id}/serverTlsPolicies/{server_tls_policy_id}"))
4784 /// .send().await?;
4785 /// println!("response {:?}", response);
4786 /// Ok(())
4787 /// }
4788 /// ```
4789 pub fn get_server_tls_policy(&self) -> super::builder::network_security::GetServerTlsPolicy {
4790 super::builder::network_security::GetServerTlsPolicy::new(self.inner.clone())
4791 }
4792
4793 /// Creates a new ServerTlsPolicy in a given project and location.
4794 ///
4795 /// # Long running operations
4796 ///
4797 /// This method is used to start, and/or poll a [long-running Operation].
4798 /// The [Working with long-running operations] chapter in the [user guide]
4799 /// covers these operations in detail.
4800 ///
4801 /// [long-running operation]: https://google.aip.dev/151
4802 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4803 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4804 ///
4805 /// # Example
4806 /// ```
4807 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4808 /// use google_cloud_lro::Poller;
4809 /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
4810 /// use google_cloud_networksecurity_v1::Result;
4811 /// async fn sample(
4812 /// client: &NetworkSecurity, project_id: &str, location_id: &str
4813 /// ) -> Result<()> {
4814 /// let response = client.create_server_tls_policy()
4815 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4816 /// .set_server_tls_policy(
4817 /// ServerTlsPolicy::new()/* set fields */
4818 /// )
4819 /// .poller().until_done().await?;
4820 /// println!("response {:?}", response);
4821 /// Ok(())
4822 /// }
4823 /// ```
4824 pub fn create_server_tls_policy(
4825 &self,
4826 ) -> super::builder::network_security::CreateServerTlsPolicy {
4827 super::builder::network_security::CreateServerTlsPolicy::new(self.inner.clone())
4828 }
4829
4830 /// Updates the parameters of a single ServerTlsPolicy.
4831 ///
4832 /// # Long running operations
4833 ///
4834 /// This method is used to start, and/or poll a [long-running Operation].
4835 /// The [Working with long-running operations] chapter in the [user guide]
4836 /// covers these operations in detail.
4837 ///
4838 /// [long-running operation]: https://google.aip.dev/151
4839 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4840 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4841 ///
4842 /// # Example
4843 /// ```
4844 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4845 /// use google_cloud_lro::Poller;
4846 /// # extern crate wkt as google_cloud_wkt;
4847 /// use google_cloud_wkt::FieldMask;
4848 /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
4849 /// use google_cloud_networksecurity_v1::Result;
4850 /// async fn sample(
4851 /// client: &NetworkSecurity, project_id: &str, location_id: &str, server_tls_policy_id: &str
4852 /// ) -> Result<()> {
4853 /// let response = client.update_server_tls_policy()
4854 /// .set_server_tls_policy(
4855 /// ServerTlsPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/serverTlsPolicies/{server_tls_policy_id}"))/* set fields */
4856 /// )
4857 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4858 /// .poller().until_done().await?;
4859 /// println!("response {:?}", response);
4860 /// Ok(())
4861 /// }
4862 /// ```
4863 pub fn update_server_tls_policy(
4864 &self,
4865 ) -> super::builder::network_security::UpdateServerTlsPolicy {
4866 super::builder::network_security::UpdateServerTlsPolicy::new(self.inner.clone())
4867 }
4868
4869 /// Deletes a single ServerTlsPolicy.
4870 ///
4871 /// # Long running operations
4872 ///
4873 /// This method is used to start, and/or poll a [long-running Operation].
4874 /// The [Working with long-running operations] chapter in the [user guide]
4875 /// covers these operations in detail.
4876 ///
4877 /// [long-running operation]: https://google.aip.dev/151
4878 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4879 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4880 ///
4881 /// # Example
4882 /// ```
4883 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4884 /// use google_cloud_lro::Poller;
4885 /// use google_cloud_networksecurity_v1::Result;
4886 /// async fn sample(
4887 /// client: &NetworkSecurity, project_id: &str, location_id: &str, server_tls_policy_id: &str
4888 /// ) -> Result<()> {
4889 /// client.delete_server_tls_policy()
4890 /// .set_name(format!("projects/{project_id}/locations/{location_id}/serverTlsPolicies/{server_tls_policy_id}"))
4891 /// .poller().until_done().await?;
4892 /// Ok(())
4893 /// }
4894 /// ```
4895 pub fn delete_server_tls_policy(
4896 &self,
4897 ) -> super::builder::network_security::DeleteServerTlsPolicy {
4898 super::builder::network_security::DeleteServerTlsPolicy::new(self.inner.clone())
4899 }
4900
4901 /// Lists ClientTlsPolicies in a given project and location.
4902 ///
4903 /// # Example
4904 /// ```
4905 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4906 /// use google_cloud_gax::paginator::ItemPaginator as _;
4907 /// use google_cloud_networksecurity_v1::Result;
4908 /// async fn sample(
4909 /// client: &NetworkSecurity, parent: &str
4910 /// ) -> Result<()> {
4911 /// let mut list = client.list_client_tls_policies()
4912 /// .set_parent(parent)
4913 /// .by_item();
4914 /// while let Some(item) = list.next().await.transpose()? {
4915 /// println!("{:?}", item);
4916 /// }
4917 /// Ok(())
4918 /// }
4919 /// ```
4920 pub fn list_client_tls_policies(
4921 &self,
4922 ) -> super::builder::network_security::ListClientTlsPolicies {
4923 super::builder::network_security::ListClientTlsPolicies::new(self.inner.clone())
4924 }
4925
4926 /// Gets details of a single ClientTlsPolicy.
4927 ///
4928 /// # Example
4929 /// ```
4930 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4931 /// use google_cloud_networksecurity_v1::Result;
4932 /// async fn sample(
4933 /// client: &NetworkSecurity, project_id: &str, location_id: &str, client_tls_policy_id: &str
4934 /// ) -> Result<()> {
4935 /// let response = client.get_client_tls_policy()
4936 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clientTlsPolicies/{client_tls_policy_id}"))
4937 /// .send().await?;
4938 /// println!("response {:?}", response);
4939 /// Ok(())
4940 /// }
4941 /// ```
4942 pub fn get_client_tls_policy(&self) -> super::builder::network_security::GetClientTlsPolicy {
4943 super::builder::network_security::GetClientTlsPolicy::new(self.inner.clone())
4944 }
4945
4946 /// Creates a new ClientTlsPolicy in a given project and location.
4947 ///
4948 /// # Long running operations
4949 ///
4950 /// This method is used to start, and/or poll a [long-running Operation].
4951 /// The [Working with long-running operations] chapter in the [user guide]
4952 /// covers these operations in detail.
4953 ///
4954 /// [long-running operation]: https://google.aip.dev/151
4955 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4956 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4957 ///
4958 /// # Example
4959 /// ```
4960 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4961 /// use google_cloud_lro::Poller;
4962 /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
4963 /// use google_cloud_networksecurity_v1::Result;
4964 /// async fn sample(
4965 /// client: &NetworkSecurity, project_id: &str, location_id: &str
4966 /// ) -> Result<()> {
4967 /// let response = client.create_client_tls_policy()
4968 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4969 /// .set_client_tls_policy(
4970 /// ClientTlsPolicy::new()/* set fields */
4971 /// )
4972 /// .poller().until_done().await?;
4973 /// println!("response {:?}", response);
4974 /// Ok(())
4975 /// }
4976 /// ```
4977 pub fn create_client_tls_policy(
4978 &self,
4979 ) -> super::builder::network_security::CreateClientTlsPolicy {
4980 super::builder::network_security::CreateClientTlsPolicy::new(self.inner.clone())
4981 }
4982
4983 /// Updates the parameters of a single ClientTlsPolicy.
4984 ///
4985 /// # Long running operations
4986 ///
4987 /// This method is used to start, and/or poll a [long-running Operation].
4988 /// The [Working with long-running operations] chapter in the [user guide]
4989 /// covers these operations in detail.
4990 ///
4991 /// [long-running operation]: https://google.aip.dev/151
4992 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4993 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4994 ///
4995 /// # Example
4996 /// ```
4997 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4998 /// use google_cloud_lro::Poller;
4999 /// # extern crate wkt as google_cloud_wkt;
5000 /// use google_cloud_wkt::FieldMask;
5001 /// use google_cloud_networksecurity_v1::model::ClientTlsPolicy;
5002 /// use google_cloud_networksecurity_v1::Result;
5003 /// async fn sample(
5004 /// client: &NetworkSecurity, project_id: &str, location_id: &str, client_tls_policy_id: &str
5005 /// ) -> Result<()> {
5006 /// let response = client.update_client_tls_policy()
5007 /// .set_client_tls_policy(
5008 /// ClientTlsPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/clientTlsPolicies/{client_tls_policy_id}"))/* set fields */
5009 /// )
5010 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5011 /// .poller().until_done().await?;
5012 /// println!("response {:?}", response);
5013 /// Ok(())
5014 /// }
5015 /// ```
5016 pub fn update_client_tls_policy(
5017 &self,
5018 ) -> super::builder::network_security::UpdateClientTlsPolicy {
5019 super::builder::network_security::UpdateClientTlsPolicy::new(self.inner.clone())
5020 }
5021
5022 /// Deletes a single ClientTlsPolicy.
5023 ///
5024 /// # Long running operations
5025 ///
5026 /// This method is used to start, and/or poll a [long-running Operation].
5027 /// The [Working with long-running operations] chapter in the [user guide]
5028 /// covers these operations in detail.
5029 ///
5030 /// [long-running operation]: https://google.aip.dev/151
5031 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5032 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5033 ///
5034 /// # Example
5035 /// ```
5036 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5037 /// use google_cloud_lro::Poller;
5038 /// use google_cloud_networksecurity_v1::Result;
5039 /// async fn sample(
5040 /// client: &NetworkSecurity, project_id: &str, location_id: &str, client_tls_policy_id: &str
5041 /// ) -> Result<()> {
5042 /// client.delete_client_tls_policy()
5043 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clientTlsPolicies/{client_tls_policy_id}"))
5044 /// .poller().until_done().await?;
5045 /// Ok(())
5046 /// }
5047 /// ```
5048 pub fn delete_client_tls_policy(
5049 &self,
5050 ) -> super::builder::network_security::DeleteClientTlsPolicy {
5051 super::builder::network_security::DeleteClientTlsPolicy::new(self.inner.clone())
5052 }
5053
5054 /// Lists GatewaySecurityPolicies in a given project and location.
5055 ///
5056 /// # Example
5057 /// ```
5058 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5059 /// use google_cloud_gax::paginator::ItemPaginator as _;
5060 /// use google_cloud_networksecurity_v1::Result;
5061 /// async fn sample(
5062 /// client: &NetworkSecurity, parent: &str
5063 /// ) -> Result<()> {
5064 /// let mut list = client.list_gateway_security_policies()
5065 /// .set_parent(parent)
5066 /// .by_item();
5067 /// while let Some(item) = list.next().await.transpose()? {
5068 /// println!("{:?}", item);
5069 /// }
5070 /// Ok(())
5071 /// }
5072 /// ```
5073 pub fn list_gateway_security_policies(
5074 &self,
5075 ) -> super::builder::network_security::ListGatewaySecurityPolicies {
5076 super::builder::network_security::ListGatewaySecurityPolicies::new(self.inner.clone())
5077 }
5078
5079 /// Gets details of a single GatewaySecurityPolicy.
5080 ///
5081 /// # Example
5082 /// ```
5083 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5084 /// use google_cloud_networksecurity_v1::Result;
5085 /// async fn sample(
5086 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5087 /// ) -> Result<()> {
5088 /// let response = client.get_gateway_security_policy()
5089 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5090 /// .send().await?;
5091 /// println!("response {:?}", response);
5092 /// Ok(())
5093 /// }
5094 /// ```
5095 pub fn get_gateway_security_policy(
5096 &self,
5097 ) -> super::builder::network_security::GetGatewaySecurityPolicy {
5098 super::builder::network_security::GetGatewaySecurityPolicy::new(self.inner.clone())
5099 }
5100
5101 /// Creates a new GatewaySecurityPolicy in a given project and location.
5102 ///
5103 /// # Long running operations
5104 ///
5105 /// This method is used to start, and/or poll a [long-running Operation].
5106 /// The [Working with long-running operations] chapter in the [user guide]
5107 /// covers these operations in detail.
5108 ///
5109 /// [long-running operation]: https://google.aip.dev/151
5110 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5111 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5112 ///
5113 /// # Example
5114 /// ```
5115 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5116 /// use google_cloud_lro::Poller;
5117 /// use google_cloud_networksecurity_v1::model::GatewaySecurityPolicy;
5118 /// use google_cloud_networksecurity_v1::Result;
5119 /// async fn sample(
5120 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5121 /// ) -> Result<()> {
5122 /// let response = client.create_gateway_security_policy()
5123 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5124 /// .set_gateway_security_policy(
5125 /// GatewaySecurityPolicy::new()/* set fields */
5126 /// )
5127 /// .poller().until_done().await?;
5128 /// println!("response {:?}", response);
5129 /// Ok(())
5130 /// }
5131 /// ```
5132 pub fn create_gateway_security_policy(
5133 &self,
5134 ) -> super::builder::network_security::CreateGatewaySecurityPolicy {
5135 super::builder::network_security::CreateGatewaySecurityPolicy::new(self.inner.clone())
5136 }
5137
5138 /// Updates the parameters of a single GatewaySecurityPolicy.
5139 ///
5140 /// # Long running operations
5141 ///
5142 /// This method is used to start, and/or poll a [long-running Operation].
5143 /// The [Working with long-running operations] chapter in the [user guide]
5144 /// covers these operations in detail.
5145 ///
5146 /// [long-running operation]: https://google.aip.dev/151
5147 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5148 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5149 ///
5150 /// # Example
5151 /// ```
5152 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5153 /// use google_cloud_lro::Poller;
5154 /// # extern crate wkt as google_cloud_wkt;
5155 /// use google_cloud_wkt::FieldMask;
5156 /// use google_cloud_networksecurity_v1::model::GatewaySecurityPolicy;
5157 /// use google_cloud_networksecurity_v1::Result;
5158 /// async fn sample(
5159 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5160 /// ) -> Result<()> {
5161 /// let response = client.update_gateway_security_policy()
5162 /// .set_gateway_security_policy(
5163 /// GatewaySecurityPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))/* set fields */
5164 /// )
5165 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5166 /// .poller().until_done().await?;
5167 /// println!("response {:?}", response);
5168 /// Ok(())
5169 /// }
5170 /// ```
5171 pub fn update_gateway_security_policy(
5172 &self,
5173 ) -> super::builder::network_security::UpdateGatewaySecurityPolicy {
5174 super::builder::network_security::UpdateGatewaySecurityPolicy::new(self.inner.clone())
5175 }
5176
5177 /// Deletes a single GatewaySecurityPolicy.
5178 ///
5179 /// # Long running operations
5180 ///
5181 /// This method is used to start, and/or poll a [long-running Operation].
5182 /// The [Working with long-running operations] chapter in the [user guide]
5183 /// covers these operations in detail.
5184 ///
5185 /// [long-running operation]: https://google.aip.dev/151
5186 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5187 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5188 ///
5189 /// # Example
5190 /// ```
5191 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5192 /// use google_cloud_lro::Poller;
5193 /// use google_cloud_networksecurity_v1::Result;
5194 /// async fn sample(
5195 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5196 /// ) -> Result<()> {
5197 /// client.delete_gateway_security_policy()
5198 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5199 /// .poller().until_done().await?;
5200 /// Ok(())
5201 /// }
5202 /// ```
5203 pub fn delete_gateway_security_policy(
5204 &self,
5205 ) -> super::builder::network_security::DeleteGatewaySecurityPolicy {
5206 super::builder::network_security::DeleteGatewaySecurityPolicy::new(self.inner.clone())
5207 }
5208
5209 /// Lists GatewaySecurityPolicyRules in a given project and location.
5210 ///
5211 /// # Example
5212 /// ```
5213 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5214 /// use google_cloud_gax::paginator::ItemPaginator as _;
5215 /// use google_cloud_networksecurity_v1::Result;
5216 /// async fn sample(
5217 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5218 /// ) -> Result<()> {
5219 /// let mut list = client.list_gateway_security_policy_rules()
5220 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5221 /// .by_item();
5222 /// while let Some(item) = list.next().await.transpose()? {
5223 /// println!("{:?}", item);
5224 /// }
5225 /// Ok(())
5226 /// }
5227 /// ```
5228 pub fn list_gateway_security_policy_rules(
5229 &self,
5230 ) -> super::builder::network_security::ListGatewaySecurityPolicyRules {
5231 super::builder::network_security::ListGatewaySecurityPolicyRules::new(self.inner.clone())
5232 }
5233
5234 /// Gets details of a single GatewaySecurityPolicyRule.
5235 ///
5236 /// # Example
5237 /// ```
5238 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5239 /// use google_cloud_networksecurity_v1::Result;
5240 /// async fn sample(
5241 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str, rule_id: &str
5242 /// ) -> Result<()> {
5243 /// let response = client.get_gateway_security_policy_rule()
5244 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}/rules/{rule_id}"))
5245 /// .send().await?;
5246 /// println!("response {:?}", response);
5247 /// Ok(())
5248 /// }
5249 /// ```
5250 pub fn get_gateway_security_policy_rule(
5251 &self,
5252 ) -> super::builder::network_security::GetGatewaySecurityPolicyRule {
5253 super::builder::network_security::GetGatewaySecurityPolicyRule::new(self.inner.clone())
5254 }
5255
5256 /// Creates a new GatewaySecurityPolicy in a given project and location.
5257 ///
5258 /// # Long running operations
5259 ///
5260 /// This method is used to start, and/or poll a [long-running Operation].
5261 /// The [Working with long-running operations] chapter in the [user guide]
5262 /// covers these operations in detail.
5263 ///
5264 /// [long-running operation]: https://google.aip.dev/151
5265 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5266 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5267 ///
5268 /// # Example
5269 /// ```
5270 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5271 /// use google_cloud_lro::Poller;
5272 /// use google_cloud_networksecurity_v1::model::GatewaySecurityPolicyRule;
5273 /// use google_cloud_networksecurity_v1::Result;
5274 /// async fn sample(
5275 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5276 /// ) -> Result<()> {
5277 /// let response = client.create_gateway_security_policy_rule()
5278 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5279 /// .set_gateway_security_policy_rule(
5280 /// GatewaySecurityPolicyRule::new()/* set fields */
5281 /// )
5282 /// .poller().until_done().await?;
5283 /// println!("response {:?}", response);
5284 /// Ok(())
5285 /// }
5286 /// ```
5287 pub fn create_gateway_security_policy_rule(
5288 &self,
5289 ) -> super::builder::network_security::CreateGatewaySecurityPolicyRule {
5290 super::builder::network_security::CreateGatewaySecurityPolicyRule::new(self.inner.clone())
5291 }
5292
5293 /// Updates the parameters of a single GatewaySecurityPolicyRule.
5294 ///
5295 /// # Long running operations
5296 ///
5297 /// This method is used to start, and/or poll a [long-running Operation].
5298 /// The [Working with long-running operations] chapter in the [user guide]
5299 /// covers these operations in detail.
5300 ///
5301 /// [long-running operation]: https://google.aip.dev/151
5302 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5303 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5304 ///
5305 /// # Example
5306 /// ```
5307 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5308 /// use google_cloud_lro::Poller;
5309 /// # extern crate wkt as google_cloud_wkt;
5310 /// use google_cloud_wkt::FieldMask;
5311 /// use google_cloud_networksecurity_v1::model::GatewaySecurityPolicyRule;
5312 /// use google_cloud_networksecurity_v1::Result;
5313 /// async fn sample(
5314 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str, rule_id: &str
5315 /// ) -> Result<()> {
5316 /// let response = client.update_gateway_security_policy_rule()
5317 /// .set_gateway_security_policy_rule(
5318 /// GatewaySecurityPolicyRule::new().set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}/rules/{rule_id}"))/* set fields */
5319 /// )
5320 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5321 /// .poller().until_done().await?;
5322 /// println!("response {:?}", response);
5323 /// Ok(())
5324 /// }
5325 /// ```
5326 pub fn update_gateway_security_policy_rule(
5327 &self,
5328 ) -> super::builder::network_security::UpdateGatewaySecurityPolicyRule {
5329 super::builder::network_security::UpdateGatewaySecurityPolicyRule::new(self.inner.clone())
5330 }
5331
5332 /// Deletes a single GatewaySecurityPolicyRule.
5333 ///
5334 /// # Long running operations
5335 ///
5336 /// This method is used to start, and/or poll a [long-running Operation].
5337 /// The [Working with long-running operations] chapter in the [user guide]
5338 /// covers these operations in detail.
5339 ///
5340 /// [long-running operation]: https://google.aip.dev/151
5341 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5342 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5343 ///
5344 /// # Example
5345 /// ```
5346 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5347 /// use google_cloud_lro::Poller;
5348 /// use google_cloud_networksecurity_v1::Result;
5349 /// async fn sample(
5350 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str, rule_id: &str
5351 /// ) -> Result<()> {
5352 /// client.delete_gateway_security_policy_rule()
5353 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}/rules/{rule_id}"))
5354 /// .poller().until_done().await?;
5355 /// Ok(())
5356 /// }
5357 /// ```
5358 pub fn delete_gateway_security_policy_rule(
5359 &self,
5360 ) -> super::builder::network_security::DeleteGatewaySecurityPolicyRule {
5361 super::builder::network_security::DeleteGatewaySecurityPolicyRule::new(self.inner.clone())
5362 }
5363
5364 /// Lists UrlLists in a given project and location.
5365 ///
5366 /// # Example
5367 /// ```
5368 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5369 /// use google_cloud_gax::paginator::ItemPaginator as _;
5370 /// use google_cloud_networksecurity_v1::Result;
5371 /// async fn sample(
5372 /// client: &NetworkSecurity, parent: &str
5373 /// ) -> Result<()> {
5374 /// let mut list = client.list_url_lists()
5375 /// .set_parent(parent)
5376 /// .by_item();
5377 /// while let Some(item) = list.next().await.transpose()? {
5378 /// println!("{:?}", item);
5379 /// }
5380 /// Ok(())
5381 /// }
5382 /// ```
5383 pub fn list_url_lists(&self) -> super::builder::network_security::ListUrlLists {
5384 super::builder::network_security::ListUrlLists::new(self.inner.clone())
5385 }
5386
5387 /// Gets details of a single UrlList.
5388 ///
5389 /// # Example
5390 /// ```
5391 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5392 /// use google_cloud_networksecurity_v1::Result;
5393 /// async fn sample(
5394 /// client: &NetworkSecurity, project_id: &str, location_id: &str, url_list_id: &str
5395 /// ) -> Result<()> {
5396 /// let response = client.get_url_list()
5397 /// .set_name(format!("projects/{project_id}/locations/{location_id}/urlLists/{url_list_id}"))
5398 /// .send().await?;
5399 /// println!("response {:?}", response);
5400 /// Ok(())
5401 /// }
5402 /// ```
5403 pub fn get_url_list(&self) -> super::builder::network_security::GetUrlList {
5404 super::builder::network_security::GetUrlList::new(self.inner.clone())
5405 }
5406
5407 /// Creates a new UrlList in a given project and location.
5408 ///
5409 /// # Long running operations
5410 ///
5411 /// This method is used to start, and/or poll a [long-running Operation].
5412 /// The [Working with long-running operations] chapter in the [user guide]
5413 /// covers these operations in detail.
5414 ///
5415 /// [long-running operation]: https://google.aip.dev/151
5416 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5417 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5418 ///
5419 /// # Example
5420 /// ```
5421 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5422 /// use google_cloud_lro::Poller;
5423 /// use google_cloud_networksecurity_v1::model::UrlList;
5424 /// use google_cloud_networksecurity_v1::Result;
5425 /// async fn sample(
5426 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5427 /// ) -> Result<()> {
5428 /// let response = client.create_url_list()
5429 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5430 /// .set_url_list(
5431 /// UrlList::new()/* set fields */
5432 /// )
5433 /// .poller().until_done().await?;
5434 /// println!("response {:?}", response);
5435 /// Ok(())
5436 /// }
5437 /// ```
5438 pub fn create_url_list(&self) -> super::builder::network_security::CreateUrlList {
5439 super::builder::network_security::CreateUrlList::new(self.inner.clone())
5440 }
5441
5442 /// Updates the parameters of a single UrlList.
5443 ///
5444 /// # Long running operations
5445 ///
5446 /// This method is used to start, and/or poll a [long-running Operation].
5447 /// The [Working with long-running operations] chapter in the [user guide]
5448 /// covers these operations in detail.
5449 ///
5450 /// [long-running operation]: https://google.aip.dev/151
5451 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5452 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5453 ///
5454 /// # Example
5455 /// ```
5456 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5457 /// use google_cloud_lro::Poller;
5458 /// # extern crate wkt as google_cloud_wkt;
5459 /// use google_cloud_wkt::FieldMask;
5460 /// use google_cloud_networksecurity_v1::model::UrlList;
5461 /// use google_cloud_networksecurity_v1::Result;
5462 /// async fn sample(
5463 /// client: &NetworkSecurity, project_id: &str, location_id: &str, url_list_id: &str
5464 /// ) -> Result<()> {
5465 /// let response = client.update_url_list()
5466 /// .set_url_list(
5467 /// UrlList::new().set_name(format!("projects/{project_id}/locations/{location_id}/urlLists/{url_list_id}"))/* set fields */
5468 /// )
5469 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5470 /// .poller().until_done().await?;
5471 /// println!("response {:?}", response);
5472 /// Ok(())
5473 /// }
5474 /// ```
5475 pub fn update_url_list(&self) -> super::builder::network_security::UpdateUrlList {
5476 super::builder::network_security::UpdateUrlList::new(self.inner.clone())
5477 }
5478
5479 /// Deletes a single UrlList.
5480 ///
5481 /// # Long running operations
5482 ///
5483 /// This method is used to start, and/or poll a [long-running Operation].
5484 /// The [Working with long-running operations] chapter in the [user guide]
5485 /// covers these operations in detail.
5486 ///
5487 /// [long-running operation]: https://google.aip.dev/151
5488 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5489 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5490 ///
5491 /// # Example
5492 /// ```
5493 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5494 /// use google_cloud_lro::Poller;
5495 /// use google_cloud_networksecurity_v1::Result;
5496 /// async fn sample(
5497 /// client: &NetworkSecurity, project_id: &str, location_id: &str, url_list_id: &str
5498 /// ) -> Result<()> {
5499 /// client.delete_url_list()
5500 /// .set_name(format!("projects/{project_id}/locations/{location_id}/urlLists/{url_list_id}"))
5501 /// .poller().until_done().await?;
5502 /// Ok(())
5503 /// }
5504 /// ```
5505 pub fn delete_url_list(&self) -> super::builder::network_security::DeleteUrlList {
5506 super::builder::network_security::DeleteUrlList::new(self.inner.clone())
5507 }
5508
5509 /// Lists TlsInspectionPolicies in a given project and location.
5510 ///
5511 /// # Example
5512 /// ```
5513 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5514 /// use google_cloud_gax::paginator::ItemPaginator as _;
5515 /// use google_cloud_networksecurity_v1::Result;
5516 /// async fn sample(
5517 /// client: &NetworkSecurity, parent: &str
5518 /// ) -> Result<()> {
5519 /// let mut list = client.list_tls_inspection_policies()
5520 /// .set_parent(parent)
5521 /// .by_item();
5522 /// while let Some(item) = list.next().await.transpose()? {
5523 /// println!("{:?}", item);
5524 /// }
5525 /// Ok(())
5526 /// }
5527 /// ```
5528 pub fn list_tls_inspection_policies(
5529 &self,
5530 ) -> super::builder::network_security::ListTlsInspectionPolicies {
5531 super::builder::network_security::ListTlsInspectionPolicies::new(self.inner.clone())
5532 }
5533
5534 /// Gets details of a single TlsInspectionPolicy.
5535 ///
5536 /// # Example
5537 /// ```
5538 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5539 /// use google_cloud_networksecurity_v1::Result;
5540 /// async fn sample(
5541 /// client: &NetworkSecurity, project_id: &str, location_id: &str, tls_inspection_policy_id: &str
5542 /// ) -> Result<()> {
5543 /// let response = client.get_tls_inspection_policy()
5544 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tlsInspectionPolicies/{tls_inspection_policy_id}"))
5545 /// .send().await?;
5546 /// println!("response {:?}", response);
5547 /// Ok(())
5548 /// }
5549 /// ```
5550 pub fn get_tls_inspection_policy(
5551 &self,
5552 ) -> super::builder::network_security::GetTlsInspectionPolicy {
5553 super::builder::network_security::GetTlsInspectionPolicy::new(self.inner.clone())
5554 }
5555
5556 /// Creates a new TlsInspectionPolicy in a given project and location.
5557 ///
5558 /// # Long running operations
5559 ///
5560 /// This method is used to start, and/or poll a [long-running Operation].
5561 /// The [Working with long-running operations] chapter in the [user guide]
5562 /// covers these operations in detail.
5563 ///
5564 /// [long-running operation]: https://google.aip.dev/151
5565 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5566 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5567 ///
5568 /// # Example
5569 /// ```
5570 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5571 /// use google_cloud_lro::Poller;
5572 /// use google_cloud_networksecurity_v1::model::TlsInspectionPolicy;
5573 /// use google_cloud_networksecurity_v1::Result;
5574 /// async fn sample(
5575 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5576 /// ) -> Result<()> {
5577 /// let response = client.create_tls_inspection_policy()
5578 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5579 /// .set_tls_inspection_policy(
5580 /// TlsInspectionPolicy::new()/* set fields */
5581 /// )
5582 /// .poller().until_done().await?;
5583 /// println!("response {:?}", response);
5584 /// Ok(())
5585 /// }
5586 /// ```
5587 pub fn create_tls_inspection_policy(
5588 &self,
5589 ) -> super::builder::network_security::CreateTlsInspectionPolicy {
5590 super::builder::network_security::CreateTlsInspectionPolicy::new(self.inner.clone())
5591 }
5592
5593 /// Updates the parameters of a single TlsInspectionPolicy.
5594 ///
5595 /// # Long running operations
5596 ///
5597 /// This method is used to start, and/or poll a [long-running Operation].
5598 /// The [Working with long-running operations] chapter in the [user guide]
5599 /// covers these operations in detail.
5600 ///
5601 /// [long-running operation]: https://google.aip.dev/151
5602 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5603 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5604 ///
5605 /// # Example
5606 /// ```
5607 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5608 /// use google_cloud_lro::Poller;
5609 /// # extern crate wkt as google_cloud_wkt;
5610 /// use google_cloud_wkt::FieldMask;
5611 /// use google_cloud_networksecurity_v1::model::TlsInspectionPolicy;
5612 /// use google_cloud_networksecurity_v1::Result;
5613 /// async fn sample(
5614 /// client: &NetworkSecurity, project_id: &str, location_id: &str, tls_inspection_policy_id: &str
5615 /// ) -> Result<()> {
5616 /// let response = client.update_tls_inspection_policy()
5617 /// .set_tls_inspection_policy(
5618 /// TlsInspectionPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/tlsInspectionPolicies/{tls_inspection_policy_id}"))/* set fields */
5619 /// )
5620 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5621 /// .poller().until_done().await?;
5622 /// println!("response {:?}", response);
5623 /// Ok(())
5624 /// }
5625 /// ```
5626 pub fn update_tls_inspection_policy(
5627 &self,
5628 ) -> super::builder::network_security::UpdateTlsInspectionPolicy {
5629 super::builder::network_security::UpdateTlsInspectionPolicy::new(self.inner.clone())
5630 }
5631
5632 /// Deletes a single TlsInspectionPolicy.
5633 ///
5634 /// # Long running operations
5635 ///
5636 /// This method is used to start, and/or poll a [long-running Operation].
5637 /// The [Working with long-running operations] chapter in the [user guide]
5638 /// covers these operations in detail.
5639 ///
5640 /// [long-running operation]: https://google.aip.dev/151
5641 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5642 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5643 ///
5644 /// # Example
5645 /// ```
5646 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5647 /// use google_cloud_lro::Poller;
5648 /// use google_cloud_networksecurity_v1::Result;
5649 /// async fn sample(
5650 /// client: &NetworkSecurity, project_id: &str, location_id: &str, tls_inspection_policy_id: &str
5651 /// ) -> Result<()> {
5652 /// client.delete_tls_inspection_policy()
5653 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tlsInspectionPolicies/{tls_inspection_policy_id}"))
5654 /// .poller().until_done().await?;
5655 /// Ok(())
5656 /// }
5657 /// ```
5658 pub fn delete_tls_inspection_policy(
5659 &self,
5660 ) -> super::builder::network_security::DeleteTlsInspectionPolicy {
5661 super::builder::network_security::DeleteTlsInspectionPolicy::new(self.inner.clone())
5662 }
5663
5664 /// Lists AuthzPolicies in a given project and location.
5665 ///
5666 /// # Example
5667 /// ```
5668 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5669 /// use google_cloud_gax::paginator::ItemPaginator as _;
5670 /// use google_cloud_networksecurity_v1::Result;
5671 /// async fn sample(
5672 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5673 /// ) -> Result<()> {
5674 /// let mut list = client.list_authz_policies()
5675 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5676 /// .by_item();
5677 /// while let Some(item) = list.next().await.transpose()? {
5678 /// println!("{:?}", item);
5679 /// }
5680 /// Ok(())
5681 /// }
5682 /// ```
5683 pub fn list_authz_policies(&self) -> super::builder::network_security::ListAuthzPolicies {
5684 super::builder::network_security::ListAuthzPolicies::new(self.inner.clone())
5685 }
5686
5687 /// Gets details of a single AuthzPolicy.
5688 ///
5689 /// # Example
5690 /// ```
5691 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5692 /// use google_cloud_networksecurity_v1::Result;
5693 /// async fn sample(
5694 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authz_policy_id: &str
5695 /// ) -> Result<()> {
5696 /// let response = client.get_authz_policy()
5697 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authzPolicies/{authz_policy_id}"))
5698 /// .send().await?;
5699 /// println!("response {:?}", response);
5700 /// Ok(())
5701 /// }
5702 /// ```
5703 pub fn get_authz_policy(&self) -> super::builder::network_security::GetAuthzPolicy {
5704 super::builder::network_security::GetAuthzPolicy::new(self.inner.clone())
5705 }
5706
5707 /// Creates a new AuthzPolicy in a given project and location.
5708 ///
5709 /// # Long running operations
5710 ///
5711 /// This method is used to start, and/or poll a [long-running Operation].
5712 /// The [Working with long-running operations] chapter in the [user guide]
5713 /// covers these operations in detail.
5714 ///
5715 /// [long-running operation]: https://google.aip.dev/151
5716 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5717 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5718 ///
5719 /// # Example
5720 /// ```
5721 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5722 /// use google_cloud_lro::Poller;
5723 /// use google_cloud_networksecurity_v1::model::AuthzPolicy;
5724 /// use google_cloud_networksecurity_v1::Result;
5725 /// async fn sample(
5726 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5727 /// ) -> Result<()> {
5728 /// let response = client.create_authz_policy()
5729 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5730 /// .set_authz_policy(
5731 /// AuthzPolicy::new()/* set fields */
5732 /// )
5733 /// .poller().until_done().await?;
5734 /// println!("response {:?}", response);
5735 /// Ok(())
5736 /// }
5737 /// ```
5738 pub fn create_authz_policy(&self) -> super::builder::network_security::CreateAuthzPolicy {
5739 super::builder::network_security::CreateAuthzPolicy::new(self.inner.clone())
5740 }
5741
5742 /// Updates the parameters of a single AuthzPolicy.
5743 ///
5744 /// # Long running operations
5745 ///
5746 /// This method is used to start, and/or poll a [long-running Operation].
5747 /// The [Working with long-running operations] chapter in the [user guide]
5748 /// covers these operations in detail.
5749 ///
5750 /// [long-running operation]: https://google.aip.dev/151
5751 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5752 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5753 ///
5754 /// # Example
5755 /// ```
5756 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5757 /// use google_cloud_lro::Poller;
5758 /// # extern crate wkt as google_cloud_wkt;
5759 /// use google_cloud_wkt::FieldMask;
5760 /// use google_cloud_networksecurity_v1::model::AuthzPolicy;
5761 /// use google_cloud_networksecurity_v1::Result;
5762 /// async fn sample(
5763 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authz_policy_id: &str
5764 /// ) -> Result<()> {
5765 /// let response = client.update_authz_policy()
5766 /// .set_authz_policy(
5767 /// AuthzPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/authzPolicies/{authz_policy_id}"))/* set fields */
5768 /// )
5769 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5770 /// .poller().until_done().await?;
5771 /// println!("response {:?}", response);
5772 /// Ok(())
5773 /// }
5774 /// ```
5775 pub fn update_authz_policy(&self) -> super::builder::network_security::UpdateAuthzPolicy {
5776 super::builder::network_security::UpdateAuthzPolicy::new(self.inner.clone())
5777 }
5778
5779 /// Deletes a single AuthzPolicy.
5780 ///
5781 /// # Long running operations
5782 ///
5783 /// This method is used to start, and/or poll a [long-running Operation].
5784 /// The [Working with long-running operations] chapter in the [user guide]
5785 /// covers these operations in detail.
5786 ///
5787 /// [long-running operation]: https://google.aip.dev/151
5788 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5789 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5790 ///
5791 /// # Example
5792 /// ```
5793 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5794 /// use google_cloud_lro::Poller;
5795 /// use google_cloud_networksecurity_v1::Result;
5796 /// async fn sample(
5797 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authz_policy_id: &str
5798 /// ) -> Result<()> {
5799 /// client.delete_authz_policy()
5800 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authzPolicies/{authz_policy_id}"))
5801 /// .poller().until_done().await?;
5802 /// Ok(())
5803 /// }
5804 /// ```
5805 pub fn delete_authz_policy(&self) -> super::builder::network_security::DeleteAuthzPolicy {
5806 super::builder::network_security::DeleteAuthzPolicy::new(self.inner.clone())
5807 }
5808
5809 /// Lists information about the supported locations for this service.
5810 ///
5811 /// This method lists locations based on the resource scope provided in
5812 /// the [ListLocationsRequest.name] field:
5813 ///
5814 /// * **Global locations**: If `name` is empty, the method lists the
5815 /// public locations available to all projects. * **Project-specific
5816 /// locations**: If `name` follows the format
5817 /// `projects/{project}`, the method lists locations visible to that
5818 /// specific project. This includes public, private, or other
5819 /// project-specific locations enabled for the project.
5820 ///
5821 /// For gRPC and client library implementations, the resource name is
5822 /// passed as the `name` field. For direct service calls, the resource
5823 /// name is
5824 /// incorporated into the request path based on the specific service
5825 /// implementation and version.
5826 ///
5827 /// # Example
5828 /// ```
5829 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5830 /// use google_cloud_gax::paginator::ItemPaginator as _;
5831 /// use google_cloud_networksecurity_v1::Result;
5832 /// async fn sample(
5833 /// client: &NetworkSecurity
5834 /// ) -> Result<()> {
5835 /// let mut list = client.list_locations()
5836 /// /* set fields */
5837 /// .by_item();
5838 /// while let Some(item) = list.next().await.transpose()? {
5839 /// println!("{:?}", item);
5840 /// }
5841 /// Ok(())
5842 /// }
5843 /// ```
5844 pub fn list_locations(&self) -> super::builder::network_security::ListLocations {
5845 super::builder::network_security::ListLocations::new(self.inner.clone())
5846 }
5847
5848 /// Gets information about a location.
5849 ///
5850 /// # Example
5851 /// ```
5852 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5853 /// use google_cloud_networksecurity_v1::Result;
5854 /// async fn sample(
5855 /// client: &NetworkSecurity
5856 /// ) -> Result<()> {
5857 /// let response = client.get_location()
5858 /// /* set fields */
5859 /// .send().await?;
5860 /// println!("response {:?}", response);
5861 /// Ok(())
5862 /// }
5863 /// ```
5864 pub fn get_location(&self) -> super::builder::network_security::GetLocation {
5865 super::builder::network_security::GetLocation::new(self.inner.clone())
5866 }
5867
5868 /// Sets the access control policy on the specified resource. Replaces
5869 /// any existing policy.
5870 ///
5871 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
5872 /// errors.
5873 ///
5874 /// # Example
5875 /// ```
5876 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5877 /// use google_cloud_networksecurity_v1::Result;
5878 /// async fn sample(
5879 /// client: &NetworkSecurity
5880 /// ) -> Result<()> {
5881 /// let response = client.set_iam_policy()
5882 /// /* set fields */
5883 /// .send().await?;
5884 /// println!("response {:?}", response);
5885 /// Ok(())
5886 /// }
5887 /// ```
5888 pub fn set_iam_policy(&self) -> super::builder::network_security::SetIamPolicy {
5889 super::builder::network_security::SetIamPolicy::new(self.inner.clone())
5890 }
5891
5892 /// Gets the access control policy for a resource. Returns an empty policy
5893 /// if the resource exists and does not have a policy set.
5894 ///
5895 /// # Example
5896 /// ```
5897 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5898 /// use google_cloud_networksecurity_v1::Result;
5899 /// async fn sample(
5900 /// client: &NetworkSecurity
5901 /// ) -> Result<()> {
5902 /// let response = client.get_iam_policy()
5903 /// /* set fields */
5904 /// .send().await?;
5905 /// println!("response {:?}", response);
5906 /// Ok(())
5907 /// }
5908 /// ```
5909 pub fn get_iam_policy(&self) -> super::builder::network_security::GetIamPolicy {
5910 super::builder::network_security::GetIamPolicy::new(self.inner.clone())
5911 }
5912
5913 /// Returns permissions that a caller has on the specified resource. If the
5914 /// resource does not exist, this will return an empty set of
5915 /// permissions, not a `NOT_FOUND` error.
5916 ///
5917 /// Note: This operation is designed to be used for building
5918 /// permission-aware UIs and command-line tools, not for authorization
5919 /// checking. This operation may "fail open" without warning.
5920 ///
5921 /// # Example
5922 /// ```
5923 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5924 /// use google_cloud_networksecurity_v1::Result;
5925 /// async fn sample(
5926 /// client: &NetworkSecurity
5927 /// ) -> Result<()> {
5928 /// let response = client.test_iam_permissions()
5929 /// /* set fields */
5930 /// .send().await?;
5931 /// println!("response {:?}", response);
5932 /// Ok(())
5933 /// }
5934 /// ```
5935 pub fn test_iam_permissions(&self) -> super::builder::network_security::TestIamPermissions {
5936 super::builder::network_security::TestIamPermissions::new(self.inner.clone())
5937 }
5938
5939 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5940 ///
5941 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5942 ///
5943 /// # Example
5944 /// ```
5945 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5946 /// use google_cloud_gax::paginator::ItemPaginator as _;
5947 /// use google_cloud_networksecurity_v1::Result;
5948 /// async fn sample(
5949 /// client: &NetworkSecurity
5950 /// ) -> Result<()> {
5951 /// let mut list = client.list_operations()
5952 /// /* set fields */
5953 /// .by_item();
5954 /// while let Some(item) = list.next().await.transpose()? {
5955 /// println!("{:?}", item);
5956 /// }
5957 /// Ok(())
5958 /// }
5959 /// ```
5960 pub fn list_operations(&self) -> super::builder::network_security::ListOperations {
5961 super::builder::network_security::ListOperations::new(self.inner.clone())
5962 }
5963
5964 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5965 ///
5966 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5967 ///
5968 /// # Example
5969 /// ```
5970 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5971 /// use google_cloud_networksecurity_v1::Result;
5972 /// async fn sample(
5973 /// client: &NetworkSecurity
5974 /// ) -> Result<()> {
5975 /// let response = client.get_operation()
5976 /// /* set fields */
5977 /// .send().await?;
5978 /// println!("response {:?}", response);
5979 /// Ok(())
5980 /// }
5981 /// ```
5982 pub fn get_operation(&self) -> super::builder::network_security::GetOperation {
5983 super::builder::network_security::GetOperation::new(self.inner.clone())
5984 }
5985
5986 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
5987 ///
5988 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
5989 ///
5990 /// # Example
5991 /// ```
5992 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5993 /// use google_cloud_networksecurity_v1::Result;
5994 /// async fn sample(
5995 /// client: &NetworkSecurity
5996 /// ) -> Result<()> {
5997 /// client.delete_operation()
5998 /// /* set fields */
5999 /// .send().await?;
6000 /// Ok(())
6001 /// }
6002 /// ```
6003 pub fn delete_operation(&self) -> super::builder::network_security::DeleteOperation {
6004 super::builder::network_security::DeleteOperation::new(self.inner.clone())
6005 }
6006
6007 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6008 ///
6009 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6010 ///
6011 /// # Example
6012 /// ```
6013 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6014 /// use google_cloud_networksecurity_v1::Result;
6015 /// async fn sample(
6016 /// client: &NetworkSecurity
6017 /// ) -> Result<()> {
6018 /// client.cancel_operation()
6019 /// /* set fields */
6020 /// .send().await?;
6021 /// Ok(())
6022 /// }
6023 /// ```
6024 pub fn cancel_operation(&self) -> super::builder::network_security::CancelOperation {
6025 super::builder::network_security::CancelOperation::new(self.inner.clone())
6026 }
6027}
6028
6029/// Implements a client for the Network Security API.
6030///
6031/// # Example
6032/// ```
6033/// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6034/// use google_cloud_gax::paginator::ItemPaginator as _;
6035/// async fn sample(
6036/// organization_id: &str,
6037/// location_id: &str,
6038/// ) -> anyhow::Result<()> {
6039/// let client = OrganizationSecurityProfileGroupService::builder().build().await?;
6040/// let mut list = client.list_security_profile_groups()
6041/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6042/// .by_item();
6043/// while let Some(item) = list.next().await.transpose()? {
6044/// println!("{:?}", item);
6045/// }
6046/// Ok(())
6047/// }
6048/// ```
6049///
6050/// # Service Description
6051///
6052/// Organization SecurityProfileGroup is created under organization.
6053///
6054/// # Configuration
6055///
6056/// To configure `OrganizationSecurityProfileGroupService` use the `with_*` methods in the type returned
6057/// by [builder()][OrganizationSecurityProfileGroupService::builder]. The default configuration should
6058/// work for most applications. Common configuration changes include
6059///
6060/// * [with_endpoint()]: by default this client uses the global default endpoint
6061/// (`https://networksecurity.googleapis.com`). Applications using regional
6062/// endpoints or running in restricted networks (e.g. a network configured
6063// with [Private Google Access with VPC Service Controls]) may want to
6064/// override this default.
6065/// * [with_credentials()]: by default this client uses
6066/// [Application Default Credentials]. Applications using custom
6067/// authentication may need to override this default.
6068///
6069/// [with_endpoint()]: super::builder::organization_security_profile_group_service::ClientBuilder::with_endpoint
6070/// [with_credentials()]: super::builder::organization_security_profile_group_service::ClientBuilder::with_credentials
6071/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6072/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6073///
6074/// # Pooling and Cloning
6075///
6076/// `OrganizationSecurityProfileGroupService` holds a connection pool internally, it is advised to
6077/// create one and reuse it. You do not need to wrap `OrganizationSecurityProfileGroupService` in
6078/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6079/// already uses an `Arc` internally.
6080#[derive(Clone, Debug)]
6081pub struct OrganizationSecurityProfileGroupService {
6082 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityProfileGroupService>,
6083}
6084
6085impl OrganizationSecurityProfileGroupService {
6086 /// Returns a builder for [OrganizationSecurityProfileGroupService].
6087 ///
6088 /// ```
6089 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6090 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6091 /// let client = OrganizationSecurityProfileGroupService::builder().build().await?;
6092 /// # Ok(()) }
6093 /// ```
6094 pub fn builder() -> super::builder::organization_security_profile_group_service::ClientBuilder {
6095 crate::new_client_builder(
6096 super::builder::organization_security_profile_group_service::client::Factory,
6097 )
6098 }
6099
6100 /// Creates a new client from the provided stub.
6101 ///
6102 /// The most common case for calling this function is in tests mocking the
6103 /// client's behavior.
6104 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6105 where
6106 T: super::stub::OrganizationSecurityProfileGroupService + 'static,
6107 {
6108 Self { inner: stub.into() }
6109 }
6110
6111 pub(crate) async fn new(
6112 config: gaxi::options::ClientConfig,
6113 ) -> crate::ClientBuilderResult<Self> {
6114 let inner = Self::build_inner(config).await?;
6115 Ok(Self { inner })
6116 }
6117
6118 async fn build_inner(
6119 conf: gaxi::options::ClientConfig,
6120 ) -> crate::ClientBuilderResult<
6121 std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityProfileGroupService>,
6122 > {
6123 if gaxi::options::tracing_enabled(&conf) {
6124 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6125 }
6126 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6127 }
6128
6129 async fn build_transport(
6130 conf: gaxi::options::ClientConfig,
6131 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityProfileGroupService> {
6132 super::transport::OrganizationSecurityProfileGroupService::new(conf).await
6133 }
6134
6135 async fn build_with_tracing(
6136 conf: gaxi::options::ClientConfig,
6137 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityProfileGroupService> {
6138 Self::build_transport(conf)
6139 .await
6140 .map(super::tracing::OrganizationSecurityProfileGroupService::new)
6141 }
6142
6143 /// Lists SecurityProfileGroups in a given organization and location.
6144 ///
6145 /// # Example
6146 /// ```
6147 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6148 /// use google_cloud_gax::paginator::ItemPaginator as _;
6149 /// use google_cloud_networksecurity_v1::Result;
6150 /// async fn sample(
6151 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
6152 /// ) -> Result<()> {
6153 /// let mut list = client.list_security_profile_groups()
6154 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6155 /// .by_item();
6156 /// while let Some(item) = list.next().await.transpose()? {
6157 /// println!("{:?}", item);
6158 /// }
6159 /// Ok(())
6160 /// }
6161 /// ```
6162 pub fn list_security_profile_groups(
6163 &self,
6164 ) -> super::builder::organization_security_profile_group_service::ListSecurityProfileGroups
6165 {
6166 super::builder::organization_security_profile_group_service::ListSecurityProfileGroups::new(
6167 self.inner.clone(),
6168 )
6169 }
6170
6171 /// Gets details of a single SecurityProfileGroup.
6172 ///
6173 /// # Example
6174 /// ```
6175 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6176 /// use google_cloud_networksecurity_v1::Result;
6177 /// async fn sample(
6178 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
6179 /// ) -> Result<()> {
6180 /// let response = client.get_security_profile_group()
6181 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))
6182 /// .send().await?;
6183 /// println!("response {:?}", response);
6184 /// Ok(())
6185 /// }
6186 /// ```
6187 pub fn get_security_profile_group(
6188 &self,
6189 ) -> super::builder::organization_security_profile_group_service::GetSecurityProfileGroup {
6190 super::builder::organization_security_profile_group_service::GetSecurityProfileGroup::new(
6191 self.inner.clone(),
6192 )
6193 }
6194
6195 /// Creates a new SecurityProfileGroup in a given organization and location.
6196 ///
6197 /// # Long running operations
6198 ///
6199 /// This method is used to start, and/or poll a [long-running Operation].
6200 /// The [Working with long-running operations] chapter in the [user guide]
6201 /// covers these operations in detail.
6202 ///
6203 /// [long-running operation]: https://google.aip.dev/151
6204 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6205 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6206 ///
6207 /// # Example
6208 /// ```
6209 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6210 /// use google_cloud_lro::Poller;
6211 /// use google_cloud_networksecurity_v1::model::SecurityProfileGroup;
6212 /// use google_cloud_networksecurity_v1::Result;
6213 /// async fn sample(
6214 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
6215 /// ) -> Result<()> {
6216 /// let response = client.create_security_profile_group()
6217 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6218 /// .set_security_profile_group(
6219 /// SecurityProfileGroup::new()/* set fields */
6220 /// )
6221 /// .poller().until_done().await?;
6222 /// println!("response {:?}", response);
6223 /// Ok(())
6224 /// }
6225 /// ```
6226 pub fn create_security_profile_group(
6227 &self,
6228 ) -> super::builder::organization_security_profile_group_service::CreateSecurityProfileGroup
6229 {
6230 super::builder::organization_security_profile_group_service::CreateSecurityProfileGroup::new(
6231 self.inner.clone(),
6232 )
6233 }
6234
6235 /// Updates the parameters of a single SecurityProfileGroup.
6236 ///
6237 /// # Long running operations
6238 ///
6239 /// This method is used to start, and/or poll a [long-running Operation].
6240 /// The [Working with long-running operations] chapter in the [user guide]
6241 /// covers these operations in detail.
6242 ///
6243 /// [long-running operation]: https://google.aip.dev/151
6244 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6245 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6246 ///
6247 /// # Example
6248 /// ```
6249 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6250 /// use google_cloud_lro::Poller;
6251 /// # extern crate wkt as google_cloud_wkt;
6252 /// use google_cloud_wkt::FieldMask;
6253 /// use google_cloud_networksecurity_v1::model::SecurityProfileGroup;
6254 /// use google_cloud_networksecurity_v1::Result;
6255 /// async fn sample(
6256 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
6257 /// ) -> Result<()> {
6258 /// let response = client.update_security_profile_group()
6259 /// .set_security_profile_group(
6260 /// SecurityProfileGroup::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))/* set fields */
6261 /// )
6262 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6263 /// .poller().until_done().await?;
6264 /// println!("response {:?}", response);
6265 /// Ok(())
6266 /// }
6267 /// ```
6268 pub fn update_security_profile_group(
6269 &self,
6270 ) -> super::builder::organization_security_profile_group_service::UpdateSecurityProfileGroup
6271 {
6272 super::builder::organization_security_profile_group_service::UpdateSecurityProfileGroup::new(
6273 self.inner.clone(),
6274 )
6275 }
6276
6277 /// Deletes a single SecurityProfileGroup.
6278 ///
6279 /// # Long running operations
6280 ///
6281 /// This method is used to start, and/or poll a [long-running Operation].
6282 /// The [Working with long-running operations] chapter in the [user guide]
6283 /// covers these operations in detail.
6284 ///
6285 /// [long-running operation]: https://google.aip.dev/151
6286 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6287 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6288 ///
6289 /// # Example
6290 /// ```
6291 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6292 /// use google_cloud_lro::Poller;
6293 /// use google_cloud_networksecurity_v1::Result;
6294 /// async fn sample(
6295 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
6296 /// ) -> Result<()> {
6297 /// client.delete_security_profile_group()
6298 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))
6299 /// .poller().until_done().await?;
6300 /// Ok(())
6301 /// }
6302 /// ```
6303 pub fn delete_security_profile_group(
6304 &self,
6305 ) -> super::builder::organization_security_profile_group_service::DeleteSecurityProfileGroup
6306 {
6307 super::builder::organization_security_profile_group_service::DeleteSecurityProfileGroup::new(
6308 self.inner.clone(),
6309 )
6310 }
6311
6312 /// Lists SecurityProfiles in a given organization and location.
6313 ///
6314 /// # Example
6315 /// ```
6316 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6317 /// use google_cloud_gax::paginator::ItemPaginator as _;
6318 /// use google_cloud_networksecurity_v1::Result;
6319 /// async fn sample(
6320 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
6321 /// ) -> Result<()> {
6322 /// let mut list = client.list_security_profiles()
6323 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6324 /// .by_item();
6325 /// while let Some(item) = list.next().await.transpose()? {
6326 /// println!("{:?}", item);
6327 /// }
6328 /// Ok(())
6329 /// }
6330 /// ```
6331 pub fn list_security_profiles(
6332 &self,
6333 ) -> super::builder::organization_security_profile_group_service::ListSecurityProfiles {
6334 super::builder::organization_security_profile_group_service::ListSecurityProfiles::new(
6335 self.inner.clone(),
6336 )
6337 }
6338
6339 /// Gets details of a single SecurityProfile.
6340 ///
6341 /// # Example
6342 /// ```
6343 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6344 /// use google_cloud_networksecurity_v1::Result;
6345 /// async fn sample(
6346 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
6347 /// ) -> Result<()> {
6348 /// let response = client.get_security_profile()
6349 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))
6350 /// .send().await?;
6351 /// println!("response {:?}", response);
6352 /// Ok(())
6353 /// }
6354 /// ```
6355 pub fn get_security_profile(
6356 &self,
6357 ) -> super::builder::organization_security_profile_group_service::GetSecurityProfile {
6358 super::builder::organization_security_profile_group_service::GetSecurityProfile::new(
6359 self.inner.clone(),
6360 )
6361 }
6362
6363 /// Creates a new SecurityProfile in a given organization and location.
6364 ///
6365 /// # Long running operations
6366 ///
6367 /// This method is used to start, and/or poll a [long-running Operation].
6368 /// The [Working with long-running operations] chapter in the [user guide]
6369 /// covers these operations in detail.
6370 ///
6371 /// [long-running operation]: https://google.aip.dev/151
6372 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6373 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6374 ///
6375 /// # Example
6376 /// ```
6377 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6378 /// use google_cloud_lro::Poller;
6379 /// use google_cloud_networksecurity_v1::model::SecurityProfile;
6380 /// use google_cloud_networksecurity_v1::Result;
6381 /// async fn sample(
6382 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
6383 /// ) -> Result<()> {
6384 /// let response = client.create_security_profile()
6385 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6386 /// .set_security_profile(
6387 /// SecurityProfile::new()/* set fields */
6388 /// )
6389 /// .poller().until_done().await?;
6390 /// println!("response {:?}", response);
6391 /// Ok(())
6392 /// }
6393 /// ```
6394 pub fn create_security_profile(
6395 &self,
6396 ) -> super::builder::organization_security_profile_group_service::CreateSecurityProfile {
6397 super::builder::organization_security_profile_group_service::CreateSecurityProfile::new(
6398 self.inner.clone(),
6399 )
6400 }
6401
6402 /// Updates the parameters of a single SecurityProfile.
6403 ///
6404 /// # Long running operations
6405 ///
6406 /// This method is used to start, and/or poll a [long-running Operation].
6407 /// The [Working with long-running operations] chapter in the [user guide]
6408 /// covers these operations in detail.
6409 ///
6410 /// [long-running operation]: https://google.aip.dev/151
6411 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6412 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6413 ///
6414 /// # Example
6415 /// ```
6416 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6417 /// use google_cloud_lro::Poller;
6418 /// # extern crate wkt as google_cloud_wkt;
6419 /// use google_cloud_wkt::FieldMask;
6420 /// use google_cloud_networksecurity_v1::model::SecurityProfile;
6421 /// use google_cloud_networksecurity_v1::Result;
6422 /// async fn sample(
6423 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
6424 /// ) -> Result<()> {
6425 /// let response = client.update_security_profile()
6426 /// .set_security_profile(
6427 /// SecurityProfile::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))/* set fields */
6428 /// )
6429 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6430 /// .poller().until_done().await?;
6431 /// println!("response {:?}", response);
6432 /// Ok(())
6433 /// }
6434 /// ```
6435 pub fn update_security_profile(
6436 &self,
6437 ) -> super::builder::organization_security_profile_group_service::UpdateSecurityProfile {
6438 super::builder::organization_security_profile_group_service::UpdateSecurityProfile::new(
6439 self.inner.clone(),
6440 )
6441 }
6442
6443 /// Deletes a single SecurityProfile.
6444 ///
6445 /// # Long running operations
6446 ///
6447 /// This method is used to start, and/or poll a [long-running Operation].
6448 /// The [Working with long-running operations] chapter in the [user guide]
6449 /// covers these operations in detail.
6450 ///
6451 /// [long-running operation]: https://google.aip.dev/151
6452 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6453 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6454 ///
6455 /// # Example
6456 /// ```
6457 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6458 /// use google_cloud_lro::Poller;
6459 /// use google_cloud_networksecurity_v1::Result;
6460 /// async fn sample(
6461 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
6462 /// ) -> Result<()> {
6463 /// client.delete_security_profile()
6464 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))
6465 /// .poller().until_done().await?;
6466 /// Ok(())
6467 /// }
6468 /// ```
6469 pub fn delete_security_profile(
6470 &self,
6471 ) -> super::builder::organization_security_profile_group_service::DeleteSecurityProfile {
6472 super::builder::organization_security_profile_group_service::DeleteSecurityProfile::new(
6473 self.inner.clone(),
6474 )
6475 }
6476
6477 /// Lists information about the supported locations for this service.
6478 ///
6479 /// This method lists locations based on the resource scope provided in
6480 /// the [ListLocationsRequest.name] field:
6481 ///
6482 /// * **Global locations**: If `name` is empty, the method lists the
6483 /// public locations available to all projects. * **Project-specific
6484 /// locations**: If `name` follows the format
6485 /// `projects/{project}`, the method lists locations visible to that
6486 /// specific project. This includes public, private, or other
6487 /// project-specific locations enabled for the project.
6488 ///
6489 /// For gRPC and client library implementations, the resource name is
6490 /// passed as the `name` field. For direct service calls, the resource
6491 /// name is
6492 /// incorporated into the request path based on the specific service
6493 /// implementation and version.
6494 ///
6495 /// # Example
6496 /// ```
6497 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6498 /// use google_cloud_gax::paginator::ItemPaginator as _;
6499 /// use google_cloud_networksecurity_v1::Result;
6500 /// async fn sample(
6501 /// client: &OrganizationSecurityProfileGroupService
6502 /// ) -> Result<()> {
6503 /// let mut list = client.list_locations()
6504 /// /* set fields */
6505 /// .by_item();
6506 /// while let Some(item) = list.next().await.transpose()? {
6507 /// println!("{:?}", item);
6508 /// }
6509 /// Ok(())
6510 /// }
6511 /// ```
6512 pub fn list_locations(
6513 &self,
6514 ) -> super::builder::organization_security_profile_group_service::ListLocations {
6515 super::builder::organization_security_profile_group_service::ListLocations::new(
6516 self.inner.clone(),
6517 )
6518 }
6519
6520 /// Gets information about a location.
6521 ///
6522 /// # Example
6523 /// ```
6524 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6525 /// use google_cloud_networksecurity_v1::Result;
6526 /// async fn sample(
6527 /// client: &OrganizationSecurityProfileGroupService
6528 /// ) -> Result<()> {
6529 /// let response = client.get_location()
6530 /// /* set fields */
6531 /// .send().await?;
6532 /// println!("response {:?}", response);
6533 /// Ok(())
6534 /// }
6535 /// ```
6536 pub fn get_location(
6537 &self,
6538 ) -> super::builder::organization_security_profile_group_service::GetLocation {
6539 super::builder::organization_security_profile_group_service::GetLocation::new(
6540 self.inner.clone(),
6541 )
6542 }
6543
6544 /// Sets the access control policy on the specified resource. Replaces
6545 /// any existing policy.
6546 ///
6547 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6548 /// errors.
6549 ///
6550 /// # Example
6551 /// ```
6552 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6553 /// use google_cloud_networksecurity_v1::Result;
6554 /// async fn sample(
6555 /// client: &OrganizationSecurityProfileGroupService
6556 /// ) -> Result<()> {
6557 /// let response = client.set_iam_policy()
6558 /// /* set fields */
6559 /// .send().await?;
6560 /// println!("response {:?}", response);
6561 /// Ok(())
6562 /// }
6563 /// ```
6564 pub fn set_iam_policy(
6565 &self,
6566 ) -> super::builder::organization_security_profile_group_service::SetIamPolicy {
6567 super::builder::organization_security_profile_group_service::SetIamPolicy::new(
6568 self.inner.clone(),
6569 )
6570 }
6571
6572 /// Gets the access control policy for a resource. Returns an empty policy
6573 /// if the resource exists and does not have a policy set.
6574 ///
6575 /// # Example
6576 /// ```
6577 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6578 /// use google_cloud_networksecurity_v1::Result;
6579 /// async fn sample(
6580 /// client: &OrganizationSecurityProfileGroupService
6581 /// ) -> Result<()> {
6582 /// let response = client.get_iam_policy()
6583 /// /* set fields */
6584 /// .send().await?;
6585 /// println!("response {:?}", response);
6586 /// Ok(())
6587 /// }
6588 /// ```
6589 pub fn get_iam_policy(
6590 &self,
6591 ) -> super::builder::organization_security_profile_group_service::GetIamPolicy {
6592 super::builder::organization_security_profile_group_service::GetIamPolicy::new(
6593 self.inner.clone(),
6594 )
6595 }
6596
6597 /// Returns permissions that a caller has on the specified resource. If the
6598 /// resource does not exist, this will return an empty set of
6599 /// permissions, not a `NOT_FOUND` error.
6600 ///
6601 /// Note: This operation is designed to be used for building
6602 /// permission-aware UIs and command-line tools, not for authorization
6603 /// checking. This operation may "fail open" without warning.
6604 ///
6605 /// # Example
6606 /// ```
6607 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6608 /// use google_cloud_networksecurity_v1::Result;
6609 /// async fn sample(
6610 /// client: &OrganizationSecurityProfileGroupService
6611 /// ) -> Result<()> {
6612 /// let response = client.test_iam_permissions()
6613 /// /* set fields */
6614 /// .send().await?;
6615 /// println!("response {:?}", response);
6616 /// Ok(())
6617 /// }
6618 /// ```
6619 pub fn test_iam_permissions(
6620 &self,
6621 ) -> super::builder::organization_security_profile_group_service::TestIamPermissions {
6622 super::builder::organization_security_profile_group_service::TestIamPermissions::new(
6623 self.inner.clone(),
6624 )
6625 }
6626
6627 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6628 ///
6629 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6630 ///
6631 /// # Example
6632 /// ```
6633 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6634 /// use google_cloud_gax::paginator::ItemPaginator as _;
6635 /// use google_cloud_networksecurity_v1::Result;
6636 /// async fn sample(
6637 /// client: &OrganizationSecurityProfileGroupService
6638 /// ) -> Result<()> {
6639 /// let mut list = client.list_operations()
6640 /// /* set fields */
6641 /// .by_item();
6642 /// while let Some(item) = list.next().await.transpose()? {
6643 /// println!("{:?}", item);
6644 /// }
6645 /// Ok(())
6646 /// }
6647 /// ```
6648 pub fn list_operations(
6649 &self,
6650 ) -> super::builder::organization_security_profile_group_service::ListOperations {
6651 super::builder::organization_security_profile_group_service::ListOperations::new(
6652 self.inner.clone(),
6653 )
6654 }
6655
6656 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6657 ///
6658 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6659 ///
6660 /// # Example
6661 /// ```
6662 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6663 /// use google_cloud_networksecurity_v1::Result;
6664 /// async fn sample(
6665 /// client: &OrganizationSecurityProfileGroupService
6666 /// ) -> Result<()> {
6667 /// let response = client.get_operation()
6668 /// /* set fields */
6669 /// .send().await?;
6670 /// println!("response {:?}", response);
6671 /// Ok(())
6672 /// }
6673 /// ```
6674 pub fn get_operation(
6675 &self,
6676 ) -> super::builder::organization_security_profile_group_service::GetOperation {
6677 super::builder::organization_security_profile_group_service::GetOperation::new(
6678 self.inner.clone(),
6679 )
6680 }
6681
6682 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6683 ///
6684 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6685 ///
6686 /// # Example
6687 /// ```
6688 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6689 /// use google_cloud_networksecurity_v1::Result;
6690 /// async fn sample(
6691 /// client: &OrganizationSecurityProfileGroupService
6692 /// ) -> Result<()> {
6693 /// client.delete_operation()
6694 /// /* set fields */
6695 /// .send().await?;
6696 /// Ok(())
6697 /// }
6698 /// ```
6699 pub fn delete_operation(
6700 &self,
6701 ) -> super::builder::organization_security_profile_group_service::DeleteOperation {
6702 super::builder::organization_security_profile_group_service::DeleteOperation::new(
6703 self.inner.clone(),
6704 )
6705 }
6706
6707 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6708 ///
6709 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6710 ///
6711 /// # Example
6712 /// ```
6713 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6714 /// use google_cloud_networksecurity_v1::Result;
6715 /// async fn sample(
6716 /// client: &OrganizationSecurityProfileGroupService
6717 /// ) -> Result<()> {
6718 /// client.cancel_operation()
6719 /// /* set fields */
6720 /// .send().await?;
6721 /// Ok(())
6722 /// }
6723 /// ```
6724 pub fn cancel_operation(
6725 &self,
6726 ) -> super::builder::organization_security_profile_group_service::CancelOperation {
6727 super::builder::organization_security_profile_group_service::CancelOperation::new(
6728 self.inner.clone(),
6729 )
6730 }
6731}