google_cloud_securitycenter_v2/client.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19/// Implements a client for the Security Command Center API.
20///
21/// # Example
22/// ```
23/// # use google_cloud_securitycenter_v2::client::SecurityCenter;
24/// use google_cloud_gax::paginator::ItemPaginator as _;
25/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
26/// let client = SecurityCenter::builder().build().await?;
27/// let parent = "parent_value";
28/// let mut list = client.list_attack_paths()
29/// .set_parent(parent)
30/// .by_item();
31/// while let Some(item) = list.next().await.transpose()? {
32/// println!("{:?}", item);
33/// }
34/// # Ok(()) }
35/// ```
36///
37/// # Service Description
38///
39/// V2 APIs for Security Center service.
40///
41/// # Configuration
42///
43/// To configure `SecurityCenter` use the `with_*` methods in the type returned
44/// by [builder()][SecurityCenter::builder]. The default configuration should
45/// work for most applications. Common configuration changes include
46///
47/// * [with_endpoint()]: by default this client uses the global default endpoint
48/// (`https://securitycenter.googleapis.com`). Applications using regional
49/// endpoints or running in restricted networks (e.g. a network configured
50// with [Private Google Access with VPC Service Controls]) may want to
51/// override this default.
52/// * [with_credentials()]: by default this client uses
53/// [Application Default Credentials]. Applications using custom
54/// authentication may need to override this default.
55///
56/// [with_endpoint()]: super::builder::security_center::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::security_center::ClientBuilder::with_credentials
58/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
59/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
60///
61/// # Pooling and Cloning
62///
63/// `SecurityCenter` holds a connection pool internally, it is advised to
64/// create one and reuse it. You do not need to wrap `SecurityCenter` in
65/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
66/// already uses an `Arc` internally.
67#[derive(Clone, Debug)]
68pub struct SecurityCenter {
69 inner: std::sync::Arc<dyn super::stub::dynamic::SecurityCenter>,
70}
71
72impl SecurityCenter {
73 /// Returns a builder for [SecurityCenter].
74 ///
75 /// ```
76 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
78 /// let client = SecurityCenter::builder().build().await?;
79 /// # Ok(()) }
80 /// ```
81 pub fn builder() -> super::builder::security_center::ClientBuilder {
82 crate::new_client_builder(super::builder::security_center::client::Factory)
83 }
84
85 /// Creates a new client from the provided stub.
86 ///
87 /// The most common case for calling this function is in tests mocking the
88 /// client's behavior.
89 pub fn from_stub<T>(stub: T) -> Self
90 where
91 T: super::stub::SecurityCenter + 'static,
92 {
93 Self {
94 inner: std::sync::Arc::new(stub),
95 }
96 }
97
98 pub(crate) async fn new(
99 config: gaxi::options::ClientConfig,
100 ) -> crate::ClientBuilderResult<Self> {
101 let inner = Self::build_inner(config).await?;
102 Ok(Self { inner })
103 }
104
105 async fn build_inner(
106 conf: gaxi::options::ClientConfig,
107 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SecurityCenter>> {
108 if gaxi::options::tracing_enabled(&conf) {
109 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
110 }
111 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
112 }
113
114 async fn build_transport(
115 conf: gaxi::options::ClientConfig,
116 ) -> crate::ClientBuilderResult<impl super::stub::SecurityCenter> {
117 super::transport::SecurityCenter::new(conf).await
118 }
119
120 async fn build_with_tracing(
121 conf: gaxi::options::ClientConfig,
122 ) -> crate::ClientBuilderResult<impl super::stub::SecurityCenter> {
123 Self::build_transport(conf)
124 .await
125 .map(super::tracing::SecurityCenter::new)
126 }
127
128 /// Creates a ResourceValueConfig for an organization. Maps user's tags to
129 /// difference resource values for use by the attack path simulation.
130 ///
131 /// # Example
132 /// ```
133 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
134 /// use google_cloud_securitycenter_v2::Result;
135 /// async fn sample(
136 /// client: &SecurityCenter
137 /// ) -> Result<()> {
138 /// let response = client.batch_create_resource_value_configs()
139 /// /* set fields */
140 /// .send().await?;
141 /// println!("response {:?}", response);
142 /// Ok(())
143 /// }
144 /// ```
145 pub fn batch_create_resource_value_configs(
146 &self,
147 ) -> super::builder::security_center::BatchCreateResourceValueConfigs {
148 super::builder::security_center::BatchCreateResourceValueConfigs::new(self.inner.clone())
149 }
150
151 /// Kicks off an LRO to bulk mute findings for a parent based on a filter. If
152 /// no location is specified, findings are muted in global. The parent
153 /// can be either an organization, folder, or project. The findings matched by
154 /// the filter will be muted after the LRO is done.
155 ///
156 /// # Long running operations
157 ///
158 /// This method is used to start, and/or poll a [long-running Operation].
159 /// The [Working with long-running operations] chapter in the [user guide]
160 /// covers these operations in detail.
161 ///
162 /// [long-running operation]: https://google.aip.dev/151
163 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
164 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
165 ///
166 /// # Example
167 /// ```
168 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
169 /// use google_cloud_lro::Poller;
170 /// use google_cloud_securitycenter_v2::Result;
171 /// async fn sample(
172 /// client: &SecurityCenter
173 /// ) -> Result<()> {
174 /// let response = client.bulk_mute_findings()
175 /// /* set fields */
176 /// .poller().until_done().await?;
177 /// println!("response {:?}", response);
178 /// Ok(())
179 /// }
180 /// ```
181 pub fn bulk_mute_findings(&self) -> super::builder::security_center::BulkMuteFindings {
182 super::builder::security_center::BulkMuteFindings::new(self.inner.clone())
183 }
184
185 /// Creates a BigQuery export.
186 ///
187 /// # Example
188 /// ```
189 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
190 /// use google_cloud_securitycenter_v2::model::BigQueryExport;
191 /// use google_cloud_securitycenter_v2::Result;
192 /// async fn sample(
193 /// client: &SecurityCenter, parent: &str
194 /// ) -> Result<()> {
195 /// let response = client.create_big_query_export()
196 /// .set_parent(parent)
197 /// .set_big_query_export(
198 /// BigQueryExport::new()/* set fields */
199 /// )
200 /// .send().await?;
201 /// println!("response {:?}", response);
202 /// Ok(())
203 /// }
204 /// ```
205 pub fn create_big_query_export(&self) -> super::builder::security_center::CreateBigQueryExport {
206 super::builder::security_center::CreateBigQueryExport::new(self.inner.clone())
207 }
208
209 /// Creates a finding in a location. The corresponding source must exist for
210 /// finding creation to succeed.
211 ///
212 /// # Example
213 /// ```
214 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
215 /// use google_cloud_securitycenter_v2::model::Finding;
216 /// use google_cloud_securitycenter_v2::Result;
217 /// async fn sample(
218 /// client: &SecurityCenter, parent: &str
219 /// ) -> Result<()> {
220 /// let response = client.create_finding()
221 /// .set_parent(parent)
222 /// .set_finding_id("finding_id_value")
223 /// .set_finding(
224 /// Finding::new()/* set fields */
225 /// )
226 /// .send().await?;
227 /// println!("response {:?}", response);
228 /// Ok(())
229 /// }
230 /// ```
231 pub fn create_finding(&self) -> super::builder::security_center::CreateFinding {
232 super::builder::security_center::CreateFinding::new(self.inner.clone())
233 }
234
235 /// Creates a mute config.
236 ///
237 /// # Example
238 /// ```
239 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
240 /// use google_cloud_securitycenter_v2::model::MuteConfig;
241 /// use google_cloud_securitycenter_v2::Result;
242 /// async fn sample(
243 /// client: &SecurityCenter, parent: &str
244 /// ) -> Result<()> {
245 /// let response = client.create_mute_config()
246 /// .set_parent(parent)
247 /// .set_mute_config(
248 /// MuteConfig::new()/* set fields */
249 /// )
250 /// .send().await?;
251 /// println!("response {:?}", response);
252 /// Ok(())
253 /// }
254 /// ```
255 pub fn create_mute_config(&self) -> super::builder::security_center::CreateMuteConfig {
256 super::builder::security_center::CreateMuteConfig::new(self.inner.clone())
257 }
258
259 /// Creates a notification config.
260 ///
261 /// # Example
262 /// ```
263 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
264 /// use google_cloud_securitycenter_v2::model::NotificationConfig;
265 /// use google_cloud_securitycenter_v2::Result;
266 /// async fn sample(
267 /// client: &SecurityCenter, parent: &str
268 /// ) -> Result<()> {
269 /// let response = client.create_notification_config()
270 /// .set_parent(parent)
271 /// .set_notification_config(
272 /// NotificationConfig::new()/* set fields */
273 /// )
274 /// .send().await?;
275 /// println!("response {:?}", response);
276 /// Ok(())
277 /// }
278 /// ```
279 pub fn create_notification_config(
280 &self,
281 ) -> super::builder::security_center::CreateNotificationConfig {
282 super::builder::security_center::CreateNotificationConfig::new(self.inner.clone())
283 }
284
285 /// Creates a source.
286 ///
287 /// # Example
288 /// ```
289 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
290 /// use google_cloud_securitycenter_v2::model::Source;
291 /// use google_cloud_securitycenter_v2::Result;
292 /// async fn sample(
293 /// client: &SecurityCenter, parent: &str
294 /// ) -> Result<()> {
295 /// let response = client.create_source()
296 /// .set_parent(parent)
297 /// .set_source(
298 /// Source::new()/* set fields */
299 /// )
300 /// .send().await?;
301 /// println!("response {:?}", response);
302 /// Ok(())
303 /// }
304 /// ```
305 pub fn create_source(&self) -> super::builder::security_center::CreateSource {
306 super::builder::security_center::CreateSource::new(self.inner.clone())
307 }
308
309 /// Deletes an existing BigQuery export.
310 ///
311 /// # Example
312 /// ```
313 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
314 /// use google_cloud_securitycenter_v2::Result;
315 /// async fn sample(
316 /// client: &SecurityCenter, name: &str
317 /// ) -> Result<()> {
318 /// client.delete_big_query_export()
319 /// .set_name(name)
320 /// .send().await?;
321 /// Ok(())
322 /// }
323 /// ```
324 pub fn delete_big_query_export(&self) -> super::builder::security_center::DeleteBigQueryExport {
325 super::builder::security_center::DeleteBigQueryExport::new(self.inner.clone())
326 }
327
328 /// Deletes an existing mute config. If no location is specified, default is
329 /// global.
330 ///
331 /// # Example
332 /// ```
333 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
334 /// use google_cloud_securitycenter_v2::Result;
335 /// async fn sample(
336 /// client: &SecurityCenter, name: &str
337 /// ) -> Result<()> {
338 /// client.delete_mute_config()
339 /// .set_name(name)
340 /// .send().await?;
341 /// Ok(())
342 /// }
343 /// ```
344 pub fn delete_mute_config(&self) -> super::builder::security_center::DeleteMuteConfig {
345 super::builder::security_center::DeleteMuteConfig::new(self.inner.clone())
346 }
347
348 /// Deletes a notification config.
349 ///
350 /// # Example
351 /// ```
352 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
353 /// use google_cloud_securitycenter_v2::Result;
354 /// async fn sample(
355 /// client: &SecurityCenter, name: &str
356 /// ) -> Result<()> {
357 /// client.delete_notification_config()
358 /// .set_name(name)
359 /// .send().await?;
360 /// Ok(())
361 /// }
362 /// ```
363 pub fn delete_notification_config(
364 &self,
365 ) -> super::builder::security_center::DeleteNotificationConfig {
366 super::builder::security_center::DeleteNotificationConfig::new(self.inner.clone())
367 }
368
369 /// Deletes a ResourceValueConfig.
370 ///
371 /// # Example
372 /// ```
373 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
374 /// use google_cloud_securitycenter_v2::Result;
375 /// async fn sample(
376 /// client: &SecurityCenter, name: &str
377 /// ) -> Result<()> {
378 /// client.delete_resource_value_config()
379 /// .set_name(name)
380 /// .send().await?;
381 /// Ok(())
382 /// }
383 /// ```
384 pub fn delete_resource_value_config(
385 &self,
386 ) -> super::builder::security_center::DeleteResourceValueConfig {
387 super::builder::security_center::DeleteResourceValueConfig::new(self.inner.clone())
388 }
389
390 /// Gets a BigQuery export.
391 ///
392 /// # Example
393 /// ```
394 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
395 /// use google_cloud_securitycenter_v2::Result;
396 /// async fn sample(
397 /// client: &SecurityCenter, name: &str
398 /// ) -> Result<()> {
399 /// let response = client.get_big_query_export()
400 /// .set_name(name)
401 /// .send().await?;
402 /// println!("response {:?}", response);
403 /// Ok(())
404 /// }
405 /// ```
406 pub fn get_big_query_export(&self) -> super::builder::security_center::GetBigQueryExport {
407 super::builder::security_center::GetBigQueryExport::new(self.inner.clone())
408 }
409
410 /// Get the simulation by name or the latest simulation for the given
411 /// organization.
412 ///
413 /// # Example
414 /// ```
415 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
416 /// use google_cloud_securitycenter_v2::Result;
417 /// async fn sample(
418 /// client: &SecurityCenter, name: &str
419 /// ) -> Result<()> {
420 /// let response = client.get_simulation()
421 /// .set_name(name)
422 /// .send().await?;
423 /// println!("response {:?}", response);
424 /// Ok(())
425 /// }
426 /// ```
427 pub fn get_simulation(&self) -> super::builder::security_center::GetSimulation {
428 super::builder::security_center::GetSimulation::new(self.inner.clone())
429 }
430
431 /// Get the valued resource by name
432 ///
433 /// # Example
434 /// ```
435 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
436 /// use google_cloud_securitycenter_v2::Result;
437 /// async fn sample(
438 /// client: &SecurityCenter, name: &str
439 /// ) -> Result<()> {
440 /// let response = client.get_valued_resource()
441 /// .set_name(name)
442 /// .send().await?;
443 /// println!("response {:?}", response);
444 /// Ok(())
445 /// }
446 /// ```
447 pub fn get_valued_resource(&self) -> super::builder::security_center::GetValuedResource {
448 super::builder::security_center::GetValuedResource::new(self.inner.clone())
449 }
450
451 /// Gets the access control policy on the specified Source.
452 ///
453 /// # Example
454 /// ```
455 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
456 /// use google_cloud_securitycenter_v2::Result;
457 /// async fn sample(
458 /// client: &SecurityCenter
459 /// ) -> Result<()> {
460 /// let response = client.get_iam_policy()
461 /// /* set fields */
462 /// .send().await?;
463 /// println!("response {:?}", response);
464 /// Ok(())
465 /// }
466 /// ```
467 pub fn get_iam_policy(&self) -> super::builder::security_center::GetIamPolicy {
468 super::builder::security_center::GetIamPolicy::new(self.inner.clone())
469 }
470
471 /// Gets a mute config. If no location is specified, default is
472 /// global.
473 ///
474 /// # Example
475 /// ```
476 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
477 /// use google_cloud_securitycenter_v2::Result;
478 /// async fn sample(
479 /// client: &SecurityCenter, name: &str
480 /// ) -> Result<()> {
481 /// let response = client.get_mute_config()
482 /// .set_name(name)
483 /// .send().await?;
484 /// println!("response {:?}", response);
485 /// Ok(())
486 /// }
487 /// ```
488 pub fn get_mute_config(&self) -> super::builder::security_center::GetMuteConfig {
489 super::builder::security_center::GetMuteConfig::new(self.inner.clone())
490 }
491
492 /// Gets a notification config.
493 ///
494 /// # Example
495 /// ```
496 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
497 /// use google_cloud_securitycenter_v2::Result;
498 /// async fn sample(
499 /// client: &SecurityCenter, name: &str
500 /// ) -> Result<()> {
501 /// let response = client.get_notification_config()
502 /// .set_name(name)
503 /// .send().await?;
504 /// println!("response {:?}", response);
505 /// Ok(())
506 /// }
507 /// ```
508 pub fn get_notification_config(
509 &self,
510 ) -> super::builder::security_center::GetNotificationConfig {
511 super::builder::security_center::GetNotificationConfig::new(self.inner.clone())
512 }
513
514 /// Gets a ResourceValueConfig.
515 ///
516 /// # Example
517 /// ```
518 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
519 /// use google_cloud_securitycenter_v2::Result;
520 /// async fn sample(
521 /// client: &SecurityCenter, name: &str
522 /// ) -> Result<()> {
523 /// let response = client.get_resource_value_config()
524 /// .set_name(name)
525 /// .send().await?;
526 /// println!("response {:?}", response);
527 /// Ok(())
528 /// }
529 /// ```
530 pub fn get_resource_value_config(
531 &self,
532 ) -> super::builder::security_center::GetResourceValueConfig {
533 super::builder::security_center::GetResourceValueConfig::new(self.inner.clone())
534 }
535
536 /// Gets a source.
537 ///
538 /// # Example
539 /// ```
540 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
541 /// use google_cloud_securitycenter_v2::Result;
542 /// async fn sample(
543 /// client: &SecurityCenter, name: &str
544 /// ) -> Result<()> {
545 /// let response = client.get_source()
546 /// .set_name(name)
547 /// .send().await?;
548 /// println!("response {:?}", response);
549 /// Ok(())
550 /// }
551 /// ```
552 pub fn get_source(&self) -> super::builder::security_center::GetSource {
553 super::builder::security_center::GetSource::new(self.inner.clone())
554 }
555
556 /// Filters an organization or source's findings and groups them by their
557 /// specified properties in a location. If no location is specified, findings
558 /// are assumed to be in global
559 ///
560 /// To group across all sources provide a `-` as the source id.
561 /// The following list shows some examples:
562 ///
563 /// + `/v2/organizations/{organization_id}/sources/-/findings`
564 ///
565 /// `/v2/organizations/{organization_id}/sources/-/locations/{location_id}/findings`
566 ///
567 /// + `/v2/folders/{folder_id}/sources/-/findings`
568 /// + `/v2/folders/{folder_id}/sources/-/locations/{location_id}/findings`
569 /// + `/v2/projects/{project_id}/sources/-/findings`
570 /// + `/v2/projects/{project_id}/sources/-/locations/{location_id}/findings`
571 ///
572 /// # Example
573 /// ```
574 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
575 /// use google_cloud_gax::paginator::ItemPaginator as _;
576 /// use google_cloud_securitycenter_v2::Result;
577 /// async fn sample(
578 /// client: &SecurityCenter
579 /// ) -> Result<()> {
580 /// let mut list = client.group_findings()
581 /// /* set fields */
582 /// .by_item();
583 /// while let Some(item) = list.next().await.transpose()? {
584 /// println!("{:?}", item);
585 /// }
586 /// Ok(())
587 /// }
588 /// ```
589 pub fn group_findings(&self) -> super::builder::security_center::GroupFindings {
590 super::builder::security_center::GroupFindings::new(self.inner.clone())
591 }
592
593 /// Lists the attack paths for a set of simulation results or valued resources
594 /// and filter.
595 ///
596 /// # Example
597 /// ```
598 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
599 /// use google_cloud_gax::paginator::ItemPaginator as _;
600 /// use google_cloud_securitycenter_v2::Result;
601 /// async fn sample(
602 /// client: &SecurityCenter, parent: &str
603 /// ) -> Result<()> {
604 /// let mut list = client.list_attack_paths()
605 /// .set_parent(parent)
606 /// .by_item();
607 /// while let Some(item) = list.next().await.transpose()? {
608 /// println!("{:?}", item);
609 /// }
610 /// Ok(())
611 /// }
612 /// ```
613 pub fn list_attack_paths(&self) -> super::builder::security_center::ListAttackPaths {
614 super::builder::security_center::ListAttackPaths::new(self.inner.clone())
615 }
616
617 /// Lists BigQuery exports. Note that when requesting BigQuery exports at a
618 /// given level all exports under that level are also returned e.g. if
619 /// requesting BigQuery exports under a folder, then all BigQuery exports
620 /// immediately under the folder plus the ones created under the projects
621 /// within the folder are returned.
622 ///
623 /// # Example
624 /// ```
625 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
626 /// use google_cloud_gax::paginator::ItemPaginator as _;
627 /// use google_cloud_securitycenter_v2::Result;
628 /// async fn sample(
629 /// client: &SecurityCenter, parent: &str
630 /// ) -> Result<()> {
631 /// let mut list = client.list_big_query_exports()
632 /// .set_parent(parent)
633 /// .by_item();
634 /// while let Some(item) = list.next().await.transpose()? {
635 /// println!("{:?}", item);
636 /// }
637 /// Ok(())
638 /// }
639 /// ```
640 pub fn list_big_query_exports(&self) -> super::builder::security_center::ListBigQueryExports {
641 super::builder::security_center::ListBigQueryExports::new(self.inner.clone())
642 }
643
644 /// Lists an organization or source's findings.
645 ///
646 /// To list across all sources for a given location provide a `-` as the source
647 /// id. If no location is specified, finding are assumed to be in global.
648 /// The following list shows some examples:
649 ///
650 /// + `/v2/organizations/{organization_id}/sources/-/findings`
651 ///
652 /// `/v2/organizations/{organization_id}/sources/-/locations/{location_id}/findings`
653 ///
654 /// # Example
655 /// ```
656 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
657 /// use google_cloud_gax::paginator::ItemPaginator as _;
658 /// use google_cloud_securitycenter_v2::Result;
659 /// async fn sample(
660 /// client: &SecurityCenter
661 /// ) -> Result<()> {
662 /// let mut list = client.list_findings()
663 /// /* set fields */
664 /// .by_item();
665 /// while let Some(item) = list.next().await.transpose()? {
666 /// println!("{:?}", item);
667 /// }
668 /// Ok(())
669 /// }
670 /// ```
671 pub fn list_findings(&self) -> super::builder::security_center::ListFindings {
672 super::builder::security_center::ListFindings::new(self.inner.clone())
673 }
674
675 /// Lists mute configs. If no location is specified, default is
676 /// global.
677 ///
678 /// # Example
679 /// ```
680 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
681 /// use google_cloud_gax::paginator::ItemPaginator as _;
682 /// use google_cloud_securitycenter_v2::Result;
683 /// async fn sample(
684 /// client: &SecurityCenter, parent: &str
685 /// ) -> Result<()> {
686 /// let mut list = client.list_mute_configs()
687 /// .set_parent(parent)
688 /// .by_item();
689 /// while let Some(item) = list.next().await.transpose()? {
690 /// println!("{:?}", item);
691 /// }
692 /// Ok(())
693 /// }
694 /// ```
695 pub fn list_mute_configs(&self) -> super::builder::security_center::ListMuteConfigs {
696 super::builder::security_center::ListMuteConfigs::new(self.inner.clone())
697 }
698
699 /// Lists notification configs.
700 ///
701 /// # Example
702 /// ```
703 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
704 /// use google_cloud_gax::paginator::ItemPaginator as _;
705 /// use google_cloud_securitycenter_v2::Result;
706 /// async fn sample(
707 /// client: &SecurityCenter, parent: &str
708 /// ) -> Result<()> {
709 /// let mut list = client.list_notification_configs()
710 /// .set_parent(parent)
711 /// .by_item();
712 /// while let Some(item) = list.next().await.transpose()? {
713 /// println!("{:?}", item);
714 /// }
715 /// Ok(())
716 /// }
717 /// ```
718 pub fn list_notification_configs(
719 &self,
720 ) -> super::builder::security_center::ListNotificationConfigs {
721 super::builder::security_center::ListNotificationConfigs::new(self.inner.clone())
722 }
723
724 /// Lists all ResourceValueConfigs.
725 ///
726 /// # Example
727 /// ```
728 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
729 /// use google_cloud_gax::paginator::ItemPaginator as _;
730 /// use google_cloud_securitycenter_v2::Result;
731 /// async fn sample(
732 /// client: &SecurityCenter, parent: &str
733 /// ) -> Result<()> {
734 /// let mut list = client.list_resource_value_configs()
735 /// .set_parent(parent)
736 /// .by_item();
737 /// while let Some(item) = list.next().await.transpose()? {
738 /// println!("{:?}", item);
739 /// }
740 /// Ok(())
741 /// }
742 /// ```
743 pub fn list_resource_value_configs(
744 &self,
745 ) -> super::builder::security_center::ListResourceValueConfigs {
746 super::builder::security_center::ListResourceValueConfigs::new(self.inner.clone())
747 }
748
749 /// Lists all sources belonging to an organization.
750 ///
751 /// # Example
752 /// ```
753 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
754 /// use google_cloud_gax::paginator::ItemPaginator as _;
755 /// use google_cloud_securitycenter_v2::Result;
756 /// async fn sample(
757 /// client: &SecurityCenter, parent: &str
758 /// ) -> Result<()> {
759 /// let mut list = client.list_sources()
760 /// .set_parent(parent)
761 /// .by_item();
762 /// while let Some(item) = list.next().await.transpose()? {
763 /// println!("{:?}", item);
764 /// }
765 /// Ok(())
766 /// }
767 /// ```
768 pub fn list_sources(&self) -> super::builder::security_center::ListSources {
769 super::builder::security_center::ListSources::new(self.inner.clone())
770 }
771
772 /// Lists the valued resources for a set of simulation results and filter.
773 ///
774 /// # Example
775 /// ```
776 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
777 /// use google_cloud_gax::paginator::ItemPaginator as _;
778 /// use google_cloud_securitycenter_v2::Result;
779 /// async fn sample(
780 /// client: &SecurityCenter, parent: &str
781 /// ) -> Result<()> {
782 /// let mut list = client.list_valued_resources()
783 /// .set_parent(parent)
784 /// .by_item();
785 /// while let Some(item) = list.next().await.transpose()? {
786 /// println!("{:?}", item);
787 /// }
788 /// Ok(())
789 /// }
790 /// ```
791 pub fn list_valued_resources(&self) -> super::builder::security_center::ListValuedResources {
792 super::builder::security_center::ListValuedResources::new(self.inner.clone())
793 }
794
795 /// Updates the state of a finding. If no location is specified, finding is
796 /// assumed to be in global
797 ///
798 /// # Example
799 /// ```
800 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
801 /// use google_cloud_securitycenter_v2::Result;
802 /// async fn sample(
803 /// client: &SecurityCenter
804 /// ) -> Result<()> {
805 /// let response = client.set_finding_state()
806 /// /* set fields */
807 /// .send().await?;
808 /// println!("response {:?}", response);
809 /// Ok(())
810 /// }
811 /// ```
812 pub fn set_finding_state(&self) -> super::builder::security_center::SetFindingState {
813 super::builder::security_center::SetFindingState::new(self.inner.clone())
814 }
815
816 /// Sets the access control policy on the specified Source.
817 ///
818 /// # Example
819 /// ```
820 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
821 /// use google_cloud_securitycenter_v2::Result;
822 /// async fn sample(
823 /// client: &SecurityCenter
824 /// ) -> Result<()> {
825 /// let response = client.set_iam_policy()
826 /// /* set fields */
827 /// .send().await?;
828 /// println!("response {:?}", response);
829 /// Ok(())
830 /// }
831 /// ```
832 pub fn set_iam_policy(&self) -> super::builder::security_center::SetIamPolicy {
833 super::builder::security_center::SetIamPolicy::new(self.inner.clone())
834 }
835
836 /// Updates the mute state of a finding. If no location is specified, finding
837 /// is assumed to be in global
838 ///
839 /// # Example
840 /// ```
841 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
842 /// use google_cloud_securitycenter_v2::Result;
843 /// async fn sample(
844 /// client: &SecurityCenter
845 /// ) -> Result<()> {
846 /// let response = client.set_mute()
847 /// /* set fields */
848 /// .send().await?;
849 /// println!("response {:?}", response);
850 /// Ok(())
851 /// }
852 /// ```
853 pub fn set_mute(&self) -> super::builder::security_center::SetMute {
854 super::builder::security_center::SetMute::new(self.inner.clone())
855 }
856
857 /// Returns the permissions that a caller has on the specified source.
858 ///
859 /// # Example
860 /// ```
861 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
862 /// use google_cloud_securitycenter_v2::Result;
863 /// async fn sample(
864 /// client: &SecurityCenter
865 /// ) -> Result<()> {
866 /// let response = client.test_iam_permissions()
867 /// /* set fields */
868 /// .send().await?;
869 /// println!("response {:?}", response);
870 /// Ok(())
871 /// }
872 /// ```
873 pub fn test_iam_permissions(&self) -> super::builder::security_center::TestIamPermissions {
874 super::builder::security_center::TestIamPermissions::new(self.inner.clone())
875 }
876
877 /// Updates a BigQuery export.
878 ///
879 /// # Example
880 /// ```
881 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
882 /// # extern crate wkt as google_cloud_wkt;
883 /// use google_cloud_wkt::FieldMask;
884 /// use google_cloud_securitycenter_v2::model::BigQueryExport;
885 /// use google_cloud_securitycenter_v2::Result;
886 /// async fn sample(
887 /// client: &SecurityCenter, name: &str
888 /// ) -> Result<()> {
889 /// let response = client.update_big_query_export()
890 /// .set_big_query_export(
891 /// BigQueryExport::new().set_name(name)/* set fields */
892 /// )
893 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
894 /// .send().await?;
895 /// println!("response {:?}", response);
896 /// Ok(())
897 /// }
898 /// ```
899 pub fn update_big_query_export(&self) -> super::builder::security_center::UpdateBigQueryExport {
900 super::builder::security_center::UpdateBigQueryExport::new(self.inner.clone())
901 }
902
903 /// Updates external system. This is for a given finding. If no location is
904 /// specified, finding is assumed to be in global
905 ///
906 /// # Example
907 /// ```
908 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
909 /// # extern crate wkt as google_cloud_wkt;
910 /// use google_cloud_wkt::FieldMask;
911 /// use google_cloud_securitycenter_v2::model::ExternalSystem;
912 /// use google_cloud_securitycenter_v2::Result;
913 /// async fn sample(
914 /// client: &SecurityCenter, name: &str
915 /// ) -> Result<()> {
916 /// let response = client.update_external_system()
917 /// .set_external_system(
918 /// ExternalSystem::new().set_name(name)/* set fields */
919 /// )
920 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
921 /// .send().await?;
922 /// println!("response {:?}", response);
923 /// Ok(())
924 /// }
925 /// ```
926 pub fn update_external_system(&self) -> super::builder::security_center::UpdateExternalSystem {
927 super::builder::security_center::UpdateExternalSystem::new(self.inner.clone())
928 }
929
930 /// Creates or updates a finding. If no location is specified, finding is
931 /// assumed to be in global. The corresponding source must exist for a finding
932 /// creation to succeed.
933 ///
934 /// # Example
935 /// ```
936 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
937 /// # extern crate wkt as google_cloud_wkt;
938 /// use google_cloud_wkt::FieldMask;
939 /// use google_cloud_securitycenter_v2::model::Finding;
940 /// use google_cloud_securitycenter_v2::Result;
941 /// async fn sample(
942 /// client: &SecurityCenter, name: &str
943 /// ) -> Result<()> {
944 /// let response = client.update_finding()
945 /// .set_finding(
946 /// Finding::new().set_name(name)/* set fields */
947 /// )
948 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
949 /// .send().await?;
950 /// println!("response {:?}", response);
951 /// Ok(())
952 /// }
953 /// ```
954 pub fn update_finding(&self) -> super::builder::security_center::UpdateFinding {
955 super::builder::security_center::UpdateFinding::new(self.inner.clone())
956 }
957
958 /// Updates a mute config. If no location is specified, default is
959 /// global.
960 ///
961 /// # Example
962 /// ```
963 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
964 /// # extern crate wkt as google_cloud_wkt;
965 /// use google_cloud_wkt::FieldMask;
966 /// use google_cloud_securitycenter_v2::model::MuteConfig;
967 /// use google_cloud_securitycenter_v2::Result;
968 /// async fn sample(
969 /// client: &SecurityCenter, name: &str
970 /// ) -> Result<()> {
971 /// let response = client.update_mute_config()
972 /// .set_mute_config(
973 /// MuteConfig::new().set_name(name)/* set fields */
974 /// )
975 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
976 /// .send().await?;
977 /// println!("response {:?}", response);
978 /// Ok(())
979 /// }
980 /// ```
981 pub fn update_mute_config(&self) -> super::builder::security_center::UpdateMuteConfig {
982 super::builder::security_center::UpdateMuteConfig::new(self.inner.clone())
983 }
984
985 /// Updates a notification config. The following update
986 /// fields are allowed: description, pubsub_topic, streaming_config.filter
987 ///
988 /// # Example
989 /// ```
990 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
991 /// # extern crate wkt as google_cloud_wkt;
992 /// use google_cloud_wkt::FieldMask;
993 /// use google_cloud_securitycenter_v2::model::NotificationConfig;
994 /// use google_cloud_securitycenter_v2::Result;
995 /// async fn sample(
996 /// client: &SecurityCenter, name: &str
997 /// ) -> Result<()> {
998 /// let response = client.update_notification_config()
999 /// .set_notification_config(
1000 /// NotificationConfig::new().set_name(name)/* set fields */
1001 /// )
1002 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1003 /// .send().await?;
1004 /// println!("response {:?}", response);
1005 /// Ok(())
1006 /// }
1007 /// ```
1008 pub fn update_notification_config(
1009 &self,
1010 ) -> super::builder::security_center::UpdateNotificationConfig {
1011 super::builder::security_center::UpdateNotificationConfig::new(self.inner.clone())
1012 }
1013
1014 /// Updates an existing ResourceValueConfigs with new rules.
1015 ///
1016 /// # Example
1017 /// ```
1018 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
1019 /// # extern crate wkt as google_cloud_wkt;
1020 /// use google_cloud_wkt::FieldMask;
1021 /// use google_cloud_securitycenter_v2::model::ResourceValueConfig;
1022 /// use google_cloud_securitycenter_v2::Result;
1023 /// async fn sample(
1024 /// client: &SecurityCenter, name: &str
1025 /// ) -> Result<()> {
1026 /// let response = client.update_resource_value_config()
1027 /// .set_resource_value_config(
1028 /// ResourceValueConfig::new().set_name(name)/* set fields */
1029 /// )
1030 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1031 /// .send().await?;
1032 /// println!("response {:?}", response);
1033 /// Ok(())
1034 /// }
1035 /// ```
1036 pub fn update_resource_value_config(
1037 &self,
1038 ) -> super::builder::security_center::UpdateResourceValueConfig {
1039 super::builder::security_center::UpdateResourceValueConfig::new(self.inner.clone())
1040 }
1041
1042 /// Updates security marks. For Finding Security marks, if no location is
1043 /// specified, finding is assumed to be in global. Assets Security Marks can
1044 /// only be accessed through global endpoint.
1045 ///
1046 /// # Example
1047 /// ```
1048 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
1049 /// # extern crate wkt as google_cloud_wkt;
1050 /// use google_cloud_wkt::FieldMask;
1051 /// use google_cloud_securitycenter_v2::model::SecurityMarks;
1052 /// use google_cloud_securitycenter_v2::Result;
1053 /// async fn sample(
1054 /// client: &SecurityCenter, name: &str
1055 /// ) -> Result<()> {
1056 /// let response = client.update_security_marks()
1057 /// .set_security_marks(
1058 /// SecurityMarks::new().set_name(name)/* 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_security_marks(&self) -> super::builder::security_center::UpdateSecurityMarks {
1067 super::builder::security_center::UpdateSecurityMarks::new(self.inner.clone())
1068 }
1069
1070 /// Updates a source.
1071 ///
1072 /// # Example
1073 /// ```
1074 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
1075 /// # extern crate wkt as google_cloud_wkt;
1076 /// use google_cloud_wkt::FieldMask;
1077 /// use google_cloud_securitycenter_v2::model::Source;
1078 /// use google_cloud_securitycenter_v2::Result;
1079 /// async fn sample(
1080 /// client: &SecurityCenter, name: &str
1081 /// ) -> Result<()> {
1082 /// let response = client.update_source()
1083 /// .set_source(
1084 /// Source::new().set_name(name)/* set fields */
1085 /// )
1086 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1087 /// .send().await?;
1088 /// println!("response {:?}", response);
1089 /// Ok(())
1090 /// }
1091 /// ```
1092 pub fn update_source(&self) -> super::builder::security_center::UpdateSource {
1093 super::builder::security_center::UpdateSource::new(self.inner.clone())
1094 }
1095
1096 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1097 ///
1098 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1099 ///
1100 /// # Example
1101 /// ```
1102 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
1103 /// use google_cloud_gax::paginator::ItemPaginator as _;
1104 /// use google_cloud_securitycenter_v2::Result;
1105 /// async fn sample(
1106 /// client: &SecurityCenter
1107 /// ) -> Result<()> {
1108 /// let mut list = client.list_operations()
1109 /// /* set fields */
1110 /// .by_item();
1111 /// while let Some(item) = list.next().await.transpose()? {
1112 /// println!("{:?}", item);
1113 /// }
1114 /// Ok(())
1115 /// }
1116 /// ```
1117 pub fn list_operations(&self) -> super::builder::security_center::ListOperations {
1118 super::builder::security_center::ListOperations::new(self.inner.clone())
1119 }
1120
1121 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1122 ///
1123 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1124 ///
1125 /// # Example
1126 /// ```
1127 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
1128 /// use google_cloud_securitycenter_v2::Result;
1129 /// async fn sample(
1130 /// client: &SecurityCenter
1131 /// ) -> Result<()> {
1132 /// let response = client.get_operation()
1133 /// /* set fields */
1134 /// .send().await?;
1135 /// println!("response {:?}", response);
1136 /// Ok(())
1137 /// }
1138 /// ```
1139 pub fn get_operation(&self) -> super::builder::security_center::GetOperation {
1140 super::builder::security_center::GetOperation::new(self.inner.clone())
1141 }
1142
1143 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1144 ///
1145 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1146 ///
1147 /// # Example
1148 /// ```
1149 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
1150 /// use google_cloud_securitycenter_v2::Result;
1151 /// async fn sample(
1152 /// client: &SecurityCenter
1153 /// ) -> Result<()> {
1154 /// client.delete_operation()
1155 /// /* set fields */
1156 /// .send().await?;
1157 /// Ok(())
1158 /// }
1159 /// ```
1160 pub fn delete_operation(&self) -> super::builder::security_center::DeleteOperation {
1161 super::builder::security_center::DeleteOperation::new(self.inner.clone())
1162 }
1163
1164 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1165 ///
1166 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1167 ///
1168 /// # Example
1169 /// ```
1170 /// # use google_cloud_securitycenter_v2::client::SecurityCenter;
1171 /// use google_cloud_securitycenter_v2::Result;
1172 /// async fn sample(
1173 /// client: &SecurityCenter
1174 /// ) -> Result<()> {
1175 /// client.cancel_operation()
1176 /// /* set fields */
1177 /// .send().await?;
1178 /// Ok(())
1179 /// }
1180 /// ```
1181 pub fn cancel_operation(&self) -> super::builder::security_center::CancelOperation {
1182 super::builder::security_center::CancelOperation::new(self.inner.clone())
1183 }
1184}