google_cloud_containeranalysis_v1/model.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
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_grafeas_v1;
25extern crate google_cloud_iam_v1;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// The request to generate and export SBOM. Target must be specified for the
38/// request.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct ExportSBOMRequest {
42 /// Required. The name of the resource in the form of
43 /// `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
44 pub name: std::string::String,
45
46 /// The location of the SBOM export.
47 pub target: std::option::Option<crate::model::export_sbom_request::Target>,
48
49 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
50}
51
52impl ExportSBOMRequest {
53 pub fn new() -> Self {
54 std::default::Default::default()
55 }
56
57 /// Sets the value of [name][crate::model::ExportSBOMRequest::name].
58 ///
59 /// # Example
60 /// ```ignore,no_run
61 /// # use google_cloud_containeranalysis_v1::model::ExportSBOMRequest;
62 /// let x = ExportSBOMRequest::new().set_name("example");
63 /// ```
64 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
65 self.name = v.into();
66 self
67 }
68
69 /// Sets the value of [target][crate::model::ExportSBOMRequest::target].
70 ///
71 /// Note that all the setters affecting `target` are mutually
72 /// exclusive.
73 ///
74 /// # Example
75 /// ```ignore,no_run
76 /// # use google_cloud_containeranalysis_v1::model::ExportSBOMRequest;
77 /// use google_cloud_containeranalysis_v1::model::export_sbom_request::CloudStorageLocation;
78 /// let x = ExportSBOMRequest::new().set_target(Some(
79 /// google_cloud_containeranalysis_v1::model::export_sbom_request::Target::CloudStorageLocation(CloudStorageLocation::default().into())));
80 /// ```
81 pub fn set_target<
82 T: std::convert::Into<std::option::Option<crate::model::export_sbom_request::Target>>,
83 >(
84 mut self,
85 v: T,
86 ) -> Self {
87 self.target = v.into();
88 self
89 }
90
91 /// The value of [target][crate::model::ExportSBOMRequest::target]
92 /// if it holds a `CloudStorageLocation`, `None` if the field is not set or
93 /// holds a different branch.
94 pub fn cloud_storage_location(
95 &self,
96 ) -> std::option::Option<
97 &std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
98 > {
99 #[allow(unreachable_patterns)]
100 self.target.as_ref().and_then(|v| match v {
101 crate::model::export_sbom_request::Target::CloudStorageLocation(v) => {
102 std::option::Option::Some(v)
103 }
104 _ => std::option::Option::None,
105 })
106 }
107
108 /// Sets the value of [target][crate::model::ExportSBOMRequest::target]
109 /// to hold a `CloudStorageLocation`.
110 ///
111 /// Note that all the setters affecting `target` are
112 /// mutually exclusive.
113 ///
114 /// # Example
115 /// ```ignore,no_run
116 /// # use google_cloud_containeranalysis_v1::model::ExportSBOMRequest;
117 /// use google_cloud_containeranalysis_v1::model::export_sbom_request::CloudStorageLocation;
118 /// let x = ExportSBOMRequest::new().set_cloud_storage_location(CloudStorageLocation::default()/* use setters */);
119 /// assert!(x.cloud_storage_location().is_some());
120 /// ```
121 pub fn set_cloud_storage_location<
122 T: std::convert::Into<
123 std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
124 >,
125 >(
126 mut self,
127 v: T,
128 ) -> Self {
129 self.target = std::option::Option::Some(
130 crate::model::export_sbom_request::Target::CloudStorageLocation(v.into()),
131 );
132 self
133 }
134}
135
136impl wkt::message::Message for ExportSBOMRequest {
137 fn typename() -> &'static str {
138 "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest"
139 }
140}
141
142/// Defines additional types related to [ExportSBOMRequest].
143pub mod export_sbom_request {
144 #[allow(unused_imports)]
145 use super::*;
146
147 /// Empty placeholder to denote that this is a Google Cloud Storage
148 /// export request.
149 #[derive(Clone, Default, PartialEq)]
150 #[non_exhaustive]
151 pub struct CloudStorageLocation {
152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
153 }
154
155 impl CloudStorageLocation {
156 pub fn new() -> Self {
157 std::default::Default::default()
158 }
159 }
160
161 impl wkt::message::Message for CloudStorageLocation {
162 fn typename() -> &'static str {
163 "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest.CloudStorageLocation"
164 }
165 }
166
167 /// The location of the SBOM export.
168 #[derive(Clone, Debug, PartialEq)]
169 #[non_exhaustive]
170 pub enum Target {
171 /// Optional. Empty placeholder to denote that this is a Google Cloud Storage
172 /// export request.
173 CloudStorageLocation(
174 std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
175 ),
176 }
177}
178
179/// The response from a call to ExportSBOM.
180#[derive(Clone, Default, PartialEq)]
181#[non_exhaustive]
182pub struct ExportSBOMResponse {
183 /// The name of the discovery occurrence in the form
184 /// "projects/{project_id}/occurrences/{OCCURRENCE_ID}
185 /// It can be used to track the progress of the SBOM export.
186 pub discovery_occurrence: std::string::String,
187
188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
189}
190
191impl ExportSBOMResponse {
192 pub fn new() -> Self {
193 std::default::Default::default()
194 }
195
196 /// Sets the value of [discovery_occurrence][crate::model::ExportSBOMResponse::discovery_occurrence].
197 ///
198 /// # Example
199 /// ```ignore,no_run
200 /// # use google_cloud_containeranalysis_v1::model::ExportSBOMResponse;
201 /// let x = ExportSBOMResponse::new().set_discovery_occurrence("example");
202 /// ```
203 pub fn set_discovery_occurrence<T: std::convert::Into<std::string::String>>(
204 mut self,
205 v: T,
206 ) -> Self {
207 self.discovery_occurrence = v.into();
208 self
209 }
210}
211
212impl wkt::message::Message for ExportSBOMResponse {
213 fn typename() -> &'static str {
214 "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMResponse"
215 }
216}
217
218/// Request to get a vulnerability summary for some set of occurrences.
219#[derive(Clone, Default, PartialEq)]
220#[non_exhaustive]
221pub struct GetVulnerabilityOccurrencesSummaryRequest {
222 /// Required. The name of the project to get a vulnerability summary for in the
223 /// form of `projects/[PROJECT_ID]`.
224 pub parent: std::string::String,
225
226 /// The filter expression.
227 pub filter: std::string::String,
228
229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
230}
231
232impl GetVulnerabilityOccurrencesSummaryRequest {
233 pub fn new() -> Self {
234 std::default::Default::default()
235 }
236
237 /// Sets the value of [parent][crate::model::GetVulnerabilityOccurrencesSummaryRequest::parent].
238 ///
239 /// # Example
240 /// ```ignore,no_run
241 /// # use google_cloud_containeranalysis_v1::model::GetVulnerabilityOccurrencesSummaryRequest;
242 /// let x = GetVulnerabilityOccurrencesSummaryRequest::new().set_parent("example");
243 /// ```
244 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
245 self.parent = v.into();
246 self
247 }
248
249 /// Sets the value of [filter][crate::model::GetVulnerabilityOccurrencesSummaryRequest::filter].
250 ///
251 /// # Example
252 /// ```ignore,no_run
253 /// # use google_cloud_containeranalysis_v1::model::GetVulnerabilityOccurrencesSummaryRequest;
254 /// let x = GetVulnerabilityOccurrencesSummaryRequest::new().set_filter("example");
255 /// ```
256 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
257 self.filter = v.into();
258 self
259 }
260}
261
262impl wkt::message::Message for GetVulnerabilityOccurrencesSummaryRequest {
263 fn typename() -> &'static str {
264 "type.googleapis.com/google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest"
265 }
266}
267
268/// A summary of how many vulnerability occurrences there are per resource and
269/// severity type.
270#[derive(Clone, Default, PartialEq)]
271#[non_exhaustive]
272pub struct VulnerabilityOccurrencesSummary {
273 /// A listing by resource of the number of fixable and total vulnerabilities.
274 pub counts:
275 std::vec::Vec<crate::model::vulnerability_occurrences_summary::FixableTotalByDigest>,
276
277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
278}
279
280impl VulnerabilityOccurrencesSummary {
281 pub fn new() -> Self {
282 std::default::Default::default()
283 }
284
285 /// Sets the value of [counts][crate::model::VulnerabilityOccurrencesSummary::counts].
286 ///
287 /// # Example
288 /// ```ignore,no_run
289 /// # use google_cloud_containeranalysis_v1::model::VulnerabilityOccurrencesSummary;
290 /// use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
291 /// let x = VulnerabilityOccurrencesSummary::new()
292 /// .set_counts([
293 /// FixableTotalByDigest::default()/* use setters */,
294 /// FixableTotalByDigest::default()/* use (different) setters */,
295 /// ]);
296 /// ```
297 pub fn set_counts<T, V>(mut self, v: T) -> Self
298 where
299 T: std::iter::IntoIterator<Item = V>,
300 V: std::convert::Into<
301 crate::model::vulnerability_occurrences_summary::FixableTotalByDigest,
302 >,
303 {
304 use std::iter::Iterator;
305 self.counts = v.into_iter().map(|i| i.into()).collect();
306 self
307 }
308}
309
310impl wkt::message::Message for VulnerabilityOccurrencesSummary {
311 fn typename() -> &'static str {
312 "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary"
313 }
314}
315
316/// Defines additional types related to [VulnerabilityOccurrencesSummary].
317pub mod vulnerability_occurrences_summary {
318 #[allow(unused_imports)]
319 use super::*;
320
321 /// Per resource and severity counts of fixable and total vulnerabilities.
322 #[derive(Clone, Default, PartialEq)]
323 #[non_exhaustive]
324 pub struct FixableTotalByDigest {
325 /// The affected resource.
326 pub resource_uri: std::string::String,
327
328 /// The severity for this count. SEVERITY_UNSPECIFIED indicates total across
329 /// all severities.
330 pub severity: google_cloud_grafeas_v1::model::Severity,
331
332 /// The number of fixable vulnerabilities associated with this resource.
333 pub fixable_count: i64,
334
335 /// The total number of vulnerabilities associated with this resource.
336 pub total_count: i64,
337
338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
339 }
340
341 impl FixableTotalByDigest {
342 pub fn new() -> Self {
343 std::default::Default::default()
344 }
345
346 /// Sets the value of [resource_uri][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::resource_uri].
347 ///
348 /// # Example
349 /// ```ignore,no_run
350 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
351 /// let x = FixableTotalByDigest::new().set_resource_uri("example");
352 /// ```
353 pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(
354 mut self,
355 v: T,
356 ) -> Self {
357 self.resource_uri = v.into();
358 self
359 }
360
361 /// Sets the value of [severity][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::severity].
362 ///
363 /// # Example
364 /// ```ignore,no_run
365 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
366 /// use google_cloud_grafeas_v1::model::Severity;
367 /// let x0 = FixableTotalByDigest::new().set_severity(Severity::Minimal);
368 /// let x1 = FixableTotalByDigest::new().set_severity(Severity::Low);
369 /// let x2 = FixableTotalByDigest::new().set_severity(Severity::Medium);
370 /// ```
371 pub fn set_severity<T: std::convert::Into<google_cloud_grafeas_v1::model::Severity>>(
372 mut self,
373 v: T,
374 ) -> Self {
375 self.severity = v.into();
376 self
377 }
378
379 /// Sets the value of [fixable_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::fixable_count].
380 ///
381 /// # Example
382 /// ```ignore,no_run
383 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
384 /// let x = FixableTotalByDigest::new().set_fixable_count(42);
385 /// ```
386 pub fn set_fixable_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
387 self.fixable_count = v.into();
388 self
389 }
390
391 /// Sets the value of [total_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::total_count].
392 ///
393 /// # Example
394 /// ```ignore,no_run
395 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
396 /// let x = FixableTotalByDigest::new().set_total_count(42);
397 /// ```
398 pub fn set_total_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
399 self.total_count = v.into();
400 self
401 }
402 }
403
404 impl wkt::message::Message for FixableTotalByDigest {
405 fn typename() -> &'static str {
406 "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary.FixableTotalByDigest"
407 }
408 }
409}