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 /// Creates a new default instance.
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 /// Creates a new default instance.
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 /// Creates a new default instance.
195 pub fn new() -> Self {
196 std::default::Default::default()
197 }
198
199 /// Sets the value of [discovery_occurrence][crate::model::ExportSBOMResponse::discovery_occurrence].
200 ///
201 /// # Example
202 /// ```ignore,no_run
203 /// # use google_cloud_containeranalysis_v1::model::ExportSBOMResponse;
204 /// let x = ExportSBOMResponse::new().set_discovery_occurrence("example");
205 /// ```
206 pub fn set_discovery_occurrence<T: std::convert::Into<std::string::String>>(
207 mut self,
208 v: T,
209 ) -> Self {
210 self.discovery_occurrence = v.into();
211 self
212 }
213}
214
215impl wkt::message::Message for ExportSBOMResponse {
216 fn typename() -> &'static str {
217 "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMResponse"
218 }
219}
220
221/// Request to get a vulnerability summary for some set of occurrences.
222#[derive(Clone, Default, PartialEq)]
223#[non_exhaustive]
224pub struct GetVulnerabilityOccurrencesSummaryRequest {
225 /// Required. The name of the project to get a vulnerability summary for in the
226 /// form of `projects/[PROJECT_ID]`.
227 pub parent: std::string::String,
228
229 /// The filter expression.
230 pub filter: std::string::String,
231
232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
233}
234
235impl GetVulnerabilityOccurrencesSummaryRequest {
236 /// Creates a new default instance.
237 pub fn new() -> Self {
238 std::default::Default::default()
239 }
240
241 /// Sets the value of [parent][crate::model::GetVulnerabilityOccurrencesSummaryRequest::parent].
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_containeranalysis_v1::model::GetVulnerabilityOccurrencesSummaryRequest;
246 /// let x = GetVulnerabilityOccurrencesSummaryRequest::new().set_parent("example");
247 /// ```
248 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
249 self.parent = v.into();
250 self
251 }
252
253 /// Sets the value of [filter][crate::model::GetVulnerabilityOccurrencesSummaryRequest::filter].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_containeranalysis_v1::model::GetVulnerabilityOccurrencesSummaryRequest;
258 /// let x = GetVulnerabilityOccurrencesSummaryRequest::new().set_filter("example");
259 /// ```
260 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
261 self.filter = v.into();
262 self
263 }
264}
265
266impl wkt::message::Message for GetVulnerabilityOccurrencesSummaryRequest {
267 fn typename() -> &'static str {
268 "type.googleapis.com/google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest"
269 }
270}
271
272/// A summary of how many vulnerability occurrences there are per resource and
273/// severity type.
274#[derive(Clone, Default, PartialEq)]
275#[non_exhaustive]
276pub struct VulnerabilityOccurrencesSummary {
277 /// A listing by resource of the number of fixable and total vulnerabilities.
278 pub counts:
279 std::vec::Vec<crate::model::vulnerability_occurrences_summary::FixableTotalByDigest>,
280
281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
282}
283
284impl VulnerabilityOccurrencesSummary {
285 /// Creates a new default instance.
286 pub fn new() -> Self {
287 std::default::Default::default()
288 }
289
290 /// Sets the value of [counts][crate::model::VulnerabilityOccurrencesSummary::counts].
291 ///
292 /// # Example
293 /// ```ignore,no_run
294 /// # use google_cloud_containeranalysis_v1::model::VulnerabilityOccurrencesSummary;
295 /// use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
296 /// let x = VulnerabilityOccurrencesSummary::new()
297 /// .set_counts([
298 /// FixableTotalByDigest::default()/* use setters */,
299 /// FixableTotalByDigest::default()/* use (different) setters */,
300 /// ]);
301 /// ```
302 pub fn set_counts<T, V>(mut self, v: T) -> Self
303 where
304 T: std::iter::IntoIterator<Item = V>,
305 V: std::convert::Into<
306 crate::model::vulnerability_occurrences_summary::FixableTotalByDigest,
307 >,
308 {
309 use std::iter::Iterator;
310 self.counts = v.into_iter().map(|i| i.into()).collect();
311 self
312 }
313}
314
315impl wkt::message::Message for VulnerabilityOccurrencesSummary {
316 fn typename() -> &'static str {
317 "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary"
318 }
319}
320
321/// Defines additional types related to [VulnerabilityOccurrencesSummary].
322pub mod vulnerability_occurrences_summary {
323 #[allow(unused_imports)]
324 use super::*;
325
326 /// Per resource and severity counts of fixable and total vulnerabilities.
327 #[derive(Clone, Default, PartialEq)]
328 #[non_exhaustive]
329 pub struct FixableTotalByDigest {
330 /// The affected resource.
331 pub resource_uri: std::string::String,
332
333 /// The severity for this count. SEVERITY_UNSPECIFIED indicates total across
334 /// all severities.
335 pub severity: google_cloud_grafeas_v1::model::Severity,
336
337 /// The number of fixable vulnerabilities associated with this resource.
338 pub fixable_count: i64,
339
340 /// The total number of vulnerabilities associated with this resource.
341 pub total_count: i64,
342
343 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
344 }
345
346 impl FixableTotalByDigest {
347 /// Creates a new default instance.
348 pub fn new() -> Self {
349 std::default::Default::default()
350 }
351
352 /// Sets the value of [resource_uri][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::resource_uri].
353 ///
354 /// # Example
355 /// ```ignore,no_run
356 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
357 /// let x = FixableTotalByDigest::new().set_resource_uri("example");
358 /// ```
359 pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(
360 mut self,
361 v: T,
362 ) -> Self {
363 self.resource_uri = v.into();
364 self
365 }
366
367 /// Sets the value of [severity][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::severity].
368 ///
369 /// # Example
370 /// ```ignore,no_run
371 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
372 /// use google_cloud_grafeas_v1::model::Severity;
373 /// let x0 = FixableTotalByDigest::new().set_severity(Severity::Minimal);
374 /// let x1 = FixableTotalByDigest::new().set_severity(Severity::Low);
375 /// let x2 = FixableTotalByDigest::new().set_severity(Severity::Medium);
376 /// ```
377 pub fn set_severity<T: std::convert::Into<google_cloud_grafeas_v1::model::Severity>>(
378 mut self,
379 v: T,
380 ) -> Self {
381 self.severity = v.into();
382 self
383 }
384
385 /// Sets the value of [fixable_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::fixable_count].
386 ///
387 /// # Example
388 /// ```ignore,no_run
389 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
390 /// let x = FixableTotalByDigest::new().set_fixable_count(42);
391 /// ```
392 pub fn set_fixable_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
393 self.fixable_count = v.into();
394 self
395 }
396
397 /// Sets the value of [total_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::total_count].
398 ///
399 /// # Example
400 /// ```ignore,no_run
401 /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
402 /// let x = FixableTotalByDigest::new().set_total_count(42);
403 /// ```
404 pub fn set_total_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
405 self.total_count = v.into();
406 self
407 }
408 }
409
410 impl wkt::message::Message for FixableTotalByDigest {
411 fn typename() -> &'static str {
412 "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary.FixableTotalByDigest"
413 }
414 }
415}