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