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