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    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
61        self.name = v.into();
62        self
63    }
64
65    /// Sets the value of [target][crate::model::ExportSBOMRequest::target].
66    ///
67    /// Note that all the setters affecting `target` are mutually
68    /// exclusive.
69    pub fn set_target<
70        T: std::convert::Into<std::option::Option<crate::model::export_sbom_request::Target>>,
71    >(
72        mut self,
73        v: T,
74    ) -> Self {
75        self.target = v.into();
76        self
77    }
78
79    /// The value of [target][crate::model::ExportSBOMRequest::target]
80    /// if it holds a `CloudStorageLocation`, `None` if the field is not set or
81    /// holds a different branch.
82    pub fn cloud_storage_location(
83        &self,
84    ) -> std::option::Option<
85        &std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
86    > {
87        #[allow(unreachable_patterns)]
88        self.target.as_ref().and_then(|v| match v {
89            crate::model::export_sbom_request::Target::CloudStorageLocation(v) => {
90                std::option::Option::Some(v)
91            }
92            _ => std::option::Option::None,
93        })
94    }
95
96    /// Sets the value of [target][crate::model::ExportSBOMRequest::target]
97    /// to hold a `CloudStorageLocation`.
98    ///
99    /// Note that all the setters affecting `target` are
100    /// mutually exclusive.
101    pub fn set_cloud_storage_location<
102        T: std::convert::Into<
103                std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
104            >,
105    >(
106        mut self,
107        v: T,
108    ) -> Self {
109        self.target = std::option::Option::Some(
110            crate::model::export_sbom_request::Target::CloudStorageLocation(v.into()),
111        );
112        self
113    }
114}
115
116impl wkt::message::Message for ExportSBOMRequest {
117    fn typename() -> &'static str {
118        "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest"
119    }
120}
121
122/// Defines additional types related to [ExportSBOMRequest].
123pub mod export_sbom_request {
124    #[allow(unused_imports)]
125    use super::*;
126
127    /// Empty placeholder to denote that this is a Google Cloud Storage
128    /// export request.
129    #[derive(Clone, Default, PartialEq)]
130    #[non_exhaustive]
131    pub struct CloudStorageLocation {
132        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
133    }
134
135    impl CloudStorageLocation {
136        pub fn new() -> Self {
137            std::default::Default::default()
138        }
139    }
140
141    impl wkt::message::Message for CloudStorageLocation {
142        fn typename() -> &'static str {
143            "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest.CloudStorageLocation"
144        }
145    }
146
147    /// The location of the SBOM export.
148    #[derive(Clone, Debug, PartialEq)]
149    #[non_exhaustive]
150    pub enum Target {
151        /// Optional. Empty placeholder to denote that this is a Google Cloud Storage
152        /// export request.
153        CloudStorageLocation(
154            std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
155        ),
156    }
157}
158
159/// The response from a call to ExportSBOM.
160#[derive(Clone, Default, PartialEq)]
161#[non_exhaustive]
162pub struct ExportSBOMResponse {
163    /// The name of the discovery occurrence in the form
164    /// "projects/{project_id}/occurrences/{OCCURRENCE_ID}
165    /// It can be used to track the progress of the SBOM export.
166    pub discovery_occurrence: std::string::String,
167
168    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
169}
170
171impl ExportSBOMResponse {
172    pub fn new() -> Self {
173        std::default::Default::default()
174    }
175
176    /// Sets the value of [discovery_occurrence][crate::model::ExportSBOMResponse::discovery_occurrence].
177    pub fn set_discovery_occurrence<T: std::convert::Into<std::string::String>>(
178        mut self,
179        v: T,
180    ) -> Self {
181        self.discovery_occurrence = v.into();
182        self
183    }
184}
185
186impl wkt::message::Message for ExportSBOMResponse {
187    fn typename() -> &'static str {
188        "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMResponse"
189    }
190}
191
192/// Request to get a vulnerability summary for some set of occurrences.
193#[derive(Clone, Default, PartialEq)]
194#[non_exhaustive]
195pub struct GetVulnerabilityOccurrencesSummaryRequest {
196    /// Required. The name of the project to get a vulnerability summary for in the
197    /// form of `projects/[PROJECT_ID]`.
198    pub parent: std::string::String,
199
200    /// The filter expression.
201    pub filter: std::string::String,
202
203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
204}
205
206impl GetVulnerabilityOccurrencesSummaryRequest {
207    pub fn new() -> Self {
208        std::default::Default::default()
209    }
210
211    /// Sets the value of [parent][crate::model::GetVulnerabilityOccurrencesSummaryRequest::parent].
212    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
213        self.parent = v.into();
214        self
215    }
216
217    /// Sets the value of [filter][crate::model::GetVulnerabilityOccurrencesSummaryRequest::filter].
218    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
219        self.filter = v.into();
220        self
221    }
222}
223
224impl wkt::message::Message for GetVulnerabilityOccurrencesSummaryRequest {
225    fn typename() -> &'static str {
226        "type.googleapis.com/google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest"
227    }
228}
229
230/// A summary of how many vulnerability occurrences there are per resource and
231/// severity type.
232#[derive(Clone, Default, PartialEq)]
233#[non_exhaustive]
234pub struct VulnerabilityOccurrencesSummary {
235    /// A listing by resource of the number of fixable and total vulnerabilities.
236    pub counts:
237        std::vec::Vec<crate::model::vulnerability_occurrences_summary::FixableTotalByDigest>,
238
239    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
240}
241
242impl VulnerabilityOccurrencesSummary {
243    pub fn new() -> Self {
244        std::default::Default::default()
245    }
246
247    /// Sets the value of [counts][crate::model::VulnerabilityOccurrencesSummary::counts].
248    pub fn set_counts<T, V>(mut self, v: T) -> Self
249    where
250        T: std::iter::IntoIterator<Item = V>,
251        V: std::convert::Into<
252                crate::model::vulnerability_occurrences_summary::FixableTotalByDigest,
253            >,
254    {
255        use std::iter::Iterator;
256        self.counts = v.into_iter().map(|i| i.into()).collect();
257        self
258    }
259}
260
261impl wkt::message::Message for VulnerabilityOccurrencesSummary {
262    fn typename() -> &'static str {
263        "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary"
264    }
265}
266
267/// Defines additional types related to [VulnerabilityOccurrencesSummary].
268pub mod vulnerability_occurrences_summary {
269    #[allow(unused_imports)]
270    use super::*;
271
272    /// Per resource and severity counts of fixable and total vulnerabilities.
273    #[derive(Clone, Default, PartialEq)]
274    #[non_exhaustive]
275    pub struct FixableTotalByDigest {
276        /// The affected resource.
277        pub resource_uri: std::string::String,
278
279        /// The severity for this count. SEVERITY_UNSPECIFIED indicates total across
280        /// all severities.
281        pub severity: grafeas::model::Severity,
282
283        /// The number of fixable vulnerabilities associated with this resource.
284        pub fixable_count: i64,
285
286        /// The total number of vulnerabilities associated with this resource.
287        pub total_count: i64,
288
289        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
290    }
291
292    impl FixableTotalByDigest {
293        pub fn new() -> Self {
294            std::default::Default::default()
295        }
296
297        /// Sets the value of [resource_uri][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::resource_uri].
298        pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(
299            mut self,
300            v: T,
301        ) -> Self {
302            self.resource_uri = v.into();
303            self
304        }
305
306        /// Sets the value of [severity][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::severity].
307        pub fn set_severity<T: std::convert::Into<grafeas::model::Severity>>(
308            mut self,
309            v: T,
310        ) -> Self {
311            self.severity = v.into();
312            self
313        }
314
315        /// Sets the value of [fixable_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::fixable_count].
316        pub fn set_fixable_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
317            self.fixable_count = v.into();
318            self
319        }
320
321        /// Sets the value of [total_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::total_count].
322        pub fn set_total_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
323            self.total_count = v.into();
324            self
325        }
326    }
327
328    impl wkt::message::Message for FixableTotalByDigest {
329        fn typename() -> &'static str {
330            "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary.FixableTotalByDigest"
331        }
332    }
333}