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/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24/// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
25/// let client = Audit::builder().build().await?;
26/// // use `client` to make requests to the Cloud Security Compliance API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// Service describing handlers for resources
33///
34/// # Configuration
35///
36/// To configure `Audit` use the `with_*` methods in the type returned
37/// by [builder()][Audit::builder]. The default configuration should
38/// work for most applications. Common configuration changes include
39///
40/// * [with_endpoint()]: by default this client uses the global default endpoint
41/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
42/// endpoints or running in restricted networks (e.g. a network configured
43// with [Private Google Access with VPC Service Controls]) may want to
44/// override this default.
45/// * [with_credentials()]: by default this client uses
46/// [Application Default Credentials]. Applications using custom
47/// authentication may need to override this default.
48///
49/// [with_endpoint()]: super::builder::audit::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::audit::ClientBuilder::credentials
51/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
52/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
53///
54/// # Pooling and Cloning
55///
56/// `Audit` holds a connection pool internally, it is advised to
57/// create one and the reuse it. You do not need to wrap `Audit` in
58/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
59/// already uses an `Arc` internally.
60#[derive(Clone, Debug)]
61pub struct Audit {
62 inner: std::sync::Arc<dyn super::stub::dynamic::Audit>,
63}
64
65impl Audit {
66 /// Returns a builder for [Audit].
67 ///
68 /// ```
69 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
70 /// # use google_cloud_cloudsecuritycompliance_v1::client::Audit;
71 /// let client = Audit::builder().build().await?;
72 /// # Ok(()) }
73 /// ```
74 pub fn builder() -> super::builder::audit::ClientBuilder {
75 crate::new_client_builder(super::builder::audit::client::Factory)
76 }
77
78 /// Creates a new client from the provided stub.
79 ///
80 /// The most common case for calling this function is in tests mocking the
81 /// client's behavior.
82 pub fn from_stub<T>(stub: T) -> Self
83 where
84 T: super::stub::Audit + 'static,
85 {
86 Self {
87 inner: std::sync::Arc::new(stub),
88 }
89 }
90
91 pub(crate) async fn new(
92 config: gaxi::options::ClientConfig,
93 ) -> crate::ClientBuilderResult<Self> {
94 let inner = Self::build_inner(config).await?;
95 Ok(Self { inner })
96 }
97
98 async fn build_inner(
99 conf: gaxi::options::ClientConfig,
100 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Audit>> {
101 if gaxi::options::tracing_enabled(&conf) {
102 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
103 }
104 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
105 }
106
107 async fn build_transport(
108 conf: gaxi::options::ClientConfig,
109 ) -> crate::ClientBuilderResult<impl super::stub::Audit> {
110 super::transport::Audit::new(conf).await
111 }
112
113 async fn build_with_tracing(
114 conf: gaxi::options::ClientConfig,
115 ) -> crate::ClientBuilderResult<impl super::stub::Audit> {
116 Self::build_transport(conf)
117 .await
118 .map(super::tracing::Audit::new)
119 }
120
121 /// Generates an audit scope report for a framework.
122 pub fn generate_framework_audit_scope_report(
123 &self,
124 ) -> super::builder::audit::GenerateFrameworkAuditScopeReport {
125 super::builder::audit::GenerateFrameworkAuditScopeReport::new(self.inner.clone())
126 }
127
128 /// Creates an audit scope report for a framework.
129 ///
130 /// # Long running operations
131 ///
132 /// This method is used to start, and/or poll a [long-running Operation].
133 /// The [Working with long-running operations] chapter in the [user guide]
134 /// covers these operations in detail.
135 ///
136 /// [long-running operation]: https://google.aip.dev/151
137 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
138 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
139 pub fn create_framework_audit(&self) -> super::builder::audit::CreateFrameworkAudit {
140 super::builder::audit::CreateFrameworkAudit::new(self.inner.clone())
141 }
142
143 /// Lists the framework audits for a given organization, folder, or project.
144 pub fn list_framework_audits(&self) -> super::builder::audit::ListFrameworkAudits {
145 super::builder::audit::ListFrameworkAudits::new(self.inner.clone())
146 }
147
148 /// Gets the details for a framework audit.
149 pub fn get_framework_audit(&self) -> super::builder::audit::GetFrameworkAudit {
150 super::builder::audit::GetFrameworkAudit::new(self.inner.clone())
151 }
152
153 /// Lists information about the supported locations for this service.
154 pub fn list_locations(&self) -> super::builder::audit::ListLocations {
155 super::builder::audit::ListLocations::new(self.inner.clone())
156 }
157
158 /// Gets information about a location.
159 pub fn get_location(&self) -> super::builder::audit::GetLocation {
160 super::builder::audit::GetLocation::new(self.inner.clone())
161 }
162
163 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
164 ///
165 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
166 pub fn list_operations(&self) -> super::builder::audit::ListOperations {
167 super::builder::audit::ListOperations::new(self.inner.clone())
168 }
169
170 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
171 ///
172 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
173 pub fn get_operation(&self) -> super::builder::audit::GetOperation {
174 super::builder::audit::GetOperation::new(self.inner.clone())
175 }
176
177 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
178 ///
179 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
180 pub fn delete_operation(&self) -> super::builder::audit::DeleteOperation {
181 super::builder::audit::DeleteOperation::new(self.inner.clone())
182 }
183
184 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
185 ///
186 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
187 pub fn cancel_operation(&self) -> super::builder::audit::CancelOperation {
188 super::builder::audit::CancelOperation::new(self.inner.clone())
189 }
190}
191
192/// Implements a client for the Cloud Security Compliance API.
193///
194/// # Example
195/// ```
196/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
197/// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
198/// let client = CmEnrollmentService::builder().build().await?;
199/// // use `client` to make requests to the Cloud Security Compliance API.
200/// # Ok(()) }
201/// ```
202///
203/// # Service Description
204///
205/// Service describing CmEnrollment related RPCs for
206/// complianceManager.
207///
208/// # Configuration
209///
210/// To configure `CmEnrollmentService` use the `with_*` methods in the type returned
211/// by [builder()][CmEnrollmentService::builder]. The default configuration should
212/// work for most applications. Common configuration changes include
213///
214/// * [with_endpoint()]: by default this client uses the global default endpoint
215/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
216/// endpoints or running in restricted networks (e.g. a network configured
217// with [Private Google Access with VPC Service Controls]) may want to
218/// override this default.
219/// * [with_credentials()]: by default this client uses
220/// [Application Default Credentials]. Applications using custom
221/// authentication may need to override this default.
222///
223/// [with_endpoint()]: super::builder::cm_enrollment_service::ClientBuilder::with_endpoint
224/// [with_credentials()]: super::builder::cm_enrollment_service::ClientBuilder::credentials
225/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
226/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
227///
228/// # Pooling and Cloning
229///
230/// `CmEnrollmentService` holds a connection pool internally, it is advised to
231/// create one and the reuse it. You do not need to wrap `CmEnrollmentService` in
232/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
233/// already uses an `Arc` internally.
234#[derive(Clone, Debug)]
235pub struct CmEnrollmentService {
236 inner: std::sync::Arc<dyn super::stub::dynamic::CmEnrollmentService>,
237}
238
239impl CmEnrollmentService {
240 /// Returns a builder for [CmEnrollmentService].
241 ///
242 /// ```
243 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
244 /// # use google_cloud_cloudsecuritycompliance_v1::client::CmEnrollmentService;
245 /// let client = CmEnrollmentService::builder().build().await?;
246 /// # Ok(()) }
247 /// ```
248 pub fn builder() -> super::builder::cm_enrollment_service::ClientBuilder {
249 crate::new_client_builder(super::builder::cm_enrollment_service::client::Factory)
250 }
251
252 /// Creates a new client from the provided stub.
253 ///
254 /// The most common case for calling this function is in tests mocking the
255 /// client's behavior.
256 pub fn from_stub<T>(stub: T) -> Self
257 where
258 T: super::stub::CmEnrollmentService + 'static,
259 {
260 Self {
261 inner: std::sync::Arc::new(stub),
262 }
263 }
264
265 pub(crate) async fn new(
266 config: gaxi::options::ClientConfig,
267 ) -> crate::ClientBuilderResult<Self> {
268 let inner = Self::build_inner(config).await?;
269 Ok(Self { inner })
270 }
271
272 async fn build_inner(
273 conf: gaxi::options::ClientConfig,
274 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CmEnrollmentService>>
275 {
276 if gaxi::options::tracing_enabled(&conf) {
277 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
278 }
279 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
280 }
281
282 async fn build_transport(
283 conf: gaxi::options::ClientConfig,
284 ) -> crate::ClientBuilderResult<impl super::stub::CmEnrollmentService> {
285 super::transport::CmEnrollmentService::new(conf).await
286 }
287
288 async fn build_with_tracing(
289 conf: gaxi::options::ClientConfig,
290 ) -> crate::ClientBuilderResult<impl super::stub::CmEnrollmentService> {
291 Self::build_transport(conf)
292 .await
293 .map(super::tracing::CmEnrollmentService::new)
294 }
295
296 /// Updates the Compliance Manager enrollment for a resource to facilitate
297 /// an audit.
298 /// Use this method to enroll a resource in Compliance Manager or to
299 /// create or update feature-specific configurations.
300 pub fn update_cm_enrollment(
301 &self,
302 ) -> super::builder::cm_enrollment_service::UpdateCmEnrollment {
303 super::builder::cm_enrollment_service::UpdateCmEnrollment::new(self.inner.clone())
304 }
305
306 /// Calculates the effective Compliance Manager enrollment for a resource.
307 /// An effective enrollment is either a direct enrollment of a
308 /// resource (if it exists), or an enrollment of the closest parent of a
309 /// resource that's enrolled in Compliance Manager.
310 pub fn calculate_effective_cm_enrollment(
311 &self,
312 ) -> super::builder::cm_enrollment_service::CalculateEffectiveCmEnrollment {
313 super::builder::cm_enrollment_service::CalculateEffectiveCmEnrollment::new(
314 self.inner.clone(),
315 )
316 }
317
318 /// Lists information about the supported locations for this service.
319 pub fn list_locations(&self) -> super::builder::cm_enrollment_service::ListLocations {
320 super::builder::cm_enrollment_service::ListLocations::new(self.inner.clone())
321 }
322
323 /// Gets information about a location.
324 pub fn get_location(&self) -> super::builder::cm_enrollment_service::GetLocation {
325 super::builder::cm_enrollment_service::GetLocation::new(self.inner.clone())
326 }
327
328 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
329 ///
330 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
331 pub fn list_operations(&self) -> super::builder::cm_enrollment_service::ListOperations {
332 super::builder::cm_enrollment_service::ListOperations::new(self.inner.clone())
333 }
334
335 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
336 ///
337 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
338 pub fn get_operation(&self) -> super::builder::cm_enrollment_service::GetOperation {
339 super::builder::cm_enrollment_service::GetOperation::new(self.inner.clone())
340 }
341
342 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
343 ///
344 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
345 pub fn delete_operation(&self) -> super::builder::cm_enrollment_service::DeleteOperation {
346 super::builder::cm_enrollment_service::DeleteOperation::new(self.inner.clone())
347 }
348
349 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
350 ///
351 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
352 pub fn cancel_operation(&self) -> super::builder::cm_enrollment_service::CancelOperation {
353 super::builder::cm_enrollment_service::CancelOperation::new(self.inner.clone())
354 }
355}
356
357/// Implements a client for the Cloud Security Compliance API.
358///
359/// # Example
360/// ```
361/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
362/// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
363/// let client = Config::builder().build().await?;
364/// // use `client` to make requests to the Cloud Security Compliance API.
365/// # Ok(()) }
366/// ```
367///
368/// # Service Description
369///
370/// Config Service manages compliance frameworks, cloud controls, and their
371/// configurations.
372///
373/// # Configuration
374///
375/// To configure `Config` use the `with_*` methods in the type returned
376/// by [builder()][Config::builder]. The default configuration should
377/// work for most applications. Common configuration changes include
378///
379/// * [with_endpoint()]: by default this client uses the global default endpoint
380/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
381/// endpoints or running in restricted networks (e.g. a network configured
382// with [Private Google Access with VPC Service Controls]) may want to
383/// override this default.
384/// * [with_credentials()]: by default this client uses
385/// [Application Default Credentials]. Applications using custom
386/// authentication may need to override this default.
387///
388/// [with_endpoint()]: super::builder::config::ClientBuilder::with_endpoint
389/// [with_credentials()]: super::builder::config::ClientBuilder::credentials
390/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
391/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
392///
393/// # Pooling and Cloning
394///
395/// `Config` holds a connection pool internally, it is advised to
396/// create one and the reuse it. You do not need to wrap `Config` in
397/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
398/// already uses an `Arc` internally.
399#[derive(Clone, Debug)]
400pub struct Config {
401 inner: std::sync::Arc<dyn super::stub::dynamic::Config>,
402}
403
404impl Config {
405 /// Returns a builder for [Config].
406 ///
407 /// ```
408 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
409 /// # use google_cloud_cloudsecuritycompliance_v1::client::Config;
410 /// let client = Config::builder().build().await?;
411 /// # Ok(()) }
412 /// ```
413 pub fn builder() -> super::builder::config::ClientBuilder {
414 crate::new_client_builder(super::builder::config::client::Factory)
415 }
416
417 /// Creates a new client from the provided stub.
418 ///
419 /// The most common case for calling this function is in tests mocking the
420 /// client's behavior.
421 pub fn from_stub<T>(stub: T) -> Self
422 where
423 T: super::stub::Config + 'static,
424 {
425 Self {
426 inner: std::sync::Arc::new(stub),
427 }
428 }
429
430 pub(crate) async fn new(
431 config: gaxi::options::ClientConfig,
432 ) -> crate::ClientBuilderResult<Self> {
433 let inner = Self::build_inner(config).await?;
434 Ok(Self { inner })
435 }
436
437 async fn build_inner(
438 conf: gaxi::options::ClientConfig,
439 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Config>> {
440 if gaxi::options::tracing_enabled(&conf) {
441 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
442 }
443 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
444 }
445
446 async fn build_transport(
447 conf: gaxi::options::ClientConfig,
448 ) -> crate::ClientBuilderResult<impl super::stub::Config> {
449 super::transport::Config::new(conf).await
450 }
451
452 async fn build_with_tracing(
453 conf: gaxi::options::ClientConfig,
454 ) -> crate::ClientBuilderResult<impl super::stub::Config> {
455 Self::build_transport(conf)
456 .await
457 .map(super::tracing::Config::new)
458 }
459
460 /// Lists the frameworks (both built-in and custom) that are available within
461 /// the parent resource. The latest major version of each framework is
462 /// returned.
463 /// This method supports pagination.
464 pub fn list_frameworks(&self) -> super::builder::config::ListFrameworks {
465 super::builder::config::ListFrameworks::new(self.inner.clone())
466 }
467
468 /// Gets details about a framework.
469 /// This method retrieves the latest major version of the framework.
470 ///
471 /// To retrieve a specific major version, include `major_revision_id` in
472 /// the request.
473 pub fn get_framework(&self) -> super::builder::config::GetFramework {
474 super::builder::config::GetFramework::new(self.inner.clone())
475 }
476
477 /// Creates a custom framework in a given parent resource.
478 /// You can't create built-in frameworks because those are managed by
479 /// Google.
480 pub fn create_framework(&self) -> super::builder::config::CreateFramework {
481 super::builder::config::CreateFramework::new(self.inner.clone())
482 }
483
484 /// Updates a custom framework.
485 /// This method allows for partial updates of a framework. Use the
486 /// `update_mask` to specify which fields to update. Consider the following:
487 ///
488 /// - If you provide an `update_mask`, only the fields that are specified
489 /// in the mask are updated.
490 /// - If you don't provide an `update_mask`, all the fields that are present
491 /// in the request's `framework` body are used to overwrite the existing
492 /// resource.
493 ///
494 /// You can only update frameworks with the `CUSTOM` type.
495 /// A successful update creates a new version of the framework.
496 pub fn update_framework(&self) -> super::builder::config::UpdateFramework {
497 super::builder::config::UpdateFramework::new(self.inner.clone())
498 }
499
500 /// Deletes a custom framework, including all its major and
501 /// minor revisions. Consider the following:
502 ///
503 /// - You can't delete built-in frameworks. You can only delete frameworks
504 /// with type `CUSTOM`.
505 /// - You can't delete frameworks that are deployed to a resource.
506 /// - You can't restore a deleted framework. This action is permanent.
507 pub fn delete_framework(&self) -> super::builder::config::DeleteFramework {
508 super::builder::config::DeleteFramework::new(self.inner.clone())
509 }
510
511 /// Lists the cloud controls (both built-in and custom) that are available
512 /// in a given parent resource. The latest major version of each cloud control
513 /// is returned.
514 /// This method supports pagination.
515 pub fn list_cloud_controls(&self) -> super::builder::config::ListCloudControls {
516 super::builder::config::ListCloudControls::new(self.inner.clone())
517 }
518
519 /// Gets details about a cloud control.
520 /// This method retrieves the latest major version of a cloud control that
521 /// you identify by name.
522 ///
523 /// By default, the latest major version of the cloud control is returned.
524 /// To retrieve a specific major version, include `major_revision_id` in
525 /// the request.
526 pub fn get_cloud_control(&self) -> super::builder::config::GetCloudControl {
527 super::builder::config::GetCloudControl::new(self.inner.clone())
528 }
529
530 /// Creates a custom cloud control in a given parent
531 /// resource.
532 /// You can't create built-in cloud controls because those are managed by
533 /// Google.
534 pub fn create_cloud_control(&self) -> super::builder::config::CreateCloudControl {
535 super::builder::config::CreateCloudControl::new(self.inner.clone())
536 }
537
538 /// Updates a custom cloud control.
539 /// This method allows for partial updates of a cloud control. Use the
540 /// `update_mask` to specify which fields to update. Consider the following:
541 ///
542 /// - If you provide an `update_mask`, only the fields that are specified
543 /// in the mask are updated.
544 /// - If you don't provide an `update_mask`, all the fields that are present
545 /// in the request's `cloud_control` body are used to overwrite the existing
546 /// resource.
547 ///
548 /// You can only update cloud controls with the `CUSTOM` type.
549 /// A successful update creates a new version of the cloud control.
550 pub fn update_cloud_control(&self) -> super::builder::config::UpdateCloudControl {
551 super::builder::config::UpdateCloudControl::new(self.inner.clone())
552 }
553
554 /// Deletes a custom cloud control, including all its
555 /// major and minor revisions. Consider the following:
556 ///
557 /// - You can't delete built-in cloud controls. You can only delete cloud
558 /// controls with type `CUSTOM`.
559 /// - You can't delete cloud controls if any of the versions are referenced
560 /// by a framework.
561 /// - You can't restore a deleted cloud control. This action is permanent.
562 pub fn delete_cloud_control(&self) -> super::builder::config::DeleteCloudControl {
563 super::builder::config::DeleteCloudControl::new(self.inner.clone())
564 }
565
566 /// Lists information about the supported locations for this service.
567 pub fn list_locations(&self) -> super::builder::config::ListLocations {
568 super::builder::config::ListLocations::new(self.inner.clone())
569 }
570
571 /// Gets information about a location.
572 pub fn get_location(&self) -> super::builder::config::GetLocation {
573 super::builder::config::GetLocation::new(self.inner.clone())
574 }
575
576 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
577 ///
578 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
579 pub fn list_operations(&self) -> super::builder::config::ListOperations {
580 super::builder::config::ListOperations::new(self.inner.clone())
581 }
582
583 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
584 ///
585 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
586 pub fn get_operation(&self) -> super::builder::config::GetOperation {
587 super::builder::config::GetOperation::new(self.inner.clone())
588 }
589
590 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
591 ///
592 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
593 pub fn delete_operation(&self) -> super::builder::config::DeleteOperation {
594 super::builder::config::DeleteOperation::new(self.inner.clone())
595 }
596
597 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
598 ///
599 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
600 pub fn cancel_operation(&self) -> super::builder::config::CancelOperation {
601 super::builder::config::CancelOperation::new(self.inner.clone())
602 }
603}
604
605/// Implements a client for the Cloud Security Compliance API.
606///
607/// # Example
608/// ```
609/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
610/// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
611/// let client = Deployment::builder().build().await?;
612/// // use `client` to make requests to the Cloud Security Compliance API.
613/// # Ok(()) }
614/// ```
615///
616/// # Service Description
617///
618/// Deployment service allows users to manage deployments of Frameworks and
619/// Cloud Controls on a target resource.
620///
621/// # Configuration
622///
623/// To configure `Deployment` use the `with_*` methods in the type returned
624/// by [builder()][Deployment::builder]. The default configuration should
625/// work for most applications. Common configuration changes include
626///
627/// * [with_endpoint()]: by default this client uses the global default endpoint
628/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
629/// endpoints or running in restricted networks (e.g. a network configured
630// with [Private Google Access with VPC Service Controls]) may want to
631/// override this default.
632/// * [with_credentials()]: by default this client uses
633/// [Application Default Credentials]. Applications using custom
634/// authentication may need to override this default.
635///
636/// [with_endpoint()]: super::builder::deployment::ClientBuilder::with_endpoint
637/// [with_credentials()]: super::builder::deployment::ClientBuilder::credentials
638/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
639/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
640///
641/// # Pooling and Cloning
642///
643/// `Deployment` holds a connection pool internally, it is advised to
644/// create one and the reuse it. You do not need to wrap `Deployment` in
645/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
646/// already uses an `Arc` internally.
647#[derive(Clone, Debug)]
648pub struct Deployment {
649 inner: std::sync::Arc<dyn super::stub::dynamic::Deployment>,
650}
651
652impl Deployment {
653 /// Returns a builder for [Deployment].
654 ///
655 /// ```
656 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
657 /// # use google_cloud_cloudsecuritycompliance_v1::client::Deployment;
658 /// let client = Deployment::builder().build().await?;
659 /// # Ok(()) }
660 /// ```
661 pub fn builder() -> super::builder::deployment::ClientBuilder {
662 crate::new_client_builder(super::builder::deployment::client::Factory)
663 }
664
665 /// Creates a new client from the provided stub.
666 ///
667 /// The most common case for calling this function is in tests mocking the
668 /// client's behavior.
669 pub fn from_stub<T>(stub: T) -> Self
670 where
671 T: super::stub::Deployment + 'static,
672 {
673 Self {
674 inner: std::sync::Arc::new(stub),
675 }
676 }
677
678 pub(crate) async fn new(
679 config: gaxi::options::ClientConfig,
680 ) -> crate::ClientBuilderResult<Self> {
681 let inner = Self::build_inner(config).await?;
682 Ok(Self { inner })
683 }
684
685 async fn build_inner(
686 conf: gaxi::options::ClientConfig,
687 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Deployment>> {
688 if gaxi::options::tracing_enabled(&conf) {
689 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
690 }
691 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
692 }
693
694 async fn build_transport(
695 conf: gaxi::options::ClientConfig,
696 ) -> crate::ClientBuilderResult<impl super::stub::Deployment> {
697 super::transport::Deployment::new(conf).await
698 }
699
700 async fn build_with_tracing(
701 conf: gaxi::options::ClientConfig,
702 ) -> crate::ClientBuilderResult<impl super::stub::Deployment> {
703 Self::build_transport(conf)
704 .await
705 .map(super::tracing::Deployment::new)
706 }
707
708 /// Creates a framework deployment in a given parent resource. A
709 /// framework deployment lets you assign a particular framework version to an
710 /// organization, folder, or project so that you can control and monitor
711 /// those resources using the framework's cloud controls.
712 ///
713 /// # Long running operations
714 ///
715 /// This method is used to start, and/or poll a [long-running Operation].
716 /// The [Working with long-running operations] chapter in the [user guide]
717 /// covers these operations in detail.
718 ///
719 /// [long-running operation]: https://google.aip.dev/151
720 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
721 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
722 pub fn create_framework_deployment(
723 &self,
724 ) -> super::builder::deployment::CreateFrameworkDeployment {
725 super::builder::deployment::CreateFrameworkDeployment::new(self.inner.clone())
726 }
727
728 /// Deletes a framework deployment.
729 ///
730 /// # Long running operations
731 ///
732 /// This method is used to start, and/or poll a [long-running Operation].
733 /// The [Working with long-running operations] chapter in the [user guide]
734 /// covers these operations in detail.
735 ///
736 /// [long-running operation]: https://google.aip.dev/151
737 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
738 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
739 pub fn delete_framework_deployment(
740 &self,
741 ) -> super::builder::deployment::DeleteFrameworkDeployment {
742 super::builder::deployment::DeleteFrameworkDeployment::new(self.inner.clone())
743 }
744
745 /// Gets details about a framework deployment.
746 pub fn get_framework_deployment(&self) -> super::builder::deployment::GetFrameworkDeployment {
747 super::builder::deployment::GetFrameworkDeployment::new(self.inner.clone())
748 }
749
750 /// Lists the framework deployments in a given parent resource.
751 pub fn list_framework_deployments(
752 &self,
753 ) -> super::builder::deployment::ListFrameworkDeployments {
754 super::builder::deployment::ListFrameworkDeployments::new(self.inner.clone())
755 }
756
757 /// Gets details about a cloud control deployment.
758 pub fn get_cloud_control_deployment(
759 &self,
760 ) -> super::builder::deployment::GetCloudControlDeployment {
761 super::builder::deployment::GetCloudControlDeployment::new(self.inner.clone())
762 }
763
764 /// Lists the cloud conrol deployments in a given parent resource.
765 pub fn list_cloud_control_deployments(
766 &self,
767 ) -> super::builder::deployment::ListCloudControlDeployments {
768 super::builder::deployment::ListCloudControlDeployments::new(self.inner.clone())
769 }
770
771 /// Lists information about the supported locations for this service.
772 pub fn list_locations(&self) -> super::builder::deployment::ListLocations {
773 super::builder::deployment::ListLocations::new(self.inner.clone())
774 }
775
776 /// Gets information about a location.
777 pub fn get_location(&self) -> super::builder::deployment::GetLocation {
778 super::builder::deployment::GetLocation::new(self.inner.clone())
779 }
780
781 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
782 ///
783 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
784 pub fn list_operations(&self) -> super::builder::deployment::ListOperations {
785 super::builder::deployment::ListOperations::new(self.inner.clone())
786 }
787
788 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
789 ///
790 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
791 pub fn get_operation(&self) -> super::builder::deployment::GetOperation {
792 super::builder::deployment::GetOperation::new(self.inner.clone())
793 }
794
795 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
796 ///
797 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
798 pub fn delete_operation(&self) -> super::builder::deployment::DeleteOperation {
799 super::builder::deployment::DeleteOperation::new(self.inner.clone())
800 }
801
802 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
803 ///
804 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
805 pub fn cancel_operation(&self) -> super::builder::deployment::CancelOperation {
806 super::builder::deployment::CancelOperation::new(self.inner.clone())
807 }
808}
809
810/// Implements a client for the Cloud Security Compliance API.
811///
812/// # Example
813/// ```
814/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
815/// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
816/// let client = Monitoring::builder().build().await?;
817/// // use `client` to make requests to the Cloud Security Compliance API.
818/// # Ok(()) }
819/// ```
820///
821/// # Service Description
822///
823/// Service describing handlers for resources
824///
825/// # Configuration
826///
827/// To configure `Monitoring` use the `with_*` methods in the type returned
828/// by [builder()][Monitoring::builder]. The default configuration should
829/// work for most applications. Common configuration changes include
830///
831/// * [with_endpoint()]: by default this client uses the global default endpoint
832/// (`https://cloudsecuritycompliance.googleapis.com`). Applications using regional
833/// endpoints or running in restricted networks (e.g. a network configured
834// with [Private Google Access with VPC Service Controls]) may want to
835/// override this default.
836/// * [with_credentials()]: by default this client uses
837/// [Application Default Credentials]. Applications using custom
838/// authentication may need to override this default.
839///
840/// [with_endpoint()]: super::builder::monitoring::ClientBuilder::with_endpoint
841/// [with_credentials()]: super::builder::monitoring::ClientBuilder::credentials
842/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
843/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
844///
845/// # Pooling and Cloning
846///
847/// `Monitoring` holds a connection pool internally, it is advised to
848/// create one and the reuse it. You do not need to wrap `Monitoring` in
849/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
850/// already uses an `Arc` internally.
851#[derive(Clone, Debug)]
852pub struct Monitoring {
853 inner: std::sync::Arc<dyn super::stub::dynamic::Monitoring>,
854}
855
856impl Monitoring {
857 /// Returns a builder for [Monitoring].
858 ///
859 /// ```
860 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
861 /// # use google_cloud_cloudsecuritycompliance_v1::client::Monitoring;
862 /// let client = Monitoring::builder().build().await?;
863 /// # Ok(()) }
864 /// ```
865 pub fn builder() -> super::builder::monitoring::ClientBuilder {
866 crate::new_client_builder(super::builder::monitoring::client::Factory)
867 }
868
869 /// Creates a new client from the provided stub.
870 ///
871 /// The most common case for calling this function is in tests mocking the
872 /// client's behavior.
873 pub fn from_stub<T>(stub: T) -> Self
874 where
875 T: super::stub::Monitoring + 'static,
876 {
877 Self {
878 inner: std::sync::Arc::new(stub),
879 }
880 }
881
882 pub(crate) async fn new(
883 config: gaxi::options::ClientConfig,
884 ) -> crate::ClientBuilderResult<Self> {
885 let inner = Self::build_inner(config).await?;
886 Ok(Self { inner })
887 }
888
889 async fn build_inner(
890 conf: gaxi::options::ClientConfig,
891 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Monitoring>> {
892 if gaxi::options::tracing_enabled(&conf) {
893 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
894 }
895 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
896 }
897
898 async fn build_transport(
899 conf: gaxi::options::ClientConfig,
900 ) -> crate::ClientBuilderResult<impl super::stub::Monitoring> {
901 super::transport::Monitoring::new(conf).await
902 }
903
904 async fn build_with_tracing(
905 conf: gaxi::options::ClientConfig,
906 ) -> crate::ClientBuilderResult<impl super::stub::Monitoring> {
907 Self::build_transport(conf)
908 .await
909 .map(super::tracing::Monitoring::new)
910 }
911
912 /// Lists the framework compliance summary for a given scope.
913 pub fn list_framework_compliance_summaries(
914 &self,
915 ) -> super::builder::monitoring::ListFrameworkComplianceSummaries {
916 super::builder::monitoring::ListFrameworkComplianceSummaries::new(self.inner.clone())
917 }
918
919 /// Lists the finding summary by category for a given scope.
920 pub fn list_finding_summaries(&self) -> super::builder::monitoring::ListFindingSummaries {
921 super::builder::monitoring::ListFindingSummaries::new(self.inner.clone())
922 }
923
924 /// Fetches the framework compliance report for a given scope.
925 pub fn fetch_framework_compliance_report(
926 &self,
927 ) -> super::builder::monitoring::FetchFrameworkComplianceReport {
928 super::builder::monitoring::FetchFrameworkComplianceReport::new(self.inner.clone())
929 }
930
931 /// Lists the control compliance summary for a given scope.
932 pub fn list_control_compliance_summaries(
933 &self,
934 ) -> super::builder::monitoring::ListControlComplianceSummaries {
935 super::builder::monitoring::ListControlComplianceSummaries::new(self.inner.clone())
936 }
937
938 /// Gets the aggregated compliance report over time for a given scope.
939 pub fn aggregate_framework_compliance_report(
940 &self,
941 ) -> super::builder::monitoring::AggregateFrameworkComplianceReport {
942 super::builder::monitoring::AggregateFrameworkComplianceReport::new(self.inner.clone())
943 }
944
945 /// Lists information about the supported locations for this service.
946 pub fn list_locations(&self) -> super::builder::monitoring::ListLocations {
947 super::builder::monitoring::ListLocations::new(self.inner.clone())
948 }
949
950 /// Gets information about a location.
951 pub fn get_location(&self) -> super::builder::monitoring::GetLocation {
952 super::builder::monitoring::GetLocation::new(self.inner.clone())
953 }
954
955 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
956 ///
957 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
958 pub fn list_operations(&self) -> super::builder::monitoring::ListOperations {
959 super::builder::monitoring::ListOperations::new(self.inner.clone())
960 }
961
962 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
963 ///
964 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
965 pub fn get_operation(&self) -> super::builder::monitoring::GetOperation {
966 super::builder::monitoring::GetOperation::new(self.inner.clone())
967 }
968
969 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
970 ///
971 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
972 pub fn delete_operation(&self) -> super::builder::monitoring::DeleteOperation {
973 super::builder::monitoring::DeleteOperation::new(self.inner.clone())
974 }
975
976 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
977 ///
978 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
979 pub fn cancel_operation(&self) -> super::builder::monitoring::CancelOperation {
980 super::builder::monitoring::CancelOperation::new(self.inner.clone())
981 }
982}