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