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