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