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