Skip to main content

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