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