google-cloud-containeranalysis-v1 1.8.0

Google Cloud Client Libraries for Rust - Container Analysis API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_grafeas_v1;
extern crate google_cloud_iam_v1;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// The request to generate and export SBOM. Target must be specified for the
/// request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportSBOMRequest {
    /// Required. The name of the resource in the form of
    /// `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`.
    pub name: std::string::String,

    /// The location of the SBOM export.
    pub target: std::option::Option<crate::model::export_sbom_request::Target>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportSBOMRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ExportSBOMRequest::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_containeranalysis_v1::model::ExportSBOMRequest;
    /// let x = ExportSBOMRequest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [target][crate::model::ExportSBOMRequest::target].
    ///
    /// Note that all the setters affecting `target` are mutually
    /// exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_containeranalysis_v1::model::ExportSBOMRequest;
    /// use google_cloud_containeranalysis_v1::model::export_sbom_request::CloudStorageLocation;
    /// let x = ExportSBOMRequest::new().set_target(Some(
    ///     google_cloud_containeranalysis_v1::model::export_sbom_request::Target::CloudStorageLocation(CloudStorageLocation::default().into())));
    /// ```
    pub fn set_target<
        T: std::convert::Into<std::option::Option<crate::model::export_sbom_request::Target>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.target = v.into();
        self
    }

    /// The value of [target][crate::model::ExportSBOMRequest::target]
    /// if it holds a `CloudStorageLocation`, `None` if the field is not set or
    /// holds a different branch.
    pub fn cloud_storage_location(
        &self,
    ) -> std::option::Option<
        &std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
    > {
        #[allow(unreachable_patterns)]
        self.target.as_ref().and_then(|v| match v {
            crate::model::export_sbom_request::Target::CloudStorageLocation(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [target][crate::model::ExportSBOMRequest::target]
    /// to hold a `CloudStorageLocation`.
    ///
    /// Note that all the setters affecting `target` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_containeranalysis_v1::model::ExportSBOMRequest;
    /// use google_cloud_containeranalysis_v1::model::export_sbom_request::CloudStorageLocation;
    /// let x = ExportSBOMRequest::new().set_cloud_storage_location(CloudStorageLocation::default()/* use setters */);
    /// assert!(x.cloud_storage_location().is_some());
    /// ```
    pub fn set_cloud_storage_location<
        T: std::convert::Into<
                std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.target = std::option::Option::Some(
            crate::model::export_sbom_request::Target::CloudStorageLocation(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ExportSBOMRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest"
    }
}

/// Defines additional types related to [ExportSBOMRequest].
pub mod export_sbom_request {
    #[allow(unused_imports)]
    use super::*;

    /// Empty placeholder to denote that this is a Google Cloud Storage
    /// export request.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct CloudStorageLocation {
        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl CloudStorageLocation {
        pub fn new() -> Self {
            std::default::Default::default()
        }
    }

    impl wkt::message::Message for CloudStorageLocation {
        fn typename() -> &'static str {
            "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest.CloudStorageLocation"
        }
    }

    /// The location of the SBOM export.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Target {
        /// Optional. Empty placeholder to denote that this is a Google Cloud Storage
        /// export request.
        CloudStorageLocation(
            std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
        ),
    }
}

/// The response from a call to ExportSBOM.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportSBOMResponse {
    /// The name of the discovery occurrence in the form
    /// "projects/{project_id}/occurrences/{OCCURRENCE_ID}
    /// It can be used to track the progress of the SBOM export.
    pub discovery_occurrence: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportSBOMResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [discovery_occurrence][crate::model::ExportSBOMResponse::discovery_occurrence].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_containeranalysis_v1::model::ExportSBOMResponse;
    /// let x = ExportSBOMResponse::new().set_discovery_occurrence("example");
    /// ```
    pub fn set_discovery_occurrence<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.discovery_occurrence = v.into();
        self
    }
}

impl wkt::message::Message for ExportSBOMResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMResponse"
    }
}

/// Request to get a vulnerability summary for some set of occurrences.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetVulnerabilityOccurrencesSummaryRequest {
    /// Required. The name of the project to get a vulnerability summary for in the
    /// form of `projects/[PROJECT_ID]`.
    pub parent: std::string::String,

    /// The filter expression.
    pub filter: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetVulnerabilityOccurrencesSummaryRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::GetVulnerabilityOccurrencesSummaryRequest::parent].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_containeranalysis_v1::model::GetVulnerabilityOccurrencesSummaryRequest;
    /// let x = GetVulnerabilityOccurrencesSummaryRequest::new().set_parent("example");
    /// ```
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::GetVulnerabilityOccurrencesSummaryRequest::filter].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_containeranalysis_v1::model::GetVulnerabilityOccurrencesSummaryRequest;
    /// let x = GetVulnerabilityOccurrencesSummaryRequest::new().set_filter("example");
    /// ```
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }
}

impl wkt::message::Message for GetVulnerabilityOccurrencesSummaryRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest"
    }
}

/// A summary of how many vulnerability occurrences there are per resource and
/// severity type.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VulnerabilityOccurrencesSummary {
    /// A listing by resource of the number of fixable and total vulnerabilities.
    pub counts:
        std::vec::Vec<crate::model::vulnerability_occurrences_summary::FixableTotalByDigest>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl VulnerabilityOccurrencesSummary {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [counts][crate::model::VulnerabilityOccurrencesSummary::counts].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_containeranalysis_v1::model::VulnerabilityOccurrencesSummary;
    /// use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
    /// let x = VulnerabilityOccurrencesSummary::new()
    ///     .set_counts([
    ///         FixableTotalByDigest::default()/* use setters */,
    ///         FixableTotalByDigest::default()/* use (different) setters */,
    ///     ]);
    /// ```
    pub fn set_counts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<
                crate::model::vulnerability_occurrences_summary::FixableTotalByDigest,
            >,
    {
        use std::iter::Iterator;
        self.counts = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for VulnerabilityOccurrencesSummary {
    fn typename() -> &'static str {
        "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary"
    }
}

/// Defines additional types related to [VulnerabilityOccurrencesSummary].
pub mod vulnerability_occurrences_summary {
    #[allow(unused_imports)]
    use super::*;

    /// Per resource and severity counts of fixable and total vulnerabilities.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct FixableTotalByDigest {
        /// The affected resource.
        pub resource_uri: std::string::String,

        /// The severity for this count. SEVERITY_UNSPECIFIED indicates total across
        /// all severities.
        pub severity: google_cloud_grafeas_v1::model::Severity,

        /// The number of fixable vulnerabilities associated with this resource.
        pub fixable_count: i64,

        /// The total number of vulnerabilities associated with this resource.
        pub total_count: i64,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl FixableTotalByDigest {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [resource_uri][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::resource_uri].
        ///
        /// # Example
        /// ```ignore,no_run
        /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
        /// let x = FixableTotalByDigest::new().set_resource_uri("example");
        /// ```
        pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(
            mut self,
            v: T,
        ) -> Self {
            self.resource_uri = v.into();
            self
        }

        /// Sets the value of [severity][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::severity].
        ///
        /// # Example
        /// ```ignore,no_run
        /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
        /// use google_cloud_grafeas_v1::model::Severity;
        /// let x0 = FixableTotalByDigest::new().set_severity(Severity::Minimal);
        /// let x1 = FixableTotalByDigest::new().set_severity(Severity::Low);
        /// let x2 = FixableTotalByDigest::new().set_severity(Severity::Medium);
        /// ```
        pub fn set_severity<T: std::convert::Into<google_cloud_grafeas_v1::model::Severity>>(
            mut self,
            v: T,
        ) -> Self {
            self.severity = v.into();
            self
        }

        /// Sets the value of [fixable_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::fixable_count].
        ///
        /// # Example
        /// ```ignore,no_run
        /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
        /// let x = FixableTotalByDigest::new().set_fixable_count(42);
        /// ```
        pub fn set_fixable_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
            self.fixable_count = v.into();
            self
        }

        /// Sets the value of [total_count][crate::model::vulnerability_occurrences_summary::FixableTotalByDigest::total_count].
        ///
        /// # Example
        /// ```ignore,no_run
        /// # use google_cloud_containeranalysis_v1::model::vulnerability_occurrences_summary::FixableTotalByDigest;
        /// let x = FixableTotalByDigest::new().set_total_count(42);
        /// ```
        pub fn set_total_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
            self.total_count = v.into();
            self
        }
    }

    impl wkt::message::Message for FixableTotalByDigest {
        fn typename() -> &'static str {
            "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary.FixableTotalByDigest"
        }
    }
}