google_cloud_networksecurity_v1/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Network Security API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_networksecurity_v1::client::AddressGroupService;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26/// parent: &str,
27/// ) -> anyhow::Result<()> {
28/// let client = AddressGroupService::builder().build().await?;
29/// let mut list = client.list_address_groups()
30/// .set_parent(parent)
31/// .by_item();
32/// while let Some(item) = list.next().await.transpose()? {
33/// println!("{:?}", item);
34/// }
35/// Ok(())
36/// }
37/// ```
38///
39/// # Service Description
40///
41/// AddressGroup is a resource that manages a collection of IP or Domain Names,
42/// it can be used in Firewall Policy to represent allow or deny traffic from
43/// all the IP or Domain Names from the Address Group.
44///
45/// # Configuration
46///
47/// To configure `AddressGroupService` use the `with_*` methods in the type returned
48/// by [builder()][AddressGroupService::builder]. The default configuration should
49/// work for most applications. Common configuration changes include
50///
51/// * [with_endpoint()]: by default this client uses the global default endpoint
52/// (`https://networksecurity.googleapis.com`). Applications using regional
53/// endpoints or running in restricted networks (e.g. a network configured
54/// with [Private Google Access with VPC Service Controls]) may want to
55/// override this default.
56/// * [with_credentials()]: by default this client uses
57/// [Application Default Credentials]. Applications using custom
58/// authentication may need to override this default.
59///
60/// [with_endpoint()]: super::builder::address_group_service::ClientBuilder::with_endpoint
61/// [with_credentials()]: super::builder::address_group_service::ClientBuilder::with_credentials
62/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
63/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
64///
65/// # Pooling and Cloning
66///
67/// `AddressGroupService` holds a connection pool internally, it is advised to
68/// create one and reuse it. You do not need to wrap `AddressGroupService` in
69/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
70/// already uses an `Arc` internally.
71#[derive(Clone, Debug)]
72pub struct AddressGroupService {
73 inner: std::sync::Arc<dyn super::stub::dynamic::AddressGroupService>,
74}
75
76impl AddressGroupService {
77 /// Returns a builder for [AddressGroupService].
78 ///
79 /// ```
80 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
81 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
82 /// let client = AddressGroupService::builder().build().await?;
83 /// # Ok(()) }
84 /// ```
85 pub fn builder() -> super::builder::address_group_service::ClientBuilder {
86 crate::new_client_builder(super::builder::address_group_service::client::Factory)
87 }
88
89 /// Creates a new client from the provided stub.
90 ///
91 /// The most common case for calling this function is in tests mocking the
92 /// client's behavior.
93 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
94 where
95 T: super::stub::AddressGroupService + 'static,
96 {
97 Self { inner: stub.into() }
98 }
99
100 pub(crate) async fn new(
101 config: gaxi::options::ClientConfig,
102 ) -> crate::ClientBuilderResult<Self> {
103 let inner = Self::build_inner(config).await?;
104 Ok(Self { inner })
105 }
106
107 async fn build_inner(
108 conf: gaxi::options::ClientConfig,
109 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AddressGroupService>>
110 {
111 if gaxi::options::tracing_enabled(&conf) {
112 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
113 }
114 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
115 }
116
117 async fn build_transport(
118 conf: gaxi::options::ClientConfig,
119 ) -> crate::ClientBuilderResult<impl super::stub::AddressGroupService> {
120 super::transport::AddressGroupService::new(conf).await
121 }
122
123 async fn build_with_tracing(
124 conf: gaxi::options::ClientConfig,
125 ) -> crate::ClientBuilderResult<impl super::stub::AddressGroupService> {
126 Self::build_transport(conf)
127 .await
128 .map(super::tracing::AddressGroupService::new)
129 }
130
131 /// Lists address groups in a given project and location.
132 ///
133 /// # Example
134 /// ```
135 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
136 /// use google_cloud_gax::paginator::ItemPaginator as _;
137 /// use google_cloud_networksecurity_v1::Result;
138 /// async fn sample(
139 /// client: &AddressGroupService, parent: &str
140 /// ) -> Result<()> {
141 /// let mut list = client.list_address_groups()
142 /// .set_parent(parent)
143 /// .by_item();
144 /// while let Some(item) = list.next().await.transpose()? {
145 /// println!("{:?}", item);
146 /// }
147 /// Ok(())
148 /// }
149 /// ```
150 pub fn list_address_groups(&self) -> super::builder::address_group_service::ListAddressGroups {
151 super::builder::address_group_service::ListAddressGroups::new(self.inner.clone())
152 }
153
154 /// Gets details of a single address group.
155 ///
156 /// # Example
157 /// ```
158 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
159 /// use google_cloud_networksecurity_v1::Result;
160 /// async fn sample(
161 /// client: &AddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
162 /// ) -> Result<()> {
163 /// let response = client.get_address_group()
164 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
165 /// .send().await?;
166 /// println!("response {:?}", response);
167 /// Ok(())
168 /// }
169 /// ```
170 pub fn get_address_group(&self) -> super::builder::address_group_service::GetAddressGroup {
171 super::builder::address_group_service::GetAddressGroup::new(self.inner.clone())
172 }
173
174 /// Creates a new address group in a given project and location.
175 ///
176 /// # Long running operations
177 ///
178 /// This method is used to start, and/or poll a [long-running Operation].
179 /// The [Working with long-running operations] chapter in the [user guide]
180 /// covers these operations in detail.
181 ///
182 /// [long-running operation]: https://google.aip.dev/151
183 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
184 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
185 ///
186 /// # Example
187 /// ```
188 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
189 /// use google_cloud_lro::Poller;
190 /// use google_cloud_networksecurity_v1::model::AddressGroup;
191 /// use google_cloud_networksecurity_v1::Result;
192 /// async fn sample(
193 /// client: &AddressGroupService, project_id: &str, location_id: &str
194 /// ) -> Result<()> {
195 /// let response = client.create_address_group()
196 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
197 /// .set_address_group(
198 /// AddressGroup::new()/* set fields */
199 /// )
200 /// .poller().until_done().await?;
201 /// println!("response {:?}", response);
202 /// Ok(())
203 /// }
204 /// ```
205 pub fn create_address_group(
206 &self,
207 ) -> super::builder::address_group_service::CreateAddressGroup {
208 super::builder::address_group_service::CreateAddressGroup::new(self.inner.clone())
209 }
210
211 /// Updates the parameters of a single address group.
212 ///
213 /// # Long running operations
214 ///
215 /// This method is used to start, and/or poll a [long-running Operation].
216 /// The [Working with long-running operations] chapter in the [user guide]
217 /// covers these operations in detail.
218 ///
219 /// [long-running operation]: https://google.aip.dev/151
220 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
221 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
222 ///
223 /// # Example
224 /// ```
225 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
226 /// use google_cloud_lro::Poller;
227 /// # extern crate wkt as google_cloud_wkt;
228 /// use google_cloud_wkt::FieldMask;
229 /// use google_cloud_networksecurity_v1::model::AddressGroup;
230 /// use google_cloud_networksecurity_v1::Result;
231 /// async fn sample(
232 /// client: &AddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
233 /// ) -> Result<()> {
234 /// let response = client.update_address_group()
235 /// .set_address_group(
236 /// AddressGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))/* set fields */
237 /// )
238 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
239 /// .poller().until_done().await?;
240 /// println!("response {:?}", response);
241 /// Ok(())
242 /// }
243 /// ```
244 pub fn update_address_group(
245 &self,
246 ) -> super::builder::address_group_service::UpdateAddressGroup {
247 super::builder::address_group_service::UpdateAddressGroup::new(self.inner.clone())
248 }
249
250 /// Adds items to an address group.
251 ///
252 /// # Long running operations
253 ///
254 /// This method is used to start, and/or poll a [long-running Operation].
255 /// The [Working with long-running operations] chapter in the [user guide]
256 /// covers these operations in detail.
257 ///
258 /// [long-running operation]: https://google.aip.dev/151
259 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
260 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
261 ///
262 /// # Example
263 /// ```
264 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
265 /// use google_cloud_lro::Poller;
266 /// use google_cloud_networksecurity_v1::Result;
267 /// async fn sample(
268 /// client: &AddressGroupService
269 /// ) -> Result<()> {
270 /// let response = client.add_address_group_items()
271 /// /* set fields */
272 /// .poller().until_done().await?;
273 /// println!("response {:?}", response);
274 /// Ok(())
275 /// }
276 /// ```
277 pub fn add_address_group_items(
278 &self,
279 ) -> super::builder::address_group_service::AddAddressGroupItems {
280 super::builder::address_group_service::AddAddressGroupItems::new(self.inner.clone())
281 }
282
283 /// Removes items from an address group.
284 ///
285 /// # Long running operations
286 ///
287 /// This method is used to start, and/or poll a [long-running Operation].
288 /// The [Working with long-running operations] chapter in the [user guide]
289 /// covers these operations in detail.
290 ///
291 /// [long-running operation]: https://google.aip.dev/151
292 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
293 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
294 ///
295 /// # Example
296 /// ```
297 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
298 /// use google_cloud_lro::Poller;
299 /// use google_cloud_networksecurity_v1::Result;
300 /// async fn sample(
301 /// client: &AddressGroupService
302 /// ) -> Result<()> {
303 /// let response = client.remove_address_group_items()
304 /// /* set fields */
305 /// .poller().until_done().await?;
306 /// println!("response {:?}", response);
307 /// Ok(())
308 /// }
309 /// ```
310 pub fn remove_address_group_items(
311 &self,
312 ) -> super::builder::address_group_service::RemoveAddressGroupItems {
313 super::builder::address_group_service::RemoveAddressGroupItems::new(self.inner.clone())
314 }
315
316 /// Clones items from one address group to another.
317 ///
318 /// # Long running operations
319 ///
320 /// This method is used to start, and/or poll a [long-running Operation].
321 /// The [Working with long-running operations] chapter in the [user guide]
322 /// covers these operations in detail.
323 ///
324 /// [long-running operation]: https://google.aip.dev/151
325 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
326 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
327 ///
328 /// # Example
329 /// ```
330 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
331 /// use google_cloud_lro::Poller;
332 /// use google_cloud_networksecurity_v1::Result;
333 /// async fn sample(
334 /// client: &AddressGroupService
335 /// ) -> Result<()> {
336 /// let response = client.clone_address_group_items()
337 /// /* set fields */
338 /// .poller().until_done().await?;
339 /// println!("response {:?}", response);
340 /// Ok(())
341 /// }
342 /// ```
343 pub fn clone_address_group_items(
344 &self,
345 ) -> super::builder::address_group_service::CloneAddressGroupItems {
346 super::builder::address_group_service::CloneAddressGroupItems::new(self.inner.clone())
347 }
348
349 /// Deletes a single address group.
350 ///
351 /// # Long running operations
352 ///
353 /// This method is used to start, and/or poll a [long-running Operation].
354 /// The [Working with long-running operations] chapter in the [user guide]
355 /// covers these operations in detail.
356 ///
357 /// [long-running operation]: https://google.aip.dev/151
358 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
359 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
360 ///
361 /// # Example
362 /// ```
363 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
364 /// use google_cloud_lro::Poller;
365 /// use google_cloud_networksecurity_v1::Result;
366 /// async fn sample(
367 /// client: &AddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
368 /// ) -> Result<()> {
369 /// client.delete_address_group()
370 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
371 /// .poller().until_done().await?;
372 /// Ok(())
373 /// }
374 /// ```
375 pub fn delete_address_group(
376 &self,
377 ) -> super::builder::address_group_service::DeleteAddressGroup {
378 super::builder::address_group_service::DeleteAddressGroup::new(self.inner.clone())
379 }
380
381 /// Lists references of an address group.
382 ///
383 /// # Example
384 /// ```
385 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
386 /// use google_cloud_gax::paginator::ItemPaginator as _;
387 /// use google_cloud_networksecurity_v1::Result;
388 /// async fn sample(
389 /// client: &AddressGroupService
390 /// ) -> Result<()> {
391 /// let mut list = client.list_address_group_references()
392 /// /* set fields */
393 /// .by_item();
394 /// while let Some(item) = list.next().await.transpose()? {
395 /// println!("{:?}", item);
396 /// }
397 /// Ok(())
398 /// }
399 /// ```
400 pub fn list_address_group_references(
401 &self,
402 ) -> super::builder::address_group_service::ListAddressGroupReferences {
403 super::builder::address_group_service::ListAddressGroupReferences::new(self.inner.clone())
404 }
405
406 /// Lists information about the supported locations for this service.
407 ///
408 /// This method lists locations based on the resource scope provided in
409 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
410 /// **Global locations**: If `name` is empty, the method lists the
411 /// public locations available to all projects. * **Project-specific
412 /// locations**: If `name` follows the format
413 /// `projects/{project}`, the method lists locations visible to that
414 /// specific project. This includes public, private, or other
415 /// project-specific locations enabled for the project.
416 ///
417 /// For gRPC and client library implementations, the resource name is
418 /// passed as the `name` field. For direct service calls, the resource
419 /// name is
420 /// incorporated into the request path based on the specific service
421 /// implementation and version.
422 ///
423 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
424 ///
425 /// # Example
426 /// ```
427 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
428 /// use google_cloud_gax::paginator::ItemPaginator as _;
429 /// use google_cloud_networksecurity_v1::Result;
430 /// async fn sample(
431 /// client: &AddressGroupService
432 /// ) -> Result<()> {
433 /// let mut list = client.list_locations()
434 /// /* set fields */
435 /// .by_item();
436 /// while let Some(item) = list.next().await.transpose()? {
437 /// println!("{:?}", item);
438 /// }
439 /// Ok(())
440 /// }
441 /// ```
442 pub fn list_locations(&self) -> super::builder::address_group_service::ListLocations {
443 super::builder::address_group_service::ListLocations::new(self.inner.clone())
444 }
445
446 /// Gets information about a location.
447 ///
448 /// # Example
449 /// ```
450 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
451 /// use google_cloud_networksecurity_v1::Result;
452 /// async fn sample(
453 /// client: &AddressGroupService
454 /// ) -> Result<()> {
455 /// let response = client.get_location()
456 /// /* set fields */
457 /// .send().await?;
458 /// println!("response {:?}", response);
459 /// Ok(())
460 /// }
461 /// ```
462 pub fn get_location(&self) -> super::builder::address_group_service::GetLocation {
463 super::builder::address_group_service::GetLocation::new(self.inner.clone())
464 }
465
466 /// Sets the access control policy on the specified resource. Replaces
467 /// any existing policy.
468 ///
469 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
470 /// errors.
471 ///
472 /// # Example
473 /// ```
474 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
475 /// use google_cloud_networksecurity_v1::Result;
476 /// async fn sample(
477 /// client: &AddressGroupService
478 /// ) -> Result<()> {
479 /// let response = client.set_iam_policy()
480 /// /* set fields */
481 /// .send().await?;
482 /// println!("response {:?}", response);
483 /// Ok(())
484 /// }
485 /// ```
486 pub fn set_iam_policy(&self) -> super::builder::address_group_service::SetIamPolicy {
487 super::builder::address_group_service::SetIamPolicy::new(self.inner.clone())
488 }
489
490 /// Gets the access control policy for a resource. Returns an empty policy
491 /// if the resource exists and does not have a policy set.
492 ///
493 /// # Example
494 /// ```
495 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
496 /// use google_cloud_networksecurity_v1::Result;
497 /// async fn sample(
498 /// client: &AddressGroupService
499 /// ) -> Result<()> {
500 /// let response = client.get_iam_policy()
501 /// /* set fields */
502 /// .send().await?;
503 /// println!("response {:?}", response);
504 /// Ok(())
505 /// }
506 /// ```
507 pub fn get_iam_policy(&self) -> super::builder::address_group_service::GetIamPolicy {
508 super::builder::address_group_service::GetIamPolicy::new(self.inner.clone())
509 }
510
511 /// Returns permissions that a caller has on the specified resource. If the
512 /// resource does not exist, this will return an empty set of
513 /// permissions, not a `NOT_FOUND` error.
514 ///
515 /// Note: This operation is designed to be used for building
516 /// permission-aware UIs and command-line tools, not for authorization
517 /// checking. This operation may "fail open" without warning.
518 ///
519 /// # Example
520 /// ```
521 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
522 /// use google_cloud_networksecurity_v1::Result;
523 /// async fn sample(
524 /// client: &AddressGroupService
525 /// ) -> Result<()> {
526 /// let response = client.test_iam_permissions()
527 /// /* set fields */
528 /// .send().await?;
529 /// println!("response {:?}", response);
530 /// Ok(())
531 /// }
532 /// ```
533 pub fn test_iam_permissions(
534 &self,
535 ) -> super::builder::address_group_service::TestIamPermissions {
536 super::builder::address_group_service::TestIamPermissions::new(self.inner.clone())
537 }
538
539 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
540 ///
541 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
542 ///
543 /// # Example
544 /// ```
545 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
546 /// use google_cloud_gax::paginator::ItemPaginator as _;
547 /// use google_cloud_networksecurity_v1::Result;
548 /// async fn sample(
549 /// client: &AddressGroupService
550 /// ) -> Result<()> {
551 /// let mut list = client.list_operations()
552 /// /* set fields */
553 /// .by_item();
554 /// while let Some(item) = list.next().await.transpose()? {
555 /// println!("{:?}", item);
556 /// }
557 /// Ok(())
558 /// }
559 /// ```
560 pub fn list_operations(&self) -> super::builder::address_group_service::ListOperations {
561 super::builder::address_group_service::ListOperations::new(self.inner.clone())
562 }
563
564 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
565 ///
566 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
567 ///
568 /// # Example
569 /// ```
570 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
571 /// use google_cloud_networksecurity_v1::Result;
572 /// async fn sample(
573 /// client: &AddressGroupService
574 /// ) -> Result<()> {
575 /// let response = client.get_operation()
576 /// /* set fields */
577 /// .send().await?;
578 /// println!("response {:?}", response);
579 /// Ok(())
580 /// }
581 /// ```
582 pub fn get_operation(&self) -> super::builder::address_group_service::GetOperation {
583 super::builder::address_group_service::GetOperation::new(self.inner.clone())
584 }
585
586 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
587 ///
588 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
589 ///
590 /// # Example
591 /// ```
592 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
593 /// use google_cloud_networksecurity_v1::Result;
594 /// async fn sample(
595 /// client: &AddressGroupService
596 /// ) -> Result<()> {
597 /// client.delete_operation()
598 /// /* set fields */
599 /// .send().await?;
600 /// Ok(())
601 /// }
602 /// ```
603 pub fn delete_operation(&self) -> super::builder::address_group_service::DeleteOperation {
604 super::builder::address_group_service::DeleteOperation::new(self.inner.clone())
605 }
606
607 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
608 ///
609 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
610 ///
611 /// # Example
612 /// ```
613 /// # use google_cloud_networksecurity_v1::client::AddressGroupService;
614 /// use google_cloud_networksecurity_v1::Result;
615 /// async fn sample(
616 /// client: &AddressGroupService
617 /// ) -> Result<()> {
618 /// client.cancel_operation()
619 /// /* set fields */
620 /// .send().await?;
621 /// Ok(())
622 /// }
623 /// ```
624 pub fn cancel_operation(&self) -> super::builder::address_group_service::CancelOperation {
625 super::builder::address_group_service::CancelOperation::new(self.inner.clone())
626 }
627}
628
629/// Implements a client for the Network Security API.
630///
631/// # Example
632/// ```
633/// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
634/// use google_cloud_gax::paginator::ItemPaginator as _;
635/// async fn sample(
636/// parent: &str,
637/// ) -> anyhow::Result<()> {
638/// let client = OrganizationAddressGroupService::builder().build().await?;
639/// let mut list = client.list_address_groups()
640/// .set_parent(parent)
641/// .by_item();
642/// while let Some(item) = list.next().await.transpose()? {
643/// println!("{:?}", item);
644/// }
645/// Ok(())
646/// }
647/// ```
648///
649/// # Service Description
650///
651/// Organization AddressGroup is created under organization. Requests against
652/// Organization AddressGroup will use project from request credential for
653/// activation/quota/visibility check.
654///
655/// # Configuration
656///
657/// To configure `OrganizationAddressGroupService` use the `with_*` methods in the type returned
658/// by [builder()][OrganizationAddressGroupService::builder]. The default configuration should
659/// work for most applications. Common configuration changes include
660///
661/// * [with_endpoint()]: by default this client uses the global default endpoint
662/// (`https://networksecurity.googleapis.com`). Applications using regional
663/// endpoints or running in restricted networks (e.g. a network configured
664/// with [Private Google Access with VPC Service Controls]) may want to
665/// override this default.
666/// * [with_credentials()]: by default this client uses
667/// [Application Default Credentials]. Applications using custom
668/// authentication may need to override this default.
669///
670/// [with_endpoint()]: super::builder::organization_address_group_service::ClientBuilder::with_endpoint
671/// [with_credentials()]: super::builder::organization_address_group_service::ClientBuilder::with_credentials
672/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
673/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
674///
675/// # Pooling and Cloning
676///
677/// `OrganizationAddressGroupService` holds a connection pool internally, it is advised to
678/// create one and reuse it. You do not need to wrap `OrganizationAddressGroupService` in
679/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
680/// already uses an `Arc` internally.
681#[derive(Clone, Debug)]
682pub struct OrganizationAddressGroupService {
683 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
684}
685
686impl OrganizationAddressGroupService {
687 /// Returns a builder for [OrganizationAddressGroupService].
688 ///
689 /// ```
690 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
691 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
692 /// let client = OrganizationAddressGroupService::builder().build().await?;
693 /// # Ok(()) }
694 /// ```
695 pub fn builder() -> super::builder::organization_address_group_service::ClientBuilder {
696 crate::new_client_builder(
697 super::builder::organization_address_group_service::client::Factory,
698 )
699 }
700
701 /// Creates a new client from the provided stub.
702 ///
703 /// The most common case for calling this function is in tests mocking the
704 /// client's behavior.
705 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
706 where
707 T: super::stub::OrganizationAddressGroupService + 'static,
708 {
709 Self { inner: stub.into() }
710 }
711
712 pub(crate) async fn new(
713 config: gaxi::options::ClientConfig,
714 ) -> crate::ClientBuilderResult<Self> {
715 let inner = Self::build_inner(config).await?;
716 Ok(Self { inner })
717 }
718
719 async fn build_inner(
720 conf: gaxi::options::ClientConfig,
721 ) -> crate::ClientBuilderResult<
722 std::sync::Arc<dyn super::stub::dynamic::OrganizationAddressGroupService>,
723 > {
724 if gaxi::options::tracing_enabled(&conf) {
725 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
726 }
727 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
728 }
729
730 async fn build_transport(
731 conf: gaxi::options::ClientConfig,
732 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationAddressGroupService> {
733 super::transport::OrganizationAddressGroupService::new(conf).await
734 }
735
736 async fn build_with_tracing(
737 conf: gaxi::options::ClientConfig,
738 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationAddressGroupService> {
739 Self::build_transport(conf)
740 .await
741 .map(super::tracing::OrganizationAddressGroupService::new)
742 }
743
744 /// Lists address groups in a given project and location.
745 ///
746 /// # Example
747 /// ```
748 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
749 /// use google_cloud_gax::paginator::ItemPaginator as _;
750 /// use google_cloud_networksecurity_v1::Result;
751 /// async fn sample(
752 /// client: &OrganizationAddressGroupService, parent: &str
753 /// ) -> Result<()> {
754 /// let mut list = client.list_address_groups()
755 /// .set_parent(parent)
756 /// .by_item();
757 /// while let Some(item) = list.next().await.transpose()? {
758 /// println!("{:?}", item);
759 /// }
760 /// Ok(())
761 /// }
762 /// ```
763 pub fn list_address_groups(
764 &self,
765 ) -> super::builder::organization_address_group_service::ListAddressGroups {
766 super::builder::organization_address_group_service::ListAddressGroups::new(
767 self.inner.clone(),
768 )
769 }
770
771 /// Gets details of a single address group.
772 ///
773 /// # Example
774 /// ```
775 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
776 /// use google_cloud_networksecurity_v1::Result;
777 /// async fn sample(
778 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
779 /// ) -> Result<()> {
780 /// let response = client.get_address_group()
781 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
782 /// .send().await?;
783 /// println!("response {:?}", response);
784 /// Ok(())
785 /// }
786 /// ```
787 pub fn get_address_group(
788 &self,
789 ) -> super::builder::organization_address_group_service::GetAddressGroup {
790 super::builder::organization_address_group_service::GetAddressGroup::new(self.inner.clone())
791 }
792
793 /// Creates a new address group in a given project and location.
794 ///
795 /// # Long running operations
796 ///
797 /// This method is used to start, and/or poll a [long-running Operation].
798 /// The [Working with long-running operations] chapter in the [user guide]
799 /// covers these operations in detail.
800 ///
801 /// [long-running operation]: https://google.aip.dev/151
802 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
803 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
804 ///
805 /// # Example
806 /// ```
807 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
808 /// use google_cloud_lro::Poller;
809 /// use google_cloud_networksecurity_v1::model::AddressGroup;
810 /// use google_cloud_networksecurity_v1::Result;
811 /// async fn sample(
812 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str
813 /// ) -> Result<()> {
814 /// let response = client.create_address_group()
815 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
816 /// .set_address_group(
817 /// AddressGroup::new()/* set fields */
818 /// )
819 /// .poller().until_done().await?;
820 /// println!("response {:?}", response);
821 /// Ok(())
822 /// }
823 /// ```
824 pub fn create_address_group(
825 &self,
826 ) -> super::builder::organization_address_group_service::CreateAddressGroup {
827 super::builder::organization_address_group_service::CreateAddressGroup::new(
828 self.inner.clone(),
829 )
830 }
831
832 /// Updates parameters of an address group.
833 ///
834 /// # Long running operations
835 ///
836 /// This method is used to start, and/or poll a [long-running Operation].
837 /// The [Working with long-running operations] chapter in the [user guide]
838 /// covers these operations in detail.
839 ///
840 /// [long-running operation]: https://google.aip.dev/151
841 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
842 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
843 ///
844 /// # Example
845 /// ```
846 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
847 /// use google_cloud_lro::Poller;
848 /// # extern crate wkt as google_cloud_wkt;
849 /// use google_cloud_wkt::FieldMask;
850 /// use google_cloud_networksecurity_v1::model::AddressGroup;
851 /// use google_cloud_networksecurity_v1::Result;
852 /// async fn sample(
853 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
854 /// ) -> Result<()> {
855 /// let response = client.update_address_group()
856 /// .set_address_group(
857 /// AddressGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))/* set fields */
858 /// )
859 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
860 /// .poller().until_done().await?;
861 /// println!("response {:?}", response);
862 /// Ok(())
863 /// }
864 /// ```
865 pub fn update_address_group(
866 &self,
867 ) -> super::builder::organization_address_group_service::UpdateAddressGroup {
868 super::builder::organization_address_group_service::UpdateAddressGroup::new(
869 self.inner.clone(),
870 )
871 }
872
873 /// Adds items to an address group.
874 ///
875 /// # Long running operations
876 ///
877 /// This method is used to start, and/or poll a [long-running Operation].
878 /// The [Working with long-running operations] chapter in the [user guide]
879 /// covers these operations in detail.
880 ///
881 /// [long-running operation]: https://google.aip.dev/151
882 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
883 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
884 ///
885 /// # Example
886 /// ```
887 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
888 /// use google_cloud_lro::Poller;
889 /// use google_cloud_networksecurity_v1::Result;
890 /// async fn sample(
891 /// client: &OrganizationAddressGroupService
892 /// ) -> Result<()> {
893 /// let response = client.add_address_group_items()
894 /// /* set fields */
895 /// .poller().until_done().await?;
896 /// println!("response {:?}", response);
897 /// Ok(())
898 /// }
899 /// ```
900 pub fn add_address_group_items(
901 &self,
902 ) -> super::builder::organization_address_group_service::AddAddressGroupItems {
903 super::builder::organization_address_group_service::AddAddressGroupItems::new(
904 self.inner.clone(),
905 )
906 }
907
908 /// Removes items from an address group.
909 ///
910 /// # Long running operations
911 ///
912 /// This method is used to start, and/or poll a [long-running Operation].
913 /// The [Working with long-running operations] chapter in the [user guide]
914 /// covers these operations in detail.
915 ///
916 /// [long-running operation]: https://google.aip.dev/151
917 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
918 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
919 ///
920 /// # Example
921 /// ```
922 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
923 /// use google_cloud_lro::Poller;
924 /// use google_cloud_networksecurity_v1::Result;
925 /// async fn sample(
926 /// client: &OrganizationAddressGroupService
927 /// ) -> Result<()> {
928 /// let response = client.remove_address_group_items()
929 /// /* set fields */
930 /// .poller().until_done().await?;
931 /// println!("response {:?}", response);
932 /// Ok(())
933 /// }
934 /// ```
935 pub fn remove_address_group_items(
936 &self,
937 ) -> super::builder::organization_address_group_service::RemoveAddressGroupItems {
938 super::builder::organization_address_group_service::RemoveAddressGroupItems::new(
939 self.inner.clone(),
940 )
941 }
942
943 /// Clones items from one address group to another.
944 ///
945 /// # Long running operations
946 ///
947 /// This method is used to start, and/or poll a [long-running Operation].
948 /// The [Working with long-running operations] chapter in the [user guide]
949 /// covers these operations in detail.
950 ///
951 /// [long-running operation]: https://google.aip.dev/151
952 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
953 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
954 ///
955 /// # Example
956 /// ```
957 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
958 /// use google_cloud_lro::Poller;
959 /// use google_cloud_networksecurity_v1::Result;
960 /// async fn sample(
961 /// client: &OrganizationAddressGroupService
962 /// ) -> Result<()> {
963 /// let response = client.clone_address_group_items()
964 /// /* set fields */
965 /// .poller().until_done().await?;
966 /// println!("response {:?}", response);
967 /// Ok(())
968 /// }
969 /// ```
970 pub fn clone_address_group_items(
971 &self,
972 ) -> super::builder::organization_address_group_service::CloneAddressGroupItems {
973 super::builder::organization_address_group_service::CloneAddressGroupItems::new(
974 self.inner.clone(),
975 )
976 }
977
978 /// Deletes an address group.
979 ///
980 /// # Long running operations
981 ///
982 /// This method is used to start, and/or poll a [long-running Operation].
983 /// The [Working with long-running operations] chapter in the [user guide]
984 /// covers these operations in detail.
985 ///
986 /// [long-running operation]: https://google.aip.dev/151
987 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
988 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
989 ///
990 /// # Example
991 /// ```
992 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
993 /// use google_cloud_lro::Poller;
994 /// use google_cloud_networksecurity_v1::Result;
995 /// async fn sample(
996 /// client: &OrganizationAddressGroupService, project_id: &str, location_id: &str, address_group_id: &str
997 /// ) -> Result<()> {
998 /// client.delete_address_group()
999 /// .set_name(format!("projects/{project_id}/locations/{location_id}/addressGroups/{address_group_id}"))
1000 /// .poller().until_done().await?;
1001 /// Ok(())
1002 /// }
1003 /// ```
1004 pub fn delete_address_group(
1005 &self,
1006 ) -> super::builder::organization_address_group_service::DeleteAddressGroup {
1007 super::builder::organization_address_group_service::DeleteAddressGroup::new(
1008 self.inner.clone(),
1009 )
1010 }
1011
1012 /// Lists references of an address group.
1013 ///
1014 /// # Example
1015 /// ```
1016 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1017 /// use google_cloud_gax::paginator::ItemPaginator as _;
1018 /// use google_cloud_networksecurity_v1::Result;
1019 /// async fn sample(
1020 /// client: &OrganizationAddressGroupService
1021 /// ) -> Result<()> {
1022 /// let mut list = client.list_address_group_references()
1023 /// /* set fields */
1024 /// .by_item();
1025 /// while let Some(item) = list.next().await.transpose()? {
1026 /// println!("{:?}", item);
1027 /// }
1028 /// Ok(())
1029 /// }
1030 /// ```
1031 pub fn list_address_group_references(
1032 &self,
1033 ) -> super::builder::organization_address_group_service::ListAddressGroupReferences {
1034 super::builder::organization_address_group_service::ListAddressGroupReferences::new(
1035 self.inner.clone(),
1036 )
1037 }
1038
1039 /// Lists information about the supported locations for this service.
1040 ///
1041 /// This method lists locations based on the resource scope provided in
1042 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
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 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1057 ///
1058 /// # Example
1059 /// ```
1060 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1061 /// use google_cloud_gax::paginator::ItemPaginator as _;
1062 /// use google_cloud_networksecurity_v1::Result;
1063 /// async fn sample(
1064 /// client: &OrganizationAddressGroupService
1065 /// ) -> Result<()> {
1066 /// let mut list = client.list_locations()
1067 /// /* set fields */
1068 /// .by_item();
1069 /// while let Some(item) = list.next().await.transpose()? {
1070 /// println!("{:?}", item);
1071 /// }
1072 /// Ok(())
1073 /// }
1074 /// ```
1075 pub fn list_locations(
1076 &self,
1077 ) -> super::builder::organization_address_group_service::ListLocations {
1078 super::builder::organization_address_group_service::ListLocations::new(self.inner.clone())
1079 }
1080
1081 /// Gets information about a location.
1082 ///
1083 /// # Example
1084 /// ```
1085 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1086 /// use google_cloud_networksecurity_v1::Result;
1087 /// async fn sample(
1088 /// client: &OrganizationAddressGroupService
1089 /// ) -> Result<()> {
1090 /// let response = client.get_location()
1091 /// /* set fields */
1092 /// .send().await?;
1093 /// println!("response {:?}", response);
1094 /// Ok(())
1095 /// }
1096 /// ```
1097 pub fn get_location(&self) -> super::builder::organization_address_group_service::GetLocation {
1098 super::builder::organization_address_group_service::GetLocation::new(self.inner.clone())
1099 }
1100
1101 /// Sets the access control policy on the specified resource. Replaces
1102 /// any existing policy.
1103 ///
1104 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1105 /// errors.
1106 ///
1107 /// # Example
1108 /// ```
1109 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1110 /// use google_cloud_networksecurity_v1::Result;
1111 /// async fn sample(
1112 /// client: &OrganizationAddressGroupService
1113 /// ) -> Result<()> {
1114 /// let response = client.set_iam_policy()
1115 /// /* set fields */
1116 /// .send().await?;
1117 /// println!("response {:?}", response);
1118 /// Ok(())
1119 /// }
1120 /// ```
1121 pub fn set_iam_policy(
1122 &self,
1123 ) -> super::builder::organization_address_group_service::SetIamPolicy {
1124 super::builder::organization_address_group_service::SetIamPolicy::new(self.inner.clone())
1125 }
1126
1127 /// Gets the access control policy for a resource. Returns an empty policy
1128 /// if the resource exists and does not have a policy set.
1129 ///
1130 /// # Example
1131 /// ```
1132 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1133 /// use google_cloud_networksecurity_v1::Result;
1134 /// async fn sample(
1135 /// client: &OrganizationAddressGroupService
1136 /// ) -> Result<()> {
1137 /// let response = client.get_iam_policy()
1138 /// /* set fields */
1139 /// .send().await?;
1140 /// println!("response {:?}", response);
1141 /// Ok(())
1142 /// }
1143 /// ```
1144 pub fn get_iam_policy(
1145 &self,
1146 ) -> super::builder::organization_address_group_service::GetIamPolicy {
1147 super::builder::organization_address_group_service::GetIamPolicy::new(self.inner.clone())
1148 }
1149
1150 /// Returns permissions that a caller has on the specified resource. If the
1151 /// resource does not exist, this will return an empty set of
1152 /// permissions, not a `NOT_FOUND` error.
1153 ///
1154 /// Note: This operation is designed to be used for building
1155 /// permission-aware UIs and command-line tools, not for authorization
1156 /// checking. This operation may "fail open" without warning.
1157 ///
1158 /// # Example
1159 /// ```
1160 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1161 /// use google_cloud_networksecurity_v1::Result;
1162 /// async fn sample(
1163 /// client: &OrganizationAddressGroupService
1164 /// ) -> Result<()> {
1165 /// let response = client.test_iam_permissions()
1166 /// /* set fields */
1167 /// .send().await?;
1168 /// println!("response {:?}", response);
1169 /// Ok(())
1170 /// }
1171 /// ```
1172 pub fn test_iam_permissions(
1173 &self,
1174 ) -> super::builder::organization_address_group_service::TestIamPermissions {
1175 super::builder::organization_address_group_service::TestIamPermissions::new(
1176 self.inner.clone(),
1177 )
1178 }
1179
1180 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1181 ///
1182 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1183 ///
1184 /// # Example
1185 /// ```
1186 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1187 /// use google_cloud_gax::paginator::ItemPaginator as _;
1188 /// use google_cloud_networksecurity_v1::Result;
1189 /// async fn sample(
1190 /// client: &OrganizationAddressGroupService
1191 /// ) -> Result<()> {
1192 /// let mut list = client.list_operations()
1193 /// /* set fields */
1194 /// .by_item();
1195 /// while let Some(item) = list.next().await.transpose()? {
1196 /// println!("{:?}", item);
1197 /// }
1198 /// Ok(())
1199 /// }
1200 /// ```
1201 pub fn list_operations(
1202 &self,
1203 ) -> super::builder::organization_address_group_service::ListOperations {
1204 super::builder::organization_address_group_service::ListOperations::new(self.inner.clone())
1205 }
1206
1207 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1208 ///
1209 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1210 ///
1211 /// # Example
1212 /// ```
1213 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1214 /// use google_cloud_networksecurity_v1::Result;
1215 /// async fn sample(
1216 /// client: &OrganizationAddressGroupService
1217 /// ) -> Result<()> {
1218 /// let response = client.get_operation()
1219 /// /* set fields */
1220 /// .send().await?;
1221 /// println!("response {:?}", response);
1222 /// Ok(())
1223 /// }
1224 /// ```
1225 pub fn get_operation(
1226 &self,
1227 ) -> super::builder::organization_address_group_service::GetOperation {
1228 super::builder::organization_address_group_service::GetOperation::new(self.inner.clone())
1229 }
1230
1231 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1232 ///
1233 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1234 ///
1235 /// # Example
1236 /// ```
1237 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1238 /// use google_cloud_networksecurity_v1::Result;
1239 /// async fn sample(
1240 /// client: &OrganizationAddressGroupService
1241 /// ) -> Result<()> {
1242 /// client.delete_operation()
1243 /// /* set fields */
1244 /// .send().await?;
1245 /// Ok(())
1246 /// }
1247 /// ```
1248 pub fn delete_operation(
1249 &self,
1250 ) -> super::builder::organization_address_group_service::DeleteOperation {
1251 super::builder::organization_address_group_service::DeleteOperation::new(self.inner.clone())
1252 }
1253
1254 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1255 ///
1256 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1257 ///
1258 /// # Example
1259 /// ```
1260 /// # use google_cloud_networksecurity_v1::client::OrganizationAddressGroupService;
1261 /// use google_cloud_networksecurity_v1::Result;
1262 /// async fn sample(
1263 /// client: &OrganizationAddressGroupService
1264 /// ) -> Result<()> {
1265 /// client.cancel_operation()
1266 /// /* set fields */
1267 /// .send().await?;
1268 /// Ok(())
1269 /// }
1270 /// ```
1271 pub fn cancel_operation(
1272 &self,
1273 ) -> super::builder::organization_address_group_service::CancelOperation {
1274 super::builder::organization_address_group_service::CancelOperation::new(self.inner.clone())
1275 }
1276}
1277
1278/// Implements a client for the Network Security API.
1279///
1280/// # Example
1281/// ```
1282/// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1283/// use google_cloud_gax::paginator::ItemPaginator as _;
1284/// async fn sample(
1285/// project_id: &str,
1286/// location_id: &str,
1287/// ) -> anyhow::Result<()> {
1288/// let client = DnsThreatDetectorService::builder().build().await?;
1289/// let mut list = client.list_dns_threat_detectors()
1290/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1291/// .by_item();
1292/// while let Some(item) = list.next().await.transpose()? {
1293/// println!("{:?}", item);
1294/// }
1295/// Ok(())
1296/// }
1297/// ```
1298///
1299/// # Service Description
1300///
1301/// The Network Security API for DNS Threat Detectors.
1302///
1303/// # Configuration
1304///
1305/// To configure `DnsThreatDetectorService` use the `with_*` methods in the type returned
1306/// by [builder()][DnsThreatDetectorService::builder]. The default configuration should
1307/// work for most applications. Common configuration changes include
1308///
1309/// * [with_endpoint()]: by default this client uses the global default endpoint
1310/// (`https://networksecurity.googleapis.com`). Applications using regional
1311/// endpoints or running in restricted networks (e.g. a network configured
1312/// with [Private Google Access with VPC Service Controls]) may want to
1313/// override this default.
1314/// * [with_credentials()]: by default this client uses
1315/// [Application Default Credentials]. Applications using custom
1316/// authentication may need to override this default.
1317///
1318/// [with_endpoint()]: super::builder::dns_threat_detector_service::ClientBuilder::with_endpoint
1319/// [with_credentials()]: super::builder::dns_threat_detector_service::ClientBuilder::with_credentials
1320/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1321/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1322///
1323/// # Pooling and Cloning
1324///
1325/// `DnsThreatDetectorService` holds a connection pool internally, it is advised to
1326/// create one and reuse it. You do not need to wrap `DnsThreatDetectorService` in
1327/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1328/// already uses an `Arc` internally.
1329#[derive(Clone, Debug)]
1330pub struct DnsThreatDetectorService {
1331 inner: std::sync::Arc<dyn super::stub::dynamic::DnsThreatDetectorService>,
1332}
1333
1334impl DnsThreatDetectorService {
1335 /// Returns a builder for [DnsThreatDetectorService].
1336 ///
1337 /// ```
1338 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1339 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1340 /// let client = DnsThreatDetectorService::builder().build().await?;
1341 /// # Ok(()) }
1342 /// ```
1343 pub fn builder() -> super::builder::dns_threat_detector_service::ClientBuilder {
1344 crate::new_client_builder(super::builder::dns_threat_detector_service::client::Factory)
1345 }
1346
1347 /// Creates a new client from the provided stub.
1348 ///
1349 /// The most common case for calling this function is in tests mocking the
1350 /// client's behavior.
1351 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1352 where
1353 T: super::stub::DnsThreatDetectorService + 'static,
1354 {
1355 Self { inner: stub.into() }
1356 }
1357
1358 pub(crate) async fn new(
1359 config: gaxi::options::ClientConfig,
1360 ) -> crate::ClientBuilderResult<Self> {
1361 let inner = Self::build_inner(config).await?;
1362 Ok(Self { inner })
1363 }
1364
1365 async fn build_inner(
1366 conf: gaxi::options::ClientConfig,
1367 ) -> crate::ClientBuilderResult<
1368 std::sync::Arc<dyn super::stub::dynamic::DnsThreatDetectorService>,
1369 > {
1370 if gaxi::options::tracing_enabled(&conf) {
1371 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1372 }
1373 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1374 }
1375
1376 async fn build_transport(
1377 conf: gaxi::options::ClientConfig,
1378 ) -> crate::ClientBuilderResult<impl super::stub::DnsThreatDetectorService> {
1379 super::transport::DnsThreatDetectorService::new(conf).await
1380 }
1381
1382 async fn build_with_tracing(
1383 conf: gaxi::options::ClientConfig,
1384 ) -> crate::ClientBuilderResult<impl super::stub::DnsThreatDetectorService> {
1385 Self::build_transport(conf)
1386 .await
1387 .map(super::tracing::DnsThreatDetectorService::new)
1388 }
1389
1390 /// Lists DnsThreatDetectors in a given project and location.
1391 ///
1392 /// # Example
1393 /// ```
1394 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1395 /// use google_cloud_gax::paginator::ItemPaginator as _;
1396 /// use google_cloud_networksecurity_v1::Result;
1397 /// async fn sample(
1398 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str
1399 /// ) -> Result<()> {
1400 /// let mut list = client.list_dns_threat_detectors()
1401 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1402 /// .by_item();
1403 /// while let Some(item) = list.next().await.transpose()? {
1404 /// println!("{:?}", item);
1405 /// }
1406 /// Ok(())
1407 /// }
1408 /// ```
1409 pub fn list_dns_threat_detectors(
1410 &self,
1411 ) -> super::builder::dns_threat_detector_service::ListDnsThreatDetectors {
1412 super::builder::dns_threat_detector_service::ListDnsThreatDetectors::new(self.inner.clone())
1413 }
1414
1415 /// Gets the details of a single DnsThreatDetector.
1416 ///
1417 /// # Example
1418 /// ```
1419 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1420 /// use google_cloud_networksecurity_v1::Result;
1421 /// async fn sample(
1422 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str, dns_threat_detector_id: &str
1423 /// ) -> Result<()> {
1424 /// let response = client.get_dns_threat_detector()
1425 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dnsThreatDetectors/{dns_threat_detector_id}"))
1426 /// .send().await?;
1427 /// println!("response {:?}", response);
1428 /// Ok(())
1429 /// }
1430 /// ```
1431 pub fn get_dns_threat_detector(
1432 &self,
1433 ) -> super::builder::dns_threat_detector_service::GetDnsThreatDetector {
1434 super::builder::dns_threat_detector_service::GetDnsThreatDetector::new(self.inner.clone())
1435 }
1436
1437 /// Creates a new DnsThreatDetector in a given project and location.
1438 ///
1439 /// # Example
1440 /// ```
1441 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1442 /// use google_cloud_networksecurity_v1::model::DnsThreatDetector;
1443 /// use google_cloud_networksecurity_v1::Result;
1444 /// async fn sample(
1445 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str
1446 /// ) -> Result<()> {
1447 /// let response = client.create_dns_threat_detector()
1448 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1449 /// .set_dns_threat_detector(
1450 /// DnsThreatDetector::new()/* set fields */
1451 /// )
1452 /// .send().await?;
1453 /// println!("response {:?}", response);
1454 /// Ok(())
1455 /// }
1456 /// ```
1457 pub fn create_dns_threat_detector(
1458 &self,
1459 ) -> super::builder::dns_threat_detector_service::CreateDnsThreatDetector {
1460 super::builder::dns_threat_detector_service::CreateDnsThreatDetector::new(
1461 self.inner.clone(),
1462 )
1463 }
1464
1465 /// Updates a single DnsThreatDetector.
1466 ///
1467 /// # Example
1468 /// ```
1469 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1470 /// # extern crate wkt as google_cloud_wkt;
1471 /// use google_cloud_wkt::FieldMask;
1472 /// use google_cloud_networksecurity_v1::model::DnsThreatDetector;
1473 /// use google_cloud_networksecurity_v1::Result;
1474 /// async fn sample(
1475 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str, dns_threat_detector_id: &str
1476 /// ) -> Result<()> {
1477 /// let response = client.update_dns_threat_detector()
1478 /// .set_dns_threat_detector(
1479 /// DnsThreatDetector::new().set_name(format!("projects/{project_id}/locations/{location_id}/dnsThreatDetectors/{dns_threat_detector_id}"))/* set fields */
1480 /// )
1481 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1482 /// .send().await?;
1483 /// println!("response {:?}", response);
1484 /// Ok(())
1485 /// }
1486 /// ```
1487 pub fn update_dns_threat_detector(
1488 &self,
1489 ) -> super::builder::dns_threat_detector_service::UpdateDnsThreatDetector {
1490 super::builder::dns_threat_detector_service::UpdateDnsThreatDetector::new(
1491 self.inner.clone(),
1492 )
1493 }
1494
1495 /// Deletes a single DnsThreatDetector.
1496 ///
1497 /// # Example
1498 /// ```
1499 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1500 /// use google_cloud_networksecurity_v1::Result;
1501 /// async fn sample(
1502 /// client: &DnsThreatDetectorService, project_id: &str, location_id: &str, dns_threat_detector_id: &str
1503 /// ) -> Result<()> {
1504 /// client.delete_dns_threat_detector()
1505 /// .set_name(format!("projects/{project_id}/locations/{location_id}/dnsThreatDetectors/{dns_threat_detector_id}"))
1506 /// .send().await?;
1507 /// Ok(())
1508 /// }
1509 /// ```
1510 pub fn delete_dns_threat_detector(
1511 &self,
1512 ) -> super::builder::dns_threat_detector_service::DeleteDnsThreatDetector {
1513 super::builder::dns_threat_detector_service::DeleteDnsThreatDetector::new(
1514 self.inner.clone(),
1515 )
1516 }
1517
1518 /// Lists information about the supported locations for this service.
1519 ///
1520 /// This method lists locations based on the resource scope provided in
1521 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1522 /// **Global locations**: If `name` is empty, the method lists the
1523 /// public locations available to all projects. * **Project-specific
1524 /// locations**: If `name` follows the format
1525 /// `projects/{project}`, the method lists locations visible to that
1526 /// specific project. This includes public, private, or other
1527 /// project-specific locations enabled for the project.
1528 ///
1529 /// For gRPC and client library implementations, the resource name is
1530 /// passed as the `name` field. For direct service calls, the resource
1531 /// name is
1532 /// incorporated into the request path based on the specific service
1533 /// implementation and version.
1534 ///
1535 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1536 ///
1537 /// # Example
1538 /// ```
1539 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1540 /// use google_cloud_gax::paginator::ItemPaginator as _;
1541 /// use google_cloud_networksecurity_v1::Result;
1542 /// async fn sample(
1543 /// client: &DnsThreatDetectorService
1544 /// ) -> Result<()> {
1545 /// let mut list = client.list_locations()
1546 /// /* set fields */
1547 /// .by_item();
1548 /// while let Some(item) = list.next().await.transpose()? {
1549 /// println!("{:?}", item);
1550 /// }
1551 /// Ok(())
1552 /// }
1553 /// ```
1554 pub fn list_locations(&self) -> super::builder::dns_threat_detector_service::ListLocations {
1555 super::builder::dns_threat_detector_service::ListLocations::new(self.inner.clone())
1556 }
1557
1558 /// Gets information about a location.
1559 ///
1560 /// # Example
1561 /// ```
1562 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1563 /// use google_cloud_networksecurity_v1::Result;
1564 /// async fn sample(
1565 /// client: &DnsThreatDetectorService
1566 /// ) -> Result<()> {
1567 /// let response = client.get_location()
1568 /// /* set fields */
1569 /// .send().await?;
1570 /// println!("response {:?}", response);
1571 /// Ok(())
1572 /// }
1573 /// ```
1574 pub fn get_location(&self) -> super::builder::dns_threat_detector_service::GetLocation {
1575 super::builder::dns_threat_detector_service::GetLocation::new(self.inner.clone())
1576 }
1577
1578 /// Sets the access control policy on the specified resource. Replaces
1579 /// any existing policy.
1580 ///
1581 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
1582 /// errors.
1583 ///
1584 /// # Example
1585 /// ```
1586 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1587 /// use google_cloud_networksecurity_v1::Result;
1588 /// async fn sample(
1589 /// client: &DnsThreatDetectorService
1590 /// ) -> Result<()> {
1591 /// let response = client.set_iam_policy()
1592 /// /* set fields */
1593 /// .send().await?;
1594 /// println!("response {:?}", response);
1595 /// Ok(())
1596 /// }
1597 /// ```
1598 pub fn set_iam_policy(&self) -> super::builder::dns_threat_detector_service::SetIamPolicy {
1599 super::builder::dns_threat_detector_service::SetIamPolicy::new(self.inner.clone())
1600 }
1601
1602 /// Gets the access control policy for a resource. Returns an empty policy
1603 /// if the resource exists and does not have a policy set.
1604 ///
1605 /// # Example
1606 /// ```
1607 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1608 /// use google_cloud_networksecurity_v1::Result;
1609 /// async fn sample(
1610 /// client: &DnsThreatDetectorService
1611 /// ) -> Result<()> {
1612 /// let response = client.get_iam_policy()
1613 /// /* set fields */
1614 /// .send().await?;
1615 /// println!("response {:?}", response);
1616 /// Ok(())
1617 /// }
1618 /// ```
1619 pub fn get_iam_policy(&self) -> super::builder::dns_threat_detector_service::GetIamPolicy {
1620 super::builder::dns_threat_detector_service::GetIamPolicy::new(self.inner.clone())
1621 }
1622
1623 /// Returns permissions that a caller has on the specified resource. If the
1624 /// resource does not exist, this will return an empty set of
1625 /// permissions, not a `NOT_FOUND` error.
1626 ///
1627 /// Note: This operation is designed to be used for building
1628 /// permission-aware UIs and command-line tools, not for authorization
1629 /// checking. This operation may "fail open" without warning.
1630 ///
1631 /// # Example
1632 /// ```
1633 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1634 /// use google_cloud_networksecurity_v1::Result;
1635 /// async fn sample(
1636 /// client: &DnsThreatDetectorService
1637 /// ) -> Result<()> {
1638 /// let response = client.test_iam_permissions()
1639 /// /* set fields */
1640 /// .send().await?;
1641 /// println!("response {:?}", response);
1642 /// Ok(())
1643 /// }
1644 /// ```
1645 pub fn test_iam_permissions(
1646 &self,
1647 ) -> super::builder::dns_threat_detector_service::TestIamPermissions {
1648 super::builder::dns_threat_detector_service::TestIamPermissions::new(self.inner.clone())
1649 }
1650
1651 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1652 ///
1653 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1654 ///
1655 /// # Example
1656 /// ```
1657 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1658 /// use google_cloud_gax::paginator::ItemPaginator as _;
1659 /// use google_cloud_networksecurity_v1::Result;
1660 /// async fn sample(
1661 /// client: &DnsThreatDetectorService
1662 /// ) -> Result<()> {
1663 /// let mut list = client.list_operations()
1664 /// /* set fields */
1665 /// .by_item();
1666 /// while let Some(item) = list.next().await.transpose()? {
1667 /// println!("{:?}", item);
1668 /// }
1669 /// Ok(())
1670 /// }
1671 /// ```
1672 pub fn list_operations(&self) -> super::builder::dns_threat_detector_service::ListOperations {
1673 super::builder::dns_threat_detector_service::ListOperations::new(self.inner.clone())
1674 }
1675
1676 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1677 ///
1678 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1679 ///
1680 /// # Example
1681 /// ```
1682 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1683 /// use google_cloud_networksecurity_v1::Result;
1684 /// async fn sample(
1685 /// client: &DnsThreatDetectorService
1686 /// ) -> Result<()> {
1687 /// let response = client.get_operation()
1688 /// /* set fields */
1689 /// .send().await?;
1690 /// println!("response {:?}", response);
1691 /// Ok(())
1692 /// }
1693 /// ```
1694 pub fn get_operation(&self) -> super::builder::dns_threat_detector_service::GetOperation {
1695 super::builder::dns_threat_detector_service::GetOperation::new(self.inner.clone())
1696 }
1697
1698 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1699 ///
1700 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1701 ///
1702 /// # Example
1703 /// ```
1704 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1705 /// use google_cloud_networksecurity_v1::Result;
1706 /// async fn sample(
1707 /// client: &DnsThreatDetectorService
1708 /// ) -> Result<()> {
1709 /// client.delete_operation()
1710 /// /* set fields */
1711 /// .send().await?;
1712 /// Ok(())
1713 /// }
1714 /// ```
1715 pub fn delete_operation(&self) -> super::builder::dns_threat_detector_service::DeleteOperation {
1716 super::builder::dns_threat_detector_service::DeleteOperation::new(self.inner.clone())
1717 }
1718
1719 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1720 ///
1721 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1722 ///
1723 /// # Example
1724 /// ```
1725 /// # use google_cloud_networksecurity_v1::client::DnsThreatDetectorService;
1726 /// use google_cloud_networksecurity_v1::Result;
1727 /// async fn sample(
1728 /// client: &DnsThreatDetectorService
1729 /// ) -> Result<()> {
1730 /// client.cancel_operation()
1731 /// /* set fields */
1732 /// .send().await?;
1733 /// Ok(())
1734 /// }
1735 /// ```
1736 pub fn cancel_operation(&self) -> super::builder::dns_threat_detector_service::CancelOperation {
1737 super::builder::dns_threat_detector_service::CancelOperation::new(self.inner.clone())
1738 }
1739}
1740
1741/// Implements a client for the Network Security API.
1742///
1743/// # Example
1744/// ```
1745/// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1746/// use google_cloud_gax::paginator::ItemPaginator as _;
1747/// async fn sample(
1748/// organization_id: &str,
1749/// location_id: &str,
1750/// ) -> anyhow::Result<()> {
1751/// let client = FirewallActivation::builder().build().await?;
1752/// let mut list = client.list_firewall_endpoints()
1753/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1754/// .by_item();
1755/// while let Some(item) = list.next().await.transpose()? {
1756/// println!("{:?}", item);
1757/// }
1758/// Ok(())
1759/// }
1760/// ```
1761///
1762/// # Service Description
1763///
1764/// Service for managing Firewall Endpoints and Associations.
1765///
1766/// # Configuration
1767///
1768/// To configure `FirewallActivation` use the `with_*` methods in the type returned
1769/// by [builder()][FirewallActivation::builder]. The default configuration should
1770/// work for most applications. Common configuration changes include
1771///
1772/// * [with_endpoint()]: by default this client uses the global default endpoint
1773/// (`https://networksecurity.googleapis.com`). Applications using regional
1774/// endpoints or running in restricted networks (e.g. a network configured
1775/// with [Private Google Access with VPC Service Controls]) may want to
1776/// override this default.
1777/// * [with_credentials()]: by default this client uses
1778/// [Application Default Credentials]. Applications using custom
1779/// authentication may need to override this default.
1780///
1781/// [with_endpoint()]: super::builder::firewall_activation::ClientBuilder::with_endpoint
1782/// [with_credentials()]: super::builder::firewall_activation::ClientBuilder::with_credentials
1783/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1784/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1785///
1786/// # Pooling and Cloning
1787///
1788/// `FirewallActivation` holds a connection pool internally, it is advised to
1789/// create one and reuse it. You do not need to wrap `FirewallActivation` in
1790/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1791/// already uses an `Arc` internally.
1792#[derive(Clone, Debug)]
1793pub struct FirewallActivation {
1794 inner: std::sync::Arc<dyn super::stub::dynamic::FirewallActivation>,
1795}
1796
1797impl FirewallActivation {
1798 /// Returns a builder for [FirewallActivation].
1799 ///
1800 /// ```
1801 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1802 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1803 /// let client = FirewallActivation::builder().build().await?;
1804 /// # Ok(()) }
1805 /// ```
1806 pub fn builder() -> super::builder::firewall_activation::ClientBuilder {
1807 crate::new_client_builder(super::builder::firewall_activation::client::Factory)
1808 }
1809
1810 /// Creates a new client from the provided stub.
1811 ///
1812 /// The most common case for calling this function is in tests mocking the
1813 /// client's behavior.
1814 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1815 where
1816 T: super::stub::FirewallActivation + 'static,
1817 {
1818 Self { inner: stub.into() }
1819 }
1820
1821 pub(crate) async fn new(
1822 config: gaxi::options::ClientConfig,
1823 ) -> crate::ClientBuilderResult<Self> {
1824 let inner = Self::build_inner(config).await?;
1825 Ok(Self { inner })
1826 }
1827
1828 async fn build_inner(
1829 conf: gaxi::options::ClientConfig,
1830 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FirewallActivation>>
1831 {
1832 if gaxi::options::tracing_enabled(&conf) {
1833 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1834 }
1835 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1836 }
1837
1838 async fn build_transport(
1839 conf: gaxi::options::ClientConfig,
1840 ) -> crate::ClientBuilderResult<impl super::stub::FirewallActivation> {
1841 super::transport::FirewallActivation::new(conf).await
1842 }
1843
1844 async fn build_with_tracing(
1845 conf: gaxi::options::ClientConfig,
1846 ) -> crate::ClientBuilderResult<impl super::stub::FirewallActivation> {
1847 Self::build_transport(conf)
1848 .await
1849 .map(super::tracing::FirewallActivation::new)
1850 }
1851
1852 /// Lists FirewallEndpoints in a given organization and location.
1853 ///
1854 /// # Example
1855 /// ```
1856 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1857 /// use google_cloud_gax::paginator::ItemPaginator as _;
1858 /// use google_cloud_networksecurity_v1::Result;
1859 /// async fn sample(
1860 /// client: &FirewallActivation, organization_id: &str, location_id: &str
1861 /// ) -> Result<()> {
1862 /// let mut list = client.list_firewall_endpoints()
1863 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1864 /// .by_item();
1865 /// while let Some(item) = list.next().await.transpose()? {
1866 /// println!("{:?}", item);
1867 /// }
1868 /// Ok(())
1869 /// }
1870 /// ```
1871 pub fn list_firewall_endpoints(
1872 &self,
1873 ) -> super::builder::firewall_activation::ListFirewallEndpoints {
1874 super::builder::firewall_activation::ListFirewallEndpoints::new(self.inner.clone())
1875 }
1876
1877 /// Lists FirewallEndpoints in a given project and location.
1878 ///
1879 /// # Example
1880 /// ```
1881 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1882 /// use google_cloud_gax::paginator::ItemPaginator as _;
1883 /// use google_cloud_networksecurity_v1::Result;
1884 /// async fn sample(
1885 /// client: &FirewallActivation
1886 /// ) -> Result<()> {
1887 /// let mut list = client.list_project_firewall_endpoints()
1888 /// /* set fields */
1889 /// .by_item();
1890 /// while let Some(item) = list.next().await.transpose()? {
1891 /// println!("{:?}", item);
1892 /// }
1893 /// Ok(())
1894 /// }
1895 /// ```
1896 pub fn list_project_firewall_endpoints(
1897 &self,
1898 ) -> super::builder::firewall_activation::ListProjectFirewallEndpoints {
1899 super::builder::firewall_activation::ListProjectFirewallEndpoints::new(self.inner.clone())
1900 }
1901
1902 /// Gets details of a single org Endpoint.
1903 ///
1904 /// # Example
1905 /// ```
1906 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1907 /// use google_cloud_networksecurity_v1::Result;
1908 /// async fn sample(
1909 /// client: &FirewallActivation, organization_id: &str, location_id: &str, firewall_endpoint_id: &str
1910 /// ) -> Result<()> {
1911 /// let response = client.get_firewall_endpoint()
1912 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/firewallEndpoints/{firewall_endpoint_id}"))
1913 /// .send().await?;
1914 /// println!("response {:?}", response);
1915 /// Ok(())
1916 /// }
1917 /// ```
1918 pub fn get_firewall_endpoint(
1919 &self,
1920 ) -> super::builder::firewall_activation::GetFirewallEndpoint {
1921 super::builder::firewall_activation::GetFirewallEndpoint::new(self.inner.clone())
1922 }
1923
1924 /// Gets details of a single project Endpoint.
1925 ///
1926 /// # Example
1927 /// ```
1928 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1929 /// use google_cloud_networksecurity_v1::Result;
1930 /// async fn sample(
1931 /// client: &FirewallActivation
1932 /// ) -> Result<()> {
1933 /// let response = client.get_project_firewall_endpoint()
1934 /// /* set fields */
1935 /// .send().await?;
1936 /// println!("response {:?}", response);
1937 /// Ok(())
1938 /// }
1939 /// ```
1940 pub fn get_project_firewall_endpoint(
1941 &self,
1942 ) -> super::builder::firewall_activation::GetProjectFirewallEndpoint {
1943 super::builder::firewall_activation::GetProjectFirewallEndpoint::new(self.inner.clone())
1944 }
1945
1946 /// Creates a new FirewallEndpoint in a given organization and location.
1947 ///
1948 /// # Long running operations
1949 ///
1950 /// This method is used to start, and/or poll a [long-running Operation].
1951 /// The [Working with long-running operations] chapter in the [user guide]
1952 /// covers these operations in detail.
1953 ///
1954 /// [long-running operation]: https://google.aip.dev/151
1955 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1956 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1957 ///
1958 /// # Example
1959 /// ```
1960 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1961 /// use google_cloud_lro::Poller;
1962 /// use google_cloud_networksecurity_v1::model::FirewallEndpoint;
1963 /// use google_cloud_networksecurity_v1::Result;
1964 /// async fn sample(
1965 /// client: &FirewallActivation, organization_id: &str, location_id: &str
1966 /// ) -> Result<()> {
1967 /// let response = client.create_firewall_endpoint()
1968 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1969 /// .set_firewall_endpoint(
1970 /// FirewallEndpoint::new()/* set fields */
1971 /// )
1972 /// .poller().until_done().await?;
1973 /// println!("response {:?}", response);
1974 /// Ok(())
1975 /// }
1976 /// ```
1977 pub fn create_firewall_endpoint(
1978 &self,
1979 ) -> super::builder::firewall_activation::CreateFirewallEndpoint {
1980 super::builder::firewall_activation::CreateFirewallEndpoint::new(self.inner.clone())
1981 }
1982
1983 /// Creates a new FirewallEndpoint in a given project and location.
1984 ///
1985 /// # Long running operations
1986 ///
1987 /// This method is used to start, and/or poll a [long-running Operation].
1988 /// The [Working with long-running operations] chapter in the [user guide]
1989 /// covers these operations in detail.
1990 ///
1991 /// [long-running operation]: https://google.aip.dev/151
1992 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1993 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1994 ///
1995 /// # Example
1996 /// ```
1997 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
1998 /// use google_cloud_lro::Poller;
1999 /// use google_cloud_networksecurity_v1::Result;
2000 /// async fn sample(
2001 /// client: &FirewallActivation
2002 /// ) -> Result<()> {
2003 /// let response = client.create_project_firewall_endpoint()
2004 /// /* set fields */
2005 /// .poller().until_done().await?;
2006 /// println!("response {:?}", response);
2007 /// Ok(())
2008 /// }
2009 /// ```
2010 pub fn create_project_firewall_endpoint(
2011 &self,
2012 ) -> super::builder::firewall_activation::CreateProjectFirewallEndpoint {
2013 super::builder::firewall_activation::CreateProjectFirewallEndpoint::new(self.inner.clone())
2014 }
2015
2016 /// Deletes a single org Endpoint.
2017 ///
2018 /// # Long running operations
2019 ///
2020 /// This method is used to start, and/or poll a [long-running Operation].
2021 /// The [Working with long-running operations] chapter in the [user guide]
2022 /// covers these operations in detail.
2023 ///
2024 /// [long-running operation]: https://google.aip.dev/151
2025 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2026 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2027 ///
2028 /// # Example
2029 /// ```
2030 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2031 /// use google_cloud_lro::Poller;
2032 /// use google_cloud_networksecurity_v1::Result;
2033 /// async fn sample(
2034 /// client: &FirewallActivation, organization_id: &str, location_id: &str, firewall_endpoint_id: &str
2035 /// ) -> Result<()> {
2036 /// client.delete_firewall_endpoint()
2037 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/firewallEndpoints/{firewall_endpoint_id}"))
2038 /// .poller().until_done().await?;
2039 /// Ok(())
2040 /// }
2041 /// ```
2042 pub fn delete_firewall_endpoint(
2043 &self,
2044 ) -> super::builder::firewall_activation::DeleteFirewallEndpoint {
2045 super::builder::firewall_activation::DeleteFirewallEndpoint::new(self.inner.clone())
2046 }
2047
2048 /// Deletes a single project Endpoint.
2049 ///
2050 /// # Long running operations
2051 ///
2052 /// This method is used to start, and/or poll a [long-running Operation].
2053 /// The [Working with long-running operations] chapter in the [user guide]
2054 /// covers these operations in detail.
2055 ///
2056 /// [long-running operation]: https://google.aip.dev/151
2057 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2058 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2059 ///
2060 /// # Example
2061 /// ```
2062 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2063 /// use google_cloud_lro::Poller;
2064 /// use google_cloud_networksecurity_v1::Result;
2065 /// async fn sample(
2066 /// client: &FirewallActivation
2067 /// ) -> Result<()> {
2068 /// client.delete_project_firewall_endpoint()
2069 /// /* set fields */
2070 /// .poller().until_done().await?;
2071 /// Ok(())
2072 /// }
2073 /// ```
2074 pub fn delete_project_firewall_endpoint(
2075 &self,
2076 ) -> super::builder::firewall_activation::DeleteProjectFirewallEndpoint {
2077 super::builder::firewall_activation::DeleteProjectFirewallEndpoint::new(self.inner.clone())
2078 }
2079
2080 /// Update a single org Endpoint.
2081 ///
2082 /// # Long running operations
2083 ///
2084 /// This method is used to start, and/or poll a [long-running Operation].
2085 /// The [Working with long-running operations] chapter in the [user guide]
2086 /// covers these operations in detail.
2087 ///
2088 /// [long-running operation]: https://google.aip.dev/151
2089 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2090 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2091 ///
2092 /// # Example
2093 /// ```
2094 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2095 /// use google_cloud_lro::Poller;
2096 /// # extern crate wkt as google_cloud_wkt;
2097 /// use google_cloud_wkt::FieldMask;
2098 /// use google_cloud_networksecurity_v1::model::FirewallEndpoint;
2099 /// use google_cloud_networksecurity_v1::Result;
2100 /// async fn sample(
2101 /// client: &FirewallActivation, organization_id: &str, location_id: &str, firewall_endpoint_id: &str
2102 /// ) -> Result<()> {
2103 /// let response = client.update_firewall_endpoint()
2104 /// .set_firewall_endpoint(
2105 /// FirewallEndpoint::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/firewallEndpoints/{firewall_endpoint_id}"))/* set fields */
2106 /// )
2107 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2108 /// .poller().until_done().await?;
2109 /// println!("response {:?}", response);
2110 /// Ok(())
2111 /// }
2112 /// ```
2113 pub fn update_firewall_endpoint(
2114 &self,
2115 ) -> super::builder::firewall_activation::UpdateFirewallEndpoint {
2116 super::builder::firewall_activation::UpdateFirewallEndpoint::new(self.inner.clone())
2117 }
2118
2119 /// Update a single project Endpoint.
2120 ///
2121 /// # Long running operations
2122 ///
2123 /// This method is used to start, and/or poll a [long-running Operation].
2124 /// The [Working with long-running operations] chapter in the [user guide]
2125 /// covers these operations in detail.
2126 ///
2127 /// [long-running operation]: https://google.aip.dev/151
2128 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2129 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2130 ///
2131 /// # Example
2132 /// ```
2133 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2134 /// use google_cloud_lro::Poller;
2135 /// use google_cloud_networksecurity_v1::Result;
2136 /// async fn sample(
2137 /// client: &FirewallActivation
2138 /// ) -> Result<()> {
2139 /// let response = client.update_project_firewall_endpoint()
2140 /// /* set fields */
2141 /// .poller().until_done().await?;
2142 /// println!("response {:?}", response);
2143 /// Ok(())
2144 /// }
2145 /// ```
2146 pub fn update_project_firewall_endpoint(
2147 &self,
2148 ) -> super::builder::firewall_activation::UpdateProjectFirewallEndpoint {
2149 super::builder::firewall_activation::UpdateProjectFirewallEndpoint::new(self.inner.clone())
2150 }
2151
2152 /// Lists Associations in a given project and location.
2153 ///
2154 /// # Example
2155 /// ```
2156 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2157 /// use google_cloud_gax::paginator::ItemPaginator as _;
2158 /// use google_cloud_networksecurity_v1::Result;
2159 /// async fn sample(
2160 /// client: &FirewallActivation, project_id: &str, location_id: &str
2161 /// ) -> Result<()> {
2162 /// let mut list = client.list_firewall_endpoint_associations()
2163 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2164 /// .by_item();
2165 /// while let Some(item) = list.next().await.transpose()? {
2166 /// println!("{:?}", item);
2167 /// }
2168 /// Ok(())
2169 /// }
2170 /// ```
2171 pub fn list_firewall_endpoint_associations(
2172 &self,
2173 ) -> super::builder::firewall_activation::ListFirewallEndpointAssociations {
2174 super::builder::firewall_activation::ListFirewallEndpointAssociations::new(
2175 self.inner.clone(),
2176 )
2177 }
2178
2179 /// Gets details of a single FirewallEndpointAssociation.
2180 ///
2181 /// # Example
2182 /// ```
2183 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2184 /// use google_cloud_networksecurity_v1::Result;
2185 /// async fn sample(
2186 /// client: &FirewallActivation, project_id: &str, location_id: &str, firewall_endpoint_association_id: &str
2187 /// ) -> Result<()> {
2188 /// let response = client.get_firewall_endpoint_association()
2189 /// .set_name(format!("projects/{project_id}/locations/{location_id}/firewallEndpointAssociations/{firewall_endpoint_association_id}"))
2190 /// .send().await?;
2191 /// println!("response {:?}", response);
2192 /// Ok(())
2193 /// }
2194 /// ```
2195 pub fn get_firewall_endpoint_association(
2196 &self,
2197 ) -> super::builder::firewall_activation::GetFirewallEndpointAssociation {
2198 super::builder::firewall_activation::GetFirewallEndpointAssociation::new(self.inner.clone())
2199 }
2200
2201 /// Creates a new FirewallEndpointAssociation in a given project and location.
2202 ///
2203 /// # Long running operations
2204 ///
2205 /// This method is used to start, and/or poll a [long-running Operation].
2206 /// The [Working with long-running operations] chapter in the [user guide]
2207 /// covers these operations in detail.
2208 ///
2209 /// [long-running operation]: https://google.aip.dev/151
2210 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2211 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2212 ///
2213 /// # Example
2214 /// ```
2215 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2216 /// use google_cloud_lro::Poller;
2217 /// use google_cloud_networksecurity_v1::model::FirewallEndpointAssociation;
2218 /// use google_cloud_networksecurity_v1::Result;
2219 /// async fn sample(
2220 /// client: &FirewallActivation, project_id: &str, location_id: &str
2221 /// ) -> Result<()> {
2222 /// let response = client.create_firewall_endpoint_association()
2223 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2224 /// .set_firewall_endpoint_association(
2225 /// FirewallEndpointAssociation::new()/* set fields */
2226 /// )
2227 /// .poller().until_done().await?;
2228 /// println!("response {:?}", response);
2229 /// Ok(())
2230 /// }
2231 /// ```
2232 pub fn create_firewall_endpoint_association(
2233 &self,
2234 ) -> super::builder::firewall_activation::CreateFirewallEndpointAssociation {
2235 super::builder::firewall_activation::CreateFirewallEndpointAssociation::new(
2236 self.inner.clone(),
2237 )
2238 }
2239
2240 /// Deletes a single FirewallEndpointAssociation.
2241 ///
2242 /// # Long running operations
2243 ///
2244 /// This method is used to start, and/or poll a [long-running Operation].
2245 /// The [Working with long-running operations] chapter in the [user guide]
2246 /// covers these operations in detail.
2247 ///
2248 /// [long-running operation]: https://google.aip.dev/151
2249 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2250 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2251 ///
2252 /// # Example
2253 /// ```
2254 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2255 /// use google_cloud_lro::Poller;
2256 /// use google_cloud_networksecurity_v1::Result;
2257 /// async fn sample(
2258 /// client: &FirewallActivation, project_id: &str, location_id: &str, firewall_endpoint_association_id: &str
2259 /// ) -> Result<()> {
2260 /// client.delete_firewall_endpoint_association()
2261 /// .set_name(format!("projects/{project_id}/locations/{location_id}/firewallEndpointAssociations/{firewall_endpoint_association_id}"))
2262 /// .poller().until_done().await?;
2263 /// Ok(())
2264 /// }
2265 /// ```
2266 pub fn delete_firewall_endpoint_association(
2267 &self,
2268 ) -> super::builder::firewall_activation::DeleteFirewallEndpointAssociation {
2269 super::builder::firewall_activation::DeleteFirewallEndpointAssociation::new(
2270 self.inner.clone(),
2271 )
2272 }
2273
2274 /// Update a single FirewallEndpointAssociation.
2275 ///
2276 /// # Long running operations
2277 ///
2278 /// This method is used to start, and/or poll a [long-running Operation].
2279 /// The [Working with long-running operations] chapter in the [user guide]
2280 /// covers these operations in detail.
2281 ///
2282 /// [long-running operation]: https://google.aip.dev/151
2283 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2284 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2285 ///
2286 /// # Example
2287 /// ```
2288 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2289 /// use google_cloud_lro::Poller;
2290 /// # extern crate wkt as google_cloud_wkt;
2291 /// use google_cloud_wkt::FieldMask;
2292 /// use google_cloud_networksecurity_v1::model::FirewallEndpointAssociation;
2293 /// use google_cloud_networksecurity_v1::Result;
2294 /// async fn sample(
2295 /// client: &FirewallActivation, project_id: &str, location_id: &str, firewall_endpoint_association_id: &str
2296 /// ) -> Result<()> {
2297 /// let response = client.update_firewall_endpoint_association()
2298 /// .set_firewall_endpoint_association(
2299 /// FirewallEndpointAssociation::new().set_name(format!("projects/{project_id}/locations/{location_id}/firewallEndpointAssociations/{firewall_endpoint_association_id}"))/* set fields */
2300 /// )
2301 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2302 /// .poller().until_done().await?;
2303 /// println!("response {:?}", response);
2304 /// Ok(())
2305 /// }
2306 /// ```
2307 pub fn update_firewall_endpoint_association(
2308 &self,
2309 ) -> super::builder::firewall_activation::UpdateFirewallEndpointAssociation {
2310 super::builder::firewall_activation::UpdateFirewallEndpointAssociation::new(
2311 self.inner.clone(),
2312 )
2313 }
2314
2315 /// Lists information about the supported locations for this service.
2316 ///
2317 /// This method lists locations based on the resource scope provided in
2318 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
2319 /// **Global locations**: If `name` is empty, the method lists the
2320 /// public locations available to all projects. * **Project-specific
2321 /// locations**: If `name` follows the format
2322 /// `projects/{project}`, the method lists locations visible to that
2323 /// specific project. This includes public, private, or other
2324 /// project-specific locations enabled for the project.
2325 ///
2326 /// For gRPC and client library implementations, the resource name is
2327 /// passed as the `name` field. For direct service calls, the resource
2328 /// name is
2329 /// incorporated into the request path based on the specific service
2330 /// implementation and version.
2331 ///
2332 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
2333 ///
2334 /// # Example
2335 /// ```
2336 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2337 /// use google_cloud_gax::paginator::ItemPaginator as _;
2338 /// use google_cloud_networksecurity_v1::Result;
2339 /// async fn sample(
2340 /// client: &FirewallActivation
2341 /// ) -> Result<()> {
2342 /// let mut list = client.list_locations()
2343 /// /* set fields */
2344 /// .by_item();
2345 /// while let Some(item) = list.next().await.transpose()? {
2346 /// println!("{:?}", item);
2347 /// }
2348 /// Ok(())
2349 /// }
2350 /// ```
2351 pub fn list_locations(&self) -> super::builder::firewall_activation::ListLocations {
2352 super::builder::firewall_activation::ListLocations::new(self.inner.clone())
2353 }
2354
2355 /// Gets information about a location.
2356 ///
2357 /// # Example
2358 /// ```
2359 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2360 /// use google_cloud_networksecurity_v1::Result;
2361 /// async fn sample(
2362 /// client: &FirewallActivation
2363 /// ) -> Result<()> {
2364 /// let response = client.get_location()
2365 /// /* set fields */
2366 /// .send().await?;
2367 /// println!("response {:?}", response);
2368 /// Ok(())
2369 /// }
2370 /// ```
2371 pub fn get_location(&self) -> super::builder::firewall_activation::GetLocation {
2372 super::builder::firewall_activation::GetLocation::new(self.inner.clone())
2373 }
2374
2375 /// Sets the access control policy on the specified resource. Replaces
2376 /// any existing policy.
2377 ///
2378 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
2379 /// errors.
2380 ///
2381 /// # Example
2382 /// ```
2383 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2384 /// use google_cloud_networksecurity_v1::Result;
2385 /// async fn sample(
2386 /// client: &FirewallActivation
2387 /// ) -> Result<()> {
2388 /// let response = client.set_iam_policy()
2389 /// /* set fields */
2390 /// .send().await?;
2391 /// println!("response {:?}", response);
2392 /// Ok(())
2393 /// }
2394 /// ```
2395 pub fn set_iam_policy(&self) -> super::builder::firewall_activation::SetIamPolicy {
2396 super::builder::firewall_activation::SetIamPolicy::new(self.inner.clone())
2397 }
2398
2399 /// Gets the access control policy for a resource. Returns an empty policy
2400 /// if the resource exists and does not have a policy set.
2401 ///
2402 /// # Example
2403 /// ```
2404 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2405 /// use google_cloud_networksecurity_v1::Result;
2406 /// async fn sample(
2407 /// client: &FirewallActivation
2408 /// ) -> Result<()> {
2409 /// let response = client.get_iam_policy()
2410 /// /* set fields */
2411 /// .send().await?;
2412 /// println!("response {:?}", response);
2413 /// Ok(())
2414 /// }
2415 /// ```
2416 pub fn get_iam_policy(&self) -> super::builder::firewall_activation::GetIamPolicy {
2417 super::builder::firewall_activation::GetIamPolicy::new(self.inner.clone())
2418 }
2419
2420 /// Returns permissions that a caller has on the specified resource. If the
2421 /// resource does not exist, this will return an empty set of
2422 /// permissions, not a `NOT_FOUND` error.
2423 ///
2424 /// Note: This operation is designed to be used for building
2425 /// permission-aware UIs and command-line tools, not for authorization
2426 /// checking. This operation may "fail open" without warning.
2427 ///
2428 /// # Example
2429 /// ```
2430 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2431 /// use google_cloud_networksecurity_v1::Result;
2432 /// async fn sample(
2433 /// client: &FirewallActivation
2434 /// ) -> Result<()> {
2435 /// let response = client.test_iam_permissions()
2436 /// /* set fields */
2437 /// .send().await?;
2438 /// println!("response {:?}", response);
2439 /// Ok(())
2440 /// }
2441 /// ```
2442 pub fn test_iam_permissions(&self) -> super::builder::firewall_activation::TestIamPermissions {
2443 super::builder::firewall_activation::TestIamPermissions::new(self.inner.clone())
2444 }
2445
2446 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2447 ///
2448 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2449 ///
2450 /// # Example
2451 /// ```
2452 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2453 /// use google_cloud_gax::paginator::ItemPaginator as _;
2454 /// use google_cloud_networksecurity_v1::Result;
2455 /// async fn sample(
2456 /// client: &FirewallActivation
2457 /// ) -> Result<()> {
2458 /// let mut list = client.list_operations()
2459 /// /* set fields */
2460 /// .by_item();
2461 /// while let Some(item) = list.next().await.transpose()? {
2462 /// println!("{:?}", item);
2463 /// }
2464 /// Ok(())
2465 /// }
2466 /// ```
2467 pub fn list_operations(&self) -> super::builder::firewall_activation::ListOperations {
2468 super::builder::firewall_activation::ListOperations::new(self.inner.clone())
2469 }
2470
2471 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2472 ///
2473 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2474 ///
2475 /// # Example
2476 /// ```
2477 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2478 /// use google_cloud_networksecurity_v1::Result;
2479 /// async fn sample(
2480 /// client: &FirewallActivation
2481 /// ) -> Result<()> {
2482 /// let response = client.get_operation()
2483 /// /* set fields */
2484 /// .send().await?;
2485 /// println!("response {:?}", response);
2486 /// Ok(())
2487 /// }
2488 /// ```
2489 pub fn get_operation(&self) -> super::builder::firewall_activation::GetOperation {
2490 super::builder::firewall_activation::GetOperation::new(self.inner.clone())
2491 }
2492
2493 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2494 ///
2495 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2496 ///
2497 /// # Example
2498 /// ```
2499 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2500 /// use google_cloud_networksecurity_v1::Result;
2501 /// async fn sample(
2502 /// client: &FirewallActivation
2503 /// ) -> Result<()> {
2504 /// client.delete_operation()
2505 /// /* set fields */
2506 /// .send().await?;
2507 /// Ok(())
2508 /// }
2509 /// ```
2510 pub fn delete_operation(&self) -> super::builder::firewall_activation::DeleteOperation {
2511 super::builder::firewall_activation::DeleteOperation::new(self.inner.clone())
2512 }
2513
2514 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2515 ///
2516 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2517 ///
2518 /// # Example
2519 /// ```
2520 /// # use google_cloud_networksecurity_v1::client::FirewallActivation;
2521 /// use google_cloud_networksecurity_v1::Result;
2522 /// async fn sample(
2523 /// client: &FirewallActivation
2524 /// ) -> Result<()> {
2525 /// client.cancel_operation()
2526 /// /* set fields */
2527 /// .send().await?;
2528 /// Ok(())
2529 /// }
2530 /// ```
2531 pub fn cancel_operation(&self) -> super::builder::firewall_activation::CancelOperation {
2532 super::builder::firewall_activation::CancelOperation::new(self.inner.clone())
2533 }
2534}
2535
2536/// Implements a client for the Network Security API.
2537///
2538/// # Example
2539/// ```
2540/// # use google_cloud_networksecurity_v1::client::Intercept;
2541/// use google_cloud_gax::paginator::ItemPaginator as _;
2542/// async fn sample(
2543/// project_id: &str,
2544/// location_id: &str,
2545/// ) -> anyhow::Result<()> {
2546/// let client = Intercept::builder().build().await?;
2547/// let mut list = client.list_intercept_endpoint_groups()
2548/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2549/// .by_item();
2550/// while let Some(item) = list.next().await.transpose()? {
2551/// println!("{:?}", item);
2552/// }
2553/// Ok(())
2554/// }
2555/// ```
2556///
2557/// # Service Description
2558///
2559/// Service for Third-Party Packet Intercept (TPPI).
2560/// TPPI is the "in-band" flavor of the Network Security Integrations product.
2561///
2562/// # Configuration
2563///
2564/// To configure `Intercept` use the `with_*` methods in the type returned
2565/// by [builder()][Intercept::builder]. The default configuration should
2566/// work for most applications. Common configuration changes include
2567///
2568/// * [with_endpoint()]: by default this client uses the global default endpoint
2569/// (`https://networksecurity.googleapis.com`). Applications using regional
2570/// endpoints or running in restricted networks (e.g. a network configured
2571/// with [Private Google Access with VPC Service Controls]) may want to
2572/// override this default.
2573/// * [with_credentials()]: by default this client uses
2574/// [Application Default Credentials]. Applications using custom
2575/// authentication may need to override this default.
2576///
2577/// [with_endpoint()]: super::builder::intercept::ClientBuilder::with_endpoint
2578/// [with_credentials()]: super::builder::intercept::ClientBuilder::with_credentials
2579/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2580/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2581///
2582/// # Pooling and Cloning
2583///
2584/// `Intercept` holds a connection pool internally, it is advised to
2585/// create one and reuse it. You do not need to wrap `Intercept` in
2586/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2587/// already uses an `Arc` internally.
2588#[derive(Clone, Debug)]
2589pub struct Intercept {
2590 inner: std::sync::Arc<dyn super::stub::dynamic::Intercept>,
2591}
2592
2593impl Intercept {
2594 /// Returns a builder for [Intercept].
2595 ///
2596 /// ```
2597 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2598 /// # use google_cloud_networksecurity_v1::client::Intercept;
2599 /// let client = Intercept::builder().build().await?;
2600 /// # Ok(()) }
2601 /// ```
2602 pub fn builder() -> super::builder::intercept::ClientBuilder {
2603 crate::new_client_builder(super::builder::intercept::client::Factory)
2604 }
2605
2606 /// Creates a new client from the provided stub.
2607 ///
2608 /// The most common case for calling this function is in tests mocking the
2609 /// client's behavior.
2610 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2611 where
2612 T: super::stub::Intercept + 'static,
2613 {
2614 Self { inner: stub.into() }
2615 }
2616
2617 pub(crate) async fn new(
2618 config: gaxi::options::ClientConfig,
2619 ) -> crate::ClientBuilderResult<Self> {
2620 let inner = Self::build_inner(config).await?;
2621 Ok(Self { inner })
2622 }
2623
2624 async fn build_inner(
2625 conf: gaxi::options::ClientConfig,
2626 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Intercept>> {
2627 if gaxi::options::tracing_enabled(&conf) {
2628 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2629 }
2630 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2631 }
2632
2633 async fn build_transport(
2634 conf: gaxi::options::ClientConfig,
2635 ) -> crate::ClientBuilderResult<impl super::stub::Intercept> {
2636 super::transport::Intercept::new(conf).await
2637 }
2638
2639 async fn build_with_tracing(
2640 conf: gaxi::options::ClientConfig,
2641 ) -> crate::ClientBuilderResult<impl super::stub::Intercept> {
2642 Self::build_transport(conf)
2643 .await
2644 .map(super::tracing::Intercept::new)
2645 }
2646
2647 /// Lists endpoint groups in a given project and location.
2648 /// See <https://google.aip.dev/132>.
2649 ///
2650 /// # Example
2651 /// ```
2652 /// # use google_cloud_networksecurity_v1::client::Intercept;
2653 /// use google_cloud_gax::paginator::ItemPaginator as _;
2654 /// use google_cloud_networksecurity_v1::Result;
2655 /// async fn sample(
2656 /// client: &Intercept, project_id: &str, location_id: &str
2657 /// ) -> Result<()> {
2658 /// let mut list = client.list_intercept_endpoint_groups()
2659 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2660 /// .by_item();
2661 /// while let Some(item) = list.next().await.transpose()? {
2662 /// println!("{:?}", item);
2663 /// }
2664 /// Ok(())
2665 /// }
2666 /// ```
2667 pub fn list_intercept_endpoint_groups(
2668 &self,
2669 ) -> super::builder::intercept::ListInterceptEndpointGroups {
2670 super::builder::intercept::ListInterceptEndpointGroups::new(self.inner.clone())
2671 }
2672
2673 /// Gets a specific endpoint group.
2674 /// See <https://google.aip.dev/131>.
2675 ///
2676 /// # Example
2677 /// ```
2678 /// # use google_cloud_networksecurity_v1::client::Intercept;
2679 /// use google_cloud_networksecurity_v1::Result;
2680 /// async fn sample(
2681 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_id: &str
2682 /// ) -> Result<()> {
2683 /// let response = client.get_intercept_endpoint_group()
2684 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroups/{intercept_endpoint_group_id}"))
2685 /// .send().await?;
2686 /// println!("response {:?}", response);
2687 /// Ok(())
2688 /// }
2689 /// ```
2690 pub fn get_intercept_endpoint_group(
2691 &self,
2692 ) -> super::builder::intercept::GetInterceptEndpointGroup {
2693 super::builder::intercept::GetInterceptEndpointGroup::new(self.inner.clone())
2694 }
2695
2696 /// Creates an endpoint group in a given project and location.
2697 /// See <https://google.aip.dev/133>.
2698 ///
2699 /// # Long running operations
2700 ///
2701 /// This method is used to start, and/or poll a [long-running Operation].
2702 /// The [Working with long-running operations] chapter in the [user guide]
2703 /// covers these operations in detail.
2704 ///
2705 /// [long-running operation]: https://google.aip.dev/151
2706 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2707 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2708 ///
2709 /// # Example
2710 /// ```
2711 /// # use google_cloud_networksecurity_v1::client::Intercept;
2712 /// use google_cloud_lro::Poller;
2713 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroup;
2714 /// use google_cloud_networksecurity_v1::Result;
2715 /// async fn sample(
2716 /// client: &Intercept, project_id: &str, location_id: &str
2717 /// ) -> Result<()> {
2718 /// let response = client.create_intercept_endpoint_group()
2719 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2720 /// .set_intercept_endpoint_group(
2721 /// InterceptEndpointGroup::new()/* set fields */
2722 /// )
2723 /// .poller().until_done().await?;
2724 /// println!("response {:?}", response);
2725 /// Ok(())
2726 /// }
2727 /// ```
2728 pub fn create_intercept_endpoint_group(
2729 &self,
2730 ) -> super::builder::intercept::CreateInterceptEndpointGroup {
2731 super::builder::intercept::CreateInterceptEndpointGroup::new(self.inner.clone())
2732 }
2733
2734 /// Updates an endpoint group.
2735 /// See <https://google.aip.dev/134>.
2736 ///
2737 /// # Long running operations
2738 ///
2739 /// This method is used to start, and/or poll a [long-running Operation].
2740 /// The [Working with long-running operations] chapter in the [user guide]
2741 /// covers these operations in detail.
2742 ///
2743 /// [long-running operation]: https://google.aip.dev/151
2744 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2745 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2746 ///
2747 /// # Example
2748 /// ```
2749 /// # use google_cloud_networksecurity_v1::client::Intercept;
2750 /// use google_cloud_lro::Poller;
2751 /// # extern crate wkt as google_cloud_wkt;
2752 /// use google_cloud_wkt::FieldMask;
2753 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroup;
2754 /// use google_cloud_networksecurity_v1::Result;
2755 /// async fn sample(
2756 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_id: &str
2757 /// ) -> Result<()> {
2758 /// let response = client.update_intercept_endpoint_group()
2759 /// .set_intercept_endpoint_group(
2760 /// InterceptEndpointGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroups/{intercept_endpoint_group_id}"))/* set fields */
2761 /// )
2762 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2763 /// .poller().until_done().await?;
2764 /// println!("response {:?}", response);
2765 /// Ok(())
2766 /// }
2767 /// ```
2768 pub fn update_intercept_endpoint_group(
2769 &self,
2770 ) -> super::builder::intercept::UpdateInterceptEndpointGroup {
2771 super::builder::intercept::UpdateInterceptEndpointGroup::new(self.inner.clone())
2772 }
2773
2774 /// Deletes an endpoint group.
2775 /// See <https://google.aip.dev/135>.
2776 ///
2777 /// # Long running operations
2778 ///
2779 /// This method is used to start, and/or poll a [long-running Operation].
2780 /// The [Working with long-running operations] chapter in the [user guide]
2781 /// covers these operations in detail.
2782 ///
2783 /// [long-running operation]: https://google.aip.dev/151
2784 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2785 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2786 ///
2787 /// # Example
2788 /// ```
2789 /// # use google_cloud_networksecurity_v1::client::Intercept;
2790 /// use google_cloud_lro::Poller;
2791 /// use google_cloud_networksecurity_v1::Result;
2792 /// async fn sample(
2793 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_id: &str
2794 /// ) -> Result<()> {
2795 /// client.delete_intercept_endpoint_group()
2796 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroups/{intercept_endpoint_group_id}"))
2797 /// .poller().until_done().await?;
2798 /// Ok(())
2799 /// }
2800 /// ```
2801 pub fn delete_intercept_endpoint_group(
2802 &self,
2803 ) -> super::builder::intercept::DeleteInterceptEndpointGroup {
2804 super::builder::intercept::DeleteInterceptEndpointGroup::new(self.inner.clone())
2805 }
2806
2807 /// Lists associations in a given project and location.
2808 /// See <https://google.aip.dev/132>.
2809 ///
2810 /// # Example
2811 /// ```
2812 /// # use google_cloud_networksecurity_v1::client::Intercept;
2813 /// use google_cloud_gax::paginator::ItemPaginator as _;
2814 /// use google_cloud_networksecurity_v1::Result;
2815 /// async fn sample(
2816 /// client: &Intercept, project_id: &str, location_id: &str
2817 /// ) -> Result<()> {
2818 /// let mut list = client.list_intercept_endpoint_group_associations()
2819 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2820 /// .by_item();
2821 /// while let Some(item) = list.next().await.transpose()? {
2822 /// println!("{:?}", item);
2823 /// }
2824 /// Ok(())
2825 /// }
2826 /// ```
2827 pub fn list_intercept_endpoint_group_associations(
2828 &self,
2829 ) -> super::builder::intercept::ListInterceptEndpointGroupAssociations {
2830 super::builder::intercept::ListInterceptEndpointGroupAssociations::new(self.inner.clone())
2831 }
2832
2833 /// Gets a specific association.
2834 /// See <https://google.aip.dev/131>.
2835 ///
2836 /// # Example
2837 /// ```
2838 /// # use google_cloud_networksecurity_v1::client::Intercept;
2839 /// use google_cloud_networksecurity_v1::Result;
2840 /// async fn sample(
2841 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_association_id: &str
2842 /// ) -> Result<()> {
2843 /// let response = client.get_intercept_endpoint_group_association()
2844 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association_id}"))
2845 /// .send().await?;
2846 /// println!("response {:?}", response);
2847 /// Ok(())
2848 /// }
2849 /// ```
2850 pub fn get_intercept_endpoint_group_association(
2851 &self,
2852 ) -> super::builder::intercept::GetInterceptEndpointGroupAssociation {
2853 super::builder::intercept::GetInterceptEndpointGroupAssociation::new(self.inner.clone())
2854 }
2855
2856 /// Creates an association in a given project and location.
2857 /// See <https://google.aip.dev/133>.
2858 ///
2859 /// # Long running operations
2860 ///
2861 /// This method is used to start, and/or poll a [long-running Operation].
2862 /// The [Working with long-running operations] chapter in the [user guide]
2863 /// covers these operations in detail.
2864 ///
2865 /// [long-running operation]: https://google.aip.dev/151
2866 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2867 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2868 ///
2869 /// # Example
2870 /// ```
2871 /// # use google_cloud_networksecurity_v1::client::Intercept;
2872 /// use google_cloud_lro::Poller;
2873 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroupAssociation;
2874 /// use google_cloud_networksecurity_v1::Result;
2875 /// async fn sample(
2876 /// client: &Intercept, project_id: &str, location_id: &str
2877 /// ) -> Result<()> {
2878 /// let response = client.create_intercept_endpoint_group_association()
2879 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2880 /// .set_intercept_endpoint_group_association(
2881 /// InterceptEndpointGroupAssociation::new()/* set fields */
2882 /// )
2883 /// .poller().until_done().await?;
2884 /// println!("response {:?}", response);
2885 /// Ok(())
2886 /// }
2887 /// ```
2888 pub fn create_intercept_endpoint_group_association(
2889 &self,
2890 ) -> super::builder::intercept::CreateInterceptEndpointGroupAssociation {
2891 super::builder::intercept::CreateInterceptEndpointGroupAssociation::new(self.inner.clone())
2892 }
2893
2894 /// Updates an association.
2895 /// See <https://google.aip.dev/134>.
2896 ///
2897 /// # Long running operations
2898 ///
2899 /// This method is used to start, and/or poll a [long-running Operation].
2900 /// The [Working with long-running operations] chapter in the [user guide]
2901 /// covers these operations in detail.
2902 ///
2903 /// [long-running operation]: https://google.aip.dev/151
2904 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2905 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2906 ///
2907 /// # Example
2908 /// ```
2909 /// # use google_cloud_networksecurity_v1::client::Intercept;
2910 /// use google_cloud_lro::Poller;
2911 /// # extern crate wkt as google_cloud_wkt;
2912 /// use google_cloud_wkt::FieldMask;
2913 /// use google_cloud_networksecurity_v1::model::InterceptEndpointGroupAssociation;
2914 /// use google_cloud_networksecurity_v1::Result;
2915 /// async fn sample(
2916 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_association_id: &str
2917 /// ) -> Result<()> {
2918 /// let response = client.update_intercept_endpoint_group_association()
2919 /// .set_intercept_endpoint_group_association(
2920 /// InterceptEndpointGroupAssociation::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association_id}"))/* set fields */
2921 /// )
2922 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
2923 /// .poller().until_done().await?;
2924 /// println!("response {:?}", response);
2925 /// Ok(())
2926 /// }
2927 /// ```
2928 pub fn update_intercept_endpoint_group_association(
2929 &self,
2930 ) -> super::builder::intercept::UpdateInterceptEndpointGroupAssociation {
2931 super::builder::intercept::UpdateInterceptEndpointGroupAssociation::new(self.inner.clone())
2932 }
2933
2934 /// Deletes an association.
2935 /// See <https://google.aip.dev/135>.
2936 ///
2937 /// # Long running operations
2938 ///
2939 /// This method is used to start, and/or poll a [long-running Operation].
2940 /// The [Working with long-running operations] chapter in the [user guide]
2941 /// covers these operations in detail.
2942 ///
2943 /// [long-running operation]: https://google.aip.dev/151
2944 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
2945 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
2946 ///
2947 /// # Example
2948 /// ```
2949 /// # use google_cloud_networksecurity_v1::client::Intercept;
2950 /// use google_cloud_lro::Poller;
2951 /// use google_cloud_networksecurity_v1::Result;
2952 /// async fn sample(
2953 /// client: &Intercept, project_id: &str, location_id: &str, intercept_endpoint_group_association_id: &str
2954 /// ) -> Result<()> {
2955 /// client.delete_intercept_endpoint_group_association()
2956 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptEndpointGroupAssociations/{intercept_endpoint_group_association_id}"))
2957 /// .poller().until_done().await?;
2958 /// Ok(())
2959 /// }
2960 /// ```
2961 pub fn delete_intercept_endpoint_group_association(
2962 &self,
2963 ) -> super::builder::intercept::DeleteInterceptEndpointGroupAssociation {
2964 super::builder::intercept::DeleteInterceptEndpointGroupAssociation::new(self.inner.clone())
2965 }
2966
2967 /// Lists deployment groups in a given project and location.
2968 /// See <https://google.aip.dev/132>.
2969 ///
2970 /// # Example
2971 /// ```
2972 /// # use google_cloud_networksecurity_v1::client::Intercept;
2973 /// use google_cloud_gax::paginator::ItemPaginator as _;
2974 /// use google_cloud_networksecurity_v1::Result;
2975 /// async fn sample(
2976 /// client: &Intercept, project_id: &str, location_id: &str
2977 /// ) -> Result<()> {
2978 /// let mut list = client.list_intercept_deployment_groups()
2979 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
2980 /// .by_item();
2981 /// while let Some(item) = list.next().await.transpose()? {
2982 /// println!("{:?}", item);
2983 /// }
2984 /// Ok(())
2985 /// }
2986 /// ```
2987 pub fn list_intercept_deployment_groups(
2988 &self,
2989 ) -> super::builder::intercept::ListInterceptDeploymentGroups {
2990 super::builder::intercept::ListInterceptDeploymentGroups::new(self.inner.clone())
2991 }
2992
2993 /// Gets a specific deployment group.
2994 /// See <https://google.aip.dev/131>.
2995 ///
2996 /// # Example
2997 /// ```
2998 /// # use google_cloud_networksecurity_v1::client::Intercept;
2999 /// use google_cloud_networksecurity_v1::Result;
3000 /// async fn sample(
3001 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_group_id: &str
3002 /// ) -> Result<()> {
3003 /// let response = client.get_intercept_deployment_group()
3004 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeploymentGroups/{intercept_deployment_group_id}"))
3005 /// .send().await?;
3006 /// println!("response {:?}", response);
3007 /// Ok(())
3008 /// }
3009 /// ```
3010 pub fn get_intercept_deployment_group(
3011 &self,
3012 ) -> super::builder::intercept::GetInterceptDeploymentGroup {
3013 super::builder::intercept::GetInterceptDeploymentGroup::new(self.inner.clone())
3014 }
3015
3016 /// Creates a deployment group in a given project and location.
3017 /// See <https://google.aip.dev/133>.
3018 ///
3019 /// # Long running operations
3020 ///
3021 /// This method is used to start, and/or poll a [long-running Operation].
3022 /// The [Working with long-running operations] chapter in the [user guide]
3023 /// covers these operations in detail.
3024 ///
3025 /// [long-running operation]: https://google.aip.dev/151
3026 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3027 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3028 ///
3029 /// # Example
3030 /// ```
3031 /// # use google_cloud_networksecurity_v1::client::Intercept;
3032 /// use google_cloud_lro::Poller;
3033 /// use google_cloud_networksecurity_v1::model::InterceptDeploymentGroup;
3034 /// use google_cloud_networksecurity_v1::Result;
3035 /// async fn sample(
3036 /// client: &Intercept, project_id: &str, location_id: &str
3037 /// ) -> Result<()> {
3038 /// let response = client.create_intercept_deployment_group()
3039 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3040 /// .set_intercept_deployment_group(
3041 /// InterceptDeploymentGroup::new()/* set fields */
3042 /// )
3043 /// .poller().until_done().await?;
3044 /// println!("response {:?}", response);
3045 /// Ok(())
3046 /// }
3047 /// ```
3048 pub fn create_intercept_deployment_group(
3049 &self,
3050 ) -> super::builder::intercept::CreateInterceptDeploymentGroup {
3051 super::builder::intercept::CreateInterceptDeploymentGroup::new(self.inner.clone())
3052 }
3053
3054 /// Updates a deployment group.
3055 /// See <https://google.aip.dev/134>.
3056 ///
3057 /// # Long running operations
3058 ///
3059 /// This method is used to start, and/or poll a [long-running Operation].
3060 /// The [Working with long-running operations] chapter in the [user guide]
3061 /// covers these operations in detail.
3062 ///
3063 /// [long-running operation]: https://google.aip.dev/151
3064 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3065 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3066 ///
3067 /// # Example
3068 /// ```
3069 /// # use google_cloud_networksecurity_v1::client::Intercept;
3070 /// use google_cloud_lro::Poller;
3071 /// # extern crate wkt as google_cloud_wkt;
3072 /// use google_cloud_wkt::FieldMask;
3073 /// use google_cloud_networksecurity_v1::model::InterceptDeploymentGroup;
3074 /// use google_cloud_networksecurity_v1::Result;
3075 /// async fn sample(
3076 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_group_id: &str
3077 /// ) -> Result<()> {
3078 /// let response = client.update_intercept_deployment_group()
3079 /// .set_intercept_deployment_group(
3080 /// InterceptDeploymentGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeploymentGroups/{intercept_deployment_group_id}"))/* set fields */
3081 /// )
3082 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3083 /// .poller().until_done().await?;
3084 /// println!("response {:?}", response);
3085 /// Ok(())
3086 /// }
3087 /// ```
3088 pub fn update_intercept_deployment_group(
3089 &self,
3090 ) -> super::builder::intercept::UpdateInterceptDeploymentGroup {
3091 super::builder::intercept::UpdateInterceptDeploymentGroup::new(self.inner.clone())
3092 }
3093
3094 /// Deletes a deployment group.
3095 /// See <https://google.aip.dev/135>.
3096 ///
3097 /// # Long running operations
3098 ///
3099 /// This method is used to start, and/or poll a [long-running Operation].
3100 /// The [Working with long-running operations] chapter in the [user guide]
3101 /// covers these operations in detail.
3102 ///
3103 /// [long-running operation]: https://google.aip.dev/151
3104 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3105 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3106 ///
3107 /// # Example
3108 /// ```
3109 /// # use google_cloud_networksecurity_v1::client::Intercept;
3110 /// use google_cloud_lro::Poller;
3111 /// use google_cloud_networksecurity_v1::Result;
3112 /// async fn sample(
3113 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_group_id: &str
3114 /// ) -> Result<()> {
3115 /// client.delete_intercept_deployment_group()
3116 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeploymentGroups/{intercept_deployment_group_id}"))
3117 /// .poller().until_done().await?;
3118 /// Ok(())
3119 /// }
3120 /// ```
3121 pub fn delete_intercept_deployment_group(
3122 &self,
3123 ) -> super::builder::intercept::DeleteInterceptDeploymentGroup {
3124 super::builder::intercept::DeleteInterceptDeploymentGroup::new(self.inner.clone())
3125 }
3126
3127 /// Lists deployments in a given project and location.
3128 /// See <https://google.aip.dev/132>.
3129 ///
3130 /// # Example
3131 /// ```
3132 /// # use google_cloud_networksecurity_v1::client::Intercept;
3133 /// use google_cloud_gax::paginator::ItemPaginator as _;
3134 /// use google_cloud_networksecurity_v1::Result;
3135 /// async fn sample(
3136 /// client: &Intercept, project_id: &str, location_id: &str
3137 /// ) -> Result<()> {
3138 /// let mut list = client.list_intercept_deployments()
3139 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3140 /// .by_item();
3141 /// while let Some(item) = list.next().await.transpose()? {
3142 /// println!("{:?}", item);
3143 /// }
3144 /// Ok(())
3145 /// }
3146 /// ```
3147 pub fn list_intercept_deployments(
3148 &self,
3149 ) -> super::builder::intercept::ListInterceptDeployments {
3150 super::builder::intercept::ListInterceptDeployments::new(self.inner.clone())
3151 }
3152
3153 /// Gets a specific deployment.
3154 /// See <https://google.aip.dev/131>.
3155 ///
3156 /// # Example
3157 /// ```
3158 /// # use google_cloud_networksecurity_v1::client::Intercept;
3159 /// use google_cloud_networksecurity_v1::Result;
3160 /// async fn sample(
3161 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_id: &str
3162 /// ) -> Result<()> {
3163 /// let response = client.get_intercept_deployment()
3164 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeployments/{intercept_deployment_id}"))
3165 /// .send().await?;
3166 /// println!("response {:?}", response);
3167 /// Ok(())
3168 /// }
3169 /// ```
3170 pub fn get_intercept_deployment(&self) -> super::builder::intercept::GetInterceptDeployment {
3171 super::builder::intercept::GetInterceptDeployment::new(self.inner.clone())
3172 }
3173
3174 /// Creates a deployment in a given project and location.
3175 /// See <https://google.aip.dev/133>.
3176 ///
3177 /// # Long running operations
3178 ///
3179 /// This method is used to start, and/or poll a [long-running Operation].
3180 /// The [Working with long-running operations] chapter in the [user guide]
3181 /// covers these operations in detail.
3182 ///
3183 /// [long-running operation]: https://google.aip.dev/151
3184 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3185 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3186 ///
3187 /// # Example
3188 /// ```
3189 /// # use google_cloud_networksecurity_v1::client::Intercept;
3190 /// use google_cloud_lro::Poller;
3191 /// use google_cloud_networksecurity_v1::model::InterceptDeployment;
3192 /// use google_cloud_networksecurity_v1::Result;
3193 /// async fn sample(
3194 /// client: &Intercept, project_id: &str, location_id: &str
3195 /// ) -> Result<()> {
3196 /// let response = client.create_intercept_deployment()
3197 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3198 /// .set_intercept_deployment(
3199 /// InterceptDeployment::new()/* set fields */
3200 /// )
3201 /// .poller().until_done().await?;
3202 /// println!("response {:?}", response);
3203 /// Ok(())
3204 /// }
3205 /// ```
3206 pub fn create_intercept_deployment(
3207 &self,
3208 ) -> super::builder::intercept::CreateInterceptDeployment {
3209 super::builder::intercept::CreateInterceptDeployment::new(self.inner.clone())
3210 }
3211
3212 /// Updates a deployment.
3213 /// See <https://google.aip.dev/134>.
3214 ///
3215 /// # Long running operations
3216 ///
3217 /// This method is used to start, and/or poll a [long-running Operation].
3218 /// The [Working with long-running operations] chapter in the [user guide]
3219 /// covers these operations in detail.
3220 ///
3221 /// [long-running operation]: https://google.aip.dev/151
3222 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3223 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3224 ///
3225 /// # Example
3226 /// ```
3227 /// # use google_cloud_networksecurity_v1::client::Intercept;
3228 /// use google_cloud_lro::Poller;
3229 /// # extern crate wkt as google_cloud_wkt;
3230 /// use google_cloud_wkt::FieldMask;
3231 /// use google_cloud_networksecurity_v1::model::InterceptDeployment;
3232 /// use google_cloud_networksecurity_v1::Result;
3233 /// async fn sample(
3234 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_id: &str
3235 /// ) -> Result<()> {
3236 /// let response = client.update_intercept_deployment()
3237 /// .set_intercept_deployment(
3238 /// InterceptDeployment::new().set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeployments/{intercept_deployment_id}"))/* set fields */
3239 /// )
3240 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3241 /// .poller().until_done().await?;
3242 /// println!("response {:?}", response);
3243 /// Ok(())
3244 /// }
3245 /// ```
3246 pub fn update_intercept_deployment(
3247 &self,
3248 ) -> super::builder::intercept::UpdateInterceptDeployment {
3249 super::builder::intercept::UpdateInterceptDeployment::new(self.inner.clone())
3250 }
3251
3252 /// Deletes a deployment.
3253 /// See <https://google.aip.dev/135>.
3254 ///
3255 /// # Long running operations
3256 ///
3257 /// This method is used to start, and/or poll a [long-running Operation].
3258 /// The [Working with long-running operations] chapter in the [user guide]
3259 /// covers these operations in detail.
3260 ///
3261 /// [long-running operation]: https://google.aip.dev/151
3262 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3263 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3264 ///
3265 /// # Example
3266 /// ```
3267 /// # use google_cloud_networksecurity_v1::client::Intercept;
3268 /// use google_cloud_lro::Poller;
3269 /// use google_cloud_networksecurity_v1::Result;
3270 /// async fn sample(
3271 /// client: &Intercept, project_id: &str, location_id: &str, intercept_deployment_id: &str
3272 /// ) -> Result<()> {
3273 /// client.delete_intercept_deployment()
3274 /// .set_name(format!("projects/{project_id}/locations/{location_id}/interceptDeployments/{intercept_deployment_id}"))
3275 /// .poller().until_done().await?;
3276 /// Ok(())
3277 /// }
3278 /// ```
3279 pub fn delete_intercept_deployment(
3280 &self,
3281 ) -> super::builder::intercept::DeleteInterceptDeployment {
3282 super::builder::intercept::DeleteInterceptDeployment::new(self.inner.clone())
3283 }
3284
3285 /// Lists information about the supported locations for this service.
3286 ///
3287 /// This method lists locations based on the resource scope provided in
3288 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
3289 /// **Global locations**: If `name` is empty, the method lists the
3290 /// public locations available to all projects. * **Project-specific
3291 /// locations**: If `name` follows the format
3292 /// `projects/{project}`, the method lists locations visible to that
3293 /// specific project. This includes public, private, or other
3294 /// project-specific locations enabled for the project.
3295 ///
3296 /// For gRPC and client library implementations, the resource name is
3297 /// passed as the `name` field. For direct service calls, the resource
3298 /// name is
3299 /// incorporated into the request path based on the specific service
3300 /// implementation and version.
3301 ///
3302 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
3303 ///
3304 /// # Example
3305 /// ```
3306 /// # use google_cloud_networksecurity_v1::client::Intercept;
3307 /// use google_cloud_gax::paginator::ItemPaginator as _;
3308 /// use google_cloud_networksecurity_v1::Result;
3309 /// async fn sample(
3310 /// client: &Intercept
3311 /// ) -> Result<()> {
3312 /// let mut list = client.list_locations()
3313 /// /* set fields */
3314 /// .by_item();
3315 /// while let Some(item) = list.next().await.transpose()? {
3316 /// println!("{:?}", item);
3317 /// }
3318 /// Ok(())
3319 /// }
3320 /// ```
3321 pub fn list_locations(&self) -> super::builder::intercept::ListLocations {
3322 super::builder::intercept::ListLocations::new(self.inner.clone())
3323 }
3324
3325 /// Gets information about a location.
3326 ///
3327 /// # Example
3328 /// ```
3329 /// # use google_cloud_networksecurity_v1::client::Intercept;
3330 /// use google_cloud_networksecurity_v1::Result;
3331 /// async fn sample(
3332 /// client: &Intercept
3333 /// ) -> Result<()> {
3334 /// let response = client.get_location()
3335 /// /* set fields */
3336 /// .send().await?;
3337 /// println!("response {:?}", response);
3338 /// Ok(())
3339 /// }
3340 /// ```
3341 pub fn get_location(&self) -> super::builder::intercept::GetLocation {
3342 super::builder::intercept::GetLocation::new(self.inner.clone())
3343 }
3344
3345 /// Sets the access control policy on the specified resource. Replaces
3346 /// any existing policy.
3347 ///
3348 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
3349 /// errors.
3350 ///
3351 /// # Example
3352 /// ```
3353 /// # use google_cloud_networksecurity_v1::client::Intercept;
3354 /// use google_cloud_networksecurity_v1::Result;
3355 /// async fn sample(
3356 /// client: &Intercept
3357 /// ) -> Result<()> {
3358 /// let response = client.set_iam_policy()
3359 /// /* set fields */
3360 /// .send().await?;
3361 /// println!("response {:?}", response);
3362 /// Ok(())
3363 /// }
3364 /// ```
3365 pub fn set_iam_policy(&self) -> super::builder::intercept::SetIamPolicy {
3366 super::builder::intercept::SetIamPolicy::new(self.inner.clone())
3367 }
3368
3369 /// Gets the access control policy for a resource. Returns an empty policy
3370 /// if the resource exists and does not have a policy set.
3371 ///
3372 /// # Example
3373 /// ```
3374 /// # use google_cloud_networksecurity_v1::client::Intercept;
3375 /// use google_cloud_networksecurity_v1::Result;
3376 /// async fn sample(
3377 /// client: &Intercept
3378 /// ) -> Result<()> {
3379 /// let response = client.get_iam_policy()
3380 /// /* set fields */
3381 /// .send().await?;
3382 /// println!("response {:?}", response);
3383 /// Ok(())
3384 /// }
3385 /// ```
3386 pub fn get_iam_policy(&self) -> super::builder::intercept::GetIamPolicy {
3387 super::builder::intercept::GetIamPolicy::new(self.inner.clone())
3388 }
3389
3390 /// Returns permissions that a caller has on the specified resource. If the
3391 /// resource does not exist, this will return an empty set of
3392 /// permissions, not a `NOT_FOUND` error.
3393 ///
3394 /// Note: This operation is designed to be used for building
3395 /// permission-aware UIs and command-line tools, not for authorization
3396 /// checking. This operation may "fail open" without warning.
3397 ///
3398 /// # Example
3399 /// ```
3400 /// # use google_cloud_networksecurity_v1::client::Intercept;
3401 /// use google_cloud_networksecurity_v1::Result;
3402 /// async fn sample(
3403 /// client: &Intercept
3404 /// ) -> Result<()> {
3405 /// let response = client.test_iam_permissions()
3406 /// /* set fields */
3407 /// .send().await?;
3408 /// println!("response {:?}", response);
3409 /// Ok(())
3410 /// }
3411 /// ```
3412 pub fn test_iam_permissions(&self) -> super::builder::intercept::TestIamPermissions {
3413 super::builder::intercept::TestIamPermissions::new(self.inner.clone())
3414 }
3415
3416 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3417 ///
3418 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3419 ///
3420 /// # Example
3421 /// ```
3422 /// # use google_cloud_networksecurity_v1::client::Intercept;
3423 /// use google_cloud_gax::paginator::ItemPaginator as _;
3424 /// use google_cloud_networksecurity_v1::Result;
3425 /// async fn sample(
3426 /// client: &Intercept
3427 /// ) -> Result<()> {
3428 /// let mut list = client.list_operations()
3429 /// /* set fields */
3430 /// .by_item();
3431 /// while let Some(item) = list.next().await.transpose()? {
3432 /// println!("{:?}", item);
3433 /// }
3434 /// Ok(())
3435 /// }
3436 /// ```
3437 pub fn list_operations(&self) -> super::builder::intercept::ListOperations {
3438 super::builder::intercept::ListOperations::new(self.inner.clone())
3439 }
3440
3441 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3442 ///
3443 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3444 ///
3445 /// # Example
3446 /// ```
3447 /// # use google_cloud_networksecurity_v1::client::Intercept;
3448 /// use google_cloud_networksecurity_v1::Result;
3449 /// async fn sample(
3450 /// client: &Intercept
3451 /// ) -> Result<()> {
3452 /// let response = client.get_operation()
3453 /// /* set fields */
3454 /// .send().await?;
3455 /// println!("response {:?}", response);
3456 /// Ok(())
3457 /// }
3458 /// ```
3459 pub fn get_operation(&self) -> super::builder::intercept::GetOperation {
3460 super::builder::intercept::GetOperation::new(self.inner.clone())
3461 }
3462
3463 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3464 ///
3465 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3466 ///
3467 /// # Example
3468 /// ```
3469 /// # use google_cloud_networksecurity_v1::client::Intercept;
3470 /// use google_cloud_networksecurity_v1::Result;
3471 /// async fn sample(
3472 /// client: &Intercept
3473 /// ) -> Result<()> {
3474 /// client.delete_operation()
3475 /// /* set fields */
3476 /// .send().await?;
3477 /// Ok(())
3478 /// }
3479 /// ```
3480 pub fn delete_operation(&self) -> super::builder::intercept::DeleteOperation {
3481 super::builder::intercept::DeleteOperation::new(self.inner.clone())
3482 }
3483
3484 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
3485 ///
3486 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
3487 ///
3488 /// # Example
3489 /// ```
3490 /// # use google_cloud_networksecurity_v1::client::Intercept;
3491 /// use google_cloud_networksecurity_v1::Result;
3492 /// async fn sample(
3493 /// client: &Intercept
3494 /// ) -> Result<()> {
3495 /// client.cancel_operation()
3496 /// /* set fields */
3497 /// .send().await?;
3498 /// Ok(())
3499 /// }
3500 /// ```
3501 pub fn cancel_operation(&self) -> super::builder::intercept::CancelOperation {
3502 super::builder::intercept::CancelOperation::new(self.inner.clone())
3503 }
3504}
3505
3506/// Implements a client for the Network Security API.
3507///
3508/// # Example
3509/// ```
3510/// # use google_cloud_networksecurity_v1::client::Mirroring;
3511/// use google_cloud_gax::paginator::ItemPaginator as _;
3512/// async fn sample(
3513/// project_id: &str,
3514/// location_id: &str,
3515/// ) -> anyhow::Result<()> {
3516/// let client = Mirroring::builder().build().await?;
3517/// let mut list = client.list_mirroring_endpoint_groups()
3518/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3519/// .by_item();
3520/// while let Some(item) = list.next().await.transpose()? {
3521/// println!("{:?}", item);
3522/// }
3523/// Ok(())
3524/// }
3525/// ```
3526///
3527/// # Service Description
3528///
3529/// PM2 is the "out-of-band" flavor of the Network Security Integrations product.
3530///
3531/// # Configuration
3532///
3533/// To configure `Mirroring` use the `with_*` methods in the type returned
3534/// by [builder()][Mirroring::builder]. The default configuration should
3535/// work for most applications. Common configuration changes include
3536///
3537/// * [with_endpoint()]: by default this client uses the global default endpoint
3538/// (`https://networksecurity.googleapis.com`). Applications using regional
3539/// endpoints or running in restricted networks (e.g. a network configured
3540/// with [Private Google Access with VPC Service Controls]) may want to
3541/// override this default.
3542/// * [with_credentials()]: by default this client uses
3543/// [Application Default Credentials]. Applications using custom
3544/// authentication may need to override this default.
3545///
3546/// [with_endpoint()]: super::builder::mirroring::ClientBuilder::with_endpoint
3547/// [with_credentials()]: super::builder::mirroring::ClientBuilder::with_credentials
3548/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3549/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3550///
3551/// # Pooling and Cloning
3552///
3553/// `Mirroring` holds a connection pool internally, it is advised to
3554/// create one and reuse it. You do not need to wrap `Mirroring` in
3555/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3556/// already uses an `Arc` internally.
3557#[derive(Clone, Debug)]
3558pub struct Mirroring {
3559 inner: std::sync::Arc<dyn super::stub::dynamic::Mirroring>,
3560}
3561
3562impl Mirroring {
3563 /// Returns a builder for [Mirroring].
3564 ///
3565 /// ```
3566 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3567 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3568 /// let client = Mirroring::builder().build().await?;
3569 /// # Ok(()) }
3570 /// ```
3571 pub fn builder() -> super::builder::mirroring::ClientBuilder {
3572 crate::new_client_builder(super::builder::mirroring::client::Factory)
3573 }
3574
3575 /// Creates a new client from the provided stub.
3576 ///
3577 /// The most common case for calling this function is in tests mocking the
3578 /// client's behavior.
3579 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3580 where
3581 T: super::stub::Mirroring + 'static,
3582 {
3583 Self { inner: stub.into() }
3584 }
3585
3586 pub(crate) async fn new(
3587 config: gaxi::options::ClientConfig,
3588 ) -> crate::ClientBuilderResult<Self> {
3589 let inner = Self::build_inner(config).await?;
3590 Ok(Self { inner })
3591 }
3592
3593 async fn build_inner(
3594 conf: gaxi::options::ClientConfig,
3595 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Mirroring>> {
3596 if gaxi::options::tracing_enabled(&conf) {
3597 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3598 }
3599 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3600 }
3601
3602 async fn build_transport(
3603 conf: gaxi::options::ClientConfig,
3604 ) -> crate::ClientBuilderResult<impl super::stub::Mirroring> {
3605 super::transport::Mirroring::new(conf).await
3606 }
3607
3608 async fn build_with_tracing(
3609 conf: gaxi::options::ClientConfig,
3610 ) -> crate::ClientBuilderResult<impl super::stub::Mirroring> {
3611 Self::build_transport(conf)
3612 .await
3613 .map(super::tracing::Mirroring::new)
3614 }
3615
3616 /// Lists endpoint groups in a given project and location.
3617 /// See <https://google.aip.dev/132>.
3618 ///
3619 /// # Example
3620 /// ```
3621 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3622 /// use google_cloud_gax::paginator::ItemPaginator as _;
3623 /// use google_cloud_networksecurity_v1::Result;
3624 /// async fn sample(
3625 /// client: &Mirroring, project_id: &str, location_id: &str
3626 /// ) -> Result<()> {
3627 /// let mut list = client.list_mirroring_endpoint_groups()
3628 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3629 /// .by_item();
3630 /// while let Some(item) = list.next().await.transpose()? {
3631 /// println!("{:?}", item);
3632 /// }
3633 /// Ok(())
3634 /// }
3635 /// ```
3636 pub fn list_mirroring_endpoint_groups(
3637 &self,
3638 ) -> super::builder::mirroring::ListMirroringEndpointGroups {
3639 super::builder::mirroring::ListMirroringEndpointGroups::new(self.inner.clone())
3640 }
3641
3642 /// Gets a specific endpoint group.
3643 /// See <https://google.aip.dev/131>.
3644 ///
3645 /// # Example
3646 /// ```
3647 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3648 /// use google_cloud_networksecurity_v1::Result;
3649 /// async fn sample(
3650 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_id: &str
3651 /// ) -> Result<()> {
3652 /// let response = client.get_mirroring_endpoint_group()
3653 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroups/{mirroring_endpoint_group_id}"))
3654 /// .send().await?;
3655 /// println!("response {:?}", response);
3656 /// Ok(())
3657 /// }
3658 /// ```
3659 pub fn get_mirroring_endpoint_group(
3660 &self,
3661 ) -> super::builder::mirroring::GetMirroringEndpointGroup {
3662 super::builder::mirroring::GetMirroringEndpointGroup::new(self.inner.clone())
3663 }
3664
3665 /// Creates an endpoint group in a given project and location.
3666 /// See <https://google.aip.dev/133>.
3667 ///
3668 /// # Long running operations
3669 ///
3670 /// This method is used to start, and/or poll a [long-running Operation].
3671 /// The [Working with long-running operations] chapter in the [user guide]
3672 /// covers these operations in detail.
3673 ///
3674 /// [long-running operation]: https://google.aip.dev/151
3675 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3676 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3677 ///
3678 /// # Example
3679 /// ```
3680 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3681 /// use google_cloud_lro::Poller;
3682 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroup;
3683 /// use google_cloud_networksecurity_v1::Result;
3684 /// async fn sample(
3685 /// client: &Mirroring, project_id: &str, location_id: &str
3686 /// ) -> Result<()> {
3687 /// let response = client.create_mirroring_endpoint_group()
3688 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3689 /// .set_mirroring_endpoint_group(
3690 /// MirroringEndpointGroup::new()/* set fields */
3691 /// )
3692 /// .poller().until_done().await?;
3693 /// println!("response {:?}", response);
3694 /// Ok(())
3695 /// }
3696 /// ```
3697 pub fn create_mirroring_endpoint_group(
3698 &self,
3699 ) -> super::builder::mirroring::CreateMirroringEndpointGroup {
3700 super::builder::mirroring::CreateMirroringEndpointGroup::new(self.inner.clone())
3701 }
3702
3703 /// Updates an endpoint group.
3704 /// See <https://google.aip.dev/134>.
3705 ///
3706 /// # Long running operations
3707 ///
3708 /// This method is used to start, and/or poll a [long-running Operation].
3709 /// The [Working with long-running operations] chapter in the [user guide]
3710 /// covers these operations in detail.
3711 ///
3712 /// [long-running operation]: https://google.aip.dev/151
3713 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3714 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3715 ///
3716 /// # Example
3717 /// ```
3718 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3719 /// use google_cloud_lro::Poller;
3720 /// # extern crate wkt as google_cloud_wkt;
3721 /// use google_cloud_wkt::FieldMask;
3722 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroup;
3723 /// use google_cloud_networksecurity_v1::Result;
3724 /// async fn sample(
3725 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_id: &str
3726 /// ) -> Result<()> {
3727 /// let response = client.update_mirroring_endpoint_group()
3728 /// .set_mirroring_endpoint_group(
3729 /// MirroringEndpointGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroups/{mirroring_endpoint_group_id}"))/* set fields */
3730 /// )
3731 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3732 /// .poller().until_done().await?;
3733 /// println!("response {:?}", response);
3734 /// Ok(())
3735 /// }
3736 /// ```
3737 pub fn update_mirroring_endpoint_group(
3738 &self,
3739 ) -> super::builder::mirroring::UpdateMirroringEndpointGroup {
3740 super::builder::mirroring::UpdateMirroringEndpointGroup::new(self.inner.clone())
3741 }
3742
3743 /// Deletes an endpoint group.
3744 /// See <https://google.aip.dev/135>.
3745 ///
3746 /// # Long running operations
3747 ///
3748 /// This method is used to start, and/or poll a [long-running Operation].
3749 /// The [Working with long-running operations] chapter in the [user guide]
3750 /// covers these operations in detail.
3751 ///
3752 /// [long-running operation]: https://google.aip.dev/151
3753 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3754 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3755 ///
3756 /// # Example
3757 /// ```
3758 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3759 /// use google_cloud_lro::Poller;
3760 /// use google_cloud_networksecurity_v1::Result;
3761 /// async fn sample(
3762 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_id: &str
3763 /// ) -> Result<()> {
3764 /// client.delete_mirroring_endpoint_group()
3765 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroups/{mirroring_endpoint_group_id}"))
3766 /// .poller().until_done().await?;
3767 /// Ok(())
3768 /// }
3769 /// ```
3770 pub fn delete_mirroring_endpoint_group(
3771 &self,
3772 ) -> super::builder::mirroring::DeleteMirroringEndpointGroup {
3773 super::builder::mirroring::DeleteMirroringEndpointGroup::new(self.inner.clone())
3774 }
3775
3776 /// Lists associations in a given project and location.
3777 /// See <https://google.aip.dev/132>.
3778 ///
3779 /// # Example
3780 /// ```
3781 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3782 /// use google_cloud_gax::paginator::ItemPaginator as _;
3783 /// use google_cloud_networksecurity_v1::Result;
3784 /// async fn sample(
3785 /// client: &Mirroring, project_id: &str, location_id: &str
3786 /// ) -> Result<()> {
3787 /// let mut list = client.list_mirroring_endpoint_group_associations()
3788 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3789 /// .by_item();
3790 /// while let Some(item) = list.next().await.transpose()? {
3791 /// println!("{:?}", item);
3792 /// }
3793 /// Ok(())
3794 /// }
3795 /// ```
3796 pub fn list_mirroring_endpoint_group_associations(
3797 &self,
3798 ) -> super::builder::mirroring::ListMirroringEndpointGroupAssociations {
3799 super::builder::mirroring::ListMirroringEndpointGroupAssociations::new(self.inner.clone())
3800 }
3801
3802 /// Gets a specific association.
3803 /// See <https://google.aip.dev/131>.
3804 ///
3805 /// # Example
3806 /// ```
3807 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3808 /// use google_cloud_networksecurity_v1::Result;
3809 /// async fn sample(
3810 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_association_id: &str
3811 /// ) -> Result<()> {
3812 /// let response = client.get_mirroring_endpoint_group_association()
3813 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association_id}"))
3814 /// .send().await?;
3815 /// println!("response {:?}", response);
3816 /// Ok(())
3817 /// }
3818 /// ```
3819 pub fn get_mirroring_endpoint_group_association(
3820 &self,
3821 ) -> super::builder::mirroring::GetMirroringEndpointGroupAssociation {
3822 super::builder::mirroring::GetMirroringEndpointGroupAssociation::new(self.inner.clone())
3823 }
3824
3825 /// Creates an association in a given project and location.
3826 /// See <https://google.aip.dev/133>.
3827 ///
3828 /// # Long running operations
3829 ///
3830 /// This method is used to start, and/or poll a [long-running Operation].
3831 /// The [Working with long-running operations] chapter in the [user guide]
3832 /// covers these operations in detail.
3833 ///
3834 /// [long-running operation]: https://google.aip.dev/151
3835 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3836 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3837 ///
3838 /// # Example
3839 /// ```
3840 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3841 /// use google_cloud_lro::Poller;
3842 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroupAssociation;
3843 /// use google_cloud_networksecurity_v1::Result;
3844 /// async fn sample(
3845 /// client: &Mirroring, project_id: &str, location_id: &str
3846 /// ) -> Result<()> {
3847 /// let response = client.create_mirroring_endpoint_group_association()
3848 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3849 /// .set_mirroring_endpoint_group_association(
3850 /// MirroringEndpointGroupAssociation::new()/* set fields */
3851 /// )
3852 /// .poller().until_done().await?;
3853 /// println!("response {:?}", response);
3854 /// Ok(())
3855 /// }
3856 /// ```
3857 pub fn create_mirroring_endpoint_group_association(
3858 &self,
3859 ) -> super::builder::mirroring::CreateMirroringEndpointGroupAssociation {
3860 super::builder::mirroring::CreateMirroringEndpointGroupAssociation::new(self.inner.clone())
3861 }
3862
3863 /// Updates an association.
3864 /// See <https://google.aip.dev/134>.
3865 ///
3866 /// # Long running operations
3867 ///
3868 /// This method is used to start, and/or poll a [long-running Operation].
3869 /// The [Working with long-running operations] chapter in the [user guide]
3870 /// covers these operations in detail.
3871 ///
3872 /// [long-running operation]: https://google.aip.dev/151
3873 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3874 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3875 ///
3876 /// # Example
3877 /// ```
3878 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3879 /// use google_cloud_lro::Poller;
3880 /// # extern crate wkt as google_cloud_wkt;
3881 /// use google_cloud_wkt::FieldMask;
3882 /// use google_cloud_networksecurity_v1::model::MirroringEndpointGroupAssociation;
3883 /// use google_cloud_networksecurity_v1::Result;
3884 /// async fn sample(
3885 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_association_id: &str
3886 /// ) -> Result<()> {
3887 /// let response = client.update_mirroring_endpoint_group_association()
3888 /// .set_mirroring_endpoint_group_association(
3889 /// MirroringEndpointGroupAssociation::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association_id}"))/* set fields */
3890 /// )
3891 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
3892 /// .poller().until_done().await?;
3893 /// println!("response {:?}", response);
3894 /// Ok(())
3895 /// }
3896 /// ```
3897 pub fn update_mirroring_endpoint_group_association(
3898 &self,
3899 ) -> super::builder::mirroring::UpdateMirroringEndpointGroupAssociation {
3900 super::builder::mirroring::UpdateMirroringEndpointGroupAssociation::new(self.inner.clone())
3901 }
3902
3903 /// Deletes an association.
3904 /// See <https://google.aip.dev/135>.
3905 ///
3906 /// # Long running operations
3907 ///
3908 /// This method is used to start, and/or poll a [long-running Operation].
3909 /// The [Working with long-running operations] chapter in the [user guide]
3910 /// covers these operations in detail.
3911 ///
3912 /// [long-running operation]: https://google.aip.dev/151
3913 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3914 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3915 ///
3916 /// # Example
3917 /// ```
3918 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3919 /// use google_cloud_lro::Poller;
3920 /// use google_cloud_networksecurity_v1::Result;
3921 /// async fn sample(
3922 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_endpoint_group_association_id: &str
3923 /// ) -> Result<()> {
3924 /// client.delete_mirroring_endpoint_group_association()
3925 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringEndpointGroupAssociations/{mirroring_endpoint_group_association_id}"))
3926 /// .poller().until_done().await?;
3927 /// Ok(())
3928 /// }
3929 /// ```
3930 pub fn delete_mirroring_endpoint_group_association(
3931 &self,
3932 ) -> super::builder::mirroring::DeleteMirroringEndpointGroupAssociation {
3933 super::builder::mirroring::DeleteMirroringEndpointGroupAssociation::new(self.inner.clone())
3934 }
3935
3936 /// Lists deployment groups in a given project and location.
3937 /// See <https://google.aip.dev/132>.
3938 ///
3939 /// # Example
3940 /// ```
3941 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3942 /// use google_cloud_gax::paginator::ItemPaginator as _;
3943 /// use google_cloud_networksecurity_v1::Result;
3944 /// async fn sample(
3945 /// client: &Mirroring, project_id: &str, location_id: &str
3946 /// ) -> Result<()> {
3947 /// let mut list = client.list_mirroring_deployment_groups()
3948 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
3949 /// .by_item();
3950 /// while let Some(item) = list.next().await.transpose()? {
3951 /// println!("{:?}", item);
3952 /// }
3953 /// Ok(())
3954 /// }
3955 /// ```
3956 pub fn list_mirroring_deployment_groups(
3957 &self,
3958 ) -> super::builder::mirroring::ListMirroringDeploymentGroups {
3959 super::builder::mirroring::ListMirroringDeploymentGroups::new(self.inner.clone())
3960 }
3961
3962 /// Gets a specific deployment group.
3963 /// See <https://google.aip.dev/131>.
3964 ///
3965 /// # Example
3966 /// ```
3967 /// # use google_cloud_networksecurity_v1::client::Mirroring;
3968 /// use google_cloud_networksecurity_v1::Result;
3969 /// async fn sample(
3970 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_group_id: &str
3971 /// ) -> Result<()> {
3972 /// let response = client.get_mirroring_deployment_group()
3973 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeploymentGroups/{mirroring_deployment_group_id}"))
3974 /// .send().await?;
3975 /// println!("response {:?}", response);
3976 /// Ok(())
3977 /// }
3978 /// ```
3979 pub fn get_mirroring_deployment_group(
3980 &self,
3981 ) -> super::builder::mirroring::GetMirroringDeploymentGroup {
3982 super::builder::mirroring::GetMirroringDeploymentGroup::new(self.inner.clone())
3983 }
3984
3985 /// Creates a deployment group in a given project and location.
3986 /// See <https://google.aip.dev/133>.
3987 ///
3988 /// # Long running operations
3989 ///
3990 /// This method is used to start, and/or poll a [long-running Operation].
3991 /// The [Working with long-running operations] chapter in the [user guide]
3992 /// covers these operations in detail.
3993 ///
3994 /// [long-running operation]: https://google.aip.dev/151
3995 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
3996 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
3997 ///
3998 /// # Example
3999 /// ```
4000 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4001 /// use google_cloud_lro::Poller;
4002 /// use google_cloud_networksecurity_v1::model::MirroringDeploymentGroup;
4003 /// use google_cloud_networksecurity_v1::Result;
4004 /// async fn sample(
4005 /// client: &Mirroring, project_id: &str, location_id: &str
4006 /// ) -> Result<()> {
4007 /// let response = client.create_mirroring_deployment_group()
4008 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4009 /// .set_mirroring_deployment_group(
4010 /// MirroringDeploymentGroup::new()/* set fields */
4011 /// )
4012 /// .poller().until_done().await?;
4013 /// println!("response {:?}", response);
4014 /// Ok(())
4015 /// }
4016 /// ```
4017 pub fn create_mirroring_deployment_group(
4018 &self,
4019 ) -> super::builder::mirroring::CreateMirroringDeploymentGroup {
4020 super::builder::mirroring::CreateMirroringDeploymentGroup::new(self.inner.clone())
4021 }
4022
4023 /// Updates a deployment group.
4024 /// See <https://google.aip.dev/134>.
4025 ///
4026 /// # Long running operations
4027 ///
4028 /// This method is used to start, and/or poll a [long-running Operation].
4029 /// The [Working with long-running operations] chapter in the [user guide]
4030 /// covers these operations in detail.
4031 ///
4032 /// [long-running operation]: https://google.aip.dev/151
4033 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4034 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4035 ///
4036 /// # Example
4037 /// ```
4038 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4039 /// use google_cloud_lro::Poller;
4040 /// # extern crate wkt as google_cloud_wkt;
4041 /// use google_cloud_wkt::FieldMask;
4042 /// use google_cloud_networksecurity_v1::model::MirroringDeploymentGroup;
4043 /// use google_cloud_networksecurity_v1::Result;
4044 /// async fn sample(
4045 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_group_id: &str
4046 /// ) -> Result<()> {
4047 /// let response = client.update_mirroring_deployment_group()
4048 /// .set_mirroring_deployment_group(
4049 /// MirroringDeploymentGroup::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeploymentGroups/{mirroring_deployment_group_id}"))/* set fields */
4050 /// )
4051 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4052 /// .poller().until_done().await?;
4053 /// println!("response {:?}", response);
4054 /// Ok(())
4055 /// }
4056 /// ```
4057 pub fn update_mirroring_deployment_group(
4058 &self,
4059 ) -> super::builder::mirroring::UpdateMirroringDeploymentGroup {
4060 super::builder::mirroring::UpdateMirroringDeploymentGroup::new(self.inner.clone())
4061 }
4062
4063 /// Deletes a deployment group.
4064 /// See <https://google.aip.dev/135>.
4065 ///
4066 /// # Long running operations
4067 ///
4068 /// This method is used to start, and/or poll a [long-running Operation].
4069 /// The [Working with long-running operations] chapter in the [user guide]
4070 /// covers these operations in detail.
4071 ///
4072 /// [long-running operation]: https://google.aip.dev/151
4073 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4074 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4075 ///
4076 /// # Example
4077 /// ```
4078 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4079 /// use google_cloud_lro::Poller;
4080 /// use google_cloud_networksecurity_v1::Result;
4081 /// async fn sample(
4082 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_group_id: &str
4083 /// ) -> Result<()> {
4084 /// client.delete_mirroring_deployment_group()
4085 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeploymentGroups/{mirroring_deployment_group_id}"))
4086 /// .poller().until_done().await?;
4087 /// Ok(())
4088 /// }
4089 /// ```
4090 pub fn delete_mirroring_deployment_group(
4091 &self,
4092 ) -> super::builder::mirroring::DeleteMirroringDeploymentGroup {
4093 super::builder::mirroring::DeleteMirroringDeploymentGroup::new(self.inner.clone())
4094 }
4095
4096 /// Lists deployments in a given project and location.
4097 /// See <https://google.aip.dev/132>.
4098 ///
4099 /// # Example
4100 /// ```
4101 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4102 /// use google_cloud_gax::paginator::ItemPaginator as _;
4103 /// use google_cloud_networksecurity_v1::Result;
4104 /// async fn sample(
4105 /// client: &Mirroring, project_id: &str, location_id: &str
4106 /// ) -> Result<()> {
4107 /// let mut list = client.list_mirroring_deployments()
4108 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4109 /// .by_item();
4110 /// while let Some(item) = list.next().await.transpose()? {
4111 /// println!("{:?}", item);
4112 /// }
4113 /// Ok(())
4114 /// }
4115 /// ```
4116 pub fn list_mirroring_deployments(
4117 &self,
4118 ) -> super::builder::mirroring::ListMirroringDeployments {
4119 super::builder::mirroring::ListMirroringDeployments::new(self.inner.clone())
4120 }
4121
4122 /// Gets a specific deployment.
4123 /// See <https://google.aip.dev/131>.
4124 ///
4125 /// # Example
4126 /// ```
4127 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4128 /// use google_cloud_networksecurity_v1::Result;
4129 /// async fn sample(
4130 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_id: &str
4131 /// ) -> Result<()> {
4132 /// let response = client.get_mirroring_deployment()
4133 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeployments/{mirroring_deployment_id}"))
4134 /// .send().await?;
4135 /// println!("response {:?}", response);
4136 /// Ok(())
4137 /// }
4138 /// ```
4139 pub fn get_mirroring_deployment(&self) -> super::builder::mirroring::GetMirroringDeployment {
4140 super::builder::mirroring::GetMirroringDeployment::new(self.inner.clone())
4141 }
4142
4143 /// Creates a deployment in a given project and location.
4144 /// See <https://google.aip.dev/133>.
4145 ///
4146 /// # Long running operations
4147 ///
4148 /// This method is used to start, and/or poll a [long-running Operation].
4149 /// The [Working with long-running operations] chapter in the [user guide]
4150 /// covers these operations in detail.
4151 ///
4152 /// [long-running operation]: https://google.aip.dev/151
4153 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4154 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4155 ///
4156 /// # Example
4157 /// ```
4158 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4159 /// use google_cloud_lro::Poller;
4160 /// use google_cloud_networksecurity_v1::model::MirroringDeployment;
4161 /// use google_cloud_networksecurity_v1::Result;
4162 /// async fn sample(
4163 /// client: &Mirroring, project_id: &str, location_id: &str
4164 /// ) -> Result<()> {
4165 /// let response = client.create_mirroring_deployment()
4166 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4167 /// .set_mirroring_deployment(
4168 /// MirroringDeployment::new()/* set fields */
4169 /// )
4170 /// .poller().until_done().await?;
4171 /// println!("response {:?}", response);
4172 /// Ok(())
4173 /// }
4174 /// ```
4175 pub fn create_mirroring_deployment(
4176 &self,
4177 ) -> super::builder::mirroring::CreateMirroringDeployment {
4178 super::builder::mirroring::CreateMirroringDeployment::new(self.inner.clone())
4179 }
4180
4181 /// Updates a deployment.
4182 /// See <https://google.aip.dev/134>.
4183 ///
4184 /// # Long running operations
4185 ///
4186 /// This method is used to start, and/or poll a [long-running Operation].
4187 /// The [Working with long-running operations] chapter in the [user guide]
4188 /// covers these operations in detail.
4189 ///
4190 /// [long-running operation]: https://google.aip.dev/151
4191 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4192 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4193 ///
4194 /// # Example
4195 /// ```
4196 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4197 /// use google_cloud_lro::Poller;
4198 /// # extern crate wkt as google_cloud_wkt;
4199 /// use google_cloud_wkt::FieldMask;
4200 /// use google_cloud_networksecurity_v1::model::MirroringDeployment;
4201 /// use google_cloud_networksecurity_v1::Result;
4202 /// async fn sample(
4203 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_id: &str
4204 /// ) -> Result<()> {
4205 /// let response = client.update_mirroring_deployment()
4206 /// .set_mirroring_deployment(
4207 /// MirroringDeployment::new().set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeployments/{mirroring_deployment_id}"))/* set fields */
4208 /// )
4209 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4210 /// .poller().until_done().await?;
4211 /// println!("response {:?}", response);
4212 /// Ok(())
4213 /// }
4214 /// ```
4215 pub fn update_mirroring_deployment(
4216 &self,
4217 ) -> super::builder::mirroring::UpdateMirroringDeployment {
4218 super::builder::mirroring::UpdateMirroringDeployment::new(self.inner.clone())
4219 }
4220
4221 /// Deletes a deployment.
4222 /// See <https://google.aip.dev/135>.
4223 ///
4224 /// # Long running operations
4225 ///
4226 /// This method is used to start, and/or poll a [long-running Operation].
4227 /// The [Working with long-running operations] chapter in the [user guide]
4228 /// covers these operations in detail.
4229 ///
4230 /// [long-running operation]: https://google.aip.dev/151
4231 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4232 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4233 ///
4234 /// # Example
4235 /// ```
4236 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4237 /// use google_cloud_lro::Poller;
4238 /// use google_cloud_networksecurity_v1::Result;
4239 /// async fn sample(
4240 /// client: &Mirroring, project_id: &str, location_id: &str, mirroring_deployment_id: &str
4241 /// ) -> Result<()> {
4242 /// client.delete_mirroring_deployment()
4243 /// .set_name(format!("projects/{project_id}/locations/{location_id}/mirroringDeployments/{mirroring_deployment_id}"))
4244 /// .poller().until_done().await?;
4245 /// Ok(())
4246 /// }
4247 /// ```
4248 pub fn delete_mirroring_deployment(
4249 &self,
4250 ) -> super::builder::mirroring::DeleteMirroringDeployment {
4251 super::builder::mirroring::DeleteMirroringDeployment::new(self.inner.clone())
4252 }
4253
4254 /// Lists information about the supported locations for this service.
4255 ///
4256 /// This method lists locations based on the resource scope provided in
4257 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
4258 /// **Global locations**: If `name` is empty, the method lists the
4259 /// public locations available to all projects. * **Project-specific
4260 /// locations**: If `name` follows the format
4261 /// `projects/{project}`, the method lists locations visible to that
4262 /// specific project. This includes public, private, or other
4263 /// project-specific locations enabled for the project.
4264 ///
4265 /// For gRPC and client library implementations, the resource name is
4266 /// passed as the `name` field. For direct service calls, the resource
4267 /// name is
4268 /// incorporated into the request path based on the specific service
4269 /// implementation and version.
4270 ///
4271 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
4272 ///
4273 /// # Example
4274 /// ```
4275 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4276 /// use google_cloud_gax::paginator::ItemPaginator as _;
4277 /// use google_cloud_networksecurity_v1::Result;
4278 /// async fn sample(
4279 /// client: &Mirroring
4280 /// ) -> Result<()> {
4281 /// let mut list = client.list_locations()
4282 /// /* set fields */
4283 /// .by_item();
4284 /// while let Some(item) = list.next().await.transpose()? {
4285 /// println!("{:?}", item);
4286 /// }
4287 /// Ok(())
4288 /// }
4289 /// ```
4290 pub fn list_locations(&self) -> super::builder::mirroring::ListLocations {
4291 super::builder::mirroring::ListLocations::new(self.inner.clone())
4292 }
4293
4294 /// Gets information about a location.
4295 ///
4296 /// # Example
4297 /// ```
4298 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4299 /// use google_cloud_networksecurity_v1::Result;
4300 /// async fn sample(
4301 /// client: &Mirroring
4302 /// ) -> Result<()> {
4303 /// let response = client.get_location()
4304 /// /* set fields */
4305 /// .send().await?;
4306 /// println!("response {:?}", response);
4307 /// Ok(())
4308 /// }
4309 /// ```
4310 pub fn get_location(&self) -> super::builder::mirroring::GetLocation {
4311 super::builder::mirroring::GetLocation::new(self.inner.clone())
4312 }
4313
4314 /// Sets the access control policy on the specified resource. Replaces
4315 /// any existing policy.
4316 ///
4317 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
4318 /// errors.
4319 ///
4320 /// # Example
4321 /// ```
4322 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4323 /// use google_cloud_networksecurity_v1::Result;
4324 /// async fn sample(
4325 /// client: &Mirroring
4326 /// ) -> Result<()> {
4327 /// let response = client.set_iam_policy()
4328 /// /* set fields */
4329 /// .send().await?;
4330 /// println!("response {:?}", response);
4331 /// Ok(())
4332 /// }
4333 /// ```
4334 pub fn set_iam_policy(&self) -> super::builder::mirroring::SetIamPolicy {
4335 super::builder::mirroring::SetIamPolicy::new(self.inner.clone())
4336 }
4337
4338 /// Gets the access control policy for a resource. Returns an empty policy
4339 /// if the resource exists and does not have a policy set.
4340 ///
4341 /// # Example
4342 /// ```
4343 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4344 /// use google_cloud_networksecurity_v1::Result;
4345 /// async fn sample(
4346 /// client: &Mirroring
4347 /// ) -> Result<()> {
4348 /// let response = client.get_iam_policy()
4349 /// /* set fields */
4350 /// .send().await?;
4351 /// println!("response {:?}", response);
4352 /// Ok(())
4353 /// }
4354 /// ```
4355 pub fn get_iam_policy(&self) -> super::builder::mirroring::GetIamPolicy {
4356 super::builder::mirroring::GetIamPolicy::new(self.inner.clone())
4357 }
4358
4359 /// Returns permissions that a caller has on the specified resource. If the
4360 /// resource does not exist, this will return an empty set of
4361 /// permissions, not a `NOT_FOUND` error.
4362 ///
4363 /// Note: This operation is designed to be used for building
4364 /// permission-aware UIs and command-line tools, not for authorization
4365 /// checking. This operation may "fail open" without warning.
4366 ///
4367 /// # Example
4368 /// ```
4369 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4370 /// use google_cloud_networksecurity_v1::Result;
4371 /// async fn sample(
4372 /// client: &Mirroring
4373 /// ) -> Result<()> {
4374 /// let response = client.test_iam_permissions()
4375 /// /* set fields */
4376 /// .send().await?;
4377 /// println!("response {:?}", response);
4378 /// Ok(())
4379 /// }
4380 /// ```
4381 pub fn test_iam_permissions(&self) -> super::builder::mirroring::TestIamPermissions {
4382 super::builder::mirroring::TestIamPermissions::new(self.inner.clone())
4383 }
4384
4385 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4386 ///
4387 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4388 ///
4389 /// # Example
4390 /// ```
4391 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4392 /// use google_cloud_gax::paginator::ItemPaginator as _;
4393 /// use google_cloud_networksecurity_v1::Result;
4394 /// async fn sample(
4395 /// client: &Mirroring
4396 /// ) -> Result<()> {
4397 /// let mut list = client.list_operations()
4398 /// /* set fields */
4399 /// .by_item();
4400 /// while let Some(item) = list.next().await.transpose()? {
4401 /// println!("{:?}", item);
4402 /// }
4403 /// Ok(())
4404 /// }
4405 /// ```
4406 pub fn list_operations(&self) -> super::builder::mirroring::ListOperations {
4407 super::builder::mirroring::ListOperations::new(self.inner.clone())
4408 }
4409
4410 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4411 ///
4412 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4413 ///
4414 /// # Example
4415 /// ```
4416 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4417 /// use google_cloud_networksecurity_v1::Result;
4418 /// async fn sample(
4419 /// client: &Mirroring
4420 /// ) -> Result<()> {
4421 /// let response = client.get_operation()
4422 /// /* set fields */
4423 /// .send().await?;
4424 /// println!("response {:?}", response);
4425 /// Ok(())
4426 /// }
4427 /// ```
4428 pub fn get_operation(&self) -> super::builder::mirroring::GetOperation {
4429 super::builder::mirroring::GetOperation::new(self.inner.clone())
4430 }
4431
4432 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4433 ///
4434 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4435 ///
4436 /// # Example
4437 /// ```
4438 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4439 /// use google_cloud_networksecurity_v1::Result;
4440 /// async fn sample(
4441 /// client: &Mirroring
4442 /// ) -> Result<()> {
4443 /// client.delete_operation()
4444 /// /* set fields */
4445 /// .send().await?;
4446 /// Ok(())
4447 /// }
4448 /// ```
4449 pub fn delete_operation(&self) -> super::builder::mirroring::DeleteOperation {
4450 super::builder::mirroring::DeleteOperation::new(self.inner.clone())
4451 }
4452
4453 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
4454 ///
4455 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
4456 ///
4457 /// # Example
4458 /// ```
4459 /// # use google_cloud_networksecurity_v1::client::Mirroring;
4460 /// use google_cloud_networksecurity_v1::Result;
4461 /// async fn sample(
4462 /// client: &Mirroring
4463 /// ) -> Result<()> {
4464 /// client.cancel_operation()
4465 /// /* set fields */
4466 /// .send().await?;
4467 /// Ok(())
4468 /// }
4469 /// ```
4470 pub fn cancel_operation(&self) -> super::builder::mirroring::CancelOperation {
4471 super::builder::mirroring::CancelOperation::new(self.inner.clone())
4472 }
4473}
4474
4475/// Implements a client for the Network Security API.
4476///
4477/// # Example
4478/// ```
4479/// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4480/// use google_cloud_gax::paginator::ItemPaginator as _;
4481/// async fn sample(
4482/// parent: &str,
4483/// ) -> anyhow::Result<()> {
4484/// let client = NetworkSecurity::builder().build().await?;
4485/// let mut list = client.list_authorization_policies()
4486/// .set_parent(parent)
4487/// .by_item();
4488/// while let Some(item) = list.next().await.transpose()? {
4489/// println!("{:?}", item);
4490/// }
4491/// Ok(())
4492/// }
4493/// ```
4494///
4495/// # Service Description
4496///
4497/// Network Security API provides resources to configure authentication and
4498/// authorization policies. Refer to per API resource documentation for more
4499/// information.
4500///
4501/// # Configuration
4502///
4503/// To configure `NetworkSecurity` use the `with_*` methods in the type returned
4504/// by [builder()][NetworkSecurity::builder]. The default configuration should
4505/// work for most applications. Common configuration changes include
4506///
4507/// * [with_endpoint()]: by default this client uses the global default endpoint
4508/// (`https://networksecurity.googleapis.com`). Applications using regional
4509/// endpoints or running in restricted networks (e.g. a network configured
4510/// with [Private Google Access with VPC Service Controls]) may want to
4511/// override this default.
4512/// * [with_credentials()]: by default this client uses
4513/// [Application Default Credentials]. Applications using custom
4514/// authentication may need to override this default.
4515///
4516/// [with_endpoint()]: super::builder::network_security::ClientBuilder::with_endpoint
4517/// [with_credentials()]: super::builder::network_security::ClientBuilder::with_credentials
4518/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4519/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4520///
4521/// # Pooling and Cloning
4522///
4523/// `NetworkSecurity` holds a connection pool internally, it is advised to
4524/// create one and reuse it. You do not need to wrap `NetworkSecurity` in
4525/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4526/// already uses an `Arc` internally.
4527#[derive(Clone, Debug)]
4528pub struct NetworkSecurity {
4529 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>,
4530}
4531
4532impl NetworkSecurity {
4533 /// Returns a builder for [NetworkSecurity].
4534 ///
4535 /// ```
4536 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4537 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4538 /// let client = NetworkSecurity::builder().build().await?;
4539 /// # Ok(()) }
4540 /// ```
4541 pub fn builder() -> super::builder::network_security::ClientBuilder {
4542 crate::new_client_builder(super::builder::network_security::client::Factory)
4543 }
4544
4545 /// Creates a new client from the provided stub.
4546 ///
4547 /// The most common case for calling this function is in tests mocking the
4548 /// client's behavior.
4549 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4550 where
4551 T: super::stub::NetworkSecurity + 'static,
4552 {
4553 Self { inner: stub.into() }
4554 }
4555
4556 pub(crate) async fn new(
4557 config: gaxi::options::ClientConfig,
4558 ) -> crate::ClientBuilderResult<Self> {
4559 let inner = Self::build_inner(config).await?;
4560 Ok(Self { inner })
4561 }
4562
4563 async fn build_inner(
4564 conf: gaxi::options::ClientConfig,
4565 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkSecurity>> {
4566 if gaxi::options::tracing_enabled(&conf) {
4567 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4568 }
4569 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4570 }
4571
4572 async fn build_transport(
4573 conf: gaxi::options::ClientConfig,
4574 ) -> crate::ClientBuilderResult<impl super::stub::NetworkSecurity> {
4575 super::transport::NetworkSecurity::new(conf).await
4576 }
4577
4578 async fn build_with_tracing(
4579 conf: gaxi::options::ClientConfig,
4580 ) -> crate::ClientBuilderResult<impl super::stub::NetworkSecurity> {
4581 Self::build_transport(conf)
4582 .await
4583 .map(super::tracing::NetworkSecurity::new)
4584 }
4585
4586 /// Lists AuthorizationPolicies 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_authorization_policies()
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_authorization_policies(
4606 &self,
4607 ) -> super::builder::network_security::ListAuthorizationPolicies {
4608 super::builder::network_security::ListAuthorizationPolicies::new(self.inner.clone())
4609 }
4610
4611 /// Gets details of a single AuthorizationPolicy.
4612 ///
4613 /// # Example
4614 /// ```
4615 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4616 /// use google_cloud_networksecurity_v1::Result;
4617 /// async fn sample(
4618 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authorization_policy_id: &str
4619 /// ) -> Result<()> {
4620 /// let response = client.get_authorization_policy()
4621 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authorizationPolicies/{authorization_policy_id}"))
4622 /// .send().await?;
4623 /// println!("response {:?}", response);
4624 /// Ok(())
4625 /// }
4626 /// ```
4627 pub fn get_authorization_policy(
4628 &self,
4629 ) -> super::builder::network_security::GetAuthorizationPolicy {
4630 super::builder::network_security::GetAuthorizationPolicy::new(self.inner.clone())
4631 }
4632
4633 /// Creates a new AuthorizationPolicy in a given project and location.
4634 ///
4635 /// # Long running operations
4636 ///
4637 /// This method is used to start, and/or poll a [long-running Operation].
4638 /// The [Working with long-running operations] chapter in the [user guide]
4639 /// covers these operations in detail.
4640 ///
4641 /// [long-running operation]: https://google.aip.dev/151
4642 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4643 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4644 ///
4645 /// # Example
4646 /// ```
4647 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4648 /// use google_cloud_lro::Poller;
4649 /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
4650 /// use google_cloud_networksecurity_v1::Result;
4651 /// async fn sample(
4652 /// client: &NetworkSecurity, project_id: &str, location_id: &str
4653 /// ) -> Result<()> {
4654 /// let response = client.create_authorization_policy()
4655 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4656 /// .set_authorization_policy(
4657 /// AuthorizationPolicy::new()/* set fields */
4658 /// )
4659 /// .poller().until_done().await?;
4660 /// println!("response {:?}", response);
4661 /// Ok(())
4662 /// }
4663 /// ```
4664 pub fn create_authorization_policy(
4665 &self,
4666 ) -> super::builder::network_security::CreateAuthorizationPolicy {
4667 super::builder::network_security::CreateAuthorizationPolicy::new(self.inner.clone())
4668 }
4669
4670 /// Updates the parameters of a single AuthorizationPolicy.
4671 ///
4672 /// # Long running operations
4673 ///
4674 /// This method is used to start, and/or poll a [long-running Operation].
4675 /// The [Working with long-running operations] chapter in the [user guide]
4676 /// covers these operations in detail.
4677 ///
4678 /// [long-running operation]: https://google.aip.dev/151
4679 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4680 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4681 ///
4682 /// # Example
4683 /// ```
4684 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4685 /// use google_cloud_lro::Poller;
4686 /// # extern crate wkt as google_cloud_wkt;
4687 /// use google_cloud_wkt::FieldMask;
4688 /// use google_cloud_networksecurity_v1::model::AuthorizationPolicy;
4689 /// use google_cloud_networksecurity_v1::Result;
4690 /// async fn sample(
4691 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authorization_policy_id: &str
4692 /// ) -> Result<()> {
4693 /// let response = client.update_authorization_policy()
4694 /// .set_authorization_policy(
4695 /// AuthorizationPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/authorizationPolicies/{authorization_policy_id}"))/* set fields */
4696 /// )
4697 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4698 /// .poller().until_done().await?;
4699 /// println!("response {:?}", response);
4700 /// Ok(())
4701 /// }
4702 /// ```
4703 pub fn update_authorization_policy(
4704 &self,
4705 ) -> super::builder::network_security::UpdateAuthorizationPolicy {
4706 super::builder::network_security::UpdateAuthorizationPolicy::new(self.inner.clone())
4707 }
4708
4709 /// Deletes a single AuthorizationPolicy.
4710 ///
4711 /// # Long running operations
4712 ///
4713 /// This method is used to start, and/or poll a [long-running Operation].
4714 /// The [Working with long-running operations] chapter in the [user guide]
4715 /// covers these operations in detail.
4716 ///
4717 /// [long-running operation]: https://google.aip.dev/151
4718 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4719 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4720 ///
4721 /// # Example
4722 /// ```
4723 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4724 /// use google_cloud_lro::Poller;
4725 /// use google_cloud_networksecurity_v1::Result;
4726 /// async fn sample(
4727 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authorization_policy_id: &str
4728 /// ) -> Result<()> {
4729 /// client.delete_authorization_policy()
4730 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authorizationPolicies/{authorization_policy_id}"))
4731 /// .poller().until_done().await?;
4732 /// Ok(())
4733 /// }
4734 /// ```
4735 pub fn delete_authorization_policy(
4736 &self,
4737 ) -> super::builder::network_security::DeleteAuthorizationPolicy {
4738 super::builder::network_security::DeleteAuthorizationPolicy::new(self.inner.clone())
4739 }
4740
4741 /// Lists BackendAuthenticationConfigs in a given project and location.
4742 ///
4743 /// # Example
4744 /// ```
4745 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4746 /// use google_cloud_gax::paginator::ItemPaginator as _;
4747 /// use google_cloud_networksecurity_v1::Result;
4748 /// async fn sample(
4749 /// client: &NetworkSecurity, parent: &str
4750 /// ) -> Result<()> {
4751 /// let mut list = client.list_backend_authentication_configs()
4752 /// .set_parent(parent)
4753 /// .by_item();
4754 /// while let Some(item) = list.next().await.transpose()? {
4755 /// println!("{:?}", item);
4756 /// }
4757 /// Ok(())
4758 /// }
4759 /// ```
4760 pub fn list_backend_authentication_configs(
4761 &self,
4762 ) -> super::builder::network_security::ListBackendAuthenticationConfigs {
4763 super::builder::network_security::ListBackendAuthenticationConfigs::new(self.inner.clone())
4764 }
4765
4766 /// Gets details of a single BackendAuthenticationConfig to
4767 /// BackendAuthenticationConfig.
4768 ///
4769 /// # Example
4770 /// ```
4771 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4772 /// use google_cloud_networksecurity_v1::Result;
4773 /// async fn sample(
4774 /// client: &NetworkSecurity, project_id: &str, location_id: &str, backend_authentication_config_id: &str
4775 /// ) -> Result<()> {
4776 /// let response = client.get_backend_authentication_config()
4777 /// .set_name(format!("projects/{project_id}/locations/{location_id}/backendAuthenticationConfigs/{backend_authentication_config_id}"))
4778 /// .send().await?;
4779 /// println!("response {:?}", response);
4780 /// Ok(())
4781 /// }
4782 /// ```
4783 pub fn get_backend_authentication_config(
4784 &self,
4785 ) -> super::builder::network_security::GetBackendAuthenticationConfig {
4786 super::builder::network_security::GetBackendAuthenticationConfig::new(self.inner.clone())
4787 }
4788
4789 /// Creates a new BackendAuthenticationConfig 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::BackendAuthenticationConfig;
4806 /// use google_cloud_networksecurity_v1::Result;
4807 /// async fn sample(
4808 /// client: &NetworkSecurity, project_id: &str, location_id: &str
4809 /// ) -> Result<()> {
4810 /// let response = client.create_backend_authentication_config()
4811 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4812 /// .set_backend_authentication_config(
4813 /// BackendAuthenticationConfig::new()/* set fields */
4814 /// )
4815 /// .poller().until_done().await?;
4816 /// println!("response {:?}", response);
4817 /// Ok(())
4818 /// }
4819 /// ```
4820 pub fn create_backend_authentication_config(
4821 &self,
4822 ) -> super::builder::network_security::CreateBackendAuthenticationConfig {
4823 super::builder::network_security::CreateBackendAuthenticationConfig::new(self.inner.clone())
4824 }
4825
4826 /// Updates the parameters of a single BackendAuthenticationConfig to
4827 /// BackendAuthenticationConfig.
4828 ///
4829 /// # Long running operations
4830 ///
4831 /// This method is used to start, and/or poll a [long-running Operation].
4832 /// The [Working with long-running operations] chapter in the [user guide]
4833 /// covers these operations in detail.
4834 ///
4835 /// [long-running operation]: https://google.aip.dev/151
4836 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4837 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4838 ///
4839 /// # Example
4840 /// ```
4841 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4842 /// use google_cloud_lro::Poller;
4843 /// # extern crate wkt as google_cloud_wkt;
4844 /// use google_cloud_wkt::FieldMask;
4845 /// use google_cloud_networksecurity_v1::model::BackendAuthenticationConfig;
4846 /// use google_cloud_networksecurity_v1::Result;
4847 /// async fn sample(
4848 /// client: &NetworkSecurity, project_id: &str, location_id: &str, backend_authentication_config_id: &str
4849 /// ) -> Result<()> {
4850 /// let response = client.update_backend_authentication_config()
4851 /// .set_backend_authentication_config(
4852 /// BackendAuthenticationConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/backendAuthenticationConfigs/{backend_authentication_config_id}"))/* set fields */
4853 /// )
4854 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
4855 /// .poller().until_done().await?;
4856 /// println!("response {:?}", response);
4857 /// Ok(())
4858 /// }
4859 /// ```
4860 pub fn update_backend_authentication_config(
4861 &self,
4862 ) -> super::builder::network_security::UpdateBackendAuthenticationConfig {
4863 super::builder::network_security::UpdateBackendAuthenticationConfig::new(self.inner.clone())
4864 }
4865
4866 /// Deletes a single BackendAuthenticationConfig to
4867 /// BackendAuthenticationConfig.
4868 ///
4869 /// # Long running operations
4870 ///
4871 /// This method is used to start, and/or poll a [long-running Operation].
4872 /// The [Working with long-running operations] chapter in the [user guide]
4873 /// covers these operations in detail.
4874 ///
4875 /// [long-running operation]: https://google.aip.dev/151
4876 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4877 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4878 ///
4879 /// # Example
4880 /// ```
4881 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4882 /// use google_cloud_lro::Poller;
4883 /// use google_cloud_networksecurity_v1::Result;
4884 /// async fn sample(
4885 /// client: &NetworkSecurity, project_id: &str, location_id: &str, backend_authentication_config_id: &str
4886 /// ) -> Result<()> {
4887 /// client.delete_backend_authentication_config()
4888 /// .set_name(format!("projects/{project_id}/locations/{location_id}/backendAuthenticationConfigs/{backend_authentication_config_id}"))
4889 /// .poller().until_done().await?;
4890 /// Ok(())
4891 /// }
4892 /// ```
4893 pub fn delete_backend_authentication_config(
4894 &self,
4895 ) -> super::builder::network_security::DeleteBackendAuthenticationConfig {
4896 super::builder::network_security::DeleteBackendAuthenticationConfig::new(self.inner.clone())
4897 }
4898
4899 /// Lists ServerTlsPolicies in a given project and location.
4900 ///
4901 /// # Example
4902 /// ```
4903 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4904 /// use google_cloud_gax::paginator::ItemPaginator as _;
4905 /// use google_cloud_networksecurity_v1::Result;
4906 /// async fn sample(
4907 /// client: &NetworkSecurity, parent: &str
4908 /// ) -> Result<()> {
4909 /// let mut list = client.list_server_tls_policies()
4910 /// .set_parent(parent)
4911 /// .by_item();
4912 /// while let Some(item) = list.next().await.transpose()? {
4913 /// println!("{:?}", item);
4914 /// }
4915 /// Ok(())
4916 /// }
4917 /// ```
4918 pub fn list_server_tls_policies(
4919 &self,
4920 ) -> super::builder::network_security::ListServerTlsPolicies {
4921 super::builder::network_security::ListServerTlsPolicies::new(self.inner.clone())
4922 }
4923
4924 /// Gets details of a single ServerTlsPolicy.
4925 ///
4926 /// # Example
4927 /// ```
4928 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4929 /// use google_cloud_networksecurity_v1::Result;
4930 /// async fn sample(
4931 /// client: &NetworkSecurity, project_id: &str, location_id: &str, server_tls_policy_id: &str
4932 /// ) -> Result<()> {
4933 /// let response = client.get_server_tls_policy()
4934 /// .set_name(format!("projects/{project_id}/locations/{location_id}/serverTlsPolicies/{server_tls_policy_id}"))
4935 /// .send().await?;
4936 /// println!("response {:?}", response);
4937 /// Ok(())
4938 /// }
4939 /// ```
4940 pub fn get_server_tls_policy(&self) -> super::builder::network_security::GetServerTlsPolicy {
4941 super::builder::network_security::GetServerTlsPolicy::new(self.inner.clone())
4942 }
4943
4944 /// Creates a new ServerTlsPolicy in a given project and location.
4945 ///
4946 /// # Long running operations
4947 ///
4948 /// This method is used to start, and/or poll a [long-running Operation].
4949 /// The [Working with long-running operations] chapter in the [user guide]
4950 /// covers these operations in detail.
4951 ///
4952 /// [long-running operation]: https://google.aip.dev/151
4953 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4954 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4955 ///
4956 /// # Example
4957 /// ```
4958 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4959 /// use google_cloud_lro::Poller;
4960 /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
4961 /// use google_cloud_networksecurity_v1::Result;
4962 /// async fn sample(
4963 /// client: &NetworkSecurity, project_id: &str, location_id: &str
4964 /// ) -> Result<()> {
4965 /// let response = client.create_server_tls_policy()
4966 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
4967 /// .set_server_tls_policy(
4968 /// ServerTlsPolicy::new()/* set fields */
4969 /// )
4970 /// .poller().until_done().await?;
4971 /// println!("response {:?}", response);
4972 /// Ok(())
4973 /// }
4974 /// ```
4975 pub fn create_server_tls_policy(
4976 &self,
4977 ) -> super::builder::network_security::CreateServerTlsPolicy {
4978 super::builder::network_security::CreateServerTlsPolicy::new(self.inner.clone())
4979 }
4980
4981 /// Updates the parameters of a single ServerTlsPolicy.
4982 ///
4983 /// # Long running operations
4984 ///
4985 /// This method is used to start, and/or poll a [long-running Operation].
4986 /// The [Working with long-running operations] chapter in the [user guide]
4987 /// covers these operations in detail.
4988 ///
4989 /// [long-running operation]: https://google.aip.dev/151
4990 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
4991 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
4992 ///
4993 /// # Example
4994 /// ```
4995 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
4996 /// use google_cloud_lro::Poller;
4997 /// # extern crate wkt as google_cloud_wkt;
4998 /// use google_cloud_wkt::FieldMask;
4999 /// use google_cloud_networksecurity_v1::model::ServerTlsPolicy;
5000 /// use google_cloud_networksecurity_v1::Result;
5001 /// async fn sample(
5002 /// client: &NetworkSecurity, project_id: &str, location_id: &str, server_tls_policy_id: &str
5003 /// ) -> Result<()> {
5004 /// let response = client.update_server_tls_policy()
5005 /// .set_server_tls_policy(
5006 /// ServerTlsPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/serverTlsPolicies/{server_tls_policy_id}"))/* set fields */
5007 /// )
5008 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5009 /// .poller().until_done().await?;
5010 /// println!("response {:?}", response);
5011 /// Ok(())
5012 /// }
5013 /// ```
5014 pub fn update_server_tls_policy(
5015 &self,
5016 ) -> super::builder::network_security::UpdateServerTlsPolicy {
5017 super::builder::network_security::UpdateServerTlsPolicy::new(self.inner.clone())
5018 }
5019
5020 /// Deletes a single ServerTlsPolicy.
5021 ///
5022 /// # Long running operations
5023 ///
5024 /// This method is used to start, and/or poll a [long-running Operation].
5025 /// The [Working with long-running operations] chapter in the [user guide]
5026 /// covers these operations in detail.
5027 ///
5028 /// [long-running operation]: https://google.aip.dev/151
5029 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5030 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5031 ///
5032 /// # Example
5033 /// ```
5034 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5035 /// use google_cloud_lro::Poller;
5036 /// use google_cloud_networksecurity_v1::Result;
5037 /// async fn sample(
5038 /// client: &NetworkSecurity, project_id: &str, location_id: &str, server_tls_policy_id: &str
5039 /// ) -> Result<()> {
5040 /// client.delete_server_tls_policy()
5041 /// .set_name(format!("projects/{project_id}/locations/{location_id}/serverTlsPolicies/{server_tls_policy_id}"))
5042 /// .poller().until_done().await?;
5043 /// Ok(())
5044 /// }
5045 /// ```
5046 pub fn delete_server_tls_policy(
5047 &self,
5048 ) -> super::builder::network_security::DeleteServerTlsPolicy {
5049 super::builder::network_security::DeleteServerTlsPolicy::new(self.inner.clone())
5050 }
5051
5052 /// Lists ClientTlsPolicies in a given project and location.
5053 ///
5054 /// # Example
5055 /// ```
5056 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5057 /// use google_cloud_gax::paginator::ItemPaginator as _;
5058 /// use google_cloud_networksecurity_v1::Result;
5059 /// async fn sample(
5060 /// client: &NetworkSecurity, parent: &str
5061 /// ) -> Result<()> {
5062 /// let mut list = client.list_client_tls_policies()
5063 /// .set_parent(parent)
5064 /// .by_item();
5065 /// while let Some(item) = list.next().await.transpose()? {
5066 /// println!("{:?}", item);
5067 /// }
5068 /// Ok(())
5069 /// }
5070 /// ```
5071 pub fn list_client_tls_policies(
5072 &self,
5073 ) -> super::builder::network_security::ListClientTlsPolicies {
5074 super::builder::network_security::ListClientTlsPolicies::new(self.inner.clone())
5075 }
5076
5077 /// Gets details of a single ClientTlsPolicy.
5078 ///
5079 /// # Example
5080 /// ```
5081 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5082 /// use google_cloud_networksecurity_v1::Result;
5083 /// async fn sample(
5084 /// client: &NetworkSecurity, project_id: &str, location_id: &str, client_tls_policy_id: &str
5085 /// ) -> Result<()> {
5086 /// let response = client.get_client_tls_policy()
5087 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clientTlsPolicies/{client_tls_policy_id}"))
5088 /// .send().await?;
5089 /// println!("response {:?}", response);
5090 /// Ok(())
5091 /// }
5092 /// ```
5093 pub fn get_client_tls_policy(&self) -> super::builder::network_security::GetClientTlsPolicy {
5094 super::builder::network_security::GetClientTlsPolicy::new(self.inner.clone())
5095 }
5096
5097 /// Creates a new ClientTlsPolicy 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::ClientTlsPolicy;
5114 /// use google_cloud_networksecurity_v1::Result;
5115 /// async fn sample(
5116 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5117 /// ) -> Result<()> {
5118 /// let response = client.create_client_tls_policy()
5119 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5120 /// .set_client_tls_policy(
5121 /// ClientTlsPolicy::new()/* set fields */
5122 /// )
5123 /// .poller().until_done().await?;
5124 /// println!("response {:?}", response);
5125 /// Ok(())
5126 /// }
5127 /// ```
5128 pub fn create_client_tls_policy(
5129 &self,
5130 ) -> super::builder::network_security::CreateClientTlsPolicy {
5131 super::builder::network_security::CreateClientTlsPolicy::new(self.inner.clone())
5132 }
5133
5134 /// Updates the parameters of a single ClientTlsPolicy.
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::ClientTlsPolicy;
5153 /// use google_cloud_networksecurity_v1::Result;
5154 /// async fn sample(
5155 /// client: &NetworkSecurity, project_id: &str, location_id: &str, client_tls_policy_id: &str
5156 /// ) -> Result<()> {
5157 /// let response = client.update_client_tls_policy()
5158 /// .set_client_tls_policy(
5159 /// ClientTlsPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/clientTlsPolicies/{client_tls_policy_id}"))/* 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_client_tls_policy(
5168 &self,
5169 ) -> super::builder::network_security::UpdateClientTlsPolicy {
5170 super::builder::network_security::UpdateClientTlsPolicy::new(self.inner.clone())
5171 }
5172
5173 /// Deletes a single ClientTlsPolicy.
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, project_id: &str, location_id: &str, client_tls_policy_id: &str
5192 /// ) -> Result<()> {
5193 /// client.delete_client_tls_policy()
5194 /// .set_name(format!("projects/{project_id}/locations/{location_id}/clientTlsPolicies/{client_tls_policy_id}"))
5195 /// .poller().until_done().await?;
5196 /// Ok(())
5197 /// }
5198 /// ```
5199 pub fn delete_client_tls_policy(
5200 &self,
5201 ) -> super::builder::network_security::DeleteClientTlsPolicy {
5202 super::builder::network_security::DeleteClientTlsPolicy::new(self.inner.clone())
5203 }
5204
5205 /// Lists GatewaySecurityPolicies 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_policies()
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_policies(
5225 &self,
5226 ) -> super::builder::network_security::ListGatewaySecurityPolicies {
5227 super::builder::network_security::ListGatewaySecurityPolicies::new(self.inner.clone())
5228 }
5229
5230 /// Gets details of a single GatewaySecurityPolicy.
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, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5238 /// ) -> Result<()> {
5239 /// let response = client.get_gateway_security_policy()
5240 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5241 /// .send().await?;
5242 /// println!("response {:?}", response);
5243 /// Ok(())
5244 /// }
5245 /// ```
5246 pub fn get_gateway_security_policy(
5247 &self,
5248 ) -> super::builder::network_security::GetGatewaySecurityPolicy {
5249 super::builder::network_security::GetGatewaySecurityPolicy::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::GatewaySecurityPolicy;
5269 /// use google_cloud_networksecurity_v1::Result;
5270 /// async fn sample(
5271 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5272 /// ) -> Result<()> {
5273 /// let response = client.create_gateway_security_policy()
5274 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5275 /// .set_gateway_security_policy(
5276 /// GatewaySecurityPolicy::new()/* set fields */
5277 /// )
5278 /// .poller().until_done().await?;
5279 /// println!("response {:?}", response);
5280 /// Ok(())
5281 /// }
5282 /// ```
5283 pub fn create_gateway_security_policy(
5284 &self,
5285 ) -> super::builder::network_security::CreateGatewaySecurityPolicy {
5286 super::builder::network_security::CreateGatewaySecurityPolicy::new(self.inner.clone())
5287 }
5288
5289 /// Updates the parameters of a single GatewaySecurityPolicy.
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::GatewaySecurityPolicy;
5308 /// use google_cloud_networksecurity_v1::Result;
5309 /// async fn sample(
5310 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5311 /// ) -> Result<()> {
5312 /// let response = client.update_gateway_security_policy()
5313 /// .set_gateway_security_policy(
5314 /// GatewaySecurityPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))/* 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(
5323 &self,
5324 ) -> super::builder::network_security::UpdateGatewaySecurityPolicy {
5325 super::builder::network_security::UpdateGatewaySecurityPolicy::new(self.inner.clone())
5326 }
5327
5328 /// Deletes a single GatewaySecurityPolicy.
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, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5347 /// ) -> Result<()> {
5348 /// client.delete_gateway_security_policy()
5349 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5350 /// .poller().until_done().await?;
5351 /// Ok(())
5352 /// }
5353 /// ```
5354 pub fn delete_gateway_security_policy(
5355 &self,
5356 ) -> super::builder::network_security::DeleteGatewaySecurityPolicy {
5357 super::builder::network_security::DeleteGatewaySecurityPolicy::new(self.inner.clone())
5358 }
5359
5360 /// Lists GatewaySecurityPolicyRules 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, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5369 /// ) -> Result<()> {
5370 /// let mut list = client.list_gateway_security_policy_rules()
5371 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5372 /// .by_item();
5373 /// while let Some(item) = list.next().await.transpose()? {
5374 /// println!("{:?}", item);
5375 /// }
5376 /// Ok(())
5377 /// }
5378 /// ```
5379 pub fn list_gateway_security_policy_rules(
5380 &self,
5381 ) -> super::builder::network_security::ListGatewaySecurityPolicyRules {
5382 super::builder::network_security::ListGatewaySecurityPolicyRules::new(self.inner.clone())
5383 }
5384
5385 /// Gets details of a single GatewaySecurityPolicyRule.
5386 ///
5387 /// # Example
5388 /// ```
5389 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5390 /// use google_cloud_networksecurity_v1::Result;
5391 /// async fn sample(
5392 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str, rule_id: &str
5393 /// ) -> Result<()> {
5394 /// let response = client.get_gateway_security_policy_rule()
5395 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}/rules/{rule_id}"))
5396 /// .send().await?;
5397 /// println!("response {:?}", response);
5398 /// Ok(())
5399 /// }
5400 /// ```
5401 pub fn get_gateway_security_policy_rule(
5402 &self,
5403 ) -> super::builder::network_security::GetGatewaySecurityPolicyRule {
5404 super::builder::network_security::GetGatewaySecurityPolicyRule::new(self.inner.clone())
5405 }
5406
5407 /// Creates a new GatewaySecurityPolicy in a given project and location.
5408 ///
5409 /// # Long running operations
5410 ///
5411 /// This method is used to start, and/or poll a [long-running Operation].
5412 /// The [Working with long-running operations] chapter in the [user guide]
5413 /// covers these operations in detail.
5414 ///
5415 /// [long-running operation]: https://google.aip.dev/151
5416 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5417 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5418 ///
5419 /// # Example
5420 /// ```
5421 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5422 /// use google_cloud_lro::Poller;
5423 /// use google_cloud_networksecurity_v1::model::GatewaySecurityPolicyRule;
5424 /// use google_cloud_networksecurity_v1::Result;
5425 /// async fn sample(
5426 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str
5427 /// ) -> Result<()> {
5428 /// let response = client.create_gateway_security_policy_rule()
5429 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}"))
5430 /// .set_gateway_security_policy_rule(
5431 /// GatewaySecurityPolicyRule::new()/* set fields */
5432 /// )
5433 /// .poller().until_done().await?;
5434 /// println!("response {:?}", response);
5435 /// Ok(())
5436 /// }
5437 /// ```
5438 pub fn create_gateway_security_policy_rule(
5439 &self,
5440 ) -> super::builder::network_security::CreateGatewaySecurityPolicyRule {
5441 super::builder::network_security::CreateGatewaySecurityPolicyRule::new(self.inner.clone())
5442 }
5443
5444 /// Updates the parameters of a single GatewaySecurityPolicyRule.
5445 ///
5446 /// # Long running operations
5447 ///
5448 /// This method is used to start, and/or poll a [long-running Operation].
5449 /// The [Working with long-running operations] chapter in the [user guide]
5450 /// covers these operations in detail.
5451 ///
5452 /// [long-running operation]: https://google.aip.dev/151
5453 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5454 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5455 ///
5456 /// # Example
5457 /// ```
5458 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5459 /// use google_cloud_lro::Poller;
5460 /// # extern crate wkt as google_cloud_wkt;
5461 /// use google_cloud_wkt::FieldMask;
5462 /// use google_cloud_networksecurity_v1::model::GatewaySecurityPolicyRule;
5463 /// use google_cloud_networksecurity_v1::Result;
5464 /// async fn sample(
5465 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str, rule_id: &str
5466 /// ) -> Result<()> {
5467 /// let response = client.update_gateway_security_policy_rule()
5468 /// .set_gateway_security_policy_rule(
5469 /// GatewaySecurityPolicyRule::new().set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}/rules/{rule_id}"))/* set fields */
5470 /// )
5471 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5472 /// .poller().until_done().await?;
5473 /// println!("response {:?}", response);
5474 /// Ok(())
5475 /// }
5476 /// ```
5477 pub fn update_gateway_security_policy_rule(
5478 &self,
5479 ) -> super::builder::network_security::UpdateGatewaySecurityPolicyRule {
5480 super::builder::network_security::UpdateGatewaySecurityPolicyRule::new(self.inner.clone())
5481 }
5482
5483 /// Deletes a single GatewaySecurityPolicyRule.
5484 ///
5485 /// # Long running operations
5486 ///
5487 /// This method is used to start, and/or poll a [long-running Operation].
5488 /// The [Working with long-running operations] chapter in the [user guide]
5489 /// covers these operations in detail.
5490 ///
5491 /// [long-running operation]: https://google.aip.dev/151
5492 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5493 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5494 ///
5495 /// # Example
5496 /// ```
5497 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5498 /// use google_cloud_lro::Poller;
5499 /// use google_cloud_networksecurity_v1::Result;
5500 /// async fn sample(
5501 /// client: &NetworkSecurity, project_id: &str, location_id: &str, gateway_security_policy_id: &str, rule_id: &str
5502 /// ) -> Result<()> {
5503 /// client.delete_gateway_security_policy_rule()
5504 /// .set_name(format!("projects/{project_id}/locations/{location_id}/gatewaySecurityPolicies/{gateway_security_policy_id}/rules/{rule_id}"))
5505 /// .poller().until_done().await?;
5506 /// Ok(())
5507 /// }
5508 /// ```
5509 pub fn delete_gateway_security_policy_rule(
5510 &self,
5511 ) -> super::builder::network_security::DeleteGatewaySecurityPolicyRule {
5512 super::builder::network_security::DeleteGatewaySecurityPolicyRule::new(self.inner.clone())
5513 }
5514
5515 /// Lists UrlLists in a given project and location.
5516 ///
5517 /// # Example
5518 /// ```
5519 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5520 /// use google_cloud_gax::paginator::ItemPaginator as _;
5521 /// use google_cloud_networksecurity_v1::Result;
5522 /// async fn sample(
5523 /// client: &NetworkSecurity, parent: &str
5524 /// ) -> Result<()> {
5525 /// let mut list = client.list_url_lists()
5526 /// .set_parent(parent)
5527 /// .by_item();
5528 /// while let Some(item) = list.next().await.transpose()? {
5529 /// println!("{:?}", item);
5530 /// }
5531 /// Ok(())
5532 /// }
5533 /// ```
5534 pub fn list_url_lists(&self) -> super::builder::network_security::ListUrlLists {
5535 super::builder::network_security::ListUrlLists::new(self.inner.clone())
5536 }
5537
5538 /// Gets details of a single UrlList.
5539 ///
5540 /// # Example
5541 /// ```
5542 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5543 /// use google_cloud_networksecurity_v1::Result;
5544 /// async fn sample(
5545 /// client: &NetworkSecurity, project_id: &str, location_id: &str, url_list_id: &str
5546 /// ) -> Result<()> {
5547 /// let response = client.get_url_list()
5548 /// .set_name(format!("projects/{project_id}/locations/{location_id}/urlLists/{url_list_id}"))
5549 /// .send().await?;
5550 /// println!("response {:?}", response);
5551 /// Ok(())
5552 /// }
5553 /// ```
5554 pub fn get_url_list(&self) -> super::builder::network_security::GetUrlList {
5555 super::builder::network_security::GetUrlList::new(self.inner.clone())
5556 }
5557
5558 /// Creates a new UrlList in a given project and location.
5559 ///
5560 /// # Long running operations
5561 ///
5562 /// This method is used to start, and/or poll a [long-running Operation].
5563 /// The [Working with long-running operations] chapter in the [user guide]
5564 /// covers these operations in detail.
5565 ///
5566 /// [long-running operation]: https://google.aip.dev/151
5567 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5568 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5569 ///
5570 /// # Example
5571 /// ```
5572 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5573 /// use google_cloud_lro::Poller;
5574 /// use google_cloud_networksecurity_v1::model::UrlList;
5575 /// use google_cloud_networksecurity_v1::Result;
5576 /// async fn sample(
5577 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5578 /// ) -> Result<()> {
5579 /// let response = client.create_url_list()
5580 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5581 /// .set_url_list(
5582 /// UrlList::new()/* set fields */
5583 /// )
5584 /// .poller().until_done().await?;
5585 /// println!("response {:?}", response);
5586 /// Ok(())
5587 /// }
5588 /// ```
5589 pub fn create_url_list(&self) -> super::builder::network_security::CreateUrlList {
5590 super::builder::network_security::CreateUrlList::new(self.inner.clone())
5591 }
5592
5593 /// Updates the parameters of a single UrlList.
5594 ///
5595 /// # Long running operations
5596 ///
5597 /// This method is used to start, and/or poll a [long-running Operation].
5598 /// The [Working with long-running operations] chapter in the [user guide]
5599 /// covers these operations in detail.
5600 ///
5601 /// [long-running operation]: https://google.aip.dev/151
5602 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5603 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5604 ///
5605 /// # Example
5606 /// ```
5607 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5608 /// use google_cloud_lro::Poller;
5609 /// # extern crate wkt as google_cloud_wkt;
5610 /// use google_cloud_wkt::FieldMask;
5611 /// use google_cloud_networksecurity_v1::model::UrlList;
5612 /// use google_cloud_networksecurity_v1::Result;
5613 /// async fn sample(
5614 /// client: &NetworkSecurity, project_id: &str, location_id: &str, url_list_id: &str
5615 /// ) -> Result<()> {
5616 /// let response = client.update_url_list()
5617 /// .set_url_list(
5618 /// UrlList::new().set_name(format!("projects/{project_id}/locations/{location_id}/urlLists/{url_list_id}"))/* set fields */
5619 /// )
5620 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5621 /// .poller().until_done().await?;
5622 /// println!("response {:?}", response);
5623 /// Ok(())
5624 /// }
5625 /// ```
5626 pub fn update_url_list(&self) -> super::builder::network_security::UpdateUrlList {
5627 super::builder::network_security::UpdateUrlList::new(self.inner.clone())
5628 }
5629
5630 /// Deletes a single UrlList.
5631 ///
5632 /// # Long running operations
5633 ///
5634 /// This method is used to start, and/or poll a [long-running Operation].
5635 /// The [Working with long-running operations] chapter in the [user guide]
5636 /// covers these operations in detail.
5637 ///
5638 /// [long-running operation]: https://google.aip.dev/151
5639 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5640 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5641 ///
5642 /// # Example
5643 /// ```
5644 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5645 /// use google_cloud_lro::Poller;
5646 /// use google_cloud_networksecurity_v1::Result;
5647 /// async fn sample(
5648 /// client: &NetworkSecurity, project_id: &str, location_id: &str, url_list_id: &str
5649 /// ) -> Result<()> {
5650 /// client.delete_url_list()
5651 /// .set_name(format!("projects/{project_id}/locations/{location_id}/urlLists/{url_list_id}"))
5652 /// .poller().until_done().await?;
5653 /// Ok(())
5654 /// }
5655 /// ```
5656 pub fn delete_url_list(&self) -> super::builder::network_security::DeleteUrlList {
5657 super::builder::network_security::DeleteUrlList::new(self.inner.clone())
5658 }
5659
5660 /// Lists TlsInspectionPolicies 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_tls_inspection_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_tls_inspection_policies(
5680 &self,
5681 ) -> super::builder::network_security::ListTlsInspectionPolicies {
5682 super::builder::network_security::ListTlsInspectionPolicies::new(self.inner.clone())
5683 }
5684
5685 /// Gets details of a single TlsInspectionPolicy.
5686 ///
5687 /// # Example
5688 /// ```
5689 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5690 /// use google_cloud_networksecurity_v1::Result;
5691 /// async fn sample(
5692 /// client: &NetworkSecurity, project_id: &str, location_id: &str, tls_inspection_policy_id: &str
5693 /// ) -> Result<()> {
5694 /// let response = client.get_tls_inspection_policy()
5695 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tlsInspectionPolicies/{tls_inspection_policy_id}"))
5696 /// .send().await?;
5697 /// println!("response {:?}", response);
5698 /// Ok(())
5699 /// }
5700 /// ```
5701 pub fn get_tls_inspection_policy(
5702 &self,
5703 ) -> super::builder::network_security::GetTlsInspectionPolicy {
5704 super::builder::network_security::GetTlsInspectionPolicy::new(self.inner.clone())
5705 }
5706
5707 /// Creates a new TlsInspectionPolicy in a given project and location.
5708 ///
5709 /// # Long running operations
5710 ///
5711 /// This method is used to start, and/or poll a [long-running Operation].
5712 /// The [Working with long-running operations] chapter in the [user guide]
5713 /// covers these operations in detail.
5714 ///
5715 /// [long-running operation]: https://google.aip.dev/151
5716 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5717 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5718 ///
5719 /// # Example
5720 /// ```
5721 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5722 /// use google_cloud_lro::Poller;
5723 /// use google_cloud_networksecurity_v1::model::TlsInspectionPolicy;
5724 /// use google_cloud_networksecurity_v1::Result;
5725 /// async fn sample(
5726 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5727 /// ) -> Result<()> {
5728 /// let response = client.create_tls_inspection_policy()
5729 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5730 /// .set_tls_inspection_policy(
5731 /// TlsInspectionPolicy::new()/* set fields */
5732 /// )
5733 /// .poller().until_done().await?;
5734 /// println!("response {:?}", response);
5735 /// Ok(())
5736 /// }
5737 /// ```
5738 pub fn create_tls_inspection_policy(
5739 &self,
5740 ) -> super::builder::network_security::CreateTlsInspectionPolicy {
5741 super::builder::network_security::CreateTlsInspectionPolicy::new(self.inner.clone())
5742 }
5743
5744 /// Updates the parameters of a single TlsInspectionPolicy.
5745 ///
5746 /// # Long running operations
5747 ///
5748 /// This method is used to start, and/or poll a [long-running Operation].
5749 /// The [Working with long-running operations] chapter in the [user guide]
5750 /// covers these operations in detail.
5751 ///
5752 /// [long-running operation]: https://google.aip.dev/151
5753 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5754 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5755 ///
5756 /// # Example
5757 /// ```
5758 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5759 /// use google_cloud_lro::Poller;
5760 /// # extern crate wkt as google_cloud_wkt;
5761 /// use google_cloud_wkt::FieldMask;
5762 /// use google_cloud_networksecurity_v1::model::TlsInspectionPolicy;
5763 /// use google_cloud_networksecurity_v1::Result;
5764 /// async fn sample(
5765 /// client: &NetworkSecurity, project_id: &str, location_id: &str, tls_inspection_policy_id: &str
5766 /// ) -> Result<()> {
5767 /// let response = client.update_tls_inspection_policy()
5768 /// .set_tls_inspection_policy(
5769 /// TlsInspectionPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/tlsInspectionPolicies/{tls_inspection_policy_id}"))/* set fields */
5770 /// )
5771 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5772 /// .poller().until_done().await?;
5773 /// println!("response {:?}", response);
5774 /// Ok(())
5775 /// }
5776 /// ```
5777 pub fn update_tls_inspection_policy(
5778 &self,
5779 ) -> super::builder::network_security::UpdateTlsInspectionPolicy {
5780 super::builder::network_security::UpdateTlsInspectionPolicy::new(self.inner.clone())
5781 }
5782
5783 /// Deletes a single TlsInspectionPolicy.
5784 ///
5785 /// # Long running operations
5786 ///
5787 /// This method is used to start, and/or poll a [long-running Operation].
5788 /// The [Working with long-running operations] chapter in the [user guide]
5789 /// covers these operations in detail.
5790 ///
5791 /// [long-running operation]: https://google.aip.dev/151
5792 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5793 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5794 ///
5795 /// # Example
5796 /// ```
5797 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5798 /// use google_cloud_lro::Poller;
5799 /// use google_cloud_networksecurity_v1::Result;
5800 /// async fn sample(
5801 /// client: &NetworkSecurity, project_id: &str, location_id: &str, tls_inspection_policy_id: &str
5802 /// ) -> Result<()> {
5803 /// client.delete_tls_inspection_policy()
5804 /// .set_name(format!("projects/{project_id}/locations/{location_id}/tlsInspectionPolicies/{tls_inspection_policy_id}"))
5805 /// .poller().until_done().await?;
5806 /// Ok(())
5807 /// }
5808 /// ```
5809 pub fn delete_tls_inspection_policy(
5810 &self,
5811 ) -> super::builder::network_security::DeleteTlsInspectionPolicy {
5812 super::builder::network_security::DeleteTlsInspectionPolicy::new(self.inner.clone())
5813 }
5814
5815 /// Lists AuthzPolicies in a given project and location.
5816 ///
5817 /// # Example
5818 /// ```
5819 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5820 /// use google_cloud_gax::paginator::ItemPaginator as _;
5821 /// use google_cloud_networksecurity_v1::Result;
5822 /// async fn sample(
5823 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5824 /// ) -> Result<()> {
5825 /// let mut list = client.list_authz_policies()
5826 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5827 /// .by_item();
5828 /// while let Some(item) = list.next().await.transpose()? {
5829 /// println!("{:?}", item);
5830 /// }
5831 /// Ok(())
5832 /// }
5833 /// ```
5834 pub fn list_authz_policies(&self) -> super::builder::network_security::ListAuthzPolicies {
5835 super::builder::network_security::ListAuthzPolicies::new(self.inner.clone())
5836 }
5837
5838 /// Gets details of a single AuthzPolicy.
5839 ///
5840 /// # Example
5841 /// ```
5842 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5843 /// use google_cloud_networksecurity_v1::Result;
5844 /// async fn sample(
5845 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authz_policy_id: &str
5846 /// ) -> Result<()> {
5847 /// let response = client.get_authz_policy()
5848 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authzPolicies/{authz_policy_id}"))
5849 /// .send().await?;
5850 /// println!("response {:?}", response);
5851 /// Ok(())
5852 /// }
5853 /// ```
5854 pub fn get_authz_policy(&self) -> super::builder::network_security::GetAuthzPolicy {
5855 super::builder::network_security::GetAuthzPolicy::new(self.inner.clone())
5856 }
5857
5858 /// Creates a new AuthzPolicy in a given project and location.
5859 ///
5860 /// # Long running operations
5861 ///
5862 /// This method is used to start, and/or poll a [long-running Operation].
5863 /// The [Working with long-running operations] chapter in the [user guide]
5864 /// covers these operations in detail.
5865 ///
5866 /// [long-running operation]: https://google.aip.dev/151
5867 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5868 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5869 ///
5870 /// # Example
5871 /// ```
5872 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5873 /// use google_cloud_lro::Poller;
5874 /// use google_cloud_networksecurity_v1::model::AuthzPolicy;
5875 /// use google_cloud_networksecurity_v1::Result;
5876 /// async fn sample(
5877 /// client: &NetworkSecurity, project_id: &str, location_id: &str
5878 /// ) -> Result<()> {
5879 /// let response = client.create_authz_policy()
5880 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
5881 /// .set_authz_policy(
5882 /// AuthzPolicy::new()/* set fields */
5883 /// )
5884 /// .poller().until_done().await?;
5885 /// println!("response {:?}", response);
5886 /// Ok(())
5887 /// }
5888 /// ```
5889 pub fn create_authz_policy(&self) -> super::builder::network_security::CreateAuthzPolicy {
5890 super::builder::network_security::CreateAuthzPolicy::new(self.inner.clone())
5891 }
5892
5893 /// Updates the parameters of a single AuthzPolicy.
5894 ///
5895 /// # Long running operations
5896 ///
5897 /// This method is used to start, and/or poll a [long-running Operation].
5898 /// The [Working with long-running operations] chapter in the [user guide]
5899 /// covers these operations in detail.
5900 ///
5901 /// [long-running operation]: https://google.aip.dev/151
5902 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5903 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5904 ///
5905 /// # Example
5906 /// ```
5907 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5908 /// use google_cloud_lro::Poller;
5909 /// # extern crate wkt as google_cloud_wkt;
5910 /// use google_cloud_wkt::FieldMask;
5911 /// use google_cloud_networksecurity_v1::model::AuthzPolicy;
5912 /// use google_cloud_networksecurity_v1::Result;
5913 /// async fn sample(
5914 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authz_policy_id: &str
5915 /// ) -> Result<()> {
5916 /// let response = client.update_authz_policy()
5917 /// .set_authz_policy(
5918 /// AuthzPolicy::new().set_name(format!("projects/{project_id}/locations/{location_id}/authzPolicies/{authz_policy_id}"))/* set fields */
5919 /// )
5920 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
5921 /// .poller().until_done().await?;
5922 /// println!("response {:?}", response);
5923 /// Ok(())
5924 /// }
5925 /// ```
5926 pub fn update_authz_policy(&self) -> super::builder::network_security::UpdateAuthzPolicy {
5927 super::builder::network_security::UpdateAuthzPolicy::new(self.inner.clone())
5928 }
5929
5930 /// Deletes a single AuthzPolicy.
5931 ///
5932 /// # Long running operations
5933 ///
5934 /// This method is used to start, and/or poll a [long-running Operation].
5935 /// The [Working with long-running operations] chapter in the [user guide]
5936 /// covers these operations in detail.
5937 ///
5938 /// [long-running operation]: https://google.aip.dev/151
5939 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
5940 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
5941 ///
5942 /// # Example
5943 /// ```
5944 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5945 /// use google_cloud_lro::Poller;
5946 /// use google_cloud_networksecurity_v1::Result;
5947 /// async fn sample(
5948 /// client: &NetworkSecurity, project_id: &str, location_id: &str, authz_policy_id: &str
5949 /// ) -> Result<()> {
5950 /// client.delete_authz_policy()
5951 /// .set_name(format!("projects/{project_id}/locations/{location_id}/authzPolicies/{authz_policy_id}"))
5952 /// .poller().until_done().await?;
5953 /// Ok(())
5954 /// }
5955 /// ```
5956 pub fn delete_authz_policy(&self) -> super::builder::network_security::DeleteAuthzPolicy {
5957 super::builder::network_security::DeleteAuthzPolicy::new(self.inner.clone())
5958 }
5959
5960 /// Lists information about the supported locations for this service.
5961 ///
5962 /// This method lists locations based on the resource scope provided in
5963 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
5964 /// **Global locations**: If `name` is empty, the method lists the
5965 /// public locations available to all projects. * **Project-specific
5966 /// locations**: If `name` follows the format
5967 /// `projects/{project}`, the method lists locations visible to that
5968 /// specific project. This includes public, private, or other
5969 /// project-specific locations enabled for the project.
5970 ///
5971 /// For gRPC and client library implementations, the resource name is
5972 /// passed as the `name` field. For direct service calls, the resource
5973 /// name is
5974 /// incorporated into the request path based on the specific service
5975 /// implementation and version.
5976 ///
5977 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
5978 ///
5979 /// # Example
5980 /// ```
5981 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
5982 /// use google_cloud_gax::paginator::ItemPaginator as _;
5983 /// use google_cloud_networksecurity_v1::Result;
5984 /// async fn sample(
5985 /// client: &NetworkSecurity
5986 /// ) -> Result<()> {
5987 /// let mut list = client.list_locations()
5988 /// /* set fields */
5989 /// .by_item();
5990 /// while let Some(item) = list.next().await.transpose()? {
5991 /// println!("{:?}", item);
5992 /// }
5993 /// Ok(())
5994 /// }
5995 /// ```
5996 pub fn list_locations(&self) -> super::builder::network_security::ListLocations {
5997 super::builder::network_security::ListLocations::new(self.inner.clone())
5998 }
5999
6000 /// Gets information about a location.
6001 ///
6002 /// # Example
6003 /// ```
6004 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6005 /// use google_cloud_networksecurity_v1::Result;
6006 /// async fn sample(
6007 /// client: &NetworkSecurity
6008 /// ) -> Result<()> {
6009 /// let response = client.get_location()
6010 /// /* set fields */
6011 /// .send().await?;
6012 /// println!("response {:?}", response);
6013 /// Ok(())
6014 /// }
6015 /// ```
6016 pub fn get_location(&self) -> super::builder::network_security::GetLocation {
6017 super::builder::network_security::GetLocation::new(self.inner.clone())
6018 }
6019
6020 /// Sets the access control policy on the specified resource. Replaces
6021 /// any existing policy.
6022 ///
6023 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6024 /// errors.
6025 ///
6026 /// # Example
6027 /// ```
6028 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6029 /// use google_cloud_networksecurity_v1::Result;
6030 /// async fn sample(
6031 /// client: &NetworkSecurity
6032 /// ) -> Result<()> {
6033 /// let response = client.set_iam_policy()
6034 /// /* set fields */
6035 /// .send().await?;
6036 /// println!("response {:?}", response);
6037 /// Ok(())
6038 /// }
6039 /// ```
6040 pub fn set_iam_policy(&self) -> super::builder::network_security::SetIamPolicy {
6041 super::builder::network_security::SetIamPolicy::new(self.inner.clone())
6042 }
6043
6044 /// Gets the access control policy for a resource. Returns an empty policy
6045 /// if the resource exists and does not have a policy set.
6046 ///
6047 /// # Example
6048 /// ```
6049 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6050 /// use google_cloud_networksecurity_v1::Result;
6051 /// async fn sample(
6052 /// client: &NetworkSecurity
6053 /// ) -> Result<()> {
6054 /// let response = client.get_iam_policy()
6055 /// /* set fields */
6056 /// .send().await?;
6057 /// println!("response {:?}", response);
6058 /// Ok(())
6059 /// }
6060 /// ```
6061 pub fn get_iam_policy(&self) -> super::builder::network_security::GetIamPolicy {
6062 super::builder::network_security::GetIamPolicy::new(self.inner.clone())
6063 }
6064
6065 /// Returns permissions that a caller has on the specified resource. If the
6066 /// resource does not exist, this will return an empty set of
6067 /// permissions, not a `NOT_FOUND` error.
6068 ///
6069 /// Note: This operation is designed to be used for building
6070 /// permission-aware UIs and command-line tools, not for authorization
6071 /// checking. This operation may "fail open" without warning.
6072 ///
6073 /// # Example
6074 /// ```
6075 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6076 /// use google_cloud_networksecurity_v1::Result;
6077 /// async fn sample(
6078 /// client: &NetworkSecurity
6079 /// ) -> Result<()> {
6080 /// let response = client.test_iam_permissions()
6081 /// /* set fields */
6082 /// .send().await?;
6083 /// println!("response {:?}", response);
6084 /// Ok(())
6085 /// }
6086 /// ```
6087 pub fn test_iam_permissions(&self) -> super::builder::network_security::TestIamPermissions {
6088 super::builder::network_security::TestIamPermissions::new(self.inner.clone())
6089 }
6090
6091 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6092 ///
6093 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6094 ///
6095 /// # Example
6096 /// ```
6097 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6098 /// use google_cloud_gax::paginator::ItemPaginator as _;
6099 /// use google_cloud_networksecurity_v1::Result;
6100 /// async fn sample(
6101 /// client: &NetworkSecurity
6102 /// ) -> Result<()> {
6103 /// let mut list = client.list_operations()
6104 /// /* set fields */
6105 /// .by_item();
6106 /// while let Some(item) = list.next().await.transpose()? {
6107 /// println!("{:?}", item);
6108 /// }
6109 /// Ok(())
6110 /// }
6111 /// ```
6112 pub fn list_operations(&self) -> super::builder::network_security::ListOperations {
6113 super::builder::network_security::ListOperations::new(self.inner.clone())
6114 }
6115
6116 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6117 ///
6118 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6119 ///
6120 /// # Example
6121 /// ```
6122 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6123 /// use google_cloud_networksecurity_v1::Result;
6124 /// async fn sample(
6125 /// client: &NetworkSecurity
6126 /// ) -> Result<()> {
6127 /// let response = client.get_operation()
6128 /// /* set fields */
6129 /// .send().await?;
6130 /// println!("response {:?}", response);
6131 /// Ok(())
6132 /// }
6133 /// ```
6134 pub fn get_operation(&self) -> super::builder::network_security::GetOperation {
6135 super::builder::network_security::GetOperation::new(self.inner.clone())
6136 }
6137
6138 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6139 ///
6140 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6141 ///
6142 /// # Example
6143 /// ```
6144 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6145 /// use google_cloud_networksecurity_v1::Result;
6146 /// async fn sample(
6147 /// client: &NetworkSecurity
6148 /// ) -> Result<()> {
6149 /// client.delete_operation()
6150 /// /* set fields */
6151 /// .send().await?;
6152 /// Ok(())
6153 /// }
6154 /// ```
6155 pub fn delete_operation(&self) -> super::builder::network_security::DeleteOperation {
6156 super::builder::network_security::DeleteOperation::new(self.inner.clone())
6157 }
6158
6159 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6160 ///
6161 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6162 ///
6163 /// # Example
6164 /// ```
6165 /// # use google_cloud_networksecurity_v1::client::NetworkSecurity;
6166 /// use google_cloud_networksecurity_v1::Result;
6167 /// async fn sample(
6168 /// client: &NetworkSecurity
6169 /// ) -> Result<()> {
6170 /// client.cancel_operation()
6171 /// /* set fields */
6172 /// .send().await?;
6173 /// Ok(())
6174 /// }
6175 /// ```
6176 pub fn cancel_operation(&self) -> super::builder::network_security::CancelOperation {
6177 super::builder::network_security::CancelOperation::new(self.inner.clone())
6178 }
6179}
6180
6181/// Implements a client for the Network Security API.
6182///
6183/// # Example
6184/// ```
6185/// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6186/// use google_cloud_gax::paginator::ItemPaginator as _;
6187/// async fn sample(
6188/// organization_id: &str,
6189/// location_id: &str,
6190/// ) -> anyhow::Result<()> {
6191/// let client = SecurityProfileGroupService::builder().build().await?;
6192/// let mut list = client.list_security_profile_groups()
6193/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6194/// .by_item();
6195/// while let Some(item) = list.next().await.transpose()? {
6196/// println!("{:?}", item);
6197/// }
6198/// Ok(())
6199/// }
6200/// ```
6201///
6202/// # Service Description
6203///
6204/// SecurityProfileGroup is a resource that defines an action for specific threat
6205/// signatures or severity levels.
6206///
6207/// # Configuration
6208///
6209/// To configure `SecurityProfileGroupService` use the `with_*` methods in the type returned
6210/// by [builder()][SecurityProfileGroupService::builder]. The default configuration should
6211/// work for most applications. Common configuration changes include
6212///
6213/// * [with_endpoint()]: by default this client uses the global default endpoint
6214/// (`https://networksecurity.googleapis.com`). Applications using regional
6215/// endpoints or running in restricted networks (e.g. a network configured
6216/// with [Private Google Access with VPC Service Controls]) may want to
6217/// override this default.
6218/// * [with_credentials()]: by default this client uses
6219/// [Application Default Credentials]. Applications using custom
6220/// authentication may need to override this default.
6221///
6222/// [with_endpoint()]: super::builder::security_profile_group_service::ClientBuilder::with_endpoint
6223/// [with_credentials()]: super::builder::security_profile_group_service::ClientBuilder::with_credentials
6224/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6225/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6226///
6227/// # Pooling and Cloning
6228///
6229/// `SecurityProfileGroupService` holds a connection pool internally, it is advised to
6230/// create one and reuse it. You do not need to wrap `SecurityProfileGroupService` in
6231/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6232/// already uses an `Arc` internally.
6233#[derive(Clone, Debug)]
6234pub struct SecurityProfileGroupService {
6235 inner: std::sync::Arc<dyn super::stub::dynamic::SecurityProfileGroupService>,
6236}
6237
6238impl SecurityProfileGroupService {
6239 /// Returns a builder for [SecurityProfileGroupService].
6240 ///
6241 /// ```
6242 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6243 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6244 /// let client = SecurityProfileGroupService::builder().build().await?;
6245 /// # Ok(()) }
6246 /// ```
6247 pub fn builder() -> super::builder::security_profile_group_service::ClientBuilder {
6248 crate::new_client_builder(super::builder::security_profile_group_service::client::Factory)
6249 }
6250
6251 /// Creates a new client from the provided stub.
6252 ///
6253 /// The most common case for calling this function is in tests mocking the
6254 /// client's behavior.
6255 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6256 where
6257 T: super::stub::SecurityProfileGroupService + 'static,
6258 {
6259 Self { inner: stub.into() }
6260 }
6261
6262 pub(crate) async fn new(
6263 config: gaxi::options::ClientConfig,
6264 ) -> crate::ClientBuilderResult<Self> {
6265 let inner = Self::build_inner(config).await?;
6266 Ok(Self { inner })
6267 }
6268
6269 async fn build_inner(
6270 conf: gaxi::options::ClientConfig,
6271 ) -> crate::ClientBuilderResult<
6272 std::sync::Arc<dyn super::stub::dynamic::SecurityProfileGroupService>,
6273 > {
6274 if gaxi::options::tracing_enabled(&conf) {
6275 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6276 }
6277 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6278 }
6279
6280 async fn build_transport(
6281 conf: gaxi::options::ClientConfig,
6282 ) -> crate::ClientBuilderResult<impl super::stub::SecurityProfileGroupService> {
6283 super::transport::SecurityProfileGroupService::new(conf).await
6284 }
6285
6286 async fn build_with_tracing(
6287 conf: gaxi::options::ClientConfig,
6288 ) -> crate::ClientBuilderResult<impl super::stub::SecurityProfileGroupService> {
6289 Self::build_transport(conf)
6290 .await
6291 .map(super::tracing::SecurityProfileGroupService::new)
6292 }
6293
6294 /// Lists SecurityProfileGroups in a given project and location.
6295 ///
6296 /// # Example
6297 /// ```
6298 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6299 /// use google_cloud_gax::paginator::ItemPaginator as _;
6300 /// use google_cloud_networksecurity_v1::Result;
6301 /// async fn sample(
6302 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str
6303 /// ) -> Result<()> {
6304 /// let mut list = client.list_security_profile_groups()
6305 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6306 /// .by_item();
6307 /// while let Some(item) = list.next().await.transpose()? {
6308 /// println!("{:?}", item);
6309 /// }
6310 /// Ok(())
6311 /// }
6312 /// ```
6313 pub fn list_security_profile_groups(
6314 &self,
6315 ) -> super::builder::security_profile_group_service::ListSecurityProfileGroups {
6316 super::builder::security_profile_group_service::ListSecurityProfileGroups::new(
6317 self.inner.clone(),
6318 )
6319 }
6320
6321 /// Gets details of a single SecurityProfileGroup.
6322 ///
6323 /// # Example
6324 /// ```
6325 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6326 /// use google_cloud_networksecurity_v1::Result;
6327 /// async fn sample(
6328 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
6329 /// ) -> Result<()> {
6330 /// let response = client.get_security_profile_group()
6331 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))
6332 /// .send().await?;
6333 /// println!("response {:?}", response);
6334 /// Ok(())
6335 /// }
6336 /// ```
6337 pub fn get_security_profile_group(
6338 &self,
6339 ) -> super::builder::security_profile_group_service::GetSecurityProfileGroup {
6340 super::builder::security_profile_group_service::GetSecurityProfileGroup::new(
6341 self.inner.clone(),
6342 )
6343 }
6344
6345 /// Creates a new SecurityProfileGroup in a given project and location.
6346 ///
6347 /// # Long running operations
6348 ///
6349 /// This method is used to start, and/or poll a [long-running Operation].
6350 /// The [Working with long-running operations] chapter in the [user guide]
6351 /// covers these operations in detail.
6352 ///
6353 /// [long-running operation]: https://google.aip.dev/151
6354 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6355 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6356 ///
6357 /// # Example
6358 /// ```
6359 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6360 /// use google_cloud_lro::Poller;
6361 /// use google_cloud_networksecurity_v1::model::SecurityProfileGroup;
6362 /// use google_cloud_networksecurity_v1::Result;
6363 /// async fn sample(
6364 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str
6365 /// ) -> Result<()> {
6366 /// let response = client.create_security_profile_group()
6367 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6368 /// .set_security_profile_group(
6369 /// SecurityProfileGroup::new()/* set fields */
6370 /// )
6371 /// .poller().until_done().await?;
6372 /// println!("response {:?}", response);
6373 /// Ok(())
6374 /// }
6375 /// ```
6376 pub fn create_security_profile_group(
6377 &self,
6378 ) -> super::builder::security_profile_group_service::CreateSecurityProfileGroup {
6379 super::builder::security_profile_group_service::CreateSecurityProfileGroup::new(
6380 self.inner.clone(),
6381 )
6382 }
6383
6384 /// Updates the parameters of a single SecurityProfileGroup.
6385 ///
6386 /// # Long running operations
6387 ///
6388 /// This method is used to start, and/or poll a [long-running Operation].
6389 /// The [Working with long-running operations] chapter in the [user guide]
6390 /// covers these operations in detail.
6391 ///
6392 /// [long-running operation]: https://google.aip.dev/151
6393 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6394 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6395 ///
6396 /// # Example
6397 /// ```
6398 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6399 /// use google_cloud_lro::Poller;
6400 /// # extern crate wkt as google_cloud_wkt;
6401 /// use google_cloud_wkt::FieldMask;
6402 /// use google_cloud_networksecurity_v1::model::SecurityProfileGroup;
6403 /// use google_cloud_networksecurity_v1::Result;
6404 /// async fn sample(
6405 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
6406 /// ) -> Result<()> {
6407 /// let response = client.update_security_profile_group()
6408 /// .set_security_profile_group(
6409 /// SecurityProfileGroup::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))/* set fields */
6410 /// )
6411 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6412 /// .poller().until_done().await?;
6413 /// println!("response {:?}", response);
6414 /// Ok(())
6415 /// }
6416 /// ```
6417 pub fn update_security_profile_group(
6418 &self,
6419 ) -> super::builder::security_profile_group_service::UpdateSecurityProfileGroup {
6420 super::builder::security_profile_group_service::UpdateSecurityProfileGroup::new(
6421 self.inner.clone(),
6422 )
6423 }
6424
6425 /// Deletes a single SecurityProfileGroup.
6426 ///
6427 /// # Long running operations
6428 ///
6429 /// This method is used to start, and/or poll a [long-running Operation].
6430 /// The [Working with long-running operations] chapter in the [user guide]
6431 /// covers these operations in detail.
6432 ///
6433 /// [long-running operation]: https://google.aip.dev/151
6434 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6435 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6436 ///
6437 /// # Example
6438 /// ```
6439 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6440 /// use google_cloud_lro::Poller;
6441 /// use google_cloud_networksecurity_v1::Result;
6442 /// async fn sample(
6443 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
6444 /// ) -> Result<()> {
6445 /// client.delete_security_profile_group()
6446 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))
6447 /// .poller().until_done().await?;
6448 /// Ok(())
6449 /// }
6450 /// ```
6451 pub fn delete_security_profile_group(
6452 &self,
6453 ) -> super::builder::security_profile_group_service::DeleteSecurityProfileGroup {
6454 super::builder::security_profile_group_service::DeleteSecurityProfileGroup::new(
6455 self.inner.clone(),
6456 )
6457 }
6458
6459 /// Lists SecurityProfiles in a given project and location.
6460 ///
6461 /// # Example
6462 /// ```
6463 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6464 /// use google_cloud_gax::paginator::ItemPaginator as _;
6465 /// use google_cloud_networksecurity_v1::Result;
6466 /// async fn sample(
6467 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str
6468 /// ) -> Result<()> {
6469 /// let mut list = client.list_security_profiles()
6470 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6471 /// .by_item();
6472 /// while let Some(item) = list.next().await.transpose()? {
6473 /// println!("{:?}", item);
6474 /// }
6475 /// Ok(())
6476 /// }
6477 /// ```
6478 pub fn list_security_profiles(
6479 &self,
6480 ) -> super::builder::security_profile_group_service::ListSecurityProfiles {
6481 super::builder::security_profile_group_service::ListSecurityProfiles::new(
6482 self.inner.clone(),
6483 )
6484 }
6485
6486 /// Gets details of a single SecurityProfile.
6487 ///
6488 /// # Example
6489 /// ```
6490 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6491 /// use google_cloud_networksecurity_v1::Result;
6492 /// async fn sample(
6493 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
6494 /// ) -> Result<()> {
6495 /// let response = client.get_security_profile()
6496 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))
6497 /// .send().await?;
6498 /// println!("response {:?}", response);
6499 /// Ok(())
6500 /// }
6501 /// ```
6502 pub fn get_security_profile(
6503 &self,
6504 ) -> super::builder::security_profile_group_service::GetSecurityProfile {
6505 super::builder::security_profile_group_service::GetSecurityProfile::new(self.inner.clone())
6506 }
6507
6508 /// Creates a new SecurityProfile in a given project and location.
6509 ///
6510 /// # Long running operations
6511 ///
6512 /// This method is used to start, and/or poll a [long-running Operation].
6513 /// The [Working with long-running operations] chapter in the [user guide]
6514 /// covers these operations in detail.
6515 ///
6516 /// [long-running operation]: https://google.aip.dev/151
6517 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6518 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6519 ///
6520 /// # Example
6521 /// ```
6522 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6523 /// use google_cloud_lro::Poller;
6524 /// use google_cloud_networksecurity_v1::model::SecurityProfile;
6525 /// use google_cloud_networksecurity_v1::Result;
6526 /// async fn sample(
6527 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str
6528 /// ) -> Result<()> {
6529 /// let response = client.create_security_profile()
6530 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6531 /// .set_security_profile(
6532 /// SecurityProfile::new()/* set fields */
6533 /// )
6534 /// .poller().until_done().await?;
6535 /// println!("response {:?}", response);
6536 /// Ok(())
6537 /// }
6538 /// ```
6539 pub fn create_security_profile(
6540 &self,
6541 ) -> super::builder::security_profile_group_service::CreateSecurityProfile {
6542 super::builder::security_profile_group_service::CreateSecurityProfile::new(
6543 self.inner.clone(),
6544 )
6545 }
6546
6547 /// Updates the parameters of a single SecurityProfile.
6548 ///
6549 /// # Long running operations
6550 ///
6551 /// This method is used to start, and/or poll a [long-running Operation].
6552 /// The [Working with long-running operations] chapter in the [user guide]
6553 /// covers these operations in detail.
6554 ///
6555 /// [long-running operation]: https://google.aip.dev/151
6556 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6557 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6558 ///
6559 /// # Example
6560 /// ```
6561 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6562 /// use google_cloud_lro::Poller;
6563 /// # extern crate wkt as google_cloud_wkt;
6564 /// use google_cloud_wkt::FieldMask;
6565 /// use google_cloud_networksecurity_v1::model::SecurityProfile;
6566 /// use google_cloud_networksecurity_v1::Result;
6567 /// async fn sample(
6568 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
6569 /// ) -> Result<()> {
6570 /// let response = client.update_security_profile()
6571 /// .set_security_profile(
6572 /// SecurityProfile::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))/* set fields */
6573 /// )
6574 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
6575 /// .poller().until_done().await?;
6576 /// println!("response {:?}", response);
6577 /// Ok(())
6578 /// }
6579 /// ```
6580 pub fn update_security_profile(
6581 &self,
6582 ) -> super::builder::security_profile_group_service::UpdateSecurityProfile {
6583 super::builder::security_profile_group_service::UpdateSecurityProfile::new(
6584 self.inner.clone(),
6585 )
6586 }
6587
6588 /// Deletes a single SecurityProfile.
6589 ///
6590 /// # Long running operations
6591 ///
6592 /// This method is used to start, and/or poll a [long-running Operation].
6593 /// The [Working with long-running operations] chapter in the [user guide]
6594 /// covers these operations in detail.
6595 ///
6596 /// [long-running operation]: https://google.aip.dev/151
6597 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
6598 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
6599 ///
6600 /// # Example
6601 /// ```
6602 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6603 /// use google_cloud_lro::Poller;
6604 /// use google_cloud_networksecurity_v1::Result;
6605 /// async fn sample(
6606 /// client: &SecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
6607 /// ) -> Result<()> {
6608 /// client.delete_security_profile()
6609 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))
6610 /// .poller().until_done().await?;
6611 /// Ok(())
6612 /// }
6613 /// ```
6614 pub fn delete_security_profile(
6615 &self,
6616 ) -> super::builder::security_profile_group_service::DeleteSecurityProfile {
6617 super::builder::security_profile_group_service::DeleteSecurityProfile::new(
6618 self.inner.clone(),
6619 )
6620 }
6621
6622 /// Lists information about the supported locations for this service.
6623 ///
6624 /// This method lists locations based on the resource scope provided in
6625 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
6626 /// **Global locations**: If `name` is empty, the method lists the
6627 /// public locations available to all projects. * **Project-specific
6628 /// locations**: If `name` follows the format
6629 /// `projects/{project}`, the method lists locations visible to that
6630 /// specific project. This includes public, private, or other
6631 /// project-specific locations enabled for the project.
6632 ///
6633 /// For gRPC and client library implementations, the resource name is
6634 /// passed as the `name` field. For direct service calls, the resource
6635 /// name is
6636 /// incorporated into the request path based on the specific service
6637 /// implementation and version.
6638 ///
6639 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
6640 ///
6641 /// # Example
6642 /// ```
6643 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6644 /// use google_cloud_gax::paginator::ItemPaginator as _;
6645 /// use google_cloud_networksecurity_v1::Result;
6646 /// async fn sample(
6647 /// client: &SecurityProfileGroupService
6648 /// ) -> Result<()> {
6649 /// let mut list = client.list_locations()
6650 /// /* set fields */
6651 /// .by_item();
6652 /// while let Some(item) = list.next().await.transpose()? {
6653 /// println!("{:?}", item);
6654 /// }
6655 /// Ok(())
6656 /// }
6657 /// ```
6658 pub fn list_locations(&self) -> super::builder::security_profile_group_service::ListLocations {
6659 super::builder::security_profile_group_service::ListLocations::new(self.inner.clone())
6660 }
6661
6662 /// Gets information about a location.
6663 ///
6664 /// # Example
6665 /// ```
6666 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6667 /// use google_cloud_networksecurity_v1::Result;
6668 /// async fn sample(
6669 /// client: &SecurityProfileGroupService
6670 /// ) -> Result<()> {
6671 /// let response = client.get_location()
6672 /// /* set fields */
6673 /// .send().await?;
6674 /// println!("response {:?}", response);
6675 /// Ok(())
6676 /// }
6677 /// ```
6678 pub fn get_location(&self) -> super::builder::security_profile_group_service::GetLocation {
6679 super::builder::security_profile_group_service::GetLocation::new(self.inner.clone())
6680 }
6681
6682 /// Sets the access control policy on the specified resource. Replaces
6683 /// any existing policy.
6684 ///
6685 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
6686 /// errors.
6687 ///
6688 /// # Example
6689 /// ```
6690 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6691 /// use google_cloud_networksecurity_v1::Result;
6692 /// async fn sample(
6693 /// client: &SecurityProfileGroupService
6694 /// ) -> Result<()> {
6695 /// let response = client.set_iam_policy()
6696 /// /* set fields */
6697 /// .send().await?;
6698 /// println!("response {:?}", response);
6699 /// Ok(())
6700 /// }
6701 /// ```
6702 pub fn set_iam_policy(&self) -> super::builder::security_profile_group_service::SetIamPolicy {
6703 super::builder::security_profile_group_service::SetIamPolicy::new(self.inner.clone())
6704 }
6705
6706 /// Gets the access control policy for a resource. Returns an empty policy
6707 /// if the resource exists and does not have a policy set.
6708 ///
6709 /// # Example
6710 /// ```
6711 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6712 /// use google_cloud_networksecurity_v1::Result;
6713 /// async fn sample(
6714 /// client: &SecurityProfileGroupService
6715 /// ) -> Result<()> {
6716 /// let response = client.get_iam_policy()
6717 /// /* set fields */
6718 /// .send().await?;
6719 /// println!("response {:?}", response);
6720 /// Ok(())
6721 /// }
6722 /// ```
6723 pub fn get_iam_policy(&self) -> super::builder::security_profile_group_service::GetIamPolicy {
6724 super::builder::security_profile_group_service::GetIamPolicy::new(self.inner.clone())
6725 }
6726
6727 /// Returns permissions that a caller has on the specified resource. If the
6728 /// resource does not exist, this will return an empty set of
6729 /// permissions, not a `NOT_FOUND` error.
6730 ///
6731 /// Note: This operation is designed to be used for building
6732 /// permission-aware UIs and command-line tools, not for authorization
6733 /// checking. This operation may "fail open" without warning.
6734 ///
6735 /// # Example
6736 /// ```
6737 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6738 /// use google_cloud_networksecurity_v1::Result;
6739 /// async fn sample(
6740 /// client: &SecurityProfileGroupService
6741 /// ) -> Result<()> {
6742 /// let response = client.test_iam_permissions()
6743 /// /* set fields */
6744 /// .send().await?;
6745 /// println!("response {:?}", response);
6746 /// Ok(())
6747 /// }
6748 /// ```
6749 pub fn test_iam_permissions(
6750 &self,
6751 ) -> super::builder::security_profile_group_service::TestIamPermissions {
6752 super::builder::security_profile_group_service::TestIamPermissions::new(self.inner.clone())
6753 }
6754
6755 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6756 ///
6757 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6758 ///
6759 /// # Example
6760 /// ```
6761 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6762 /// use google_cloud_gax::paginator::ItemPaginator as _;
6763 /// use google_cloud_networksecurity_v1::Result;
6764 /// async fn sample(
6765 /// client: &SecurityProfileGroupService
6766 /// ) -> Result<()> {
6767 /// let mut list = client.list_operations()
6768 /// /* set fields */
6769 /// .by_item();
6770 /// while let Some(item) = list.next().await.transpose()? {
6771 /// println!("{:?}", item);
6772 /// }
6773 /// Ok(())
6774 /// }
6775 /// ```
6776 pub fn list_operations(
6777 &self,
6778 ) -> super::builder::security_profile_group_service::ListOperations {
6779 super::builder::security_profile_group_service::ListOperations::new(self.inner.clone())
6780 }
6781
6782 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6783 ///
6784 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6785 ///
6786 /// # Example
6787 /// ```
6788 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6789 /// use google_cloud_networksecurity_v1::Result;
6790 /// async fn sample(
6791 /// client: &SecurityProfileGroupService
6792 /// ) -> Result<()> {
6793 /// let response = client.get_operation()
6794 /// /* set fields */
6795 /// .send().await?;
6796 /// println!("response {:?}", response);
6797 /// Ok(())
6798 /// }
6799 /// ```
6800 pub fn get_operation(&self) -> super::builder::security_profile_group_service::GetOperation {
6801 super::builder::security_profile_group_service::GetOperation::new(self.inner.clone())
6802 }
6803
6804 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6805 ///
6806 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6807 ///
6808 /// # Example
6809 /// ```
6810 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6811 /// use google_cloud_networksecurity_v1::Result;
6812 /// async fn sample(
6813 /// client: &SecurityProfileGroupService
6814 /// ) -> Result<()> {
6815 /// client.delete_operation()
6816 /// /* set fields */
6817 /// .send().await?;
6818 /// Ok(())
6819 /// }
6820 /// ```
6821 pub fn delete_operation(
6822 &self,
6823 ) -> super::builder::security_profile_group_service::DeleteOperation {
6824 super::builder::security_profile_group_service::DeleteOperation::new(self.inner.clone())
6825 }
6826
6827 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
6828 ///
6829 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
6830 ///
6831 /// # Example
6832 /// ```
6833 /// # use google_cloud_networksecurity_v1::client::SecurityProfileGroupService;
6834 /// use google_cloud_networksecurity_v1::Result;
6835 /// async fn sample(
6836 /// client: &SecurityProfileGroupService
6837 /// ) -> Result<()> {
6838 /// client.cancel_operation()
6839 /// /* set fields */
6840 /// .send().await?;
6841 /// Ok(())
6842 /// }
6843 /// ```
6844 pub fn cancel_operation(
6845 &self,
6846 ) -> super::builder::security_profile_group_service::CancelOperation {
6847 super::builder::security_profile_group_service::CancelOperation::new(self.inner.clone())
6848 }
6849}
6850
6851/// Implements a client for the Network Security API.
6852///
6853/// # Example
6854/// ```
6855/// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6856/// use google_cloud_gax::paginator::ItemPaginator as _;
6857/// async fn sample(
6858/// organization_id: &str,
6859/// location_id: &str,
6860/// ) -> anyhow::Result<()> {
6861/// let client = OrganizationSecurityProfileGroupService::builder().build().await?;
6862/// let mut list = client.list_security_profile_groups()
6863/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6864/// .by_item();
6865/// while let Some(item) = list.next().await.transpose()? {
6866/// println!("{:?}", item);
6867/// }
6868/// Ok(())
6869/// }
6870/// ```
6871///
6872/// # Service Description
6873///
6874/// Organization SecurityProfileGroup is created under organization.
6875///
6876/// # Configuration
6877///
6878/// To configure `OrganizationSecurityProfileGroupService` use the `with_*` methods in the type returned
6879/// by [builder()][OrganizationSecurityProfileGroupService::builder]. The default configuration should
6880/// work for most applications. Common configuration changes include
6881///
6882/// * [with_endpoint()]: by default this client uses the global default endpoint
6883/// (`https://networksecurity.googleapis.com`). Applications using regional
6884/// endpoints or running in restricted networks (e.g. a network configured
6885/// with [Private Google Access with VPC Service Controls]) may want to
6886/// override this default.
6887/// * [with_credentials()]: by default this client uses
6888/// [Application Default Credentials]. Applications using custom
6889/// authentication may need to override this default.
6890///
6891/// [with_endpoint()]: super::builder::organization_security_profile_group_service::ClientBuilder::with_endpoint
6892/// [with_credentials()]: super::builder::organization_security_profile_group_service::ClientBuilder::with_credentials
6893/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6894/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6895///
6896/// # Pooling and Cloning
6897///
6898/// `OrganizationSecurityProfileGroupService` holds a connection pool internally, it is advised to
6899/// create one and reuse it. You do not need to wrap `OrganizationSecurityProfileGroupService` in
6900/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6901/// already uses an `Arc` internally.
6902#[derive(Clone, Debug)]
6903pub struct OrganizationSecurityProfileGroupService {
6904 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityProfileGroupService>,
6905}
6906
6907impl OrganizationSecurityProfileGroupService {
6908 /// Returns a builder for [OrganizationSecurityProfileGroupService].
6909 ///
6910 /// ```
6911 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6912 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6913 /// let client = OrganizationSecurityProfileGroupService::builder().build().await?;
6914 /// # Ok(()) }
6915 /// ```
6916 pub fn builder() -> super::builder::organization_security_profile_group_service::ClientBuilder {
6917 crate::new_client_builder(
6918 super::builder::organization_security_profile_group_service::client::Factory,
6919 )
6920 }
6921
6922 /// Creates a new client from the provided stub.
6923 ///
6924 /// The most common case for calling this function is in tests mocking the
6925 /// client's behavior.
6926 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6927 where
6928 T: super::stub::OrganizationSecurityProfileGroupService + 'static,
6929 {
6930 Self { inner: stub.into() }
6931 }
6932
6933 pub(crate) async fn new(
6934 config: gaxi::options::ClientConfig,
6935 ) -> crate::ClientBuilderResult<Self> {
6936 let inner = Self::build_inner(config).await?;
6937 Ok(Self { inner })
6938 }
6939
6940 async fn build_inner(
6941 conf: gaxi::options::ClientConfig,
6942 ) -> crate::ClientBuilderResult<
6943 std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityProfileGroupService>,
6944 > {
6945 if gaxi::options::tracing_enabled(&conf) {
6946 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6947 }
6948 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6949 }
6950
6951 async fn build_transport(
6952 conf: gaxi::options::ClientConfig,
6953 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityProfileGroupService> {
6954 super::transport::OrganizationSecurityProfileGroupService::new(conf).await
6955 }
6956
6957 async fn build_with_tracing(
6958 conf: gaxi::options::ClientConfig,
6959 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityProfileGroupService> {
6960 Self::build_transport(conf)
6961 .await
6962 .map(super::tracing::OrganizationSecurityProfileGroupService::new)
6963 }
6964
6965 /// Lists SecurityProfileGroups in a given organization and location.
6966 ///
6967 /// # Example
6968 /// ```
6969 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6970 /// use google_cloud_gax::paginator::ItemPaginator as _;
6971 /// use google_cloud_networksecurity_v1::Result;
6972 /// async fn sample(
6973 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
6974 /// ) -> Result<()> {
6975 /// let mut list = client.list_security_profile_groups()
6976 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
6977 /// .by_item();
6978 /// while let Some(item) = list.next().await.transpose()? {
6979 /// println!("{:?}", item);
6980 /// }
6981 /// Ok(())
6982 /// }
6983 /// ```
6984 pub fn list_security_profile_groups(
6985 &self,
6986 ) -> super::builder::organization_security_profile_group_service::ListSecurityProfileGroups
6987 {
6988 super::builder::organization_security_profile_group_service::ListSecurityProfileGroups::new(
6989 self.inner.clone(),
6990 )
6991 }
6992
6993 /// Gets details of a single SecurityProfileGroup.
6994 ///
6995 /// # Example
6996 /// ```
6997 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
6998 /// use google_cloud_networksecurity_v1::Result;
6999 /// async fn sample(
7000 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
7001 /// ) -> Result<()> {
7002 /// let response = client.get_security_profile_group()
7003 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))
7004 /// .send().await?;
7005 /// println!("response {:?}", response);
7006 /// Ok(())
7007 /// }
7008 /// ```
7009 pub fn get_security_profile_group(
7010 &self,
7011 ) -> super::builder::organization_security_profile_group_service::GetSecurityProfileGroup {
7012 super::builder::organization_security_profile_group_service::GetSecurityProfileGroup::new(
7013 self.inner.clone(),
7014 )
7015 }
7016
7017 /// Creates a new SecurityProfileGroup in a given organization and location.
7018 ///
7019 /// # Long running operations
7020 ///
7021 /// This method is used to start, and/or poll a [long-running Operation].
7022 /// The [Working with long-running operations] chapter in the [user guide]
7023 /// covers these operations in detail.
7024 ///
7025 /// [long-running operation]: https://google.aip.dev/151
7026 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7027 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7028 ///
7029 /// # Example
7030 /// ```
7031 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7032 /// use google_cloud_lro::Poller;
7033 /// use google_cloud_networksecurity_v1::model::SecurityProfileGroup;
7034 /// use google_cloud_networksecurity_v1::Result;
7035 /// async fn sample(
7036 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
7037 /// ) -> Result<()> {
7038 /// let response = client.create_security_profile_group()
7039 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
7040 /// .set_security_profile_group(
7041 /// SecurityProfileGroup::new()/* set fields */
7042 /// )
7043 /// .poller().until_done().await?;
7044 /// println!("response {:?}", response);
7045 /// Ok(())
7046 /// }
7047 /// ```
7048 pub fn create_security_profile_group(
7049 &self,
7050 ) -> super::builder::organization_security_profile_group_service::CreateSecurityProfileGroup
7051 {
7052 super::builder::organization_security_profile_group_service::CreateSecurityProfileGroup::new(
7053 self.inner.clone(),
7054 )
7055 }
7056
7057 /// Updates the parameters of a single SecurityProfileGroup.
7058 ///
7059 /// # Long running operations
7060 ///
7061 /// This method is used to start, and/or poll a [long-running Operation].
7062 /// The [Working with long-running operations] chapter in the [user guide]
7063 /// covers these operations in detail.
7064 ///
7065 /// [long-running operation]: https://google.aip.dev/151
7066 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7067 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7068 ///
7069 /// # Example
7070 /// ```
7071 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7072 /// use google_cloud_lro::Poller;
7073 /// # extern crate wkt as google_cloud_wkt;
7074 /// use google_cloud_wkt::FieldMask;
7075 /// use google_cloud_networksecurity_v1::model::SecurityProfileGroup;
7076 /// use google_cloud_networksecurity_v1::Result;
7077 /// async fn sample(
7078 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
7079 /// ) -> Result<()> {
7080 /// let response = client.update_security_profile_group()
7081 /// .set_security_profile_group(
7082 /// SecurityProfileGroup::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))/* set fields */
7083 /// )
7084 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7085 /// .poller().until_done().await?;
7086 /// println!("response {:?}", response);
7087 /// Ok(())
7088 /// }
7089 /// ```
7090 pub fn update_security_profile_group(
7091 &self,
7092 ) -> super::builder::organization_security_profile_group_service::UpdateSecurityProfileGroup
7093 {
7094 super::builder::organization_security_profile_group_service::UpdateSecurityProfileGroup::new(
7095 self.inner.clone(),
7096 )
7097 }
7098
7099 /// Deletes a single SecurityProfileGroup.
7100 ///
7101 /// # Long running operations
7102 ///
7103 /// This method is used to start, and/or poll a [long-running Operation].
7104 /// The [Working with long-running operations] chapter in the [user guide]
7105 /// covers these operations in detail.
7106 ///
7107 /// [long-running operation]: https://google.aip.dev/151
7108 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7109 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7110 ///
7111 /// # Example
7112 /// ```
7113 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7114 /// use google_cloud_lro::Poller;
7115 /// use google_cloud_networksecurity_v1::Result;
7116 /// async fn sample(
7117 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_group_id: &str
7118 /// ) -> Result<()> {
7119 /// client.delete_security_profile_group()
7120 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfileGroups/{security_profile_group_id}"))
7121 /// .poller().until_done().await?;
7122 /// Ok(())
7123 /// }
7124 /// ```
7125 pub fn delete_security_profile_group(
7126 &self,
7127 ) -> super::builder::organization_security_profile_group_service::DeleteSecurityProfileGroup
7128 {
7129 super::builder::organization_security_profile_group_service::DeleteSecurityProfileGroup::new(
7130 self.inner.clone(),
7131 )
7132 }
7133
7134 /// Lists SecurityProfiles in a given organization and location.
7135 ///
7136 /// # Example
7137 /// ```
7138 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7139 /// use google_cloud_gax::paginator::ItemPaginator as _;
7140 /// use google_cloud_networksecurity_v1::Result;
7141 /// async fn sample(
7142 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
7143 /// ) -> Result<()> {
7144 /// let mut list = client.list_security_profiles()
7145 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
7146 /// .by_item();
7147 /// while let Some(item) = list.next().await.transpose()? {
7148 /// println!("{:?}", item);
7149 /// }
7150 /// Ok(())
7151 /// }
7152 /// ```
7153 pub fn list_security_profiles(
7154 &self,
7155 ) -> super::builder::organization_security_profile_group_service::ListSecurityProfiles {
7156 super::builder::organization_security_profile_group_service::ListSecurityProfiles::new(
7157 self.inner.clone(),
7158 )
7159 }
7160
7161 /// Gets details of a single SecurityProfile.
7162 ///
7163 /// # Example
7164 /// ```
7165 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7166 /// use google_cloud_networksecurity_v1::Result;
7167 /// async fn sample(
7168 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
7169 /// ) -> Result<()> {
7170 /// let response = client.get_security_profile()
7171 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))
7172 /// .send().await?;
7173 /// println!("response {:?}", response);
7174 /// Ok(())
7175 /// }
7176 /// ```
7177 pub fn get_security_profile(
7178 &self,
7179 ) -> super::builder::organization_security_profile_group_service::GetSecurityProfile {
7180 super::builder::organization_security_profile_group_service::GetSecurityProfile::new(
7181 self.inner.clone(),
7182 )
7183 }
7184
7185 /// Creates a new SecurityProfile in a given organization and location.
7186 ///
7187 /// # Long running operations
7188 ///
7189 /// This method is used to start, and/or poll a [long-running Operation].
7190 /// The [Working with long-running operations] chapter in the [user guide]
7191 /// covers these operations in detail.
7192 ///
7193 /// [long-running operation]: https://google.aip.dev/151
7194 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7195 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7196 ///
7197 /// # Example
7198 /// ```
7199 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7200 /// use google_cloud_lro::Poller;
7201 /// use google_cloud_networksecurity_v1::model::SecurityProfile;
7202 /// use google_cloud_networksecurity_v1::Result;
7203 /// async fn sample(
7204 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str
7205 /// ) -> Result<()> {
7206 /// let response = client.create_security_profile()
7207 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
7208 /// .set_security_profile(
7209 /// SecurityProfile::new()/* set fields */
7210 /// )
7211 /// .poller().until_done().await?;
7212 /// println!("response {:?}", response);
7213 /// Ok(())
7214 /// }
7215 /// ```
7216 pub fn create_security_profile(
7217 &self,
7218 ) -> super::builder::organization_security_profile_group_service::CreateSecurityProfile {
7219 super::builder::organization_security_profile_group_service::CreateSecurityProfile::new(
7220 self.inner.clone(),
7221 )
7222 }
7223
7224 /// Updates the parameters of a single SecurityProfile.
7225 ///
7226 /// # Long running operations
7227 ///
7228 /// This method is used to start, and/or poll a [long-running Operation].
7229 /// The [Working with long-running operations] chapter in the [user guide]
7230 /// covers these operations in detail.
7231 ///
7232 /// [long-running operation]: https://google.aip.dev/151
7233 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7234 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7235 ///
7236 /// # Example
7237 /// ```
7238 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7239 /// use google_cloud_lro::Poller;
7240 /// # extern crate wkt as google_cloud_wkt;
7241 /// use google_cloud_wkt::FieldMask;
7242 /// use google_cloud_networksecurity_v1::model::SecurityProfile;
7243 /// use google_cloud_networksecurity_v1::Result;
7244 /// async fn sample(
7245 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
7246 /// ) -> Result<()> {
7247 /// let response = client.update_security_profile()
7248 /// .set_security_profile(
7249 /// SecurityProfile::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))/* set fields */
7250 /// )
7251 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
7252 /// .poller().until_done().await?;
7253 /// println!("response {:?}", response);
7254 /// Ok(())
7255 /// }
7256 /// ```
7257 pub fn update_security_profile(
7258 &self,
7259 ) -> super::builder::organization_security_profile_group_service::UpdateSecurityProfile {
7260 super::builder::organization_security_profile_group_service::UpdateSecurityProfile::new(
7261 self.inner.clone(),
7262 )
7263 }
7264
7265 /// Deletes a single SecurityProfile.
7266 ///
7267 /// # Long running operations
7268 ///
7269 /// This method is used to start, and/or poll a [long-running Operation].
7270 /// The [Working with long-running operations] chapter in the [user guide]
7271 /// covers these operations in detail.
7272 ///
7273 /// [long-running operation]: https://google.aip.dev/151
7274 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7275 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7276 ///
7277 /// # Example
7278 /// ```
7279 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7280 /// use google_cloud_lro::Poller;
7281 /// use google_cloud_networksecurity_v1::Result;
7282 /// async fn sample(
7283 /// client: &OrganizationSecurityProfileGroupService, organization_id: &str, location_id: &str, security_profile_id: &str
7284 /// ) -> Result<()> {
7285 /// client.delete_security_profile()
7286 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/securityProfiles/{security_profile_id}"))
7287 /// .poller().until_done().await?;
7288 /// Ok(())
7289 /// }
7290 /// ```
7291 pub fn delete_security_profile(
7292 &self,
7293 ) -> super::builder::organization_security_profile_group_service::DeleteSecurityProfile {
7294 super::builder::organization_security_profile_group_service::DeleteSecurityProfile::new(
7295 self.inner.clone(),
7296 )
7297 }
7298
7299 /// Lists information about the supported locations for this service.
7300 ///
7301 /// This method lists locations based on the resource scope provided in
7302 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
7303 /// **Global locations**: If `name` is empty, the method lists the
7304 /// public locations available to all projects. * **Project-specific
7305 /// locations**: If `name` follows the format
7306 /// `projects/{project}`, the method lists locations visible to that
7307 /// specific project. This includes public, private, or other
7308 /// project-specific locations enabled for the project.
7309 ///
7310 /// For gRPC and client library implementations, the resource name is
7311 /// passed as the `name` field. For direct service calls, the resource
7312 /// name is
7313 /// incorporated into the request path based on the specific service
7314 /// implementation and version.
7315 ///
7316 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
7317 ///
7318 /// # Example
7319 /// ```
7320 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7321 /// use google_cloud_gax::paginator::ItemPaginator as _;
7322 /// use google_cloud_networksecurity_v1::Result;
7323 /// async fn sample(
7324 /// client: &OrganizationSecurityProfileGroupService
7325 /// ) -> Result<()> {
7326 /// let mut list = client.list_locations()
7327 /// /* set fields */
7328 /// .by_item();
7329 /// while let Some(item) = list.next().await.transpose()? {
7330 /// println!("{:?}", item);
7331 /// }
7332 /// Ok(())
7333 /// }
7334 /// ```
7335 pub fn list_locations(
7336 &self,
7337 ) -> super::builder::organization_security_profile_group_service::ListLocations {
7338 super::builder::organization_security_profile_group_service::ListLocations::new(
7339 self.inner.clone(),
7340 )
7341 }
7342
7343 /// Gets information about a location.
7344 ///
7345 /// # Example
7346 /// ```
7347 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7348 /// use google_cloud_networksecurity_v1::Result;
7349 /// async fn sample(
7350 /// client: &OrganizationSecurityProfileGroupService
7351 /// ) -> Result<()> {
7352 /// let response = client.get_location()
7353 /// /* set fields */
7354 /// .send().await?;
7355 /// println!("response {:?}", response);
7356 /// Ok(())
7357 /// }
7358 /// ```
7359 pub fn get_location(
7360 &self,
7361 ) -> super::builder::organization_security_profile_group_service::GetLocation {
7362 super::builder::organization_security_profile_group_service::GetLocation::new(
7363 self.inner.clone(),
7364 )
7365 }
7366
7367 /// Sets the access control policy on the specified resource. Replaces
7368 /// any existing policy.
7369 ///
7370 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7371 /// errors.
7372 ///
7373 /// # Example
7374 /// ```
7375 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7376 /// use google_cloud_networksecurity_v1::Result;
7377 /// async fn sample(
7378 /// client: &OrganizationSecurityProfileGroupService
7379 /// ) -> Result<()> {
7380 /// let response = client.set_iam_policy()
7381 /// /* set fields */
7382 /// .send().await?;
7383 /// println!("response {:?}", response);
7384 /// Ok(())
7385 /// }
7386 /// ```
7387 pub fn set_iam_policy(
7388 &self,
7389 ) -> super::builder::organization_security_profile_group_service::SetIamPolicy {
7390 super::builder::organization_security_profile_group_service::SetIamPolicy::new(
7391 self.inner.clone(),
7392 )
7393 }
7394
7395 /// Gets the access control policy for a resource. Returns an empty policy
7396 /// if the resource exists and does not have a policy set.
7397 ///
7398 /// # Example
7399 /// ```
7400 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7401 /// use google_cloud_networksecurity_v1::Result;
7402 /// async fn sample(
7403 /// client: &OrganizationSecurityProfileGroupService
7404 /// ) -> Result<()> {
7405 /// let response = client.get_iam_policy()
7406 /// /* set fields */
7407 /// .send().await?;
7408 /// println!("response {:?}", response);
7409 /// Ok(())
7410 /// }
7411 /// ```
7412 pub fn get_iam_policy(
7413 &self,
7414 ) -> super::builder::organization_security_profile_group_service::GetIamPolicy {
7415 super::builder::organization_security_profile_group_service::GetIamPolicy::new(
7416 self.inner.clone(),
7417 )
7418 }
7419
7420 /// Returns permissions that a caller has on the specified resource. If the
7421 /// resource does not exist, this will return an empty set of
7422 /// permissions, not a `NOT_FOUND` error.
7423 ///
7424 /// Note: This operation is designed to be used for building
7425 /// permission-aware UIs and command-line tools, not for authorization
7426 /// checking. This operation may "fail open" without warning.
7427 ///
7428 /// # Example
7429 /// ```
7430 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7431 /// use google_cloud_networksecurity_v1::Result;
7432 /// async fn sample(
7433 /// client: &OrganizationSecurityProfileGroupService
7434 /// ) -> Result<()> {
7435 /// let response = client.test_iam_permissions()
7436 /// /* set fields */
7437 /// .send().await?;
7438 /// println!("response {:?}", response);
7439 /// Ok(())
7440 /// }
7441 /// ```
7442 pub fn test_iam_permissions(
7443 &self,
7444 ) -> super::builder::organization_security_profile_group_service::TestIamPermissions {
7445 super::builder::organization_security_profile_group_service::TestIamPermissions::new(
7446 self.inner.clone(),
7447 )
7448 }
7449
7450 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7451 ///
7452 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7453 ///
7454 /// # Example
7455 /// ```
7456 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7457 /// use google_cloud_gax::paginator::ItemPaginator as _;
7458 /// use google_cloud_networksecurity_v1::Result;
7459 /// async fn sample(
7460 /// client: &OrganizationSecurityProfileGroupService
7461 /// ) -> Result<()> {
7462 /// let mut list = client.list_operations()
7463 /// /* set fields */
7464 /// .by_item();
7465 /// while let Some(item) = list.next().await.transpose()? {
7466 /// println!("{:?}", item);
7467 /// }
7468 /// Ok(())
7469 /// }
7470 /// ```
7471 pub fn list_operations(
7472 &self,
7473 ) -> super::builder::organization_security_profile_group_service::ListOperations {
7474 super::builder::organization_security_profile_group_service::ListOperations::new(
7475 self.inner.clone(),
7476 )
7477 }
7478
7479 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7480 ///
7481 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7482 ///
7483 /// # Example
7484 /// ```
7485 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7486 /// use google_cloud_networksecurity_v1::Result;
7487 /// async fn sample(
7488 /// client: &OrganizationSecurityProfileGroupService
7489 /// ) -> Result<()> {
7490 /// let response = client.get_operation()
7491 /// /* set fields */
7492 /// .send().await?;
7493 /// println!("response {:?}", response);
7494 /// Ok(())
7495 /// }
7496 /// ```
7497 pub fn get_operation(
7498 &self,
7499 ) -> super::builder::organization_security_profile_group_service::GetOperation {
7500 super::builder::organization_security_profile_group_service::GetOperation::new(
7501 self.inner.clone(),
7502 )
7503 }
7504
7505 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7506 ///
7507 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7508 ///
7509 /// # Example
7510 /// ```
7511 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7512 /// use google_cloud_networksecurity_v1::Result;
7513 /// async fn sample(
7514 /// client: &OrganizationSecurityProfileGroupService
7515 /// ) -> Result<()> {
7516 /// client.delete_operation()
7517 /// /* set fields */
7518 /// .send().await?;
7519 /// Ok(())
7520 /// }
7521 /// ```
7522 pub fn delete_operation(
7523 &self,
7524 ) -> super::builder::organization_security_profile_group_service::DeleteOperation {
7525 super::builder::organization_security_profile_group_service::DeleteOperation::new(
7526 self.inner.clone(),
7527 )
7528 }
7529
7530 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
7531 ///
7532 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
7533 ///
7534 /// # Example
7535 /// ```
7536 /// # use google_cloud_networksecurity_v1::client::OrganizationSecurityProfileGroupService;
7537 /// use google_cloud_networksecurity_v1::Result;
7538 /// async fn sample(
7539 /// client: &OrganizationSecurityProfileGroupService
7540 /// ) -> Result<()> {
7541 /// client.cancel_operation()
7542 /// /* set fields */
7543 /// .send().await?;
7544 /// Ok(())
7545 /// }
7546 /// ```
7547 pub fn cancel_operation(
7548 &self,
7549 ) -> super::builder::organization_security_profile_group_service::CancelOperation {
7550 super::builder::organization_security_profile_group_service::CancelOperation::new(
7551 self.inner.clone(),
7552 )
7553 }
7554}
7555
7556/// Implements a client for the Network Security API.
7557///
7558/// # Example
7559/// ```
7560/// # use google_cloud_networksecurity_v1::client::SSERealmService;
7561/// use google_cloud_gax::paginator::ItemPaginator as _;
7562/// async fn sample(
7563/// project_id: &str,
7564/// location_id: &str,
7565/// ) -> anyhow::Result<()> {
7566/// let client = SSERealmService::builder().build().await?;
7567/// let mut list = client.list_sac_realms()
7568/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
7569/// .by_item();
7570/// while let Some(item) = list.next().await.transpose()? {
7571/// println!("{:?}", item);
7572/// }
7573/// Ok(())
7574/// }
7575/// ```
7576///
7577/// # Service Description
7578///
7579/// Service describing handlers for resources
7580///
7581/// # Configuration
7582///
7583/// To configure `SSERealmService` use the `with_*` methods in the type returned
7584/// by [builder()][SSERealmService::builder]. The default configuration should
7585/// work for most applications. Common configuration changes include
7586///
7587/// * [with_endpoint()]: by default this client uses the global default endpoint
7588/// (`https://networksecurity.googleapis.com`). Applications using regional
7589/// endpoints or running in restricted networks (e.g. a network configured
7590/// with [Private Google Access with VPC Service Controls]) may want to
7591/// override this default.
7592/// * [with_credentials()]: by default this client uses
7593/// [Application Default Credentials]. Applications using custom
7594/// authentication may need to override this default.
7595///
7596/// [with_endpoint()]: super::builder::sse_realm_service::ClientBuilder::with_endpoint
7597/// [with_credentials()]: super::builder::sse_realm_service::ClientBuilder::with_credentials
7598/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7599/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7600///
7601/// # Pooling and Cloning
7602///
7603/// `SSERealmService` holds a connection pool internally, it is advised to
7604/// create one and reuse it. You do not need to wrap `SSERealmService` in
7605/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7606/// already uses an `Arc` internally.
7607#[derive(Clone, Debug)]
7608pub struct SSERealmService {
7609 inner: std::sync::Arc<dyn super::stub::dynamic::SSERealmService>,
7610}
7611
7612impl SSERealmService {
7613 /// Returns a builder for [SSERealmService].
7614 ///
7615 /// ```
7616 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7617 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7618 /// let client = SSERealmService::builder().build().await?;
7619 /// # Ok(()) }
7620 /// ```
7621 pub fn builder() -> super::builder::sse_realm_service::ClientBuilder {
7622 crate::new_client_builder(super::builder::sse_realm_service::client::Factory)
7623 }
7624
7625 /// Creates a new client from the provided stub.
7626 ///
7627 /// The most common case for calling this function is in tests mocking the
7628 /// client's behavior.
7629 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7630 where
7631 T: super::stub::SSERealmService + 'static,
7632 {
7633 Self { inner: stub.into() }
7634 }
7635
7636 pub(crate) async fn new(
7637 config: gaxi::options::ClientConfig,
7638 ) -> crate::ClientBuilderResult<Self> {
7639 let inner = Self::build_inner(config).await?;
7640 Ok(Self { inner })
7641 }
7642
7643 async fn build_inner(
7644 conf: gaxi::options::ClientConfig,
7645 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SSERealmService>> {
7646 if gaxi::options::tracing_enabled(&conf) {
7647 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7648 }
7649 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7650 }
7651
7652 async fn build_transport(
7653 conf: gaxi::options::ClientConfig,
7654 ) -> crate::ClientBuilderResult<impl super::stub::SSERealmService> {
7655 super::transport::SSERealmService::new(conf).await
7656 }
7657
7658 async fn build_with_tracing(
7659 conf: gaxi::options::ClientConfig,
7660 ) -> crate::ClientBuilderResult<impl super::stub::SSERealmService> {
7661 Self::build_transport(conf)
7662 .await
7663 .map(super::tracing::SSERealmService::new)
7664 }
7665
7666 /// Lists SACRealms in a given project.
7667 ///
7668 /// # Example
7669 /// ```
7670 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7671 /// use google_cloud_gax::paginator::ItemPaginator as _;
7672 /// use google_cloud_networksecurity_v1::Result;
7673 /// async fn sample(
7674 /// client: &SSERealmService, project_id: &str, location_id: &str
7675 /// ) -> Result<()> {
7676 /// let mut list = client.list_sac_realms()
7677 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
7678 /// .by_item();
7679 /// while let Some(item) = list.next().await.transpose()? {
7680 /// println!("{:?}", item);
7681 /// }
7682 /// Ok(())
7683 /// }
7684 /// ```
7685 pub fn list_sac_realms(&self) -> super::builder::sse_realm_service::ListSACRealms {
7686 super::builder::sse_realm_service::ListSACRealms::new(self.inner.clone())
7687 }
7688
7689 /// Returns the specified realm.
7690 ///
7691 /// # Example
7692 /// ```
7693 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7694 /// use google_cloud_networksecurity_v1::Result;
7695 /// async fn sample(
7696 /// client: &SSERealmService, project_id: &str, location_id: &str, sac_realm_id: &str
7697 /// ) -> Result<()> {
7698 /// let response = client.get_sac_realm()
7699 /// .set_name(format!("projects/{project_id}/locations/{location_id}/sacRealms/{sac_realm_id}"))
7700 /// .send().await?;
7701 /// println!("response {:?}", response);
7702 /// Ok(())
7703 /// }
7704 /// ```
7705 pub fn get_sac_realm(&self) -> super::builder::sse_realm_service::GetSACRealm {
7706 super::builder::sse_realm_service::GetSACRealm::new(self.inner.clone())
7707 }
7708
7709 /// Creates a new SACRealm in a given project.
7710 ///
7711 /// # Long running operations
7712 ///
7713 /// This method is used to start, and/or poll a [long-running Operation].
7714 /// The [Working with long-running operations] chapter in the [user guide]
7715 /// covers these operations in detail.
7716 ///
7717 /// [long-running operation]: https://google.aip.dev/151
7718 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7719 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7720 ///
7721 /// # Example
7722 /// ```
7723 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7724 /// use google_cloud_lro::Poller;
7725 /// use google_cloud_networksecurity_v1::model::SACRealm;
7726 /// use google_cloud_networksecurity_v1::Result;
7727 /// async fn sample(
7728 /// client: &SSERealmService, project_id: &str, location_id: &str
7729 /// ) -> Result<()> {
7730 /// let response = client.create_sac_realm()
7731 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
7732 /// .set_sac_realm(
7733 /// SACRealm::new()/* set fields */
7734 /// )
7735 /// .poller().until_done().await?;
7736 /// println!("response {:?}", response);
7737 /// Ok(())
7738 /// }
7739 /// ```
7740 pub fn create_sac_realm(&self) -> super::builder::sse_realm_service::CreateSACRealm {
7741 super::builder::sse_realm_service::CreateSACRealm::new(self.inner.clone())
7742 }
7743
7744 /// Deletes the specified realm.
7745 ///
7746 /// # Long running operations
7747 ///
7748 /// This method is used to start, and/or poll a [long-running Operation].
7749 /// The [Working with long-running operations] chapter in the [user guide]
7750 /// covers these operations in detail.
7751 ///
7752 /// [long-running operation]: https://google.aip.dev/151
7753 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7754 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7755 ///
7756 /// # Example
7757 /// ```
7758 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7759 /// use google_cloud_lro::Poller;
7760 /// use google_cloud_networksecurity_v1::Result;
7761 /// async fn sample(
7762 /// client: &SSERealmService, project_id: &str, location_id: &str, sac_realm_id: &str
7763 /// ) -> Result<()> {
7764 /// client.delete_sac_realm()
7765 /// .set_name(format!("projects/{project_id}/locations/{location_id}/sacRealms/{sac_realm_id}"))
7766 /// .poller().until_done().await?;
7767 /// Ok(())
7768 /// }
7769 /// ```
7770 pub fn delete_sac_realm(&self) -> super::builder::sse_realm_service::DeleteSACRealm {
7771 super::builder::sse_realm_service::DeleteSACRealm::new(self.inner.clone())
7772 }
7773
7774 /// Lists SACAttachments in a given project and location.
7775 ///
7776 /// # Example
7777 /// ```
7778 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7779 /// use google_cloud_gax::paginator::ItemPaginator as _;
7780 /// use google_cloud_networksecurity_v1::Result;
7781 /// async fn sample(
7782 /// client: &SSERealmService, project_id: &str, location_id: &str
7783 /// ) -> Result<()> {
7784 /// let mut list = client.list_sac_attachments()
7785 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
7786 /// .by_item();
7787 /// while let Some(item) = list.next().await.transpose()? {
7788 /// println!("{:?}", item);
7789 /// }
7790 /// Ok(())
7791 /// }
7792 /// ```
7793 pub fn list_sac_attachments(&self) -> super::builder::sse_realm_service::ListSACAttachments {
7794 super::builder::sse_realm_service::ListSACAttachments::new(self.inner.clone())
7795 }
7796
7797 /// Returns the specified attachment.
7798 ///
7799 /// # Example
7800 /// ```
7801 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7802 /// use google_cloud_networksecurity_v1::Result;
7803 /// async fn sample(
7804 /// client: &SSERealmService, project_id: &str, location_id: &str, sac_attachment_id: &str
7805 /// ) -> Result<()> {
7806 /// let response = client.get_sac_attachment()
7807 /// .set_name(format!("projects/{project_id}/locations/{location_id}/sacAttachments/{sac_attachment_id}"))
7808 /// .send().await?;
7809 /// println!("response {:?}", response);
7810 /// Ok(())
7811 /// }
7812 /// ```
7813 pub fn get_sac_attachment(&self) -> super::builder::sse_realm_service::GetSACAttachment {
7814 super::builder::sse_realm_service::GetSACAttachment::new(self.inner.clone())
7815 }
7816
7817 /// Creates a new SACAttachment in a given project and location.
7818 ///
7819 /// # Long running operations
7820 ///
7821 /// This method is used to start, and/or poll a [long-running Operation].
7822 /// The [Working with long-running operations] chapter in the [user guide]
7823 /// covers these operations in detail.
7824 ///
7825 /// [long-running operation]: https://google.aip.dev/151
7826 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7827 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7828 ///
7829 /// # Example
7830 /// ```
7831 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7832 /// use google_cloud_lro::Poller;
7833 /// use google_cloud_networksecurity_v1::model::SACAttachment;
7834 /// use google_cloud_networksecurity_v1::Result;
7835 /// async fn sample(
7836 /// client: &SSERealmService, project_id: &str, location_id: &str
7837 /// ) -> Result<()> {
7838 /// let response = client.create_sac_attachment()
7839 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
7840 /// .set_sac_attachment(
7841 /// SACAttachment::new()/* set fields */
7842 /// )
7843 /// .poller().until_done().await?;
7844 /// println!("response {:?}", response);
7845 /// Ok(())
7846 /// }
7847 /// ```
7848 pub fn create_sac_attachment(&self) -> super::builder::sse_realm_service::CreateSACAttachment {
7849 super::builder::sse_realm_service::CreateSACAttachment::new(self.inner.clone())
7850 }
7851
7852 /// Deletes the specified attachment.
7853 ///
7854 /// # Long running operations
7855 ///
7856 /// This method is used to start, and/or poll a [long-running Operation].
7857 /// The [Working with long-running operations] chapter in the [user guide]
7858 /// covers these operations in detail.
7859 ///
7860 /// [long-running operation]: https://google.aip.dev/151
7861 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
7862 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
7863 ///
7864 /// # Example
7865 /// ```
7866 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7867 /// use google_cloud_lro::Poller;
7868 /// use google_cloud_networksecurity_v1::Result;
7869 /// async fn sample(
7870 /// client: &SSERealmService, project_id: &str, location_id: &str, sac_attachment_id: &str
7871 /// ) -> Result<()> {
7872 /// client.delete_sac_attachment()
7873 /// .set_name(format!("projects/{project_id}/locations/{location_id}/sacAttachments/{sac_attachment_id}"))
7874 /// .poller().until_done().await?;
7875 /// Ok(())
7876 /// }
7877 /// ```
7878 pub fn delete_sac_attachment(&self) -> super::builder::sse_realm_service::DeleteSACAttachment {
7879 super::builder::sse_realm_service::DeleteSACAttachment::new(self.inner.clone())
7880 }
7881
7882 /// Lists information about the supported locations for this service.
7883 ///
7884 /// This method lists locations based on the resource scope provided in
7885 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
7886 /// **Global locations**: If `name` is empty, the method lists the
7887 /// public locations available to all projects. * **Project-specific
7888 /// locations**: If `name` follows the format
7889 /// `projects/{project}`, the method lists locations visible to that
7890 /// specific project. This includes public, private, or other
7891 /// project-specific locations enabled for the project.
7892 ///
7893 /// For gRPC and client library implementations, the resource name is
7894 /// passed as the `name` field. For direct service calls, the resource
7895 /// name is
7896 /// incorporated into the request path based on the specific service
7897 /// implementation and version.
7898 ///
7899 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
7900 ///
7901 /// # Example
7902 /// ```
7903 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7904 /// use google_cloud_gax::paginator::ItemPaginator as _;
7905 /// use google_cloud_networksecurity_v1::Result;
7906 /// async fn sample(
7907 /// client: &SSERealmService
7908 /// ) -> Result<()> {
7909 /// let mut list = client.list_locations()
7910 /// /* set fields */
7911 /// .by_item();
7912 /// while let Some(item) = list.next().await.transpose()? {
7913 /// println!("{:?}", item);
7914 /// }
7915 /// Ok(())
7916 /// }
7917 /// ```
7918 pub fn list_locations(&self) -> super::builder::sse_realm_service::ListLocations {
7919 super::builder::sse_realm_service::ListLocations::new(self.inner.clone())
7920 }
7921
7922 /// Gets information about a location.
7923 ///
7924 /// # Example
7925 /// ```
7926 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7927 /// use google_cloud_networksecurity_v1::Result;
7928 /// async fn sample(
7929 /// client: &SSERealmService
7930 /// ) -> Result<()> {
7931 /// let response = client.get_location()
7932 /// /* set fields */
7933 /// .send().await?;
7934 /// println!("response {:?}", response);
7935 /// Ok(())
7936 /// }
7937 /// ```
7938 pub fn get_location(&self) -> super::builder::sse_realm_service::GetLocation {
7939 super::builder::sse_realm_service::GetLocation::new(self.inner.clone())
7940 }
7941
7942 /// Sets the access control policy on the specified resource. Replaces
7943 /// any existing policy.
7944 ///
7945 /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
7946 /// errors.
7947 ///
7948 /// # Example
7949 /// ```
7950 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7951 /// use google_cloud_networksecurity_v1::Result;
7952 /// async fn sample(
7953 /// client: &SSERealmService
7954 /// ) -> Result<()> {
7955 /// let response = client.set_iam_policy()
7956 /// /* set fields */
7957 /// .send().await?;
7958 /// println!("response {:?}", response);
7959 /// Ok(())
7960 /// }
7961 /// ```
7962 pub fn set_iam_policy(&self) -> super::builder::sse_realm_service::SetIamPolicy {
7963 super::builder::sse_realm_service::SetIamPolicy::new(self.inner.clone())
7964 }
7965
7966 /// Gets the access control policy for a resource. Returns an empty policy
7967 /// if the resource exists and does not have a policy set.
7968 ///
7969 /// # Example
7970 /// ```
7971 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7972 /// use google_cloud_networksecurity_v1::Result;
7973 /// async fn sample(
7974 /// client: &SSERealmService
7975 /// ) -> Result<()> {
7976 /// let response = client.get_iam_policy()
7977 /// /* set fields */
7978 /// .send().await?;
7979 /// println!("response {:?}", response);
7980 /// Ok(())
7981 /// }
7982 /// ```
7983 pub fn get_iam_policy(&self) -> super::builder::sse_realm_service::GetIamPolicy {
7984 super::builder::sse_realm_service::GetIamPolicy::new(self.inner.clone())
7985 }
7986
7987 /// Returns permissions that a caller has on the specified resource. If the
7988 /// resource does not exist, this will return an empty set of
7989 /// permissions, not a `NOT_FOUND` error.
7990 ///
7991 /// Note: This operation is designed to be used for building
7992 /// permission-aware UIs and command-line tools, not for authorization
7993 /// checking. This operation may "fail open" without warning.
7994 ///
7995 /// # Example
7996 /// ```
7997 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
7998 /// use google_cloud_networksecurity_v1::Result;
7999 /// async fn sample(
8000 /// client: &SSERealmService
8001 /// ) -> Result<()> {
8002 /// let response = client.test_iam_permissions()
8003 /// /* set fields */
8004 /// .send().await?;
8005 /// println!("response {:?}", response);
8006 /// Ok(())
8007 /// }
8008 /// ```
8009 pub fn test_iam_permissions(&self) -> super::builder::sse_realm_service::TestIamPermissions {
8010 super::builder::sse_realm_service::TestIamPermissions::new(self.inner.clone())
8011 }
8012
8013 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8014 ///
8015 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8016 ///
8017 /// # Example
8018 /// ```
8019 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
8020 /// use google_cloud_gax::paginator::ItemPaginator as _;
8021 /// use google_cloud_networksecurity_v1::Result;
8022 /// async fn sample(
8023 /// client: &SSERealmService
8024 /// ) -> Result<()> {
8025 /// let mut list = client.list_operations()
8026 /// /* set fields */
8027 /// .by_item();
8028 /// while let Some(item) = list.next().await.transpose()? {
8029 /// println!("{:?}", item);
8030 /// }
8031 /// Ok(())
8032 /// }
8033 /// ```
8034 pub fn list_operations(&self) -> super::builder::sse_realm_service::ListOperations {
8035 super::builder::sse_realm_service::ListOperations::new(self.inner.clone())
8036 }
8037
8038 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8039 ///
8040 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8041 ///
8042 /// # Example
8043 /// ```
8044 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
8045 /// use google_cloud_networksecurity_v1::Result;
8046 /// async fn sample(
8047 /// client: &SSERealmService
8048 /// ) -> Result<()> {
8049 /// let response = client.get_operation()
8050 /// /* set fields */
8051 /// .send().await?;
8052 /// println!("response {:?}", response);
8053 /// Ok(())
8054 /// }
8055 /// ```
8056 pub fn get_operation(&self) -> super::builder::sse_realm_service::GetOperation {
8057 super::builder::sse_realm_service::GetOperation::new(self.inner.clone())
8058 }
8059
8060 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8061 ///
8062 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8063 ///
8064 /// # Example
8065 /// ```
8066 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
8067 /// use google_cloud_networksecurity_v1::Result;
8068 /// async fn sample(
8069 /// client: &SSERealmService
8070 /// ) -> Result<()> {
8071 /// client.delete_operation()
8072 /// /* set fields */
8073 /// .send().await?;
8074 /// Ok(())
8075 /// }
8076 /// ```
8077 pub fn delete_operation(&self) -> super::builder::sse_realm_service::DeleteOperation {
8078 super::builder::sse_realm_service::DeleteOperation::new(self.inner.clone())
8079 }
8080
8081 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
8082 ///
8083 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
8084 ///
8085 /// # Example
8086 /// ```
8087 /// # use google_cloud_networksecurity_v1::client::SSERealmService;
8088 /// use google_cloud_networksecurity_v1::Result;
8089 /// async fn sample(
8090 /// client: &SSERealmService
8091 /// ) -> Result<()> {
8092 /// client.cancel_operation()
8093 /// /* set fields */
8094 /// .send().await?;
8095 /// Ok(())
8096 /// }
8097 /// ```
8098 pub fn cancel_operation(&self) -> super::builder::sse_realm_service::CancelOperation {
8099 super::builder::sse_realm_service::CancelOperation::new(self.inner.clone())
8100 }
8101}