google_cloud_securityposture_v1/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Security Posture API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_securityposture_v1::client::SecurityPosture;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26/// organization_id: &str,
27/// location_id: &str,
28/// ) -> anyhow::Result<()> {
29/// let client = SecurityPosture::builder().build().await?;
30/// let mut list = client.list_postures()
31/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
32/// .by_item();
33/// while let Some(item) = list.next().await.transpose()? {
34/// println!("{:?}", item);
35/// }
36/// Ok(())
37/// }
38/// ```
39///
40/// # Service Description
41///
42/// Service describing handlers for resources.
43///
44/// # Configuration
45///
46/// To configure `SecurityPosture` use the `with_*` methods in the type returned
47/// by [builder()][SecurityPosture::builder]. The default configuration should
48/// work for most applications. Common configuration changes include
49///
50/// * [with_endpoint()]: by default this client uses the global default endpoint
51/// (`https://securityposture.googleapis.com`). Applications using regional
52/// endpoints or running in restricted networks (e.g. a network configured
53// with [Private Google Access with VPC Service Controls]) may want to
54/// override this default.
55/// * [with_credentials()]: by default this client uses
56/// [Application Default Credentials]. Applications using custom
57/// authentication may need to override this default.
58///
59/// [with_endpoint()]: super::builder::security_posture::ClientBuilder::with_endpoint
60/// [with_credentials()]: super::builder::security_posture::ClientBuilder::with_credentials
61/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
62/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
63///
64/// # Pooling and Cloning
65///
66/// `SecurityPosture` holds a connection pool internally, it is advised to
67/// create one and reuse it. You do not need to wrap `SecurityPosture` in
68/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
69/// already uses an `Arc` internally.
70#[derive(Clone, Debug)]
71pub struct SecurityPosture {
72 inner: std::sync::Arc<dyn super::stub::dynamic::SecurityPosture>,
73}
74
75impl SecurityPosture {
76 /// Returns a builder for [SecurityPosture].
77 ///
78 /// ```
79 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
80 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
81 /// let client = SecurityPosture::builder().build().await?;
82 /// # Ok(()) }
83 /// ```
84 pub fn builder() -> super::builder::security_posture::ClientBuilder {
85 crate::new_client_builder(super::builder::security_posture::client::Factory)
86 }
87
88 /// Creates a new client from the provided stub.
89 ///
90 /// The most common case for calling this function is in tests mocking the
91 /// client's behavior.
92 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
93 where
94 T: super::stub::SecurityPosture + 'static,
95 {
96 Self { inner: stub.into() }
97 }
98
99 pub(crate) async fn new(
100 config: gaxi::options::ClientConfig,
101 ) -> crate::ClientBuilderResult<Self> {
102 let inner = Self::build_inner(config).await?;
103 Ok(Self { inner })
104 }
105
106 async fn build_inner(
107 conf: gaxi::options::ClientConfig,
108 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SecurityPosture>> {
109 if gaxi::options::tracing_enabled(&conf) {
110 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
111 }
112 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
113 }
114
115 async fn build_transport(
116 conf: gaxi::options::ClientConfig,
117 ) -> crate::ClientBuilderResult<impl super::stub::SecurityPosture> {
118 super::transport::SecurityPosture::new(conf).await
119 }
120
121 async fn build_with_tracing(
122 conf: gaxi::options::ClientConfig,
123 ) -> crate::ClientBuilderResult<impl super::stub::SecurityPosture> {
124 Self::build_transport(conf)
125 .await
126 .map(super::tracing::SecurityPosture::new)
127 }
128
129 /// (-- This option restricts the visibility of the API to only projects that
130 /// will
131 /// (-- be labeled as `PREVIEW` or `GOOGLE_INTERNAL` by the service.
132 /// (-- option (google.api.api_visibility).restriction =
133 /// "PREVIEW,GOOGLE_INTERNAL"; Postures Lists Postures in a given organization
134 /// and location. In case a posture has multiple revisions, the latest revision
135 /// as per UpdateTime will be returned.
136 ///
137 /// # Example
138 /// ```
139 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
140 /// use google_cloud_gax::paginator::ItemPaginator as _;
141 /// use google_cloud_securityposture_v1::Result;
142 /// async fn sample(
143 /// client: &SecurityPosture, organization_id: &str, location_id: &str
144 /// ) -> Result<()> {
145 /// let mut list = client.list_postures()
146 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
147 /// .by_item();
148 /// while let Some(item) = list.next().await.transpose()? {
149 /// println!("{:?}", item);
150 /// }
151 /// Ok(())
152 /// }
153 /// ```
154 pub fn list_postures(&self) -> super::builder::security_posture::ListPostures {
155 super::builder::security_posture::ListPostures::new(self.inner.clone())
156 }
157
158 /// Lists revisions of a Posture in a given organization and location.
159 ///
160 /// # Example
161 /// ```
162 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
163 /// use google_cloud_gax::paginator::ItemPaginator as _;
164 /// use google_cloud_securityposture_v1::Result;
165 /// async fn sample(
166 /// client: &SecurityPosture
167 /// ) -> Result<()> {
168 /// let mut list = client.list_posture_revisions()
169 /// /* set fields */
170 /// .by_item();
171 /// while let Some(item) = list.next().await.transpose()? {
172 /// println!("{:?}", item);
173 /// }
174 /// Ok(())
175 /// }
176 /// ```
177 pub fn list_posture_revisions(&self) -> super::builder::security_posture::ListPostureRevisions {
178 super::builder::security_posture::ListPostureRevisions::new(self.inner.clone())
179 }
180
181 /// Gets a posture in a given organization and location.
182 /// User must provide revision_id to retrieve a specific revision of the
183 /// resource.
184 /// NOT_FOUND error is returned if the revision_id or the Posture name does not
185 /// exist. In case revision_id is not provided then the latest Posture revision
186 /// by UpdateTime is returned.
187 ///
188 /// # Example
189 /// ```
190 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
191 /// use google_cloud_securityposture_v1::Result;
192 /// async fn sample(
193 /// client: &SecurityPosture, organization_id: &str, location_id: &str, posture_id: &str
194 /// ) -> Result<()> {
195 /// let response = client.get_posture()
196 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"))
197 /// .send().await?;
198 /// println!("response {:?}", response);
199 /// Ok(())
200 /// }
201 /// ```
202 pub fn get_posture(&self) -> super::builder::security_posture::GetPosture {
203 super::builder::security_posture::GetPosture::new(self.inner.clone())
204 }
205
206 /// Creates a new Posture resource.
207 /// If a Posture with the specified name already exists in the specified
208 /// organization and location, the long running operation returns a
209 /// [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
210 ///
211 /// # Long running operations
212 ///
213 /// This method is used to start, and/or poll a [long-running Operation].
214 /// The [Working with long-running operations] chapter in the [user guide]
215 /// covers these operations in detail.
216 ///
217 /// [long-running operation]: https://google.aip.dev/151
218 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
219 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
220 ///
221 /// # Example
222 /// ```
223 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
224 /// use google_cloud_lro::Poller;
225 /// use google_cloud_securityposture_v1::model::Posture;
226 /// use google_cloud_securityposture_v1::Result;
227 /// async fn sample(
228 /// client: &SecurityPosture, organization_id: &str, location_id: &str
229 /// ) -> Result<()> {
230 /// let response = client.create_posture()
231 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
232 /// .set_posture_id("posture_id_value")
233 /// .set_posture(
234 /// Posture::new()/* set fields */
235 /// )
236 /// .poller().until_done().await?;
237 /// println!("response {:?}", response);
238 /// Ok(())
239 /// }
240 /// ```
241 pub fn create_posture(&self) -> super::builder::security_posture::CreatePosture {
242 super::builder::security_posture::CreatePosture::new(self.inner.clone())
243 }
244
245 /// Updates an existing Posture.
246 /// A new revision of the posture will be created if the revision to be
247 /// updated is currently deployed on a workload.
248 /// Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
249 /// Posture does not exist.
250 /// Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag
251 /// supplied in the request does not match the persisted etag of the Posture.
252 /// Updatable fields are state, description and policy_sets.
253 /// State update operation cannot be clubbed with update of description and
254 /// policy_sets.
255 /// An ACTIVE posture can be updated to both DRAFT or DEPRECATED states.
256 /// Postures in DRAFT or DEPRECATED states can only be updated to ACTIVE state.
257 ///
258 /// # Long running operations
259 ///
260 /// This method is used to start, and/or poll a [long-running Operation].
261 /// The [Working with long-running operations] chapter in the [user guide]
262 /// covers these operations in detail.
263 ///
264 /// [long-running operation]: https://google.aip.dev/151
265 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
266 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
267 ///
268 /// # Example
269 /// ```
270 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
271 /// use google_cloud_lro::Poller;
272 /// # extern crate wkt as google_cloud_wkt;
273 /// use google_cloud_wkt::FieldMask;
274 /// use google_cloud_securityposture_v1::model::Posture;
275 /// use google_cloud_securityposture_v1::Result;
276 /// async fn sample(
277 /// client: &SecurityPosture, organization_id: &str, location_id: &str, posture_id: &str
278 /// ) -> Result<()> {
279 /// let response = client.update_posture()
280 /// .set_posture(
281 /// Posture::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"))/* set fields */
282 /// )
283 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
284 /// .poller().until_done().await?;
285 /// println!("response {:?}", response);
286 /// Ok(())
287 /// }
288 /// ```
289 pub fn update_posture(&self) -> super::builder::security_posture::UpdatePosture {
290 super::builder::security_posture::UpdatePosture::new(self.inner.clone())
291 }
292
293 /// Deletes all the revisions of a resource.
294 /// A posture can only be deleted when none of the revisions are deployed to
295 /// any workload.
296 ///
297 /// # Long running operations
298 ///
299 /// This method is used to start, and/or poll a [long-running Operation].
300 /// The [Working with long-running operations] chapter in the [user guide]
301 /// covers these operations in detail.
302 ///
303 /// [long-running operation]: https://google.aip.dev/151
304 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
305 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
306 ///
307 /// # Example
308 /// ```
309 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
310 /// use google_cloud_lro::Poller;
311 /// use google_cloud_securityposture_v1::Result;
312 /// async fn sample(
313 /// client: &SecurityPosture, organization_id: &str, location_id: &str, posture_id: &str
314 /// ) -> Result<()> {
315 /// client.delete_posture()
316 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"))
317 /// .poller().until_done().await?;
318 /// Ok(())
319 /// }
320 /// ```
321 pub fn delete_posture(&self) -> super::builder::security_posture::DeletePosture {
322 super::builder::security_posture::DeletePosture::new(self.inner.clone())
323 }
324
325 /// Extracts existing policies on a workload as a posture.
326 /// If a Posture on the given workload already exists, the long running
327 /// operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.
328 ///
329 /// # Long running operations
330 ///
331 /// This method is used to start, and/or poll a [long-running Operation].
332 /// The [Working with long-running operations] chapter in the [user guide]
333 /// covers these operations in detail.
334 ///
335 /// [long-running operation]: https://google.aip.dev/151
336 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
337 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
338 ///
339 /// # Example
340 /// ```
341 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
342 /// use google_cloud_lro::Poller;
343 /// use google_cloud_securityposture_v1::Result;
344 /// async fn sample(
345 /// client: &SecurityPosture
346 /// ) -> Result<()> {
347 /// let response = client.extract_posture()
348 /// /* set fields */
349 /// .poller().until_done().await?;
350 /// println!("response {:?}", response);
351 /// Ok(())
352 /// }
353 /// ```
354 pub fn extract_posture(&self) -> super::builder::security_posture::ExtractPosture {
355 super::builder::security_posture::ExtractPosture::new(self.inner.clone())
356 }
357
358 /// PostureDeployments
359 /// Lists PostureDeployments in a given project and location.
360 ///
361 /// # Example
362 /// ```
363 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
364 /// use google_cloud_gax::paginator::ItemPaginator as _;
365 /// use google_cloud_securityposture_v1::Result;
366 /// async fn sample(
367 /// client: &SecurityPosture, organization_id: &str, location_id: &str
368 /// ) -> Result<()> {
369 /// let mut list = client.list_posture_deployments()
370 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
371 /// .by_item();
372 /// while let Some(item) = list.next().await.transpose()? {
373 /// println!("{:?}", item);
374 /// }
375 /// Ok(())
376 /// }
377 /// ```
378 pub fn list_posture_deployments(
379 &self,
380 ) -> super::builder::security_posture::ListPostureDeployments {
381 super::builder::security_posture::ListPostureDeployments::new(self.inner.clone())
382 }
383
384 /// Gets details of a single PostureDeployment.
385 ///
386 /// # Example
387 /// ```
388 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
389 /// use google_cloud_securityposture_v1::Result;
390 /// async fn sample(
391 /// client: &SecurityPosture, organization_id: &str, location_id: &str, posture_deployment_id: &str
392 /// ) -> Result<()> {
393 /// let response = client.get_posture_deployment()
394 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"))
395 /// .send().await?;
396 /// println!("response {:?}", response);
397 /// Ok(())
398 /// }
399 /// ```
400 pub fn get_posture_deployment(&self) -> super::builder::security_posture::GetPostureDeployment {
401 super::builder::security_posture::GetPostureDeployment::new(self.inner.clone())
402 }
403
404 /// Creates a new PostureDeployment in a given project and location.
405 ///
406 /// # Long running operations
407 ///
408 /// This method is used to start, and/or poll a [long-running Operation].
409 /// The [Working with long-running operations] chapter in the [user guide]
410 /// covers these operations in detail.
411 ///
412 /// [long-running operation]: https://google.aip.dev/151
413 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
414 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
415 ///
416 /// # Example
417 /// ```
418 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
419 /// use google_cloud_lro::Poller;
420 /// use google_cloud_securityposture_v1::model::PostureDeployment;
421 /// use google_cloud_securityposture_v1::Result;
422 /// async fn sample(
423 /// client: &SecurityPosture, organization_id: &str, location_id: &str
424 /// ) -> Result<()> {
425 /// let response = client.create_posture_deployment()
426 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
427 /// .set_posture_deployment(
428 /// PostureDeployment::new()/* set fields */
429 /// )
430 /// .poller().until_done().await?;
431 /// println!("response {:?}", response);
432 /// Ok(())
433 /// }
434 /// ```
435 pub fn create_posture_deployment(
436 &self,
437 ) -> super::builder::security_posture::CreatePostureDeployment {
438 super::builder::security_posture::CreatePostureDeployment::new(self.inner.clone())
439 }
440
441 /// Updates the parameters of a single PostureDeployment.
442 ///
443 /// # Long running operations
444 ///
445 /// This method is used to start, and/or poll a [long-running Operation].
446 /// The [Working with long-running operations] chapter in the [user guide]
447 /// covers these operations in detail.
448 ///
449 /// [long-running operation]: https://google.aip.dev/151
450 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
451 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
452 ///
453 /// # Example
454 /// ```
455 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
456 /// use google_cloud_lro::Poller;
457 /// # extern crate wkt as google_cloud_wkt;
458 /// use google_cloud_wkt::FieldMask;
459 /// use google_cloud_securityposture_v1::model::PostureDeployment;
460 /// use google_cloud_securityposture_v1::Result;
461 /// async fn sample(
462 /// client: &SecurityPosture, organization_id: &str, location_id: &str, posture_deployment_id: &str
463 /// ) -> Result<()> {
464 /// let response = client.update_posture_deployment()
465 /// .set_posture_deployment(
466 /// PostureDeployment::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"))/* set fields */
467 /// )
468 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
469 /// .poller().until_done().await?;
470 /// println!("response {:?}", response);
471 /// Ok(())
472 /// }
473 /// ```
474 pub fn update_posture_deployment(
475 &self,
476 ) -> super::builder::security_posture::UpdatePostureDeployment {
477 super::builder::security_posture::UpdatePostureDeployment::new(self.inner.clone())
478 }
479
480 /// Deletes a single PostureDeployment.
481 ///
482 /// # Long running operations
483 ///
484 /// This method is used to start, and/or poll a [long-running Operation].
485 /// The [Working with long-running operations] chapter in the [user guide]
486 /// covers these operations in detail.
487 ///
488 /// [long-running operation]: https://google.aip.dev/151
489 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
490 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
491 ///
492 /// # Example
493 /// ```
494 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
495 /// use google_cloud_lro::Poller;
496 /// use google_cloud_securityposture_v1::Result;
497 /// async fn sample(
498 /// client: &SecurityPosture, organization_id: &str, location_id: &str, posture_deployment_id: &str
499 /// ) -> Result<()> {
500 /// client.delete_posture_deployment()
501 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"))
502 /// .poller().until_done().await?;
503 /// Ok(())
504 /// }
505 /// ```
506 pub fn delete_posture_deployment(
507 &self,
508 ) -> super::builder::security_posture::DeletePostureDeployment {
509 super::builder::security_posture::DeletePostureDeployment::new(self.inner.clone())
510 }
511
512 /// PostureTemplates
513 /// Lists all the PostureTemplates available to the user.
514 ///
515 /// # Example
516 /// ```
517 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
518 /// use google_cloud_gax::paginator::ItemPaginator as _;
519 /// use google_cloud_securityposture_v1::Result;
520 /// async fn sample(
521 /// client: &SecurityPosture, organization_id: &str, location_id: &str
522 /// ) -> Result<()> {
523 /// let mut list = client.list_posture_templates()
524 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
525 /// .by_item();
526 /// while let Some(item) = list.next().await.transpose()? {
527 /// println!("{:?}", item);
528 /// }
529 /// Ok(())
530 /// }
531 /// ```
532 pub fn list_posture_templates(&self) -> super::builder::security_posture::ListPostureTemplates {
533 super::builder::security_posture::ListPostureTemplates::new(self.inner.clone())
534 }
535
536 /// Gets a PostureTemplate.
537 /// User must provide revision_id to retrieve a specific revision of the
538 /// resource.
539 /// NOT_FOUND error is returned if the revision_id or the PostureTemplate name
540 /// does not exist. In case revision_id is not provided then the
541 /// PostureTemplate with latest revision_id is returned.
542 ///
543 /// # Example
544 /// ```
545 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
546 /// use google_cloud_securityposture_v1::Result;
547 /// async fn sample(
548 /// client: &SecurityPosture, organization_id: &str, location_id: &str, posture_template_id: &str
549 /// ) -> Result<()> {
550 /// let response = client.get_posture_template()
551 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/postureTemplates/{posture_template_id}"))
552 /// .send().await?;
553 /// println!("response {:?}", response);
554 /// Ok(())
555 /// }
556 /// ```
557 pub fn get_posture_template(&self) -> super::builder::security_posture::GetPostureTemplate {
558 super::builder::security_posture::GetPostureTemplate::new(self.inner.clone())
559 }
560
561 /// Lists information about the supported locations for this service.
562 ///
563 /// # Example
564 /// ```
565 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
566 /// use google_cloud_gax::paginator::ItemPaginator as _;
567 /// use google_cloud_securityposture_v1::Result;
568 /// async fn sample(
569 /// client: &SecurityPosture
570 /// ) -> Result<()> {
571 /// let mut list = client.list_locations()
572 /// /* set fields */
573 /// .by_item();
574 /// while let Some(item) = list.next().await.transpose()? {
575 /// println!("{:?}", item);
576 /// }
577 /// Ok(())
578 /// }
579 /// ```
580 pub fn list_locations(&self) -> super::builder::security_posture::ListLocations {
581 super::builder::security_posture::ListLocations::new(self.inner.clone())
582 }
583
584 /// Gets information about a location.
585 ///
586 /// # Example
587 /// ```
588 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
589 /// use google_cloud_securityposture_v1::Result;
590 /// async fn sample(
591 /// client: &SecurityPosture
592 /// ) -> Result<()> {
593 /// let response = client.get_location()
594 /// /* set fields */
595 /// .send().await?;
596 /// println!("response {:?}", response);
597 /// Ok(())
598 /// }
599 /// ```
600 pub fn get_location(&self) -> super::builder::security_posture::GetLocation {
601 super::builder::security_posture::GetLocation::new(self.inner.clone())
602 }
603
604 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
605 ///
606 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
607 ///
608 /// # Example
609 /// ```
610 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
611 /// use google_cloud_gax::paginator::ItemPaginator as _;
612 /// use google_cloud_securityposture_v1::Result;
613 /// async fn sample(
614 /// client: &SecurityPosture
615 /// ) -> Result<()> {
616 /// let mut list = client.list_operations()
617 /// /* set fields */
618 /// .by_item();
619 /// while let Some(item) = list.next().await.transpose()? {
620 /// println!("{:?}", item);
621 /// }
622 /// Ok(())
623 /// }
624 /// ```
625 pub fn list_operations(&self) -> super::builder::security_posture::ListOperations {
626 super::builder::security_posture::ListOperations::new(self.inner.clone())
627 }
628
629 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
630 ///
631 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
632 ///
633 /// # Example
634 /// ```
635 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
636 /// use google_cloud_securityposture_v1::Result;
637 /// async fn sample(
638 /// client: &SecurityPosture
639 /// ) -> Result<()> {
640 /// let response = client.get_operation()
641 /// /* set fields */
642 /// .send().await?;
643 /// println!("response {:?}", response);
644 /// Ok(())
645 /// }
646 /// ```
647 pub fn get_operation(&self) -> super::builder::security_posture::GetOperation {
648 super::builder::security_posture::GetOperation::new(self.inner.clone())
649 }
650
651 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
652 ///
653 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
654 ///
655 /// # Example
656 /// ```
657 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
658 /// use google_cloud_securityposture_v1::Result;
659 /// async fn sample(
660 /// client: &SecurityPosture
661 /// ) -> Result<()> {
662 /// client.delete_operation()
663 /// /* set fields */
664 /// .send().await?;
665 /// Ok(())
666 /// }
667 /// ```
668 pub fn delete_operation(&self) -> super::builder::security_posture::DeleteOperation {
669 super::builder::security_posture::DeleteOperation::new(self.inner.clone())
670 }
671
672 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
673 ///
674 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
675 ///
676 /// # Example
677 /// ```
678 /// # use google_cloud_securityposture_v1::client::SecurityPosture;
679 /// use google_cloud_securityposture_v1::Result;
680 /// async fn sample(
681 /// client: &SecurityPosture
682 /// ) -> Result<()> {
683 /// client.cancel_operation()
684 /// /* set fields */
685 /// .send().await?;
686 /// Ok(())
687 /// }
688 /// ```
689 pub fn cancel_operation(&self) -> super::builder::security_posture::CancelOperation {
690 super::builder::security_posture::CancelOperation::new(self.inner.clone())
691 }
692}