google_cloud_cloudsecuritycompliance_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 Cloud Security Compliance API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// async fn sample(
26/// project_id: &str,
27/// location_id: &str,
28/// ) -> anyhow::Result<()> {
29/// let client = Audit::builder().build().await?;
30/// let mut list = client.list_framework_audits()
31/// .set_parent(format!("projects/{project_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 `Audit` use the `with_*` methods in the type returned
47/// by [builder()][Audit::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://cloudsecuritycompliance.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::audit::ClientBuilder::with_endpoint
60/// [with_credentials()]: super::builder::audit::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/// `Audit` holds a connection pool internally, it is advised to
67/// create one and reuse it. You do not need to wrap `Audit` 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 Audit {
72 inner: std::sync::Arc<dyn super::stub::dynamic::Audit>,
73}
74
75impl Audit {
76 /// Returns a builder for [Audit].
77 ///
78 /// ```
79 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
80 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
81 /// let client = Audit::builder().build().await?;
82 /// # Ok(()) }
83 /// ```
84 pub fn builder() -> super::builder::audit::ClientBuilder {
85 crate::new_client_builder(super::builder::audit::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::Audit + '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::Audit>> {
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::Audit> {
118 super::transport::Audit::new(conf).await
119 }
120
121 async fn build_with_tracing(
122 conf: gaxi::options::ClientConfig,
123 ) -> crate::ClientBuilderResult<impl super::stub::Audit> {
124 Self::build_transport(conf)
125 .await
126 .map(super::tracing::Audit::new)
127 }
128
129 /// Generates an audit scope report for a framework.
130 ///
131 /// # Example
132 /// ```
133 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
134 /// use google_cloud_cloudsecuritycompliance_v1::Result;
135 /// async fn sample(
136 /// client: &Audit
137 /// ) -> Result<()> {
138 /// let response = client.generate_framework_audit_scope_report()
139 /// /* set fields */
140 /// .send().await?;
141 /// println!("response {:?}", response);
142 /// Ok(())
143 /// }
144 /// ```
145 pub fn generate_framework_audit_scope_report(
146 &self,
147 ) -> super::builder::audit::GenerateFrameworkAuditScopeReport {
148 super::builder::audit::GenerateFrameworkAuditScopeReport::new(self.inner.clone())
149 }
150
151 /// Creates an audit scope report for a framework.
152 ///
153 /// # Long running operations
154 ///
155 /// This method is used to start, and/or poll a [long-running Operation].
156 /// The [Working with long-running operations] chapter in the [user guide]
157 /// covers these operations in detail.
158 ///
159 /// [long-running operation]: https://google.aip.dev/151
160 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
161 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
162 ///
163 /// # Example
164 /// ```
165 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
166 /// use google_cloud_lro::Poller;
167 /// use google_cloud_cloudsecuritycompliance_v1::model::FrameworkAudit;
168 /// use google_cloud_cloudsecuritycompliance_v1::Result;
169 /// async fn sample(
170 /// client: &Audit, project_id: &str, location_id: &str
171 /// ) -> Result<()> {
172 /// let response = client.create_framework_audit()
173 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
174 /// .set_framework_audit(
175 /// FrameworkAudit::new()/* set fields */
176 /// )
177 /// .poller().until_done().await?;
178 /// println!("response {:?}", response);
179 /// Ok(())
180 /// }
181 /// ```
182 pub fn create_framework_audit(&self) -> super::builder::audit::CreateFrameworkAudit {
183 super::builder::audit::CreateFrameworkAudit::new(self.inner.clone())
184 }
185
186 /// Lists the framework audits for a given organization, folder, or project.
187 ///
188 /// # Example
189 /// ```
190 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
191 /// use google_cloud_gax::paginator::ItemPaginator as _;
192 /// use google_cloud_cloudsecuritycompliance_v1::Result;
193 /// async fn sample(
194 /// client: &Audit, project_id: &str, location_id: &str
195 /// ) -> Result<()> {
196 /// let mut list = client.list_framework_audits()
197 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
198 /// .by_item();
199 /// while let Some(item) = list.next().await.transpose()? {
200 /// println!("{:?}", item);
201 /// }
202 /// Ok(())
203 /// }
204 /// ```
205 pub fn list_framework_audits(&self) -> super::builder::audit::ListFrameworkAudits {
206 super::builder::audit::ListFrameworkAudits::new(self.inner.clone())
207 }
208
209 /// Gets the details for a framework audit.
210 ///
211 /// # Example
212 /// ```
213 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
214 /// use google_cloud_cloudsecuritycompliance_v1::Result;
215 /// async fn sample(
216 /// client: &Audit, project_id: &str, location_id: &str, framework_audit_id: &str
217 /// ) -> Result<()> {
218 /// let response = client.get_framework_audit()
219 /// .set_name(format!("projects/{project_id}/locations/{location_id}/frameworkAudits/{framework_audit_id}"))
220 /// .send().await?;
221 /// println!("response {:?}", response);
222 /// Ok(())
223 /// }
224 /// ```
225 pub fn get_framework_audit(&self) -> super::builder::audit::GetFrameworkAudit {
226 super::builder::audit::GetFrameworkAudit::new(self.inner.clone())
227 }
228
229 /// Lists information about the supported locations for this service.
230 ///
231 /// This method lists locations based on the resource scope provided in
232 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
233 /// **Global locations**: If `name` is empty, the method lists the
234 /// public locations available to all projects. * **Project-specific
235 /// locations**: If `name` follows the format
236 /// `projects/{project}`, the method lists locations visible to that
237 /// specific project. This includes public, private, or other
238 /// project-specific locations enabled for the project.
239 ///
240 /// For gRPC and client library implementations, the resource name is
241 /// passed as the `name` field. For direct service calls, the resource
242 /// name is
243 /// incorporated into the request path based on the specific service
244 /// implementation and version.
245 ///
246 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
247 ///
248 /// # Example
249 /// ```
250 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
251 /// use google_cloud_gax::paginator::ItemPaginator as _;
252 /// use google_cloud_cloudsecuritycompliance_v1::Result;
253 /// async fn sample(
254 /// client: &Audit
255 /// ) -> Result<()> {
256 /// let mut list = client.list_locations()
257 /// /* set fields */
258 /// .by_item();
259 /// while let Some(item) = list.next().await.transpose()? {
260 /// println!("{:?}", item);
261 /// }
262 /// Ok(())
263 /// }
264 /// ```
265 pub fn list_locations(&self) -> super::builder::audit::ListLocations {
266 super::builder::audit::ListLocations::new(self.inner.clone())
267 }
268
269 /// Gets information about a location.
270 ///
271 /// # Example
272 /// ```
273 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
274 /// use google_cloud_cloudsecuritycompliance_v1::Result;
275 /// async fn sample(
276 /// client: &Audit
277 /// ) -> Result<()> {
278 /// let response = client.get_location()
279 /// /* set fields */
280 /// .send().await?;
281 /// println!("response {:?}", response);
282 /// Ok(())
283 /// }
284 /// ```
285 pub fn get_location(&self) -> super::builder::audit::GetLocation {
286 super::builder::audit::GetLocation::new(self.inner.clone())
287 }
288
289 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
290 ///
291 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
292 ///
293 /// # Example
294 /// ```
295 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
296 /// use google_cloud_gax::paginator::ItemPaginator as _;
297 /// use google_cloud_cloudsecuritycompliance_v1::Result;
298 /// async fn sample(
299 /// client: &Audit
300 /// ) -> Result<()> {
301 /// let mut list = client.list_operations()
302 /// /* set fields */
303 /// .by_item();
304 /// while let Some(item) = list.next().await.transpose()? {
305 /// println!("{:?}", item);
306 /// }
307 /// Ok(())
308 /// }
309 /// ```
310 pub fn list_operations(&self) -> super::builder::audit::ListOperations {
311 super::builder::audit::ListOperations::new(self.inner.clone())
312 }
313
314 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
315 ///
316 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
317 ///
318 /// # Example
319 /// ```
320 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
321 /// use google_cloud_cloudsecuritycompliance_v1::Result;
322 /// async fn sample(
323 /// client: &Audit
324 /// ) -> Result<()> {
325 /// let response = client.get_operation()
326 /// /* set fields */
327 /// .send().await?;
328 /// println!("response {:?}", response);
329 /// Ok(())
330 /// }
331 /// ```
332 pub fn get_operation(&self) -> super::builder::audit::GetOperation {
333 super::builder::audit::GetOperation::new(self.inner.clone())
334 }
335
336 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
337 ///
338 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
339 ///
340 /// # Example
341 /// ```
342 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
343 /// use google_cloud_cloudsecuritycompliance_v1::Result;
344 /// async fn sample(
345 /// client: &Audit
346 /// ) -> Result<()> {
347 /// client.delete_operation()
348 /// /* set fields */
349 /// .send().await?;
350 /// Ok(())
351 /// }
352 /// ```
353 pub fn delete_operation(&self) -> super::builder::audit::DeleteOperation {
354 super::builder::audit::DeleteOperation::new(self.inner.clone())
355 }
356
357 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
358 ///
359 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
360 ///
361 /// # Example
362 /// ```
363 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
364 /// use google_cloud_cloudsecuritycompliance_v1::Result;
365 /// async fn sample(
366 /// client: &Audit
367 /// ) -> Result<()> {
368 /// client.cancel_operation()
369 /// /* set fields */
370 /// .send().await?;
371 /// Ok(())
372 /// }
373 /// ```
374 pub fn cancel_operation(&self) -> super::builder::audit::CancelOperation {
375 super::builder::audit::CancelOperation::new(self.inner.clone())
376 }
377}
378
379/// Implements a client for the Cloud Security Compliance API.
380///
381/// # Example
382/// ```
383/// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
384/// # extern crate wkt as google_cloud_wkt;
385/// use google_cloud_wkt::FieldMask;
386/// use google_cloud_cloudsecuritycompliance_v1::model::CmEnrollment;
387/// async fn sample(
388/// organization_id: &str,
389/// location_id: &str,
390/// ) -> anyhow::Result<()> {
391/// let client = CmEnrollmentService::builder().build().await?;
392/// let response = client.update_cm_enrollment()
393/// .set_cm_enrollment(
394/// CmEnrollment::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/cmEnrollment"))/* set fields */
395/// )
396/// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
397/// .send().await?;
398/// println!("response {:?}", response);
399/// Ok(())
400/// }
401/// ```
402///
403/// # Service Description
404///
405/// Service describing CmEnrollment related RPCs for
406/// complianceManager.
407///
408/// # Configuration
409///
410/// To configure `CmEnrollmentService` use the `with_*` methods in the type returned
411/// by [builder()][CmEnrollmentService::builder]. The default configuration should
412/// work for most applications. Common configuration changes include
413///
414/// * [with_endpoint()]: by default this client uses the global default endpoint
415/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
416/// endpoints or running in restricted networks (e.g. a network configured
417// with [Private Google Access with VPC Service Controls]) may want to
418/// override this default.
419/// * [with_credentials()]: by default this client uses
420/// [Application Default Credentials]. Applications using custom
421/// authentication may need to override this default.
422///
423/// [with_endpoint()]: super::builder::cm_enrollment_service::ClientBuilder::with_endpoint
424/// [with_credentials()]: super::builder::cm_enrollment_service::ClientBuilder::with_credentials
425/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
426/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
427///
428/// # Pooling and Cloning
429///
430/// `CmEnrollmentService` holds a connection pool internally, it is advised to
431/// create one and reuse it. You do not need to wrap `CmEnrollmentService` in
432/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
433/// already uses an `Arc` internally.
434#[derive(Clone, Debug)]
435pub struct CmEnrollmentService {
436 inner: std::sync::Arc<dyn super::stub::dynamic::CmEnrollmentService>,
437}
438
439impl CmEnrollmentService {
440 /// Returns a builder for [CmEnrollmentService].
441 ///
442 /// ```
443 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
444 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
445 /// let client = CmEnrollmentService::builder().build().await?;
446 /// # Ok(()) }
447 /// ```
448 pub fn builder() -> super::builder::cm_enrollment_service::ClientBuilder {
449 crate::new_client_builder(super::builder::cm_enrollment_service::client::Factory)
450 }
451
452 /// Creates a new client from the provided stub.
453 ///
454 /// The most common case for calling this function is in tests mocking the
455 /// client's behavior.
456 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
457 where
458 T: super::stub::CmEnrollmentService + 'static,
459 {
460 Self { inner: stub.into() }
461 }
462
463 pub(crate) async fn new(
464 config: gaxi::options::ClientConfig,
465 ) -> crate::ClientBuilderResult<Self> {
466 let inner = Self::build_inner(config).await?;
467 Ok(Self { inner })
468 }
469
470 async fn build_inner(
471 conf: gaxi::options::ClientConfig,
472 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CmEnrollmentService>>
473 {
474 if gaxi::options::tracing_enabled(&conf) {
475 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
476 }
477 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
478 }
479
480 async fn build_transport(
481 conf: gaxi::options::ClientConfig,
482 ) -> crate::ClientBuilderResult<impl super::stub::CmEnrollmentService> {
483 super::transport::CmEnrollmentService::new(conf).await
484 }
485
486 async fn build_with_tracing(
487 conf: gaxi::options::ClientConfig,
488 ) -> crate::ClientBuilderResult<impl super::stub::CmEnrollmentService> {
489 Self::build_transport(conf)
490 .await
491 .map(super::tracing::CmEnrollmentService::new)
492 }
493
494 /// Updates the Compliance Manager enrollment for a resource to facilitate
495 /// an audit.
496 /// Use this method to enroll a resource in Compliance Manager or to
497 /// create or update feature-specific configurations.
498 ///
499 /// # Example
500 /// ```
501 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
502 /// # extern crate wkt as google_cloud_wkt;
503 /// use google_cloud_wkt::FieldMask;
504 /// use google_cloud_cloudsecuritycompliance_v1::model::CmEnrollment;
505 /// use google_cloud_cloudsecuritycompliance_v1::Result;
506 /// async fn sample(
507 /// client: &CmEnrollmentService, organization_id: &str, location_id: &str
508 /// ) -> Result<()> {
509 /// let response = client.update_cm_enrollment()
510 /// .set_cm_enrollment(
511 /// CmEnrollment::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/cmEnrollment"))/* set fields */
512 /// )
513 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
514 /// .send().await?;
515 /// println!("response {:?}", response);
516 /// Ok(())
517 /// }
518 /// ```
519 pub fn update_cm_enrollment(
520 &self,
521 ) -> super::builder::cm_enrollment_service::UpdateCmEnrollment {
522 super::builder::cm_enrollment_service::UpdateCmEnrollment::new(self.inner.clone())
523 }
524
525 /// Calculates the effective Compliance Manager enrollment for a resource.
526 /// An effective enrollment is either a direct enrollment of a
527 /// resource (if it exists), or an enrollment of the closest parent of a
528 /// resource that's enrolled in Compliance Manager.
529 ///
530 /// # Example
531 /// ```
532 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
533 /// use google_cloud_cloudsecuritycompliance_v1::Result;
534 /// async fn sample(
535 /// client: &CmEnrollmentService
536 /// ) -> Result<()> {
537 /// let response = client.calculate_effective_cm_enrollment()
538 /// /* set fields */
539 /// .send().await?;
540 /// println!("response {:?}", response);
541 /// Ok(())
542 /// }
543 /// ```
544 pub fn calculate_effective_cm_enrollment(
545 &self,
546 ) -> super::builder::cm_enrollment_service::CalculateEffectiveCmEnrollment {
547 super::builder::cm_enrollment_service::CalculateEffectiveCmEnrollment::new(
548 self.inner.clone(),
549 )
550 }
551
552 /// Lists information about the supported locations for this service.
553 ///
554 /// This method lists locations based on the resource scope provided in
555 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
556 /// **Global locations**: If `name` is empty, the method lists the
557 /// public locations available to all projects. * **Project-specific
558 /// locations**: If `name` follows the format
559 /// `projects/{project}`, the method lists locations visible to that
560 /// specific project. This includes public, private, or other
561 /// project-specific locations enabled for the project.
562 ///
563 /// For gRPC and client library implementations, the resource name is
564 /// passed as the `name` field. For direct service calls, the resource
565 /// name is
566 /// incorporated into the request path based on the specific service
567 /// implementation and version.
568 ///
569 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
570 ///
571 /// # Example
572 /// ```
573 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
574 /// use google_cloud_gax::paginator::ItemPaginator as _;
575 /// use google_cloud_cloudsecuritycompliance_v1::Result;
576 /// async fn sample(
577 /// client: &CmEnrollmentService
578 /// ) -> Result<()> {
579 /// let mut list = client.list_locations()
580 /// /* set fields */
581 /// .by_item();
582 /// while let Some(item) = list.next().await.transpose()? {
583 /// println!("{:?}", item);
584 /// }
585 /// Ok(())
586 /// }
587 /// ```
588 pub fn list_locations(&self) -> super::builder::cm_enrollment_service::ListLocations {
589 super::builder::cm_enrollment_service::ListLocations::new(self.inner.clone())
590 }
591
592 /// Gets information about a location.
593 ///
594 /// # Example
595 /// ```
596 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
597 /// use google_cloud_cloudsecuritycompliance_v1::Result;
598 /// async fn sample(
599 /// client: &CmEnrollmentService
600 /// ) -> Result<()> {
601 /// let response = client.get_location()
602 /// /* set fields */
603 /// .send().await?;
604 /// println!("response {:?}", response);
605 /// Ok(())
606 /// }
607 /// ```
608 pub fn get_location(&self) -> super::builder::cm_enrollment_service::GetLocation {
609 super::builder::cm_enrollment_service::GetLocation::new(self.inner.clone())
610 }
611
612 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
613 ///
614 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
615 ///
616 /// # Example
617 /// ```
618 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
619 /// use google_cloud_gax::paginator::ItemPaginator as _;
620 /// use google_cloud_cloudsecuritycompliance_v1::Result;
621 /// async fn sample(
622 /// client: &CmEnrollmentService
623 /// ) -> Result<()> {
624 /// let mut list = client.list_operations()
625 /// /* set fields */
626 /// .by_item();
627 /// while let Some(item) = list.next().await.transpose()? {
628 /// println!("{:?}", item);
629 /// }
630 /// Ok(())
631 /// }
632 /// ```
633 pub fn list_operations(&self) -> super::builder::cm_enrollment_service::ListOperations {
634 super::builder::cm_enrollment_service::ListOperations::new(self.inner.clone())
635 }
636
637 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
638 ///
639 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
640 ///
641 /// # Example
642 /// ```
643 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
644 /// use google_cloud_cloudsecuritycompliance_v1::Result;
645 /// async fn sample(
646 /// client: &CmEnrollmentService
647 /// ) -> Result<()> {
648 /// let response = client.get_operation()
649 /// /* set fields */
650 /// .send().await?;
651 /// println!("response {:?}", response);
652 /// Ok(())
653 /// }
654 /// ```
655 pub fn get_operation(&self) -> super::builder::cm_enrollment_service::GetOperation {
656 super::builder::cm_enrollment_service::GetOperation::new(self.inner.clone())
657 }
658
659 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
660 ///
661 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
662 ///
663 /// # Example
664 /// ```
665 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
666 /// use google_cloud_cloudsecuritycompliance_v1::Result;
667 /// async fn sample(
668 /// client: &CmEnrollmentService
669 /// ) -> Result<()> {
670 /// client.delete_operation()
671 /// /* set fields */
672 /// .send().await?;
673 /// Ok(())
674 /// }
675 /// ```
676 pub fn delete_operation(&self) -> super::builder::cm_enrollment_service::DeleteOperation {
677 super::builder::cm_enrollment_service::DeleteOperation::new(self.inner.clone())
678 }
679
680 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
681 ///
682 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
683 ///
684 /// # Example
685 /// ```
686 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
687 /// use google_cloud_cloudsecuritycompliance_v1::Result;
688 /// async fn sample(
689 /// client: &CmEnrollmentService
690 /// ) -> Result<()> {
691 /// client.cancel_operation()
692 /// /* set fields */
693 /// .send().await?;
694 /// Ok(())
695 /// }
696 /// ```
697 pub fn cancel_operation(&self) -> super::builder::cm_enrollment_service::CancelOperation {
698 super::builder::cm_enrollment_service::CancelOperation::new(self.inner.clone())
699 }
700}
701
702/// Implements a client for the Cloud Security Compliance API.
703///
704/// # Example
705/// ```
706/// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
707/// use google_cloud_gax::paginator::ItemPaginator as _;
708/// async fn sample(
709/// organization_id: &str,
710/// location_id: &str,
711/// ) -> anyhow::Result<()> {
712/// let client = Config::builder().build().await?;
713/// let mut list = client.list_frameworks()
714/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
715/// .by_item();
716/// while let Some(item) = list.next().await.transpose()? {
717/// println!("{:?}", item);
718/// }
719/// Ok(())
720/// }
721/// ```
722///
723/// # Service Description
724///
725/// Config Service manages compliance frameworks, cloud controls, and their
726/// configurations.
727///
728/// # Configuration
729///
730/// To configure `Config` use the `with_*` methods in the type returned
731/// by [builder()][Config::builder]. The default configuration should
732/// work for most applications. Common configuration changes include
733///
734/// * [with_endpoint()]: by default this client uses the global default endpoint
735/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
736/// endpoints or running in restricted networks (e.g. a network configured
737// with [Private Google Access with VPC Service Controls]) may want to
738/// override this default.
739/// * [with_credentials()]: by default this client uses
740/// [Application Default Credentials]. Applications using custom
741/// authentication may need to override this default.
742///
743/// [with_endpoint()]: super::builder::config::ClientBuilder::with_endpoint
744/// [with_credentials()]: super::builder::config::ClientBuilder::with_credentials
745/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
746/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
747///
748/// # Pooling and Cloning
749///
750/// `Config` holds a connection pool internally, it is advised to
751/// create one and reuse it. You do not need to wrap `Config` in
752/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
753/// already uses an `Arc` internally.
754#[derive(Clone, Debug)]
755pub struct Config {
756 inner: std::sync::Arc<dyn super::stub::dynamic::Config>,
757}
758
759impl Config {
760 /// Returns a builder for [Config].
761 ///
762 /// ```
763 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
764 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
765 /// let client = Config::builder().build().await?;
766 /// # Ok(()) }
767 /// ```
768 pub fn builder() -> super::builder::config::ClientBuilder {
769 crate::new_client_builder(super::builder::config::client::Factory)
770 }
771
772 /// Creates a new client from the provided stub.
773 ///
774 /// The most common case for calling this function is in tests mocking the
775 /// client's behavior.
776 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
777 where
778 T: super::stub::Config + 'static,
779 {
780 Self { inner: stub.into() }
781 }
782
783 pub(crate) async fn new(
784 config: gaxi::options::ClientConfig,
785 ) -> crate::ClientBuilderResult<Self> {
786 let inner = Self::build_inner(config).await?;
787 Ok(Self { inner })
788 }
789
790 async fn build_inner(
791 conf: gaxi::options::ClientConfig,
792 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Config>> {
793 if gaxi::options::tracing_enabled(&conf) {
794 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
795 }
796 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
797 }
798
799 async fn build_transport(
800 conf: gaxi::options::ClientConfig,
801 ) -> crate::ClientBuilderResult<impl super::stub::Config> {
802 super::transport::Config::new(conf).await
803 }
804
805 async fn build_with_tracing(
806 conf: gaxi::options::ClientConfig,
807 ) -> crate::ClientBuilderResult<impl super::stub::Config> {
808 Self::build_transport(conf)
809 .await
810 .map(super::tracing::Config::new)
811 }
812
813 /// Lists the frameworks (both built-in and custom) that are available within
814 /// the parent resource. The latest major version of each framework is
815 /// returned.
816 /// This method supports pagination.
817 ///
818 /// # Example
819 /// ```
820 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
821 /// use google_cloud_gax::paginator::ItemPaginator as _;
822 /// use google_cloud_cloudsecuritycompliance_v1::Result;
823 /// async fn sample(
824 /// client: &Config, organization_id: &str, location_id: &str
825 /// ) -> Result<()> {
826 /// let mut list = client.list_frameworks()
827 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
828 /// .by_item();
829 /// while let Some(item) = list.next().await.transpose()? {
830 /// println!("{:?}", item);
831 /// }
832 /// Ok(())
833 /// }
834 /// ```
835 pub fn list_frameworks(&self) -> super::builder::config::ListFrameworks {
836 super::builder::config::ListFrameworks::new(self.inner.clone())
837 }
838
839 /// Gets details about a framework.
840 /// This method retrieves the latest major version of the framework.
841 ///
842 /// To retrieve a specific major version, include `major_revision_id` in
843 /// the request.
844 ///
845 /// # Example
846 /// ```
847 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
848 /// use google_cloud_cloudsecuritycompliance_v1::Result;
849 /// async fn sample(
850 /// client: &Config, organization_id: &str, location_id: &str, framework_id: &str
851 /// ) -> Result<()> {
852 /// let response = client.get_framework()
853 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/frameworks/{framework_id}"))
854 /// .send().await?;
855 /// println!("response {:?}", response);
856 /// Ok(())
857 /// }
858 /// ```
859 pub fn get_framework(&self) -> super::builder::config::GetFramework {
860 super::builder::config::GetFramework::new(self.inner.clone())
861 }
862
863 /// Creates a custom framework in a given parent resource.
864 /// You can't create built-in frameworks because those are managed by
865 /// Google.
866 ///
867 /// # Example
868 /// ```
869 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
870 /// use google_cloud_cloudsecuritycompliance_v1::model::Framework;
871 /// use google_cloud_cloudsecuritycompliance_v1::Result;
872 /// async fn sample(
873 /// client: &Config, organization_id: &str, location_id: &str
874 /// ) -> Result<()> {
875 /// let response = client.create_framework()
876 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
877 /// .set_framework_id("framework_id_value")
878 /// .set_framework(
879 /// Framework::new()/* set fields */
880 /// )
881 /// .send().await?;
882 /// println!("response {:?}", response);
883 /// Ok(())
884 /// }
885 /// ```
886 pub fn create_framework(&self) -> super::builder::config::CreateFramework {
887 super::builder::config::CreateFramework::new(self.inner.clone())
888 }
889
890 /// Updates a custom framework.
891 /// This method allows for partial updates of a framework. Use the
892 /// `update_mask` to specify which fields to update. Consider the following:
893 ///
894 /// - If you provide an `update_mask`, only the fields that are specified
895 /// in the mask are updated.
896 /// - If you don't provide an `update_mask`, all the fields that are present
897 /// in the request's `framework` body are used to overwrite the existing
898 /// resource.
899 ///
900 /// You can only update frameworks with the `CUSTOM` type.
901 /// A successful update creates a new version of the framework.
902 ///
903 /// # Example
904 /// ```
905 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
906 /// # extern crate wkt as google_cloud_wkt;
907 /// use google_cloud_wkt::FieldMask;
908 /// use google_cloud_cloudsecuritycompliance_v1::model::Framework;
909 /// use google_cloud_cloudsecuritycompliance_v1::Result;
910 /// async fn sample(
911 /// client: &Config, organization_id: &str, location_id: &str, framework_id: &str
912 /// ) -> Result<()> {
913 /// let response = client.update_framework()
914 /// .set_framework(
915 /// Framework::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/frameworks/{framework_id}"))/* set fields */
916 /// )
917 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
918 /// .send().await?;
919 /// println!("response {:?}", response);
920 /// Ok(())
921 /// }
922 /// ```
923 pub fn update_framework(&self) -> super::builder::config::UpdateFramework {
924 super::builder::config::UpdateFramework::new(self.inner.clone())
925 }
926
927 /// Deletes a custom framework, including all its major and
928 /// minor revisions. Consider the following:
929 ///
930 /// - You can't delete built-in frameworks. You can only delete frameworks
931 /// with type `CUSTOM`.
932 /// - You can't delete frameworks that are deployed to a resource.
933 /// - You can't restore a deleted framework. This action is permanent.
934 ///
935 /// # Example
936 /// ```
937 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
938 /// use google_cloud_cloudsecuritycompliance_v1::Result;
939 /// async fn sample(
940 /// client: &Config, organization_id: &str, location_id: &str, framework_id: &str
941 /// ) -> Result<()> {
942 /// client.delete_framework()
943 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/frameworks/{framework_id}"))
944 /// .send().await?;
945 /// Ok(())
946 /// }
947 /// ```
948 pub fn delete_framework(&self) -> super::builder::config::DeleteFramework {
949 super::builder::config::DeleteFramework::new(self.inner.clone())
950 }
951
952 /// Lists the cloud controls (both built-in and custom) that are available
953 /// in a given parent resource. The latest major version of each cloud control
954 /// is returned.
955 /// This method supports pagination.
956 ///
957 /// # Example
958 /// ```
959 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
960 /// use google_cloud_gax::paginator::ItemPaginator as _;
961 /// use google_cloud_cloudsecuritycompliance_v1::Result;
962 /// async fn sample(
963 /// client: &Config, organization_id: &str, location_id: &str
964 /// ) -> Result<()> {
965 /// let mut list = client.list_cloud_controls()
966 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
967 /// .by_item();
968 /// while let Some(item) = list.next().await.transpose()? {
969 /// println!("{:?}", item);
970 /// }
971 /// Ok(())
972 /// }
973 /// ```
974 pub fn list_cloud_controls(&self) -> super::builder::config::ListCloudControls {
975 super::builder::config::ListCloudControls::new(self.inner.clone())
976 }
977
978 /// Gets details about a cloud control.
979 /// This method retrieves the latest major version of a cloud control that
980 /// you identify by name.
981 ///
982 /// By default, the latest major version of the cloud control is returned.
983 /// To retrieve a specific major version, include `major_revision_id` in
984 /// the request.
985 ///
986 /// # Example
987 /// ```
988 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
989 /// use google_cloud_cloudsecuritycompliance_v1::Result;
990 /// async fn sample(
991 /// client: &Config, organization_id: &str, location_id: &str, cloud_control_id: &str
992 /// ) -> Result<()> {
993 /// let response = client.get_cloud_control()
994 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/cloudControls/{cloud_control_id}"))
995 /// .send().await?;
996 /// println!("response {:?}", response);
997 /// Ok(())
998 /// }
999 /// ```
1000 pub fn get_cloud_control(&self) -> super::builder::config::GetCloudControl {
1001 super::builder::config::GetCloudControl::new(self.inner.clone())
1002 }
1003
1004 /// Creates a custom cloud control in a given parent
1005 /// resource.
1006 /// You can't create built-in cloud controls because those are managed by
1007 /// Google.
1008 ///
1009 /// # Example
1010 /// ```
1011 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1012 /// use google_cloud_cloudsecuritycompliance_v1::model::CloudControl;
1013 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1014 /// async fn sample(
1015 /// client: &Config, organization_id: &str, location_id: &str
1016 /// ) -> Result<()> {
1017 /// let response = client.create_cloud_control()
1018 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1019 /// .set_cloud_control(
1020 /// CloudControl::new()/* set fields */
1021 /// )
1022 /// .send().await?;
1023 /// println!("response {:?}", response);
1024 /// Ok(())
1025 /// }
1026 /// ```
1027 pub fn create_cloud_control(&self) -> super::builder::config::CreateCloudControl {
1028 super::builder::config::CreateCloudControl::new(self.inner.clone())
1029 }
1030
1031 /// Updates a custom cloud control.
1032 /// This method allows for partial updates of a cloud control. Use the
1033 /// `update_mask` to specify which fields to update. Consider the following:
1034 ///
1035 /// - If you provide an `update_mask`, only the fields that are specified
1036 /// in the mask are updated.
1037 /// - If you don't provide an `update_mask`, all the fields that are present
1038 /// in the request's `cloud_control` body are used to overwrite the existing
1039 /// resource.
1040 ///
1041 /// You can only update cloud controls with the `CUSTOM` type.
1042 /// A successful update creates a new version of the cloud control.
1043 ///
1044 /// # Example
1045 /// ```
1046 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1047 /// # extern crate wkt as google_cloud_wkt;
1048 /// use google_cloud_wkt::FieldMask;
1049 /// use google_cloud_cloudsecuritycompliance_v1::model::CloudControl;
1050 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1051 /// async fn sample(
1052 /// client: &Config, organization_id: &str, location_id: &str, cloud_control_id: &str
1053 /// ) -> Result<()> {
1054 /// let response = client.update_cloud_control()
1055 /// .set_cloud_control(
1056 /// CloudControl::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/cloudControls/{cloud_control_id}"))/* set fields */
1057 /// )
1058 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1059 /// .send().await?;
1060 /// println!("response {:?}", response);
1061 /// Ok(())
1062 /// }
1063 /// ```
1064 pub fn update_cloud_control(&self) -> super::builder::config::UpdateCloudControl {
1065 super::builder::config::UpdateCloudControl::new(self.inner.clone())
1066 }
1067
1068 /// Deletes a custom cloud control, including all its
1069 /// major and minor revisions. Consider the following:
1070 ///
1071 /// - You can't delete built-in cloud controls. You can only delete cloud
1072 /// controls with type `CUSTOM`.
1073 /// - You can't delete cloud controls if any of the versions are referenced
1074 /// by a framework.
1075 /// - You can't restore a deleted cloud control. This action is permanent.
1076 ///
1077 /// # Example
1078 /// ```
1079 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1080 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1081 /// async fn sample(
1082 /// client: &Config, organization_id: &str, location_id: &str, cloud_control_id: &str
1083 /// ) -> Result<()> {
1084 /// client.delete_cloud_control()
1085 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/cloudControls/{cloud_control_id}"))
1086 /// .send().await?;
1087 /// Ok(())
1088 /// }
1089 /// ```
1090 pub fn delete_cloud_control(&self) -> super::builder::config::DeleteCloudControl {
1091 super::builder::config::DeleteCloudControl::new(self.inner.clone())
1092 }
1093
1094 /// Lists information about the supported locations for this service.
1095 ///
1096 /// This method lists locations based on the resource scope provided in
1097 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1098 /// **Global locations**: If `name` is empty, the method lists the
1099 /// public locations available to all projects. * **Project-specific
1100 /// locations**: If `name` follows the format
1101 /// `projects/{project}`, the method lists locations visible to that
1102 /// specific project. This includes public, private, or other
1103 /// project-specific locations enabled for the project.
1104 ///
1105 /// For gRPC and client library implementations, the resource name is
1106 /// passed as the `name` field. For direct service calls, the resource
1107 /// name is
1108 /// incorporated into the request path based on the specific service
1109 /// implementation and version.
1110 ///
1111 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1112 ///
1113 /// # Example
1114 /// ```
1115 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1116 /// use google_cloud_gax::paginator::ItemPaginator as _;
1117 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1118 /// async fn sample(
1119 /// client: &Config
1120 /// ) -> Result<()> {
1121 /// let mut list = client.list_locations()
1122 /// /* set fields */
1123 /// .by_item();
1124 /// while let Some(item) = list.next().await.transpose()? {
1125 /// println!("{:?}", item);
1126 /// }
1127 /// Ok(())
1128 /// }
1129 /// ```
1130 pub fn list_locations(&self) -> super::builder::config::ListLocations {
1131 super::builder::config::ListLocations::new(self.inner.clone())
1132 }
1133
1134 /// Gets information about a location.
1135 ///
1136 /// # Example
1137 /// ```
1138 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1139 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1140 /// async fn sample(
1141 /// client: &Config
1142 /// ) -> Result<()> {
1143 /// let response = client.get_location()
1144 /// /* set fields */
1145 /// .send().await?;
1146 /// println!("response {:?}", response);
1147 /// Ok(())
1148 /// }
1149 /// ```
1150 pub fn get_location(&self) -> super::builder::config::GetLocation {
1151 super::builder::config::GetLocation::new(self.inner.clone())
1152 }
1153
1154 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1155 ///
1156 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1157 ///
1158 /// # Example
1159 /// ```
1160 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1161 /// use google_cloud_gax::paginator::ItemPaginator as _;
1162 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1163 /// async fn sample(
1164 /// client: &Config
1165 /// ) -> Result<()> {
1166 /// let mut list = client.list_operations()
1167 /// /* set fields */
1168 /// .by_item();
1169 /// while let Some(item) = list.next().await.transpose()? {
1170 /// println!("{:?}", item);
1171 /// }
1172 /// Ok(())
1173 /// }
1174 /// ```
1175 pub fn list_operations(&self) -> super::builder::config::ListOperations {
1176 super::builder::config::ListOperations::new(self.inner.clone())
1177 }
1178
1179 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1180 ///
1181 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1182 ///
1183 /// # Example
1184 /// ```
1185 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1186 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1187 /// async fn sample(
1188 /// client: &Config
1189 /// ) -> Result<()> {
1190 /// let response = client.get_operation()
1191 /// /* set fields */
1192 /// .send().await?;
1193 /// println!("response {:?}", response);
1194 /// Ok(())
1195 /// }
1196 /// ```
1197 pub fn get_operation(&self) -> super::builder::config::GetOperation {
1198 super::builder::config::GetOperation::new(self.inner.clone())
1199 }
1200
1201 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1202 ///
1203 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1204 ///
1205 /// # Example
1206 /// ```
1207 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1208 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1209 /// async fn sample(
1210 /// client: &Config
1211 /// ) -> Result<()> {
1212 /// client.delete_operation()
1213 /// /* set fields */
1214 /// .send().await?;
1215 /// Ok(())
1216 /// }
1217 /// ```
1218 pub fn delete_operation(&self) -> super::builder::config::DeleteOperation {
1219 super::builder::config::DeleteOperation::new(self.inner.clone())
1220 }
1221
1222 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1223 ///
1224 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1225 ///
1226 /// # Example
1227 /// ```
1228 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
1229 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1230 /// async fn sample(
1231 /// client: &Config
1232 /// ) -> Result<()> {
1233 /// client.cancel_operation()
1234 /// /* set fields */
1235 /// .send().await?;
1236 /// Ok(())
1237 /// }
1238 /// ```
1239 pub fn cancel_operation(&self) -> super::builder::config::CancelOperation {
1240 super::builder::config::CancelOperation::new(self.inner.clone())
1241 }
1242}
1243
1244/// Implements a client for the Cloud Security Compliance API.
1245///
1246/// # Example
1247/// ```
1248/// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1249/// use google_cloud_gax::paginator::ItemPaginator as _;
1250/// async fn sample(
1251/// organization_id: &str,
1252/// location_id: &str,
1253/// ) -> anyhow::Result<()> {
1254/// let client = Deployment::builder().build().await?;
1255/// let mut list = client.list_framework_deployments()
1256/// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1257/// .by_item();
1258/// while let Some(item) = list.next().await.transpose()? {
1259/// println!("{:?}", item);
1260/// }
1261/// Ok(())
1262/// }
1263/// ```
1264///
1265/// # Service Description
1266///
1267/// Deployment service allows users to manage deployments of Frameworks and
1268/// Cloud Controls on a target resource.
1269///
1270/// # Configuration
1271///
1272/// To configure `Deployment` use the `with_*` methods in the type returned
1273/// by [builder()][Deployment::builder]. The default configuration should
1274/// work for most applications. Common configuration changes include
1275///
1276/// * [with_endpoint()]: by default this client uses the global default endpoint
1277/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
1278/// endpoints or running in restricted networks (e.g. a network configured
1279// with [Private Google Access with VPC Service Controls]) may want to
1280/// override this default.
1281/// * [with_credentials()]: by default this client uses
1282/// [Application Default Credentials]. Applications using custom
1283/// authentication may need to override this default.
1284///
1285/// [with_endpoint()]: super::builder::deployment::ClientBuilder::with_endpoint
1286/// [with_credentials()]: super::builder::deployment::ClientBuilder::with_credentials
1287/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1288/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1289///
1290/// # Pooling and Cloning
1291///
1292/// `Deployment` holds a connection pool internally, it is advised to
1293/// create one and reuse it. You do not need to wrap `Deployment` in
1294/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1295/// already uses an `Arc` internally.
1296#[derive(Clone, Debug)]
1297pub struct Deployment {
1298 inner: std::sync::Arc<dyn super::stub::dynamic::Deployment>,
1299}
1300
1301impl Deployment {
1302 /// Returns a builder for [Deployment].
1303 ///
1304 /// ```
1305 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1306 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1307 /// let client = Deployment::builder().build().await?;
1308 /// # Ok(()) }
1309 /// ```
1310 pub fn builder() -> super::builder::deployment::ClientBuilder {
1311 crate::new_client_builder(super::builder::deployment::client::Factory)
1312 }
1313
1314 /// Creates a new client from the provided stub.
1315 ///
1316 /// The most common case for calling this function is in tests mocking the
1317 /// client's behavior.
1318 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1319 where
1320 T: super::stub::Deployment + 'static,
1321 {
1322 Self { inner: stub.into() }
1323 }
1324
1325 pub(crate) async fn new(
1326 config: gaxi::options::ClientConfig,
1327 ) -> crate::ClientBuilderResult<Self> {
1328 let inner = Self::build_inner(config).await?;
1329 Ok(Self { inner })
1330 }
1331
1332 async fn build_inner(
1333 conf: gaxi::options::ClientConfig,
1334 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Deployment>> {
1335 if gaxi::options::tracing_enabled(&conf) {
1336 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1337 }
1338 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1339 }
1340
1341 async fn build_transport(
1342 conf: gaxi::options::ClientConfig,
1343 ) -> crate::ClientBuilderResult<impl super::stub::Deployment> {
1344 super::transport::Deployment::new(conf).await
1345 }
1346
1347 async fn build_with_tracing(
1348 conf: gaxi::options::ClientConfig,
1349 ) -> crate::ClientBuilderResult<impl super::stub::Deployment> {
1350 Self::build_transport(conf)
1351 .await
1352 .map(super::tracing::Deployment::new)
1353 }
1354
1355 /// Creates a framework deployment in a given parent resource. A
1356 /// framework deployment lets you assign a particular framework version to an
1357 /// organization, folder, or project so that you can control and monitor
1358 /// those resources using the framework's cloud controls.
1359 ///
1360 /// # Long running operations
1361 ///
1362 /// This method is used to start, and/or poll a [long-running Operation].
1363 /// The [Working with long-running operations] chapter in the [user guide]
1364 /// covers these operations in detail.
1365 ///
1366 /// [long-running operation]: https://google.aip.dev/151
1367 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1368 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1369 ///
1370 /// # Example
1371 /// ```
1372 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1373 /// use google_cloud_lro::Poller;
1374 /// use google_cloud_cloudsecuritycompliance_v1::model::FrameworkDeployment;
1375 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1376 /// async fn sample(
1377 /// client: &Deployment, organization_id: &str, location_id: &str
1378 /// ) -> Result<()> {
1379 /// let response = client.create_framework_deployment()
1380 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1381 /// .set_framework_deployment(
1382 /// FrameworkDeployment::new()/* set fields */
1383 /// )
1384 /// .poller().until_done().await?;
1385 /// println!("response {:?}", response);
1386 /// Ok(())
1387 /// }
1388 /// ```
1389 pub fn create_framework_deployment(
1390 &self,
1391 ) -> super::builder::deployment::CreateFrameworkDeployment {
1392 super::builder::deployment::CreateFrameworkDeployment::new(self.inner.clone())
1393 }
1394
1395 /// Deletes a framework deployment.
1396 ///
1397 /// # Long running operations
1398 ///
1399 /// This method is used to start, and/or poll a [long-running Operation].
1400 /// The [Working with long-running operations] chapter in the [user guide]
1401 /// covers these operations in detail.
1402 ///
1403 /// [long-running operation]: https://google.aip.dev/151
1404 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1405 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1406 ///
1407 /// # Example
1408 /// ```
1409 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1410 /// use google_cloud_lro::Poller;
1411 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1412 /// async fn sample(
1413 /// client: &Deployment, organization_id: &str, location_id: &str, framework_deployment_id: &str
1414 /// ) -> Result<()> {
1415 /// client.delete_framework_deployment()
1416 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/frameworkDeployments/{framework_deployment_id}"))
1417 /// .poller().until_done().await?;
1418 /// Ok(())
1419 /// }
1420 /// ```
1421 pub fn delete_framework_deployment(
1422 &self,
1423 ) -> super::builder::deployment::DeleteFrameworkDeployment {
1424 super::builder::deployment::DeleteFrameworkDeployment::new(self.inner.clone())
1425 }
1426
1427 /// Gets details about a framework deployment.
1428 ///
1429 /// # Example
1430 /// ```
1431 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1432 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1433 /// async fn sample(
1434 /// client: &Deployment, organization_id: &str, location_id: &str, framework_deployment_id: &str
1435 /// ) -> Result<()> {
1436 /// let response = client.get_framework_deployment()
1437 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/frameworkDeployments/{framework_deployment_id}"))
1438 /// .send().await?;
1439 /// println!("response {:?}", response);
1440 /// Ok(())
1441 /// }
1442 /// ```
1443 pub fn get_framework_deployment(&self) -> super::builder::deployment::GetFrameworkDeployment {
1444 super::builder::deployment::GetFrameworkDeployment::new(self.inner.clone())
1445 }
1446
1447 /// Lists the framework deployments in a given parent resource.
1448 ///
1449 /// # Example
1450 /// ```
1451 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1452 /// use google_cloud_gax::paginator::ItemPaginator as _;
1453 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1454 /// async fn sample(
1455 /// client: &Deployment, organization_id: &str, location_id: &str
1456 /// ) -> Result<()> {
1457 /// let mut list = client.list_framework_deployments()
1458 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1459 /// .by_item();
1460 /// while let Some(item) = list.next().await.transpose()? {
1461 /// println!("{:?}", item);
1462 /// }
1463 /// Ok(())
1464 /// }
1465 /// ```
1466 pub fn list_framework_deployments(
1467 &self,
1468 ) -> super::builder::deployment::ListFrameworkDeployments {
1469 super::builder::deployment::ListFrameworkDeployments::new(self.inner.clone())
1470 }
1471
1472 /// Gets details about a cloud control deployment.
1473 ///
1474 /// # Example
1475 /// ```
1476 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1477 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1478 /// async fn sample(
1479 /// client: &Deployment, organization_id: &str, location_id: &str, cloud_control_deployment_id: &str
1480 /// ) -> Result<()> {
1481 /// let response = client.get_cloud_control_deployment()
1482 /// .set_name(format!("organizations/{organization_id}/locations/{location_id}/cloudControlDeployments/{cloud_control_deployment_id}"))
1483 /// .send().await?;
1484 /// println!("response {:?}", response);
1485 /// Ok(())
1486 /// }
1487 /// ```
1488 pub fn get_cloud_control_deployment(
1489 &self,
1490 ) -> super::builder::deployment::GetCloudControlDeployment {
1491 super::builder::deployment::GetCloudControlDeployment::new(self.inner.clone())
1492 }
1493
1494 /// Lists the cloud conrol deployments in a given parent resource.
1495 ///
1496 /// # Example
1497 /// ```
1498 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1499 /// use google_cloud_gax::paginator::ItemPaginator as _;
1500 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1501 /// async fn sample(
1502 /// client: &Deployment, organization_id: &str, location_id: &str
1503 /// ) -> Result<()> {
1504 /// let mut list = client.list_cloud_control_deployments()
1505 /// .set_parent(format!("organizations/{organization_id}/locations/{location_id}"))
1506 /// .by_item();
1507 /// while let Some(item) = list.next().await.transpose()? {
1508 /// println!("{:?}", item);
1509 /// }
1510 /// Ok(())
1511 /// }
1512 /// ```
1513 pub fn list_cloud_control_deployments(
1514 &self,
1515 ) -> super::builder::deployment::ListCloudControlDeployments {
1516 super::builder::deployment::ListCloudControlDeployments::new(self.inner.clone())
1517 }
1518
1519 /// Lists information about the supported locations for this service.
1520 ///
1521 /// This method lists locations based on the resource scope provided in
1522 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1523 /// **Global locations**: If `name` is empty, the method lists the
1524 /// public locations available to all projects. * **Project-specific
1525 /// locations**: If `name` follows the format
1526 /// `projects/{project}`, the method lists locations visible to that
1527 /// specific project. This includes public, private, or other
1528 /// project-specific locations enabled for the project.
1529 ///
1530 /// For gRPC and client library implementations, the resource name is
1531 /// passed as the `name` field. For direct service calls, the resource
1532 /// name is
1533 /// incorporated into the request path based on the specific service
1534 /// implementation and version.
1535 ///
1536 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1537 ///
1538 /// # Example
1539 /// ```
1540 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1541 /// use google_cloud_gax::paginator::ItemPaginator as _;
1542 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1543 /// async fn sample(
1544 /// client: &Deployment
1545 /// ) -> Result<()> {
1546 /// let mut list = client.list_locations()
1547 /// /* set fields */
1548 /// .by_item();
1549 /// while let Some(item) = list.next().await.transpose()? {
1550 /// println!("{:?}", item);
1551 /// }
1552 /// Ok(())
1553 /// }
1554 /// ```
1555 pub fn list_locations(&self) -> super::builder::deployment::ListLocations {
1556 super::builder::deployment::ListLocations::new(self.inner.clone())
1557 }
1558
1559 /// Gets information about a location.
1560 ///
1561 /// # Example
1562 /// ```
1563 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1564 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1565 /// async fn sample(
1566 /// client: &Deployment
1567 /// ) -> Result<()> {
1568 /// let response = client.get_location()
1569 /// /* set fields */
1570 /// .send().await?;
1571 /// println!("response {:?}", response);
1572 /// Ok(())
1573 /// }
1574 /// ```
1575 pub fn get_location(&self) -> super::builder::deployment::GetLocation {
1576 super::builder::deployment::GetLocation::new(self.inner.clone())
1577 }
1578
1579 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1580 ///
1581 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1582 ///
1583 /// # Example
1584 /// ```
1585 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1586 /// use google_cloud_gax::paginator::ItemPaginator as _;
1587 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1588 /// async fn sample(
1589 /// client: &Deployment
1590 /// ) -> Result<()> {
1591 /// let mut list = client.list_operations()
1592 /// /* set fields */
1593 /// .by_item();
1594 /// while let Some(item) = list.next().await.transpose()? {
1595 /// println!("{:?}", item);
1596 /// }
1597 /// Ok(())
1598 /// }
1599 /// ```
1600 pub fn list_operations(&self) -> super::builder::deployment::ListOperations {
1601 super::builder::deployment::ListOperations::new(self.inner.clone())
1602 }
1603
1604 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1605 ///
1606 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1607 ///
1608 /// # Example
1609 /// ```
1610 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1611 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1612 /// async fn sample(
1613 /// client: &Deployment
1614 /// ) -> Result<()> {
1615 /// let response = client.get_operation()
1616 /// /* set fields */
1617 /// .send().await?;
1618 /// println!("response {:?}", response);
1619 /// Ok(())
1620 /// }
1621 /// ```
1622 pub fn get_operation(&self) -> super::builder::deployment::GetOperation {
1623 super::builder::deployment::GetOperation::new(self.inner.clone())
1624 }
1625
1626 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1627 ///
1628 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1629 ///
1630 /// # Example
1631 /// ```
1632 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1633 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1634 /// async fn sample(
1635 /// client: &Deployment
1636 /// ) -> Result<()> {
1637 /// client.delete_operation()
1638 /// /* set fields */
1639 /// .send().await?;
1640 /// Ok(())
1641 /// }
1642 /// ```
1643 pub fn delete_operation(&self) -> super::builder::deployment::DeleteOperation {
1644 super::builder::deployment::DeleteOperation::new(self.inner.clone())
1645 }
1646
1647 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1648 ///
1649 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1650 ///
1651 /// # Example
1652 /// ```
1653 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
1654 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1655 /// async fn sample(
1656 /// client: &Deployment
1657 /// ) -> Result<()> {
1658 /// client.cancel_operation()
1659 /// /* set fields */
1660 /// .send().await?;
1661 /// Ok(())
1662 /// }
1663 /// ```
1664 pub fn cancel_operation(&self) -> super::builder::deployment::CancelOperation {
1665 super::builder::deployment::CancelOperation::new(self.inner.clone())
1666 }
1667}
1668
1669/// Implements a client for the Cloud Security Compliance API.
1670///
1671/// # Example
1672/// ```
1673/// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1674/// use google_cloud_gax::paginator::ItemPaginator as _;
1675/// async fn sample(
1676/// project_id: &str,
1677/// location_id: &str,
1678/// ) -> anyhow::Result<()> {
1679/// let client = Monitoring::builder().build().await?;
1680/// let mut list = client.list_framework_compliance_summaries()
1681/// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1682/// .by_item();
1683/// while let Some(item) = list.next().await.transpose()? {
1684/// println!("{:?}", item);
1685/// }
1686/// Ok(())
1687/// }
1688/// ```
1689///
1690/// # Service Description
1691///
1692/// Service describing handlers for resources
1693///
1694/// # Configuration
1695///
1696/// To configure `Monitoring` use the `with_*` methods in the type returned
1697/// by [builder()][Monitoring::builder]. The default configuration should
1698/// work for most applications. Common configuration changes include
1699///
1700/// * [with_endpoint()]: by default this client uses the global default endpoint
1701/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
1702/// endpoints or running in restricted networks (e.g. a network configured
1703// with [Private Google Access with VPC Service Controls]) may want to
1704/// override this default.
1705/// * [with_credentials()]: by default this client uses
1706/// [Application Default Credentials]. Applications using custom
1707/// authentication may need to override this default.
1708///
1709/// [with_endpoint()]: super::builder::monitoring::ClientBuilder::with_endpoint
1710/// [with_credentials()]: super::builder::monitoring::ClientBuilder::with_credentials
1711/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1712/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1713///
1714/// # Pooling and Cloning
1715///
1716/// `Monitoring` holds a connection pool internally, it is advised to
1717/// create one and reuse it. You do not need to wrap `Monitoring` in
1718/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1719/// already uses an `Arc` internally.
1720#[derive(Clone, Debug)]
1721pub struct Monitoring {
1722 inner: std::sync::Arc<dyn super::stub::dynamic::Monitoring>,
1723}
1724
1725impl Monitoring {
1726 /// Returns a builder for [Monitoring].
1727 ///
1728 /// ```
1729 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1730 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1731 /// let client = Monitoring::builder().build().await?;
1732 /// # Ok(()) }
1733 /// ```
1734 pub fn builder() -> super::builder::monitoring::ClientBuilder {
1735 crate::new_client_builder(super::builder::monitoring::client::Factory)
1736 }
1737
1738 /// Creates a new client from the provided stub.
1739 ///
1740 /// The most common case for calling this function is in tests mocking the
1741 /// client's behavior.
1742 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1743 where
1744 T: super::stub::Monitoring + 'static,
1745 {
1746 Self { inner: stub.into() }
1747 }
1748
1749 pub(crate) async fn new(
1750 config: gaxi::options::ClientConfig,
1751 ) -> crate::ClientBuilderResult<Self> {
1752 let inner = Self::build_inner(config).await?;
1753 Ok(Self { inner })
1754 }
1755
1756 async fn build_inner(
1757 conf: gaxi::options::ClientConfig,
1758 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Monitoring>> {
1759 if gaxi::options::tracing_enabled(&conf) {
1760 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1761 }
1762 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1763 }
1764
1765 async fn build_transport(
1766 conf: gaxi::options::ClientConfig,
1767 ) -> crate::ClientBuilderResult<impl super::stub::Monitoring> {
1768 super::transport::Monitoring::new(conf).await
1769 }
1770
1771 async fn build_with_tracing(
1772 conf: gaxi::options::ClientConfig,
1773 ) -> crate::ClientBuilderResult<impl super::stub::Monitoring> {
1774 Self::build_transport(conf)
1775 .await
1776 .map(super::tracing::Monitoring::new)
1777 }
1778
1779 /// Lists the framework compliance summary for a given scope.
1780 ///
1781 /// # Example
1782 /// ```
1783 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1784 /// use google_cloud_gax::paginator::ItemPaginator as _;
1785 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1786 /// async fn sample(
1787 /// client: &Monitoring, project_id: &str, location_id: &str
1788 /// ) -> Result<()> {
1789 /// let mut list = client.list_framework_compliance_summaries()
1790 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1791 /// .by_item();
1792 /// while let Some(item) = list.next().await.transpose()? {
1793 /// println!("{:?}", item);
1794 /// }
1795 /// Ok(())
1796 /// }
1797 /// ```
1798 pub fn list_framework_compliance_summaries(
1799 &self,
1800 ) -> super::builder::monitoring::ListFrameworkComplianceSummaries {
1801 super::builder::monitoring::ListFrameworkComplianceSummaries::new(self.inner.clone())
1802 }
1803
1804 /// Lists the finding summary by category for a given scope.
1805 ///
1806 /// # Example
1807 /// ```
1808 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1809 /// use google_cloud_gax::paginator::ItemPaginator as _;
1810 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1811 /// async fn sample(
1812 /// client: &Monitoring, project_id: &str, location_id: &str
1813 /// ) -> Result<()> {
1814 /// let mut list = client.list_finding_summaries()
1815 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
1816 /// .by_item();
1817 /// while let Some(item) = list.next().await.transpose()? {
1818 /// println!("{:?}", item);
1819 /// }
1820 /// Ok(())
1821 /// }
1822 /// ```
1823 pub fn list_finding_summaries(&self) -> super::builder::monitoring::ListFindingSummaries {
1824 super::builder::monitoring::ListFindingSummaries::new(self.inner.clone())
1825 }
1826
1827 /// Fetches the framework compliance report for a given scope.
1828 ///
1829 /// # Example
1830 /// ```
1831 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1832 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1833 /// async fn sample(
1834 /// client: &Monitoring
1835 /// ) -> Result<()> {
1836 /// let response = client.fetch_framework_compliance_report()
1837 /// /* set fields */
1838 /// .send().await?;
1839 /// println!("response {:?}", response);
1840 /// Ok(())
1841 /// }
1842 /// ```
1843 pub fn fetch_framework_compliance_report(
1844 &self,
1845 ) -> super::builder::monitoring::FetchFrameworkComplianceReport {
1846 super::builder::monitoring::FetchFrameworkComplianceReport::new(self.inner.clone())
1847 }
1848
1849 /// Lists the control compliance summary for a given scope.
1850 ///
1851 /// # Example
1852 /// ```
1853 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1854 /// use google_cloud_gax::paginator::ItemPaginator as _;
1855 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1856 /// async fn sample(
1857 /// client: &Monitoring, project_id: &str, location_id: &str, framework_compliance_report_id: &str
1858 /// ) -> Result<()> {
1859 /// let mut list = client.list_control_compliance_summaries()
1860 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/frameworkComplianceReports/{framework_compliance_report_id}"))
1861 /// .by_item();
1862 /// while let Some(item) = list.next().await.transpose()? {
1863 /// println!("{:?}", item);
1864 /// }
1865 /// Ok(())
1866 /// }
1867 /// ```
1868 pub fn list_control_compliance_summaries(
1869 &self,
1870 ) -> super::builder::monitoring::ListControlComplianceSummaries {
1871 super::builder::monitoring::ListControlComplianceSummaries::new(self.inner.clone())
1872 }
1873
1874 /// Gets the aggregated compliance report over time for a given scope.
1875 ///
1876 /// # Example
1877 /// ```
1878 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1879 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1880 /// async fn sample(
1881 /// client: &Monitoring
1882 /// ) -> Result<()> {
1883 /// let response = client.aggregate_framework_compliance_report()
1884 /// /* set fields */
1885 /// .send().await?;
1886 /// println!("response {:?}", response);
1887 /// Ok(())
1888 /// }
1889 /// ```
1890 pub fn aggregate_framework_compliance_report(
1891 &self,
1892 ) -> super::builder::monitoring::AggregateFrameworkComplianceReport {
1893 super::builder::monitoring::AggregateFrameworkComplianceReport::new(self.inner.clone())
1894 }
1895
1896 /// Lists information about the supported locations for this service.
1897 ///
1898 /// This method lists locations based on the resource scope provided in
1899 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1900 /// **Global locations**: If `name` is empty, the method lists the
1901 /// public locations available to all projects. * **Project-specific
1902 /// locations**: If `name` follows the format
1903 /// `projects/{project}`, the method lists locations visible to that
1904 /// specific project. This includes public, private, or other
1905 /// project-specific locations enabled for the project.
1906 ///
1907 /// For gRPC and client library implementations, the resource name is
1908 /// passed as the `name` field. For direct service calls, the resource
1909 /// name is
1910 /// incorporated into the request path based on the specific service
1911 /// implementation and version.
1912 ///
1913 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1914 ///
1915 /// # Example
1916 /// ```
1917 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1918 /// use google_cloud_gax::paginator::ItemPaginator as _;
1919 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1920 /// async fn sample(
1921 /// client: &Monitoring
1922 /// ) -> Result<()> {
1923 /// let mut list = client.list_locations()
1924 /// /* set fields */
1925 /// .by_item();
1926 /// while let Some(item) = list.next().await.transpose()? {
1927 /// println!("{:?}", item);
1928 /// }
1929 /// Ok(())
1930 /// }
1931 /// ```
1932 pub fn list_locations(&self) -> super::builder::monitoring::ListLocations {
1933 super::builder::monitoring::ListLocations::new(self.inner.clone())
1934 }
1935
1936 /// Gets information about a location.
1937 ///
1938 /// # Example
1939 /// ```
1940 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1941 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1942 /// async fn sample(
1943 /// client: &Monitoring
1944 /// ) -> Result<()> {
1945 /// let response = client.get_location()
1946 /// /* set fields */
1947 /// .send().await?;
1948 /// println!("response {:?}", response);
1949 /// Ok(())
1950 /// }
1951 /// ```
1952 pub fn get_location(&self) -> super::builder::monitoring::GetLocation {
1953 super::builder::monitoring::GetLocation::new(self.inner.clone())
1954 }
1955
1956 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1957 ///
1958 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1959 ///
1960 /// # Example
1961 /// ```
1962 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1963 /// use google_cloud_gax::paginator::ItemPaginator as _;
1964 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1965 /// async fn sample(
1966 /// client: &Monitoring
1967 /// ) -> Result<()> {
1968 /// let mut list = client.list_operations()
1969 /// /* set fields */
1970 /// .by_item();
1971 /// while let Some(item) = list.next().await.transpose()? {
1972 /// println!("{:?}", item);
1973 /// }
1974 /// Ok(())
1975 /// }
1976 /// ```
1977 pub fn list_operations(&self) -> super::builder::monitoring::ListOperations {
1978 super::builder::monitoring::ListOperations::new(self.inner.clone())
1979 }
1980
1981 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1982 ///
1983 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1984 ///
1985 /// # Example
1986 /// ```
1987 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
1988 /// use google_cloud_cloudsecuritycompliance_v1::Result;
1989 /// async fn sample(
1990 /// client: &Monitoring
1991 /// ) -> Result<()> {
1992 /// let response = client.get_operation()
1993 /// /* set fields */
1994 /// .send().await?;
1995 /// println!("response {:?}", response);
1996 /// Ok(())
1997 /// }
1998 /// ```
1999 pub fn get_operation(&self) -> super::builder::monitoring::GetOperation {
2000 super::builder::monitoring::GetOperation::new(self.inner.clone())
2001 }
2002
2003 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2004 ///
2005 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2006 ///
2007 /// # Example
2008 /// ```
2009 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
2010 /// use google_cloud_cloudsecuritycompliance_v1::Result;
2011 /// async fn sample(
2012 /// client: &Monitoring
2013 /// ) -> Result<()> {
2014 /// client.delete_operation()
2015 /// /* set fields */
2016 /// .send().await?;
2017 /// Ok(())
2018 /// }
2019 /// ```
2020 pub fn delete_operation(&self) -> super::builder::monitoring::DeleteOperation {
2021 super::builder::monitoring::DeleteOperation::new(self.inner.clone())
2022 }
2023
2024 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2025 ///
2026 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2027 ///
2028 /// # Example
2029 /// ```
2030 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
2031 /// use google_cloud_cloudsecuritycompliance_v1::Result;
2032 /// async fn sample(
2033 /// client: &Monitoring
2034 /// ) -> Result<()> {
2035 /// client.cancel_operation()
2036 /// /* set fields */
2037 /// .send().await?;
2038 /// Ok(())
2039 /// }
2040 /// ```
2041 pub fn cancel_operation(&self) -> super::builder::monitoring::CancelOperation {
2042 super::builder::monitoring::CancelOperation::new(self.inner.clone())
2043 }
2044}