google_cloud_grafeas_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_rpc;
25extern crate lazy_static;
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/// Note kind that represents a logical attestation "role" or "authority". For
38/// example, an organization might have one `Authority` for "QA" and one for
39/// "build". This note is intended to act strictly as a grouping mechanism for
40/// the attached occurrences (Attestations). This grouping mechanism also
41/// provides a security boundary, since IAM ACLs gate the ability for a principle
42/// to attach an occurrence to a given note. It also provides a single point of
43/// lookup to find all attached attestation occurrences, even if they don't all
44/// live in the same project.
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct AttestationNote {
48 /// Hint hints at the purpose of the attestation authority.
49 pub hint: std::option::Option<crate::model::attestation_note::Hint>,
50
51 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
52}
53
54impl AttestationNote {
55 pub fn new() -> Self {
56 std::default::Default::default()
57 }
58
59 /// Sets the value of [hint][crate::model::AttestationNote::hint].
60 ///
61 /// # Example
62 /// ```ignore,no_run
63 /// # use google_cloud_grafeas_v1::model::AttestationNote;
64 /// use google_cloud_grafeas_v1::model::attestation_note::Hint;
65 /// let x = AttestationNote::new().set_hint(Hint::default()/* use setters */);
66 /// ```
67 pub fn set_hint<T>(mut self, v: T) -> Self
68 where
69 T: std::convert::Into<crate::model::attestation_note::Hint>,
70 {
71 self.hint = std::option::Option::Some(v.into());
72 self
73 }
74
75 /// Sets or clears the value of [hint][crate::model::AttestationNote::hint].
76 ///
77 /// # Example
78 /// ```ignore,no_run
79 /// # use google_cloud_grafeas_v1::model::AttestationNote;
80 /// use google_cloud_grafeas_v1::model::attestation_note::Hint;
81 /// let x = AttestationNote::new().set_or_clear_hint(Some(Hint::default()/* use setters */));
82 /// let x = AttestationNote::new().set_or_clear_hint(None::<Hint>);
83 /// ```
84 pub fn set_or_clear_hint<T>(mut self, v: std::option::Option<T>) -> Self
85 where
86 T: std::convert::Into<crate::model::attestation_note::Hint>,
87 {
88 self.hint = v.map(|x| x.into());
89 self
90 }
91}
92
93impl wkt::message::Message for AttestationNote {
94 fn typename() -> &'static str {
95 "type.googleapis.com/grafeas.v1.AttestationNote"
96 }
97}
98
99/// Defines additional types related to [AttestationNote].
100pub mod attestation_note {
101 #[allow(unused_imports)]
102 use super::*;
103
104 /// This submessage provides human-readable hints about the purpose of the
105 /// authority. Because the name of a note acts as its resource reference, it is
106 /// important to disambiguate the canonical name of the Note (which might be a
107 /// UUID for security purposes) from "readable" names more suitable for debug
108 /// output. Note that these hints should not be used to look up authorities in
109 /// security sensitive contexts, such as when looking up attestations to
110 /// verify.
111 #[derive(Clone, Default, PartialEq)]
112 #[non_exhaustive]
113 pub struct Hint {
114 /// Required. The human readable name of this attestation authority, for
115 /// example "qa".
116 pub human_readable_name: std::string::String,
117
118 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
119 }
120
121 impl Hint {
122 pub fn new() -> Self {
123 std::default::Default::default()
124 }
125
126 /// Sets the value of [human_readable_name][crate::model::attestation_note::Hint::human_readable_name].
127 ///
128 /// # Example
129 /// ```ignore,no_run
130 /// # use google_cloud_grafeas_v1::model::attestation_note::Hint;
131 /// let x = Hint::new().set_human_readable_name("example");
132 /// ```
133 pub fn set_human_readable_name<T: std::convert::Into<std::string::String>>(
134 mut self,
135 v: T,
136 ) -> Self {
137 self.human_readable_name = v.into();
138 self
139 }
140 }
141
142 impl wkt::message::Message for Hint {
143 fn typename() -> &'static str {
144 "type.googleapis.com/grafeas.v1.AttestationNote.Hint"
145 }
146 }
147}
148
149#[derive(Clone, Default, PartialEq)]
150#[non_exhaustive]
151pub struct Jwt {
152 /// The compact encoding of a JWS, which is always three base64 encoded strings
153 /// joined by periods. For details, see:
154 /// <https://tools.ietf.org/html/rfc7515.html#section-3.1>
155 pub compact_jwt: std::string::String,
156
157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
158}
159
160impl Jwt {
161 pub fn new() -> Self {
162 std::default::Default::default()
163 }
164
165 /// Sets the value of [compact_jwt][crate::model::Jwt::compact_jwt].
166 ///
167 /// # Example
168 /// ```ignore,no_run
169 /// # use google_cloud_grafeas_v1::model::Jwt;
170 /// let x = Jwt::new().set_compact_jwt("example");
171 /// ```
172 pub fn set_compact_jwt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
173 self.compact_jwt = v.into();
174 self
175 }
176}
177
178impl wkt::message::Message for Jwt {
179 fn typename() -> &'static str {
180 "type.googleapis.com/grafeas.v1.Jwt"
181 }
182}
183
184/// Occurrence that represents a single "attestation". The authenticity of an
185/// attestation can be verified using the attached signature. If the verifier
186/// trusts the public key of the signer, then verifying the signature is
187/// sufficient to establish trust. In this circumstance, the authority to which
188/// this attestation is attached is primarily useful for lookup (how to find
189/// this attestation if you already know the authority and artifact to be
190/// verified) and intent (for which authority this attestation was intended to
191/// sign.
192#[derive(Clone, Default, PartialEq)]
193#[non_exhaustive]
194pub struct AttestationOccurrence {
195 /// Required. The serialized payload that is verified by one or more
196 /// `signatures`.
197 pub serialized_payload: ::bytes::Bytes,
198
199 /// One or more signatures over `serialized_payload`. Verifier implementations
200 /// should consider this attestation message verified if at least one
201 /// `signature` verifies `serialized_payload`. See `Signature` in common.proto
202 /// for more details on signature structure and verification.
203 pub signatures: std::vec::Vec<crate::model::Signature>,
204
205 /// One or more JWTs encoding a self-contained attestation.
206 /// Each JWT encodes the payload that it verifies within the JWT itself.
207 /// Verifier implementation SHOULD ignore the `serialized_payload` field
208 /// when verifying these JWTs.
209 /// If only JWTs are present on this AttestationOccurrence, then the
210 /// `serialized_payload` SHOULD be left empty.
211 /// Each JWT SHOULD encode a claim specific to the `resource_uri` of this
212 /// Occurrence, but this is not validated by Grafeas metadata API
213 /// implementations. The JWT itself is opaque to Grafeas.
214 pub jwts: std::vec::Vec<crate::model::Jwt>,
215
216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
217}
218
219impl AttestationOccurrence {
220 pub fn new() -> Self {
221 std::default::Default::default()
222 }
223
224 /// Sets the value of [serialized_payload][crate::model::AttestationOccurrence::serialized_payload].
225 ///
226 /// # Example
227 /// ```ignore,no_run
228 /// # use google_cloud_grafeas_v1::model::AttestationOccurrence;
229 /// let x = AttestationOccurrence::new().set_serialized_payload(bytes::Bytes::from_static(b"example"));
230 /// ```
231 pub fn set_serialized_payload<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
232 self.serialized_payload = v.into();
233 self
234 }
235
236 /// Sets the value of [signatures][crate::model::AttestationOccurrence::signatures].
237 ///
238 /// # Example
239 /// ```ignore,no_run
240 /// # use google_cloud_grafeas_v1::model::AttestationOccurrence;
241 /// use google_cloud_grafeas_v1::model::Signature;
242 /// let x = AttestationOccurrence::new()
243 /// .set_signatures([
244 /// Signature::default()/* use setters */,
245 /// Signature::default()/* use (different) setters */,
246 /// ]);
247 /// ```
248 pub fn set_signatures<T, V>(mut self, v: T) -> Self
249 where
250 T: std::iter::IntoIterator<Item = V>,
251 V: std::convert::Into<crate::model::Signature>,
252 {
253 use std::iter::Iterator;
254 self.signatures = v.into_iter().map(|i| i.into()).collect();
255 self
256 }
257
258 /// Sets the value of [jwts][crate::model::AttestationOccurrence::jwts].
259 ///
260 /// # Example
261 /// ```ignore,no_run
262 /// # use google_cloud_grafeas_v1::model::AttestationOccurrence;
263 /// use google_cloud_grafeas_v1::model::Jwt;
264 /// let x = AttestationOccurrence::new()
265 /// .set_jwts([
266 /// Jwt::default()/* use setters */,
267 /// Jwt::default()/* use (different) setters */,
268 /// ]);
269 /// ```
270 pub fn set_jwts<T, V>(mut self, v: T) -> Self
271 where
272 T: std::iter::IntoIterator<Item = V>,
273 V: std::convert::Into<crate::model::Jwt>,
274 {
275 use std::iter::Iterator;
276 self.jwts = v.into_iter().map(|i| i.into()).collect();
277 self
278 }
279}
280
281impl wkt::message::Message for AttestationOccurrence {
282 fn typename() -> &'static str {
283 "type.googleapis.com/grafeas.v1.AttestationOccurrence"
284 }
285}
286
287/// Note holding the version of the provider's builder and the signature of the
288/// provenance message in the build details occurrence.
289#[derive(Clone, Default, PartialEq)]
290#[non_exhaustive]
291pub struct BuildNote {
292 /// Required. Immutable. Version of the builder which produced this build.
293 pub builder_version: std::string::String,
294
295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
296}
297
298impl BuildNote {
299 pub fn new() -> Self {
300 std::default::Default::default()
301 }
302
303 /// Sets the value of [builder_version][crate::model::BuildNote::builder_version].
304 ///
305 /// # Example
306 /// ```ignore,no_run
307 /// # use google_cloud_grafeas_v1::model::BuildNote;
308 /// let x = BuildNote::new().set_builder_version("example");
309 /// ```
310 pub fn set_builder_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
311 self.builder_version = v.into();
312 self
313 }
314}
315
316impl wkt::message::Message for BuildNote {
317 fn typename() -> &'static str {
318 "type.googleapis.com/grafeas.v1.BuildNote"
319 }
320}
321
322/// Details of a build occurrence.
323#[derive(Clone, Default, PartialEq)]
324#[non_exhaustive]
325pub struct BuildOccurrence {
326 /// The actual provenance for the build.
327 pub provenance: std::option::Option<crate::model::BuildProvenance>,
328
329 /// Serialized JSON representation of the provenance, used in generating the
330 /// build signature in the corresponding build note. After verifying the
331 /// signature, `provenance_bytes` can be unmarshalled and compared to the
332 /// provenance to confirm that it is unchanged. A base64-encoded string
333 /// representation of the provenance bytes is used for the signature in order
334 /// to interoperate with openssl which expects this format for signature
335 /// verification.
336 ///
337 /// The serialized form is captured both to avoid ambiguity in how the
338 /// provenance is marshalled to json as well to prevent incompatibilities with
339 /// future changes.
340 pub provenance_bytes: std::string::String,
341
342 /// Deprecated. See InTotoStatement for the replacement.
343 /// In-toto Provenance representation as defined in spec.
344 pub intoto_provenance: std::option::Option<crate::model::InTotoProvenance>,
345
346 /// In-toto Statement representation as defined in spec.
347 /// The intoto_statement can contain any type of provenance. The serialized
348 /// payload of the statement can be stored and signed in the Occurrence's
349 /// envelope.
350 pub intoto_statement: std::option::Option<crate::model::InTotoStatement>,
351
352 /// In-Toto Slsa Provenance V1 represents a slsa provenance meeting the slsa
353 /// spec, wrapped in an in-toto statement. This allows for direct
354 /// jsonification of a to-spec in-toto slsa statement with a to-spec
355 /// slsa provenance.
356 pub in_toto_slsa_provenance_v1: std::option::Option<crate::model::InTotoSlsaProvenanceV1>,
357
358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
359}
360
361impl BuildOccurrence {
362 pub fn new() -> Self {
363 std::default::Default::default()
364 }
365
366 /// Sets the value of [provenance][crate::model::BuildOccurrence::provenance].
367 ///
368 /// # Example
369 /// ```ignore,no_run
370 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
371 /// use google_cloud_grafeas_v1::model::BuildProvenance;
372 /// let x = BuildOccurrence::new().set_provenance(BuildProvenance::default()/* use setters */);
373 /// ```
374 pub fn set_provenance<T>(mut self, v: T) -> Self
375 where
376 T: std::convert::Into<crate::model::BuildProvenance>,
377 {
378 self.provenance = std::option::Option::Some(v.into());
379 self
380 }
381
382 /// Sets or clears the value of [provenance][crate::model::BuildOccurrence::provenance].
383 ///
384 /// # Example
385 /// ```ignore,no_run
386 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
387 /// use google_cloud_grafeas_v1::model::BuildProvenance;
388 /// let x = BuildOccurrence::new().set_or_clear_provenance(Some(BuildProvenance::default()/* use setters */));
389 /// let x = BuildOccurrence::new().set_or_clear_provenance(None::<BuildProvenance>);
390 /// ```
391 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
392 where
393 T: std::convert::Into<crate::model::BuildProvenance>,
394 {
395 self.provenance = v.map(|x| x.into());
396 self
397 }
398
399 /// Sets the value of [provenance_bytes][crate::model::BuildOccurrence::provenance_bytes].
400 ///
401 /// # Example
402 /// ```ignore,no_run
403 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
404 /// let x = BuildOccurrence::new().set_provenance_bytes("example");
405 /// ```
406 pub fn set_provenance_bytes<T: std::convert::Into<std::string::String>>(
407 mut self,
408 v: T,
409 ) -> Self {
410 self.provenance_bytes = v.into();
411 self
412 }
413
414 /// Sets the value of [intoto_provenance][crate::model::BuildOccurrence::intoto_provenance].
415 ///
416 /// # Example
417 /// ```ignore,no_run
418 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
419 /// use google_cloud_grafeas_v1::model::InTotoProvenance;
420 /// let x = BuildOccurrence::new().set_intoto_provenance(InTotoProvenance::default()/* use setters */);
421 /// ```
422 pub fn set_intoto_provenance<T>(mut self, v: T) -> Self
423 where
424 T: std::convert::Into<crate::model::InTotoProvenance>,
425 {
426 self.intoto_provenance = std::option::Option::Some(v.into());
427 self
428 }
429
430 /// Sets or clears the value of [intoto_provenance][crate::model::BuildOccurrence::intoto_provenance].
431 ///
432 /// # Example
433 /// ```ignore,no_run
434 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
435 /// use google_cloud_grafeas_v1::model::InTotoProvenance;
436 /// let x = BuildOccurrence::new().set_or_clear_intoto_provenance(Some(InTotoProvenance::default()/* use setters */));
437 /// let x = BuildOccurrence::new().set_or_clear_intoto_provenance(None::<InTotoProvenance>);
438 /// ```
439 pub fn set_or_clear_intoto_provenance<T>(mut self, v: std::option::Option<T>) -> Self
440 where
441 T: std::convert::Into<crate::model::InTotoProvenance>,
442 {
443 self.intoto_provenance = v.map(|x| x.into());
444 self
445 }
446
447 /// Sets the value of [intoto_statement][crate::model::BuildOccurrence::intoto_statement].
448 ///
449 /// # Example
450 /// ```ignore,no_run
451 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
452 /// use google_cloud_grafeas_v1::model::InTotoStatement;
453 /// let x = BuildOccurrence::new().set_intoto_statement(InTotoStatement::default()/* use setters */);
454 /// ```
455 pub fn set_intoto_statement<T>(mut self, v: T) -> Self
456 where
457 T: std::convert::Into<crate::model::InTotoStatement>,
458 {
459 self.intoto_statement = std::option::Option::Some(v.into());
460 self
461 }
462
463 /// Sets or clears the value of [intoto_statement][crate::model::BuildOccurrence::intoto_statement].
464 ///
465 /// # Example
466 /// ```ignore,no_run
467 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
468 /// use google_cloud_grafeas_v1::model::InTotoStatement;
469 /// let x = BuildOccurrence::new().set_or_clear_intoto_statement(Some(InTotoStatement::default()/* use setters */));
470 /// let x = BuildOccurrence::new().set_or_clear_intoto_statement(None::<InTotoStatement>);
471 /// ```
472 pub fn set_or_clear_intoto_statement<T>(mut self, v: std::option::Option<T>) -> Self
473 where
474 T: std::convert::Into<crate::model::InTotoStatement>,
475 {
476 self.intoto_statement = v.map(|x| x.into());
477 self
478 }
479
480 /// Sets the value of [in_toto_slsa_provenance_v1][crate::model::BuildOccurrence::in_toto_slsa_provenance_v1].
481 ///
482 /// # Example
483 /// ```ignore,no_run
484 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
485 /// use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
486 /// let x = BuildOccurrence::new().set_in_toto_slsa_provenance_v1(InTotoSlsaProvenanceV1::default()/* use setters */);
487 /// ```
488 pub fn set_in_toto_slsa_provenance_v1<T>(mut self, v: T) -> Self
489 where
490 T: std::convert::Into<crate::model::InTotoSlsaProvenanceV1>,
491 {
492 self.in_toto_slsa_provenance_v1 = std::option::Option::Some(v.into());
493 self
494 }
495
496 /// Sets or clears the value of [in_toto_slsa_provenance_v1][crate::model::BuildOccurrence::in_toto_slsa_provenance_v1].
497 ///
498 /// # Example
499 /// ```ignore,no_run
500 /// # use google_cloud_grafeas_v1::model::BuildOccurrence;
501 /// use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
502 /// let x = BuildOccurrence::new().set_or_clear_in_toto_slsa_provenance_v1(Some(InTotoSlsaProvenanceV1::default()/* use setters */));
503 /// let x = BuildOccurrence::new().set_or_clear_in_toto_slsa_provenance_v1(None::<InTotoSlsaProvenanceV1>);
504 /// ```
505 pub fn set_or_clear_in_toto_slsa_provenance_v1<T>(mut self, v: std::option::Option<T>) -> Self
506 where
507 T: std::convert::Into<crate::model::InTotoSlsaProvenanceV1>,
508 {
509 self.in_toto_slsa_provenance_v1 = v.map(|x| x.into());
510 self
511 }
512}
513
514impl wkt::message::Message for BuildOccurrence {
515 fn typename() -> &'static str {
516 "type.googleapis.com/grafeas.v1.BuildOccurrence"
517 }
518}
519
520/// Metadata for any related URL information.
521#[derive(Clone, Default, PartialEq)]
522#[non_exhaustive]
523pub struct RelatedUrl {
524 /// Specific URL associated with the resource.
525 pub url: std::string::String,
526
527 /// Label to describe usage of the URL.
528 pub label: std::string::String,
529
530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
531}
532
533impl RelatedUrl {
534 pub fn new() -> Self {
535 std::default::Default::default()
536 }
537
538 /// Sets the value of [url][crate::model::RelatedUrl::url].
539 ///
540 /// # Example
541 /// ```ignore,no_run
542 /// # use google_cloud_grafeas_v1::model::RelatedUrl;
543 /// let x = RelatedUrl::new().set_url("example");
544 /// ```
545 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
546 self.url = v.into();
547 self
548 }
549
550 /// Sets the value of [label][crate::model::RelatedUrl::label].
551 ///
552 /// # Example
553 /// ```ignore,no_run
554 /// # use google_cloud_grafeas_v1::model::RelatedUrl;
555 /// let x = RelatedUrl::new().set_label("example");
556 /// ```
557 pub fn set_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
558 self.label = v.into();
559 self
560 }
561}
562
563impl wkt::message::Message for RelatedUrl {
564 fn typename() -> &'static str {
565 "type.googleapis.com/grafeas.v1.RelatedUrl"
566 }
567}
568
569/// Verifiers (e.g. Kritis implementations) MUST verify signatures
570/// with respect to the trust anchors defined in policy (e.g. a Kritis policy).
571/// Typically this means that the verifier has been configured with a map from
572/// `public_key_id` to public key material (and any required parameters, e.g.
573/// signing algorithm).
574///
575/// In particular, verification implementations MUST NOT treat the signature
576/// `public_key_id` as anything more than a key lookup hint. The `public_key_id`
577/// DOES NOT validate or authenticate a public key; it only provides a mechanism
578/// for quickly selecting a public key ALREADY CONFIGURED on the verifier through
579/// a trusted channel. Verification implementations MUST reject signatures in any
580/// of the following circumstances:
581///
582/// * The `public_key_id` is not recognized by the verifier.
583/// * The public key that `public_key_id` refers to does not verify the
584/// signature with respect to the payload.
585///
586/// The `signature` contents SHOULD NOT be "attached" (where the payload is
587/// included with the serialized `signature` bytes). Verifiers MUST ignore any
588/// "attached" payload and only verify signatures with respect to explicitly
589/// provided payload (e.g. a `payload` field on the proto message that holds
590/// this Signature, or the canonical serialization of the proto message that
591/// holds this signature).
592#[derive(Clone, Default, PartialEq)]
593#[non_exhaustive]
594pub struct Signature {
595 /// The content of the signature, an opaque bytestring.
596 /// The payload that this signature verifies MUST be unambiguously provided
597 /// with the Signature during verification. A wrapper message might provide
598 /// the payload explicitly. Alternatively, a message might have a canonical
599 /// serialization that can always be unambiguously computed to derive the
600 /// payload.
601 pub signature: ::bytes::Bytes,
602
603 /// The identifier for the public key that verifies this signature.
604 ///
605 /// * The `public_key_id` is required.
606 /// * The `public_key_id` SHOULD be an RFC3986 conformant URI.
607 /// * When possible, the `public_key_id` SHOULD be an immutable reference,
608 /// such as a cryptographic digest.
609 ///
610 /// Examples of valid `public_key_id`s:
611 ///
612 /// OpenPGP V4 public key fingerprint:
613 ///
614 /// * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA"
615 /// See <https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr> for more
616 /// details on this scheme.
617 ///
618 /// RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER
619 /// serialization):
620 ///
621 /// * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU"
622 /// * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5"
623 pub public_key_id: std::string::String,
624
625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
626}
627
628impl Signature {
629 pub fn new() -> Self {
630 std::default::Default::default()
631 }
632
633 /// Sets the value of [signature][crate::model::Signature::signature].
634 ///
635 /// # Example
636 /// ```ignore,no_run
637 /// # use google_cloud_grafeas_v1::model::Signature;
638 /// let x = Signature::new().set_signature(bytes::Bytes::from_static(b"example"));
639 /// ```
640 pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
641 self.signature = v.into();
642 self
643 }
644
645 /// Sets the value of [public_key_id][crate::model::Signature::public_key_id].
646 ///
647 /// # Example
648 /// ```ignore,no_run
649 /// # use google_cloud_grafeas_v1::model::Signature;
650 /// let x = Signature::new().set_public_key_id("example");
651 /// ```
652 pub fn set_public_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
653 self.public_key_id = v.into();
654 self
655 }
656}
657
658impl wkt::message::Message for Signature {
659 fn typename() -> &'static str {
660 "type.googleapis.com/grafeas.v1.Signature"
661 }
662}
663
664/// MUST match
665/// <https://github.com/secure-systems-lab/dsse/blob/master/envelope.proto>. An
666/// authenticated message of arbitrary type.
667#[derive(Clone, Default, PartialEq)]
668#[non_exhaustive]
669pub struct Envelope {
670 pub payload: ::bytes::Bytes,
671
672 pub payload_type: std::string::String,
673
674 pub signatures: std::vec::Vec<crate::model::EnvelopeSignature>,
675
676 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
677}
678
679impl Envelope {
680 pub fn new() -> Self {
681 std::default::Default::default()
682 }
683
684 /// Sets the value of [payload][crate::model::Envelope::payload].
685 ///
686 /// # Example
687 /// ```ignore,no_run
688 /// # use google_cloud_grafeas_v1::model::Envelope;
689 /// let x = Envelope::new().set_payload(bytes::Bytes::from_static(b"example"));
690 /// ```
691 pub fn set_payload<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
692 self.payload = v.into();
693 self
694 }
695
696 /// Sets the value of [payload_type][crate::model::Envelope::payload_type].
697 ///
698 /// # Example
699 /// ```ignore,no_run
700 /// # use google_cloud_grafeas_v1::model::Envelope;
701 /// let x = Envelope::new().set_payload_type("example");
702 /// ```
703 pub fn set_payload_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
704 self.payload_type = v.into();
705 self
706 }
707
708 /// Sets the value of [signatures][crate::model::Envelope::signatures].
709 ///
710 /// # Example
711 /// ```ignore,no_run
712 /// # use google_cloud_grafeas_v1::model::Envelope;
713 /// use google_cloud_grafeas_v1::model::EnvelopeSignature;
714 /// let x = Envelope::new()
715 /// .set_signatures([
716 /// EnvelopeSignature::default()/* use setters */,
717 /// EnvelopeSignature::default()/* use (different) setters */,
718 /// ]);
719 /// ```
720 pub fn set_signatures<T, V>(mut self, v: T) -> Self
721 where
722 T: std::iter::IntoIterator<Item = V>,
723 V: std::convert::Into<crate::model::EnvelopeSignature>,
724 {
725 use std::iter::Iterator;
726 self.signatures = v.into_iter().map(|i| i.into()).collect();
727 self
728 }
729}
730
731impl wkt::message::Message for Envelope {
732 fn typename() -> &'static str {
733 "type.googleapis.com/grafeas.v1.Envelope"
734 }
735}
736
737#[derive(Clone, Default, PartialEq)]
738#[non_exhaustive]
739pub struct EnvelopeSignature {
740 pub sig: ::bytes::Bytes,
741
742 pub keyid: std::string::String,
743
744 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
745}
746
747impl EnvelopeSignature {
748 pub fn new() -> Self {
749 std::default::Default::default()
750 }
751
752 /// Sets the value of [sig][crate::model::EnvelopeSignature::sig].
753 ///
754 /// # Example
755 /// ```ignore,no_run
756 /// # use google_cloud_grafeas_v1::model::EnvelopeSignature;
757 /// let x = EnvelopeSignature::new().set_sig(bytes::Bytes::from_static(b"example"));
758 /// ```
759 pub fn set_sig<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
760 self.sig = v.into();
761 self
762 }
763
764 /// Sets the value of [keyid][crate::model::EnvelopeSignature::keyid].
765 ///
766 /// # Example
767 /// ```ignore,no_run
768 /// # use google_cloud_grafeas_v1::model::EnvelopeSignature;
769 /// let x = EnvelopeSignature::new().set_keyid("example");
770 /// ```
771 pub fn set_keyid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
772 self.keyid = v.into();
773 self
774 }
775}
776
777impl wkt::message::Message for EnvelopeSignature {
778 fn typename() -> &'static str {
779 "type.googleapis.com/grafeas.v1.EnvelopeSignature"
780 }
781}
782
783/// Indicates the location at which a package was found.
784#[derive(Clone, Default, PartialEq)]
785#[non_exhaustive]
786pub struct FileLocation {
787 /// For jars that are contained inside .war files, this filepath
788 /// can indicate the path to war file combined with the path to jar file.
789 pub file_path: std::string::String,
790
791 /// Each package found in a file should have its own layer metadata (that is,
792 /// information from the origin layer of the package).
793 pub layer_details: std::option::Option<crate::model::LayerDetails>,
794
795 /// Line number in the file where the package was found.
796 /// Optional field that only applies to source repository scanning.
797 pub line_number: i32,
798
799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
800}
801
802impl FileLocation {
803 pub fn new() -> Self {
804 std::default::Default::default()
805 }
806
807 /// Sets the value of [file_path][crate::model::FileLocation::file_path].
808 ///
809 /// # Example
810 /// ```ignore,no_run
811 /// # use google_cloud_grafeas_v1::model::FileLocation;
812 /// let x = FileLocation::new().set_file_path("example");
813 /// ```
814 pub fn set_file_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
815 self.file_path = v.into();
816 self
817 }
818
819 /// Sets the value of [layer_details][crate::model::FileLocation::layer_details].
820 ///
821 /// # Example
822 /// ```ignore,no_run
823 /// # use google_cloud_grafeas_v1::model::FileLocation;
824 /// use google_cloud_grafeas_v1::model::LayerDetails;
825 /// let x = FileLocation::new().set_layer_details(LayerDetails::default()/* use setters */);
826 /// ```
827 pub fn set_layer_details<T>(mut self, v: T) -> Self
828 where
829 T: std::convert::Into<crate::model::LayerDetails>,
830 {
831 self.layer_details = std::option::Option::Some(v.into());
832 self
833 }
834
835 /// Sets or clears the value of [layer_details][crate::model::FileLocation::layer_details].
836 ///
837 /// # Example
838 /// ```ignore,no_run
839 /// # use google_cloud_grafeas_v1::model::FileLocation;
840 /// use google_cloud_grafeas_v1::model::LayerDetails;
841 /// let x = FileLocation::new().set_or_clear_layer_details(Some(LayerDetails::default()/* use setters */));
842 /// let x = FileLocation::new().set_or_clear_layer_details(None::<LayerDetails>);
843 /// ```
844 pub fn set_or_clear_layer_details<T>(mut self, v: std::option::Option<T>) -> Self
845 where
846 T: std::convert::Into<crate::model::LayerDetails>,
847 {
848 self.layer_details = v.map(|x| x.into());
849 self
850 }
851
852 /// Sets the value of [line_number][crate::model::FileLocation::line_number].
853 ///
854 /// # Example
855 /// ```ignore,no_run
856 /// # use google_cloud_grafeas_v1::model::FileLocation;
857 /// let x = FileLocation::new().set_line_number(42);
858 /// ```
859 pub fn set_line_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
860 self.line_number = v.into();
861 self
862 }
863}
864
865impl wkt::message::Message for FileLocation {
866 fn typename() -> &'static str {
867 "type.googleapis.com/grafeas.v1.FileLocation"
868 }
869}
870
871/// BaseImage describes a base image of a container image.
872#[derive(Clone, Default, PartialEq)]
873#[non_exhaustive]
874pub struct BaseImage {
875 /// The name of the base image.
876 pub name: std::string::String,
877
878 /// The repository name in which the base image is from.
879 pub repository: std::string::String,
880
881 /// The number of layers that the base image is composed of.
882 pub layer_count: i32,
883
884 /// The registry in which the base image is from.
885 pub registry: std::string::String,
886
887 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
888}
889
890impl BaseImage {
891 pub fn new() -> Self {
892 std::default::Default::default()
893 }
894
895 /// Sets the value of [name][crate::model::BaseImage::name].
896 ///
897 /// # Example
898 /// ```ignore,no_run
899 /// # use google_cloud_grafeas_v1::model::BaseImage;
900 /// let x = BaseImage::new().set_name("example");
901 /// ```
902 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
903 self.name = v.into();
904 self
905 }
906
907 /// Sets the value of [repository][crate::model::BaseImage::repository].
908 ///
909 /// # Example
910 /// ```ignore,no_run
911 /// # use google_cloud_grafeas_v1::model::BaseImage;
912 /// let x = BaseImage::new().set_repository("example");
913 /// ```
914 pub fn set_repository<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
915 self.repository = v.into();
916 self
917 }
918
919 /// Sets the value of [layer_count][crate::model::BaseImage::layer_count].
920 ///
921 /// # Example
922 /// ```ignore,no_run
923 /// # use google_cloud_grafeas_v1::model::BaseImage;
924 /// let x = BaseImage::new().set_layer_count(42);
925 /// ```
926 pub fn set_layer_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
927 self.layer_count = v.into();
928 self
929 }
930
931 /// Sets the value of [registry][crate::model::BaseImage::registry].
932 ///
933 /// # Example
934 /// ```ignore,no_run
935 /// # use google_cloud_grafeas_v1::model::BaseImage;
936 /// let x = BaseImage::new().set_registry("example");
937 /// ```
938 pub fn set_registry<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
939 self.registry = v.into();
940 self
941 }
942}
943
944impl wkt::message::Message for BaseImage {
945 fn typename() -> &'static str {
946 "type.googleapis.com/grafeas.v1.BaseImage"
947 }
948}
949
950/// Details about the layer a package was found in.
951#[derive(Clone, Default, PartialEq)]
952#[non_exhaustive]
953pub struct LayerDetails {
954 /// The index of the layer in the container image.
955 pub index: i32,
956
957 /// The diff ID (typically a sha256 hash) of the layer in the container image.
958 pub diff_id: std::string::String,
959
960 /// The layer chain ID (sha256 hash) of the layer in the container image.
961 /// <https://github.com/opencontainers/image-spec/blob/main/config.md#layer-chainid>
962 pub chain_id: std::string::String,
963
964 /// The layer build command that was used to build the layer. This may not be
965 /// found in all layers depending on how the container image is built.
966 pub command: std::string::String,
967
968 /// The base images the layer is found within.
969 pub base_images: std::vec::Vec<crate::model::BaseImage>,
970
971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
972}
973
974impl LayerDetails {
975 pub fn new() -> Self {
976 std::default::Default::default()
977 }
978
979 /// Sets the value of [index][crate::model::LayerDetails::index].
980 ///
981 /// # Example
982 /// ```ignore,no_run
983 /// # use google_cloud_grafeas_v1::model::LayerDetails;
984 /// let x = LayerDetails::new().set_index(42);
985 /// ```
986 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
987 self.index = v.into();
988 self
989 }
990
991 /// Sets the value of [diff_id][crate::model::LayerDetails::diff_id].
992 ///
993 /// # Example
994 /// ```ignore,no_run
995 /// # use google_cloud_grafeas_v1::model::LayerDetails;
996 /// let x = LayerDetails::new().set_diff_id("example");
997 /// ```
998 pub fn set_diff_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
999 self.diff_id = v.into();
1000 self
1001 }
1002
1003 /// Sets the value of [chain_id][crate::model::LayerDetails::chain_id].
1004 ///
1005 /// # Example
1006 /// ```ignore,no_run
1007 /// # use google_cloud_grafeas_v1::model::LayerDetails;
1008 /// let x = LayerDetails::new().set_chain_id("example");
1009 /// ```
1010 pub fn set_chain_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1011 self.chain_id = v.into();
1012 self
1013 }
1014
1015 /// Sets the value of [command][crate::model::LayerDetails::command].
1016 ///
1017 /// # Example
1018 /// ```ignore,no_run
1019 /// # use google_cloud_grafeas_v1::model::LayerDetails;
1020 /// let x = LayerDetails::new().set_command("example");
1021 /// ```
1022 pub fn set_command<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1023 self.command = v.into();
1024 self
1025 }
1026
1027 /// Sets the value of [base_images][crate::model::LayerDetails::base_images].
1028 ///
1029 /// # Example
1030 /// ```ignore,no_run
1031 /// # use google_cloud_grafeas_v1::model::LayerDetails;
1032 /// use google_cloud_grafeas_v1::model::BaseImage;
1033 /// let x = LayerDetails::new()
1034 /// .set_base_images([
1035 /// BaseImage::default()/* use setters */,
1036 /// BaseImage::default()/* use (different) setters */,
1037 /// ]);
1038 /// ```
1039 pub fn set_base_images<T, V>(mut self, v: T) -> Self
1040 where
1041 T: std::iter::IntoIterator<Item = V>,
1042 V: std::convert::Into<crate::model::BaseImage>,
1043 {
1044 use std::iter::Iterator;
1045 self.base_images = v.into_iter().map(|i| i.into()).collect();
1046 self
1047 }
1048}
1049
1050impl wkt::message::Message for LayerDetails {
1051 fn typename() -> &'static str {
1052 "type.googleapis.com/grafeas.v1.LayerDetails"
1053 }
1054}
1055
1056/// License information.
1057#[derive(Clone, Default, PartialEq)]
1058#[non_exhaustive]
1059pub struct License {
1060 /// Often a single license can be used to represent the licensing terms.
1061 /// Sometimes it is necessary to include a choice of one or more licenses
1062 /// or some combination of license identifiers.
1063 /// Examples: "LGPL-2.1-only OR MIT", "LGPL-2.1-only AND MIT",
1064 /// "GPL-2.0-or-later WITH Bison-exception-2.2".
1065 pub expression: std::string::String,
1066
1067 /// Comments
1068 pub comments: std::string::String,
1069
1070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1071}
1072
1073impl License {
1074 pub fn new() -> Self {
1075 std::default::Default::default()
1076 }
1077
1078 /// Sets the value of [expression][crate::model::License::expression].
1079 ///
1080 /// # Example
1081 /// ```ignore,no_run
1082 /// # use google_cloud_grafeas_v1::model::License;
1083 /// let x = License::new().set_expression("example");
1084 /// ```
1085 pub fn set_expression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1086 self.expression = v.into();
1087 self
1088 }
1089
1090 /// Sets the value of [comments][crate::model::License::comments].
1091 ///
1092 /// # Example
1093 /// ```ignore,no_run
1094 /// # use google_cloud_grafeas_v1::model::License;
1095 /// let x = License::new().set_comments("example");
1096 /// ```
1097 pub fn set_comments<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1098 self.comments = v.into();
1099 self
1100 }
1101}
1102
1103impl wkt::message::Message for License {
1104 fn typename() -> &'static str {
1105 "type.googleapis.com/grafeas.v1.License"
1106 }
1107}
1108
1109/// Digest information.
1110#[derive(Clone, Default, PartialEq)]
1111#[non_exhaustive]
1112pub struct Digest {
1113 /// `SHA1`, `SHA512` etc.
1114 pub algo: std::string::String,
1115
1116 /// Value of the digest.
1117 pub digest_bytes: ::bytes::Bytes,
1118
1119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1120}
1121
1122impl Digest {
1123 pub fn new() -> Self {
1124 std::default::Default::default()
1125 }
1126
1127 /// Sets the value of [algo][crate::model::Digest::algo].
1128 ///
1129 /// # Example
1130 /// ```ignore,no_run
1131 /// # use google_cloud_grafeas_v1::model::Digest;
1132 /// let x = Digest::new().set_algo("example");
1133 /// ```
1134 pub fn set_algo<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1135 self.algo = v.into();
1136 self
1137 }
1138
1139 /// Sets the value of [digest_bytes][crate::model::Digest::digest_bytes].
1140 ///
1141 /// # Example
1142 /// ```ignore,no_run
1143 /// # use google_cloud_grafeas_v1::model::Digest;
1144 /// let x = Digest::new().set_digest_bytes(bytes::Bytes::from_static(b"example"));
1145 /// ```
1146 pub fn set_digest_bytes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1147 self.digest_bytes = v.into();
1148 self
1149 }
1150}
1151
1152impl wkt::message::Message for Digest {
1153 fn typename() -> &'static str {
1154 "type.googleapis.com/grafeas.v1.Digest"
1155 }
1156}
1157
1158#[derive(Clone, Default, PartialEq)]
1159#[non_exhaustive]
1160pub struct ComplianceNote {
1161 /// The title that identifies this compliance check.
1162 pub title: std::string::String,
1163
1164 /// A description about this compliance check.
1165 pub description: std::string::String,
1166
1167 /// The OS and config versions the benchmark applies to.
1168 pub version: std::vec::Vec<crate::model::ComplianceVersion>,
1169
1170 /// A rationale for the existence of this compliance check.
1171 pub rationale: std::string::String,
1172
1173 /// A description of remediation steps if the compliance check fails.
1174 pub remediation: std::string::String,
1175
1176 /// Serialized scan instructions with a predefined format.
1177 pub scan_instructions: ::bytes::Bytes,
1178
1179 pub compliance_type: std::option::Option<crate::model::compliance_note::ComplianceType>,
1180
1181 /// Potential impact of the suggested remediation
1182 pub potential_impact: std::option::Option<crate::model::compliance_note::PotentialImpact>,
1183
1184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1185}
1186
1187impl ComplianceNote {
1188 pub fn new() -> Self {
1189 std::default::Default::default()
1190 }
1191
1192 /// Sets the value of [title][crate::model::ComplianceNote::title].
1193 ///
1194 /// # Example
1195 /// ```ignore,no_run
1196 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1197 /// let x = ComplianceNote::new().set_title("example");
1198 /// ```
1199 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1200 self.title = v.into();
1201 self
1202 }
1203
1204 /// Sets the value of [description][crate::model::ComplianceNote::description].
1205 ///
1206 /// # Example
1207 /// ```ignore,no_run
1208 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1209 /// let x = ComplianceNote::new().set_description("example");
1210 /// ```
1211 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1212 self.description = v.into();
1213 self
1214 }
1215
1216 /// Sets the value of [version][crate::model::ComplianceNote::version].
1217 ///
1218 /// # Example
1219 /// ```ignore,no_run
1220 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1221 /// use google_cloud_grafeas_v1::model::ComplianceVersion;
1222 /// let x = ComplianceNote::new()
1223 /// .set_version([
1224 /// ComplianceVersion::default()/* use setters */,
1225 /// ComplianceVersion::default()/* use (different) setters */,
1226 /// ]);
1227 /// ```
1228 pub fn set_version<T, V>(mut self, v: T) -> Self
1229 where
1230 T: std::iter::IntoIterator<Item = V>,
1231 V: std::convert::Into<crate::model::ComplianceVersion>,
1232 {
1233 use std::iter::Iterator;
1234 self.version = v.into_iter().map(|i| i.into()).collect();
1235 self
1236 }
1237
1238 /// Sets the value of [rationale][crate::model::ComplianceNote::rationale].
1239 ///
1240 /// # Example
1241 /// ```ignore,no_run
1242 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1243 /// let x = ComplianceNote::new().set_rationale("example");
1244 /// ```
1245 pub fn set_rationale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1246 self.rationale = v.into();
1247 self
1248 }
1249
1250 /// Sets the value of [remediation][crate::model::ComplianceNote::remediation].
1251 ///
1252 /// # Example
1253 /// ```ignore,no_run
1254 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1255 /// let x = ComplianceNote::new().set_remediation("example");
1256 /// ```
1257 pub fn set_remediation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1258 self.remediation = v.into();
1259 self
1260 }
1261
1262 /// Sets the value of [scan_instructions][crate::model::ComplianceNote::scan_instructions].
1263 ///
1264 /// # Example
1265 /// ```ignore,no_run
1266 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1267 /// let x = ComplianceNote::new().set_scan_instructions(bytes::Bytes::from_static(b"example"));
1268 /// ```
1269 pub fn set_scan_instructions<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1270 self.scan_instructions = v.into();
1271 self
1272 }
1273
1274 /// Sets the value of [compliance_type][crate::model::ComplianceNote::compliance_type].
1275 ///
1276 /// Note that all the setters affecting `compliance_type` are mutually
1277 /// exclusive.
1278 ///
1279 /// # Example
1280 /// ```ignore,no_run
1281 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1282 /// use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1283 /// let x = ComplianceNote::new().set_compliance_type(Some(
1284 /// google_cloud_grafeas_v1::model::compliance_note::ComplianceType::CisBenchmark(CisBenchmark::default().into())));
1285 /// ```
1286 pub fn set_compliance_type<
1287 T: std::convert::Into<std::option::Option<crate::model::compliance_note::ComplianceType>>,
1288 >(
1289 mut self,
1290 v: T,
1291 ) -> Self {
1292 self.compliance_type = v.into();
1293 self
1294 }
1295
1296 /// The value of [compliance_type][crate::model::ComplianceNote::compliance_type]
1297 /// if it holds a `CisBenchmark`, `None` if the field is not set or
1298 /// holds a different branch.
1299 pub fn cis_benchmark(
1300 &self,
1301 ) -> std::option::Option<&std::boxed::Box<crate::model::compliance_note::CisBenchmark>> {
1302 #[allow(unreachable_patterns)]
1303 self.compliance_type.as_ref().and_then(|v| match v {
1304 crate::model::compliance_note::ComplianceType::CisBenchmark(v) => {
1305 std::option::Option::Some(v)
1306 }
1307 _ => std::option::Option::None,
1308 })
1309 }
1310
1311 /// Sets the value of [compliance_type][crate::model::ComplianceNote::compliance_type]
1312 /// to hold a `CisBenchmark`.
1313 ///
1314 /// Note that all the setters affecting `compliance_type` are
1315 /// mutually exclusive.
1316 ///
1317 /// # Example
1318 /// ```ignore,no_run
1319 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1320 /// use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1321 /// let x = ComplianceNote::new().set_cis_benchmark(CisBenchmark::default()/* use setters */);
1322 /// assert!(x.cis_benchmark().is_some());
1323 /// ```
1324 pub fn set_cis_benchmark<
1325 T: std::convert::Into<std::boxed::Box<crate::model::compliance_note::CisBenchmark>>,
1326 >(
1327 mut self,
1328 v: T,
1329 ) -> Self {
1330 self.compliance_type = std::option::Option::Some(
1331 crate::model::compliance_note::ComplianceType::CisBenchmark(v.into()),
1332 );
1333 self
1334 }
1335
1336 /// Sets the value of [potential_impact][crate::model::ComplianceNote::potential_impact].
1337 ///
1338 /// Note that all the setters affecting `potential_impact` are mutually
1339 /// exclusive.
1340 ///
1341 /// # Example
1342 /// ```ignore,no_run
1343 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1344 /// use google_cloud_grafeas_v1::model::compliance_note::PotentialImpact;
1345 /// let x = ComplianceNote::new().set_potential_impact(Some(PotentialImpact::Impact("example".to_string())));
1346 /// ```
1347 pub fn set_potential_impact<
1348 T: std::convert::Into<std::option::Option<crate::model::compliance_note::PotentialImpact>>,
1349 >(
1350 mut self,
1351 v: T,
1352 ) -> Self {
1353 self.potential_impact = v.into();
1354 self
1355 }
1356
1357 /// The value of [potential_impact][crate::model::ComplianceNote::potential_impact]
1358 /// if it holds a `Impact`, `None` if the field is not set or
1359 /// holds a different branch.
1360 pub fn impact(&self) -> std::option::Option<&std::string::String> {
1361 #[allow(unreachable_patterns)]
1362 self.potential_impact.as_ref().and_then(|v| match v {
1363 crate::model::compliance_note::PotentialImpact::Impact(v) => {
1364 std::option::Option::Some(v)
1365 }
1366 _ => std::option::Option::None,
1367 })
1368 }
1369
1370 /// Sets the value of [potential_impact][crate::model::ComplianceNote::potential_impact]
1371 /// to hold a `Impact`.
1372 ///
1373 /// Note that all the setters affecting `potential_impact` are
1374 /// mutually exclusive.
1375 ///
1376 /// # Example
1377 /// ```ignore,no_run
1378 /// # use google_cloud_grafeas_v1::model::ComplianceNote;
1379 /// let x = ComplianceNote::new().set_impact("example");
1380 /// assert!(x.impact().is_some());
1381 /// ```
1382 pub fn set_impact<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1383 self.potential_impact = std::option::Option::Some(
1384 crate::model::compliance_note::PotentialImpact::Impact(v.into()),
1385 );
1386 self
1387 }
1388}
1389
1390impl wkt::message::Message for ComplianceNote {
1391 fn typename() -> &'static str {
1392 "type.googleapis.com/grafeas.v1.ComplianceNote"
1393 }
1394}
1395
1396/// Defines additional types related to [ComplianceNote].
1397pub mod compliance_note {
1398 #[allow(unused_imports)]
1399 use super::*;
1400
1401 /// A compliance check that is a CIS benchmark.
1402 #[derive(Clone, Default, PartialEq)]
1403 #[non_exhaustive]
1404 pub struct CisBenchmark {
1405 pub profile_level: i32,
1406
1407 pub severity: crate::model::Severity,
1408
1409 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1410 }
1411
1412 impl CisBenchmark {
1413 pub fn new() -> Self {
1414 std::default::Default::default()
1415 }
1416
1417 /// Sets the value of [profile_level][crate::model::compliance_note::CisBenchmark::profile_level].
1418 ///
1419 /// # Example
1420 /// ```ignore,no_run
1421 /// # use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1422 /// let x = CisBenchmark::new().set_profile_level(42);
1423 /// ```
1424 pub fn set_profile_level<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1425 self.profile_level = v.into();
1426 self
1427 }
1428
1429 /// Sets the value of [severity][crate::model::compliance_note::CisBenchmark::severity].
1430 ///
1431 /// # Example
1432 /// ```ignore,no_run
1433 /// # use google_cloud_grafeas_v1::model::compliance_note::CisBenchmark;
1434 /// use google_cloud_grafeas_v1::model::Severity;
1435 /// let x0 = CisBenchmark::new().set_severity(Severity::Minimal);
1436 /// let x1 = CisBenchmark::new().set_severity(Severity::Low);
1437 /// let x2 = CisBenchmark::new().set_severity(Severity::Medium);
1438 /// ```
1439 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
1440 self.severity = v.into();
1441 self
1442 }
1443 }
1444
1445 impl wkt::message::Message for CisBenchmark {
1446 fn typename() -> &'static str {
1447 "type.googleapis.com/grafeas.v1.ComplianceNote.CisBenchmark"
1448 }
1449 }
1450
1451 #[derive(Clone, Debug, PartialEq)]
1452 #[non_exhaustive]
1453 pub enum ComplianceType {
1454 CisBenchmark(std::boxed::Box<crate::model::compliance_note::CisBenchmark>),
1455 }
1456
1457 /// Potential impact of the suggested remediation
1458 #[derive(Clone, Debug, PartialEq)]
1459 #[non_exhaustive]
1460 pub enum PotentialImpact {
1461 Impact(std::string::String),
1462 }
1463}
1464
1465/// Describes the CIS benchmark version that is applicable to a given OS and
1466/// os version.
1467#[derive(Clone, Default, PartialEq)]
1468#[non_exhaustive]
1469pub struct ComplianceVersion {
1470 /// The CPE URI (<https://cpe.mitre.org/specification/>) this benchmark is
1471 /// applicable to.
1472 pub cpe_uri: std::string::String,
1473
1474 /// The name of the document that defines this benchmark, e.g. "CIS
1475 /// Container-Optimized OS".
1476 pub benchmark_document: std::string::String,
1477
1478 /// The version of the benchmark. This is set to the version of the OS-specific
1479 /// CIS document the benchmark is defined in.
1480 pub version: std::string::String,
1481
1482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1483}
1484
1485impl ComplianceVersion {
1486 pub fn new() -> Self {
1487 std::default::Default::default()
1488 }
1489
1490 /// Sets the value of [cpe_uri][crate::model::ComplianceVersion::cpe_uri].
1491 ///
1492 /// # Example
1493 /// ```ignore,no_run
1494 /// # use google_cloud_grafeas_v1::model::ComplianceVersion;
1495 /// let x = ComplianceVersion::new().set_cpe_uri("example");
1496 /// ```
1497 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1498 self.cpe_uri = v.into();
1499 self
1500 }
1501
1502 /// Sets the value of [benchmark_document][crate::model::ComplianceVersion::benchmark_document].
1503 ///
1504 /// # Example
1505 /// ```ignore,no_run
1506 /// # use google_cloud_grafeas_v1::model::ComplianceVersion;
1507 /// let x = ComplianceVersion::new().set_benchmark_document("example");
1508 /// ```
1509 pub fn set_benchmark_document<T: std::convert::Into<std::string::String>>(
1510 mut self,
1511 v: T,
1512 ) -> Self {
1513 self.benchmark_document = v.into();
1514 self
1515 }
1516
1517 /// Sets the value of [version][crate::model::ComplianceVersion::version].
1518 ///
1519 /// # Example
1520 /// ```ignore,no_run
1521 /// # use google_cloud_grafeas_v1::model::ComplianceVersion;
1522 /// let x = ComplianceVersion::new().set_version("example");
1523 /// ```
1524 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1525 self.version = v.into();
1526 self
1527 }
1528}
1529
1530impl wkt::message::Message for ComplianceVersion {
1531 fn typename() -> &'static str {
1532 "type.googleapis.com/grafeas.v1.ComplianceVersion"
1533 }
1534}
1535
1536/// An indication that the compliance checks in the associated ComplianceNote
1537/// were not satisfied for particular resources or a specified reason.
1538#[derive(Clone, Default, PartialEq)]
1539#[non_exhaustive]
1540pub struct ComplianceOccurrence {
1541 pub non_compliant_files: std::vec::Vec<crate::model::NonCompliantFile>,
1542
1543 pub non_compliance_reason: std::string::String,
1544
1545 /// The OS and config version the benchmark was run on.
1546 pub version: std::option::Option<crate::model::ComplianceVersion>,
1547
1548 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1549}
1550
1551impl ComplianceOccurrence {
1552 pub fn new() -> Self {
1553 std::default::Default::default()
1554 }
1555
1556 /// Sets the value of [non_compliant_files][crate::model::ComplianceOccurrence::non_compliant_files].
1557 ///
1558 /// # Example
1559 /// ```ignore,no_run
1560 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1561 /// use google_cloud_grafeas_v1::model::NonCompliantFile;
1562 /// let x = ComplianceOccurrence::new()
1563 /// .set_non_compliant_files([
1564 /// NonCompliantFile::default()/* use setters */,
1565 /// NonCompliantFile::default()/* use (different) setters */,
1566 /// ]);
1567 /// ```
1568 pub fn set_non_compliant_files<T, V>(mut self, v: T) -> Self
1569 where
1570 T: std::iter::IntoIterator<Item = V>,
1571 V: std::convert::Into<crate::model::NonCompliantFile>,
1572 {
1573 use std::iter::Iterator;
1574 self.non_compliant_files = v.into_iter().map(|i| i.into()).collect();
1575 self
1576 }
1577
1578 /// Sets the value of [non_compliance_reason][crate::model::ComplianceOccurrence::non_compliance_reason].
1579 ///
1580 /// # Example
1581 /// ```ignore,no_run
1582 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1583 /// let x = ComplianceOccurrence::new().set_non_compliance_reason("example");
1584 /// ```
1585 pub fn set_non_compliance_reason<T: std::convert::Into<std::string::String>>(
1586 mut self,
1587 v: T,
1588 ) -> Self {
1589 self.non_compliance_reason = v.into();
1590 self
1591 }
1592
1593 /// Sets the value of [version][crate::model::ComplianceOccurrence::version].
1594 ///
1595 /// # Example
1596 /// ```ignore,no_run
1597 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1598 /// use google_cloud_grafeas_v1::model::ComplianceVersion;
1599 /// let x = ComplianceOccurrence::new().set_version(ComplianceVersion::default()/* use setters */);
1600 /// ```
1601 pub fn set_version<T>(mut self, v: T) -> Self
1602 where
1603 T: std::convert::Into<crate::model::ComplianceVersion>,
1604 {
1605 self.version = std::option::Option::Some(v.into());
1606 self
1607 }
1608
1609 /// Sets or clears the value of [version][crate::model::ComplianceOccurrence::version].
1610 ///
1611 /// # Example
1612 /// ```ignore,no_run
1613 /// # use google_cloud_grafeas_v1::model::ComplianceOccurrence;
1614 /// use google_cloud_grafeas_v1::model::ComplianceVersion;
1615 /// let x = ComplianceOccurrence::new().set_or_clear_version(Some(ComplianceVersion::default()/* use setters */));
1616 /// let x = ComplianceOccurrence::new().set_or_clear_version(None::<ComplianceVersion>);
1617 /// ```
1618 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
1619 where
1620 T: std::convert::Into<crate::model::ComplianceVersion>,
1621 {
1622 self.version = v.map(|x| x.into());
1623 self
1624 }
1625}
1626
1627impl wkt::message::Message for ComplianceOccurrence {
1628 fn typename() -> &'static str {
1629 "type.googleapis.com/grafeas.v1.ComplianceOccurrence"
1630 }
1631}
1632
1633/// Details about files that caused a compliance check to fail.
1634#[derive(Clone, Default, PartialEq)]
1635#[non_exhaustive]
1636pub struct NonCompliantFile {
1637 /// Empty if `display_command` is set.
1638 pub path: std::string::String,
1639
1640 /// Command to display the non-compliant files.
1641 pub display_command: std::string::String,
1642
1643 /// Explains why a file is non compliant for a CIS check.
1644 pub reason: std::string::String,
1645
1646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1647}
1648
1649impl NonCompliantFile {
1650 pub fn new() -> Self {
1651 std::default::Default::default()
1652 }
1653
1654 /// Sets the value of [path][crate::model::NonCompliantFile::path].
1655 ///
1656 /// # Example
1657 /// ```ignore,no_run
1658 /// # use google_cloud_grafeas_v1::model::NonCompliantFile;
1659 /// let x = NonCompliantFile::new().set_path("example");
1660 /// ```
1661 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1662 self.path = v.into();
1663 self
1664 }
1665
1666 /// Sets the value of [display_command][crate::model::NonCompliantFile::display_command].
1667 ///
1668 /// # Example
1669 /// ```ignore,no_run
1670 /// # use google_cloud_grafeas_v1::model::NonCompliantFile;
1671 /// let x = NonCompliantFile::new().set_display_command("example");
1672 /// ```
1673 pub fn set_display_command<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1674 self.display_command = v.into();
1675 self
1676 }
1677
1678 /// Sets the value of [reason][crate::model::NonCompliantFile::reason].
1679 ///
1680 /// # Example
1681 /// ```ignore,no_run
1682 /// # use google_cloud_grafeas_v1::model::NonCompliantFile;
1683 /// let x = NonCompliantFile::new().set_reason("example");
1684 /// ```
1685 pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1686 self.reason = v.into();
1687 self
1688 }
1689}
1690
1691impl wkt::message::Message for NonCompliantFile {
1692 fn typename() -> &'static str {
1693 "type.googleapis.com/grafeas.v1.NonCompliantFile"
1694 }
1695}
1696
1697/// Common Vulnerability Scoring System version 3.
1698/// For details, see <https://www.first.org/cvss/specification-document>
1699#[derive(Clone, Default, PartialEq)]
1700#[non_exhaustive]
1701pub struct CVSSv3 {
1702 /// The base score is a function of the base metric scores.
1703 pub base_score: f32,
1704
1705 pub exploitability_score: f32,
1706
1707 pub impact_score: f32,
1708
1709 /// Base Metrics
1710 /// Represents the intrinsic characteristics of a vulnerability that are
1711 /// constant over time and across user environments.
1712 pub attack_vector: crate::model::cvs_sv_3::AttackVector,
1713
1714 pub attack_complexity: crate::model::cvs_sv_3::AttackComplexity,
1715
1716 pub privileges_required: crate::model::cvs_sv_3::PrivilegesRequired,
1717
1718 pub user_interaction: crate::model::cvs_sv_3::UserInteraction,
1719
1720 pub scope: crate::model::cvs_sv_3::Scope,
1721
1722 pub confidentiality_impact: crate::model::cvs_sv_3::Impact,
1723
1724 pub integrity_impact: crate::model::cvs_sv_3::Impact,
1725
1726 pub availability_impact: crate::model::cvs_sv_3::Impact,
1727
1728 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1729}
1730
1731impl CVSSv3 {
1732 pub fn new() -> Self {
1733 std::default::Default::default()
1734 }
1735
1736 /// Sets the value of [base_score][crate::model::CVSSv3::base_score].
1737 ///
1738 /// # Example
1739 /// ```ignore,no_run
1740 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1741 /// let x = CVSSv3::new().set_base_score(42.0);
1742 /// ```
1743 pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1744 self.base_score = v.into();
1745 self
1746 }
1747
1748 /// Sets the value of [exploitability_score][crate::model::CVSSv3::exploitability_score].
1749 ///
1750 /// # Example
1751 /// ```ignore,no_run
1752 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1753 /// let x = CVSSv3::new().set_exploitability_score(42.0);
1754 /// ```
1755 pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1756 self.exploitability_score = v.into();
1757 self
1758 }
1759
1760 /// Sets the value of [impact_score][crate::model::CVSSv3::impact_score].
1761 ///
1762 /// # Example
1763 /// ```ignore,no_run
1764 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1765 /// let x = CVSSv3::new().set_impact_score(42.0);
1766 /// ```
1767 pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1768 self.impact_score = v.into();
1769 self
1770 }
1771
1772 /// Sets the value of [attack_vector][crate::model::CVSSv3::attack_vector].
1773 ///
1774 /// # Example
1775 /// ```ignore,no_run
1776 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1777 /// use google_cloud_grafeas_v1::model::cvs_sv_3::AttackVector;
1778 /// let x0 = CVSSv3::new().set_attack_vector(AttackVector::Network);
1779 /// let x1 = CVSSv3::new().set_attack_vector(AttackVector::Adjacent);
1780 /// let x2 = CVSSv3::new().set_attack_vector(AttackVector::Local);
1781 /// ```
1782 pub fn set_attack_vector<T: std::convert::Into<crate::model::cvs_sv_3::AttackVector>>(
1783 mut self,
1784 v: T,
1785 ) -> Self {
1786 self.attack_vector = v.into();
1787 self
1788 }
1789
1790 /// Sets the value of [attack_complexity][crate::model::CVSSv3::attack_complexity].
1791 ///
1792 /// # Example
1793 /// ```ignore,no_run
1794 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1795 /// use google_cloud_grafeas_v1::model::cvs_sv_3::AttackComplexity;
1796 /// let x0 = CVSSv3::new().set_attack_complexity(AttackComplexity::Low);
1797 /// let x1 = CVSSv3::new().set_attack_complexity(AttackComplexity::High);
1798 /// ```
1799 pub fn set_attack_complexity<
1800 T: std::convert::Into<crate::model::cvs_sv_3::AttackComplexity>,
1801 >(
1802 mut self,
1803 v: T,
1804 ) -> Self {
1805 self.attack_complexity = v.into();
1806 self
1807 }
1808
1809 /// Sets the value of [privileges_required][crate::model::CVSSv3::privileges_required].
1810 ///
1811 /// # Example
1812 /// ```ignore,no_run
1813 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1814 /// use google_cloud_grafeas_v1::model::cvs_sv_3::PrivilegesRequired;
1815 /// let x0 = CVSSv3::new().set_privileges_required(PrivilegesRequired::None);
1816 /// let x1 = CVSSv3::new().set_privileges_required(PrivilegesRequired::Low);
1817 /// let x2 = CVSSv3::new().set_privileges_required(PrivilegesRequired::High);
1818 /// ```
1819 pub fn set_privileges_required<
1820 T: std::convert::Into<crate::model::cvs_sv_3::PrivilegesRequired>,
1821 >(
1822 mut self,
1823 v: T,
1824 ) -> Self {
1825 self.privileges_required = v.into();
1826 self
1827 }
1828
1829 /// Sets the value of [user_interaction][crate::model::CVSSv3::user_interaction].
1830 ///
1831 /// # Example
1832 /// ```ignore,no_run
1833 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1834 /// use google_cloud_grafeas_v1::model::cvs_sv_3::UserInteraction;
1835 /// let x0 = CVSSv3::new().set_user_interaction(UserInteraction::None);
1836 /// let x1 = CVSSv3::new().set_user_interaction(UserInteraction::Required);
1837 /// ```
1838 pub fn set_user_interaction<T: std::convert::Into<crate::model::cvs_sv_3::UserInteraction>>(
1839 mut self,
1840 v: T,
1841 ) -> Self {
1842 self.user_interaction = v.into();
1843 self
1844 }
1845
1846 /// Sets the value of [scope][crate::model::CVSSv3::scope].
1847 ///
1848 /// # Example
1849 /// ```ignore,no_run
1850 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1851 /// use google_cloud_grafeas_v1::model::cvs_sv_3::Scope;
1852 /// let x0 = CVSSv3::new().set_scope(Scope::Unchanged);
1853 /// let x1 = CVSSv3::new().set_scope(Scope::Changed);
1854 /// ```
1855 pub fn set_scope<T: std::convert::Into<crate::model::cvs_sv_3::Scope>>(mut self, v: T) -> Self {
1856 self.scope = v.into();
1857 self
1858 }
1859
1860 /// Sets the value of [confidentiality_impact][crate::model::CVSSv3::confidentiality_impact].
1861 ///
1862 /// # Example
1863 /// ```ignore,no_run
1864 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1865 /// use google_cloud_grafeas_v1::model::cvs_sv_3::Impact;
1866 /// let x0 = CVSSv3::new().set_confidentiality_impact(Impact::High);
1867 /// let x1 = CVSSv3::new().set_confidentiality_impact(Impact::Low);
1868 /// let x2 = CVSSv3::new().set_confidentiality_impact(Impact::None);
1869 /// ```
1870 pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
1871 mut self,
1872 v: T,
1873 ) -> Self {
1874 self.confidentiality_impact = v.into();
1875 self
1876 }
1877
1878 /// Sets the value of [integrity_impact][crate::model::CVSSv3::integrity_impact].
1879 ///
1880 /// # Example
1881 /// ```ignore,no_run
1882 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1883 /// use google_cloud_grafeas_v1::model::cvs_sv_3::Impact;
1884 /// let x0 = CVSSv3::new().set_integrity_impact(Impact::High);
1885 /// let x1 = CVSSv3::new().set_integrity_impact(Impact::Low);
1886 /// let x2 = CVSSv3::new().set_integrity_impact(Impact::None);
1887 /// ```
1888 pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
1889 mut self,
1890 v: T,
1891 ) -> Self {
1892 self.integrity_impact = v.into();
1893 self
1894 }
1895
1896 /// Sets the value of [availability_impact][crate::model::CVSSv3::availability_impact].
1897 ///
1898 /// # Example
1899 /// ```ignore,no_run
1900 /// # use google_cloud_grafeas_v1::model::CVSSv3;
1901 /// use google_cloud_grafeas_v1::model::cvs_sv_3::Impact;
1902 /// let x0 = CVSSv3::new().set_availability_impact(Impact::High);
1903 /// let x1 = CVSSv3::new().set_availability_impact(Impact::Low);
1904 /// let x2 = CVSSv3::new().set_availability_impact(Impact::None);
1905 /// ```
1906 pub fn set_availability_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
1907 mut self,
1908 v: T,
1909 ) -> Self {
1910 self.availability_impact = v.into();
1911 self
1912 }
1913}
1914
1915impl wkt::message::Message for CVSSv3 {
1916 fn typename() -> &'static str {
1917 "type.googleapis.com/grafeas.v1.CVSSv3"
1918 }
1919}
1920
1921/// Defines additional types related to [CVSSv3].
1922pub mod cvs_sv_3 {
1923 #[allow(unused_imports)]
1924 use super::*;
1925
1926 ///
1927 /// # Working with unknown values
1928 ///
1929 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1930 /// additional enum variants at any time. Adding new variants is not considered
1931 /// a breaking change. Applications should write their code in anticipation of:
1932 ///
1933 /// - New values appearing in future releases of the client library, **and**
1934 /// - New values received dynamically, without application changes.
1935 ///
1936 /// Please consult the [Working with enums] section in the user guide for some
1937 /// guidelines.
1938 ///
1939 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1940 #[derive(Clone, Debug, PartialEq)]
1941 #[non_exhaustive]
1942 pub enum AttackVector {
1943 Unspecified,
1944 Network,
1945 Adjacent,
1946 Local,
1947 Physical,
1948 /// If set, the enum was initialized with an unknown value.
1949 ///
1950 /// Applications can examine the value using [AttackVector::value] or
1951 /// [AttackVector::name].
1952 UnknownValue(attack_vector::UnknownValue),
1953 }
1954
1955 #[doc(hidden)]
1956 pub mod attack_vector {
1957 #[allow(unused_imports)]
1958 use super::*;
1959 #[derive(Clone, Debug, PartialEq)]
1960 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1961 }
1962
1963 impl AttackVector {
1964 /// Gets the enum value.
1965 ///
1966 /// Returns `None` if the enum contains an unknown value deserialized from
1967 /// the string representation of enums.
1968 pub fn value(&self) -> std::option::Option<i32> {
1969 match self {
1970 Self::Unspecified => std::option::Option::Some(0),
1971 Self::Network => std::option::Option::Some(1),
1972 Self::Adjacent => std::option::Option::Some(2),
1973 Self::Local => std::option::Option::Some(3),
1974 Self::Physical => std::option::Option::Some(4),
1975 Self::UnknownValue(u) => u.0.value(),
1976 }
1977 }
1978
1979 /// Gets the enum value as a string.
1980 ///
1981 /// Returns `None` if the enum contains an unknown value deserialized from
1982 /// the integer representation of enums.
1983 pub fn name(&self) -> std::option::Option<&str> {
1984 match self {
1985 Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
1986 Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
1987 Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
1988 Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
1989 Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
1990 Self::UnknownValue(u) => u.0.name(),
1991 }
1992 }
1993 }
1994
1995 impl std::default::Default for AttackVector {
1996 fn default() -> Self {
1997 use std::convert::From;
1998 Self::from(0)
1999 }
2000 }
2001
2002 impl std::fmt::Display for AttackVector {
2003 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2004 wkt::internal::display_enum(f, self.name(), self.value())
2005 }
2006 }
2007
2008 impl std::convert::From<i32> for AttackVector {
2009 fn from(value: i32) -> Self {
2010 match value {
2011 0 => Self::Unspecified,
2012 1 => Self::Network,
2013 2 => Self::Adjacent,
2014 3 => Self::Local,
2015 4 => Self::Physical,
2016 _ => Self::UnknownValue(attack_vector::UnknownValue(
2017 wkt::internal::UnknownEnumValue::Integer(value),
2018 )),
2019 }
2020 }
2021 }
2022
2023 impl std::convert::From<&str> for AttackVector {
2024 fn from(value: &str) -> Self {
2025 use std::string::ToString;
2026 match value {
2027 "ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
2028 "ATTACK_VECTOR_NETWORK" => Self::Network,
2029 "ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
2030 "ATTACK_VECTOR_LOCAL" => Self::Local,
2031 "ATTACK_VECTOR_PHYSICAL" => Self::Physical,
2032 _ => Self::UnknownValue(attack_vector::UnknownValue(
2033 wkt::internal::UnknownEnumValue::String(value.to_string()),
2034 )),
2035 }
2036 }
2037 }
2038
2039 impl serde::ser::Serialize for AttackVector {
2040 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2041 where
2042 S: serde::Serializer,
2043 {
2044 match self {
2045 Self::Unspecified => serializer.serialize_i32(0),
2046 Self::Network => serializer.serialize_i32(1),
2047 Self::Adjacent => serializer.serialize_i32(2),
2048 Self::Local => serializer.serialize_i32(3),
2049 Self::Physical => serializer.serialize_i32(4),
2050 Self::UnknownValue(u) => u.0.serialize(serializer),
2051 }
2052 }
2053 }
2054
2055 impl<'de> serde::de::Deserialize<'de> for AttackVector {
2056 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2057 where
2058 D: serde::Deserializer<'de>,
2059 {
2060 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
2061 ".grafeas.v1.CVSSv3.AttackVector",
2062 ))
2063 }
2064 }
2065
2066 ///
2067 /// # Working with unknown values
2068 ///
2069 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2070 /// additional enum variants at any time. Adding new variants is not considered
2071 /// a breaking change. Applications should write their code in anticipation of:
2072 ///
2073 /// - New values appearing in future releases of the client library, **and**
2074 /// - New values received dynamically, without application changes.
2075 ///
2076 /// Please consult the [Working with enums] section in the user guide for some
2077 /// guidelines.
2078 ///
2079 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2080 #[derive(Clone, Debug, PartialEq)]
2081 #[non_exhaustive]
2082 pub enum AttackComplexity {
2083 Unspecified,
2084 Low,
2085 High,
2086 /// If set, the enum was initialized with an unknown value.
2087 ///
2088 /// Applications can examine the value using [AttackComplexity::value] or
2089 /// [AttackComplexity::name].
2090 UnknownValue(attack_complexity::UnknownValue),
2091 }
2092
2093 #[doc(hidden)]
2094 pub mod attack_complexity {
2095 #[allow(unused_imports)]
2096 use super::*;
2097 #[derive(Clone, Debug, PartialEq)]
2098 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2099 }
2100
2101 impl AttackComplexity {
2102 /// Gets the enum value.
2103 ///
2104 /// Returns `None` if the enum contains an unknown value deserialized from
2105 /// the string representation of enums.
2106 pub fn value(&self) -> std::option::Option<i32> {
2107 match self {
2108 Self::Unspecified => std::option::Option::Some(0),
2109 Self::Low => std::option::Option::Some(1),
2110 Self::High => std::option::Option::Some(2),
2111 Self::UnknownValue(u) => u.0.value(),
2112 }
2113 }
2114
2115 /// Gets the enum value as a string.
2116 ///
2117 /// Returns `None` if the enum contains an unknown value deserialized from
2118 /// the integer representation of enums.
2119 pub fn name(&self) -> std::option::Option<&str> {
2120 match self {
2121 Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
2122 Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
2123 Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
2124 Self::UnknownValue(u) => u.0.name(),
2125 }
2126 }
2127 }
2128
2129 impl std::default::Default for AttackComplexity {
2130 fn default() -> Self {
2131 use std::convert::From;
2132 Self::from(0)
2133 }
2134 }
2135
2136 impl std::fmt::Display for AttackComplexity {
2137 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2138 wkt::internal::display_enum(f, self.name(), self.value())
2139 }
2140 }
2141
2142 impl std::convert::From<i32> for AttackComplexity {
2143 fn from(value: i32) -> Self {
2144 match value {
2145 0 => Self::Unspecified,
2146 1 => Self::Low,
2147 2 => Self::High,
2148 _ => Self::UnknownValue(attack_complexity::UnknownValue(
2149 wkt::internal::UnknownEnumValue::Integer(value),
2150 )),
2151 }
2152 }
2153 }
2154
2155 impl std::convert::From<&str> for AttackComplexity {
2156 fn from(value: &str) -> Self {
2157 use std::string::ToString;
2158 match value {
2159 "ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
2160 "ATTACK_COMPLEXITY_LOW" => Self::Low,
2161 "ATTACK_COMPLEXITY_HIGH" => Self::High,
2162 _ => Self::UnknownValue(attack_complexity::UnknownValue(
2163 wkt::internal::UnknownEnumValue::String(value.to_string()),
2164 )),
2165 }
2166 }
2167 }
2168
2169 impl serde::ser::Serialize for AttackComplexity {
2170 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2171 where
2172 S: serde::Serializer,
2173 {
2174 match self {
2175 Self::Unspecified => serializer.serialize_i32(0),
2176 Self::Low => serializer.serialize_i32(1),
2177 Self::High => serializer.serialize_i32(2),
2178 Self::UnknownValue(u) => u.0.serialize(serializer),
2179 }
2180 }
2181 }
2182
2183 impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
2184 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2185 where
2186 D: serde::Deserializer<'de>,
2187 {
2188 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
2189 ".grafeas.v1.CVSSv3.AttackComplexity",
2190 ))
2191 }
2192 }
2193
2194 ///
2195 /// # Working with unknown values
2196 ///
2197 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2198 /// additional enum variants at any time. Adding new variants is not considered
2199 /// a breaking change. Applications should write their code in anticipation of:
2200 ///
2201 /// - New values appearing in future releases of the client library, **and**
2202 /// - New values received dynamically, without application changes.
2203 ///
2204 /// Please consult the [Working with enums] section in the user guide for some
2205 /// guidelines.
2206 ///
2207 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2208 #[derive(Clone, Debug, PartialEq)]
2209 #[non_exhaustive]
2210 pub enum PrivilegesRequired {
2211 Unspecified,
2212 None,
2213 Low,
2214 High,
2215 /// If set, the enum was initialized with an unknown value.
2216 ///
2217 /// Applications can examine the value using [PrivilegesRequired::value] or
2218 /// [PrivilegesRequired::name].
2219 UnknownValue(privileges_required::UnknownValue),
2220 }
2221
2222 #[doc(hidden)]
2223 pub mod privileges_required {
2224 #[allow(unused_imports)]
2225 use super::*;
2226 #[derive(Clone, Debug, PartialEq)]
2227 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2228 }
2229
2230 impl PrivilegesRequired {
2231 /// Gets the enum value.
2232 ///
2233 /// Returns `None` if the enum contains an unknown value deserialized from
2234 /// the string representation of enums.
2235 pub fn value(&self) -> std::option::Option<i32> {
2236 match self {
2237 Self::Unspecified => std::option::Option::Some(0),
2238 Self::None => std::option::Option::Some(1),
2239 Self::Low => std::option::Option::Some(2),
2240 Self::High => std::option::Option::Some(3),
2241 Self::UnknownValue(u) => u.0.value(),
2242 }
2243 }
2244
2245 /// Gets the enum value as a string.
2246 ///
2247 /// Returns `None` if the enum contains an unknown value deserialized from
2248 /// the integer representation of enums.
2249 pub fn name(&self) -> std::option::Option<&str> {
2250 match self {
2251 Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
2252 Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
2253 Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
2254 Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
2255 Self::UnknownValue(u) => u.0.name(),
2256 }
2257 }
2258 }
2259
2260 impl std::default::Default for PrivilegesRequired {
2261 fn default() -> Self {
2262 use std::convert::From;
2263 Self::from(0)
2264 }
2265 }
2266
2267 impl std::fmt::Display for PrivilegesRequired {
2268 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2269 wkt::internal::display_enum(f, self.name(), self.value())
2270 }
2271 }
2272
2273 impl std::convert::From<i32> for PrivilegesRequired {
2274 fn from(value: i32) -> Self {
2275 match value {
2276 0 => Self::Unspecified,
2277 1 => Self::None,
2278 2 => Self::Low,
2279 3 => Self::High,
2280 _ => Self::UnknownValue(privileges_required::UnknownValue(
2281 wkt::internal::UnknownEnumValue::Integer(value),
2282 )),
2283 }
2284 }
2285 }
2286
2287 impl std::convert::From<&str> for PrivilegesRequired {
2288 fn from(value: &str) -> Self {
2289 use std::string::ToString;
2290 match value {
2291 "PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
2292 "PRIVILEGES_REQUIRED_NONE" => Self::None,
2293 "PRIVILEGES_REQUIRED_LOW" => Self::Low,
2294 "PRIVILEGES_REQUIRED_HIGH" => Self::High,
2295 _ => Self::UnknownValue(privileges_required::UnknownValue(
2296 wkt::internal::UnknownEnumValue::String(value.to_string()),
2297 )),
2298 }
2299 }
2300 }
2301
2302 impl serde::ser::Serialize for PrivilegesRequired {
2303 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2304 where
2305 S: serde::Serializer,
2306 {
2307 match self {
2308 Self::Unspecified => serializer.serialize_i32(0),
2309 Self::None => serializer.serialize_i32(1),
2310 Self::Low => serializer.serialize_i32(2),
2311 Self::High => serializer.serialize_i32(3),
2312 Self::UnknownValue(u) => u.0.serialize(serializer),
2313 }
2314 }
2315 }
2316
2317 impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
2318 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2319 where
2320 D: serde::Deserializer<'de>,
2321 {
2322 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
2323 ".grafeas.v1.CVSSv3.PrivilegesRequired",
2324 ))
2325 }
2326 }
2327
2328 ///
2329 /// # Working with unknown values
2330 ///
2331 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2332 /// additional enum variants at any time. Adding new variants is not considered
2333 /// a breaking change. Applications should write their code in anticipation of:
2334 ///
2335 /// - New values appearing in future releases of the client library, **and**
2336 /// - New values received dynamically, without application changes.
2337 ///
2338 /// Please consult the [Working with enums] section in the user guide for some
2339 /// guidelines.
2340 ///
2341 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2342 #[derive(Clone, Debug, PartialEq)]
2343 #[non_exhaustive]
2344 pub enum UserInteraction {
2345 Unspecified,
2346 None,
2347 Required,
2348 /// If set, the enum was initialized with an unknown value.
2349 ///
2350 /// Applications can examine the value using [UserInteraction::value] or
2351 /// [UserInteraction::name].
2352 UnknownValue(user_interaction::UnknownValue),
2353 }
2354
2355 #[doc(hidden)]
2356 pub mod user_interaction {
2357 #[allow(unused_imports)]
2358 use super::*;
2359 #[derive(Clone, Debug, PartialEq)]
2360 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2361 }
2362
2363 impl UserInteraction {
2364 /// Gets the enum value.
2365 ///
2366 /// Returns `None` if the enum contains an unknown value deserialized from
2367 /// the string representation of enums.
2368 pub fn value(&self) -> std::option::Option<i32> {
2369 match self {
2370 Self::Unspecified => std::option::Option::Some(0),
2371 Self::None => std::option::Option::Some(1),
2372 Self::Required => std::option::Option::Some(2),
2373 Self::UnknownValue(u) => u.0.value(),
2374 }
2375 }
2376
2377 /// Gets the enum value as a string.
2378 ///
2379 /// Returns `None` if the enum contains an unknown value deserialized from
2380 /// the integer representation of enums.
2381 pub fn name(&self) -> std::option::Option<&str> {
2382 match self {
2383 Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
2384 Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
2385 Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
2386 Self::UnknownValue(u) => u.0.name(),
2387 }
2388 }
2389 }
2390
2391 impl std::default::Default for UserInteraction {
2392 fn default() -> Self {
2393 use std::convert::From;
2394 Self::from(0)
2395 }
2396 }
2397
2398 impl std::fmt::Display for UserInteraction {
2399 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2400 wkt::internal::display_enum(f, self.name(), self.value())
2401 }
2402 }
2403
2404 impl std::convert::From<i32> for UserInteraction {
2405 fn from(value: i32) -> Self {
2406 match value {
2407 0 => Self::Unspecified,
2408 1 => Self::None,
2409 2 => Self::Required,
2410 _ => Self::UnknownValue(user_interaction::UnknownValue(
2411 wkt::internal::UnknownEnumValue::Integer(value),
2412 )),
2413 }
2414 }
2415 }
2416
2417 impl std::convert::From<&str> for UserInteraction {
2418 fn from(value: &str) -> Self {
2419 use std::string::ToString;
2420 match value {
2421 "USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
2422 "USER_INTERACTION_NONE" => Self::None,
2423 "USER_INTERACTION_REQUIRED" => Self::Required,
2424 _ => Self::UnknownValue(user_interaction::UnknownValue(
2425 wkt::internal::UnknownEnumValue::String(value.to_string()),
2426 )),
2427 }
2428 }
2429 }
2430
2431 impl serde::ser::Serialize for UserInteraction {
2432 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2433 where
2434 S: serde::Serializer,
2435 {
2436 match self {
2437 Self::Unspecified => serializer.serialize_i32(0),
2438 Self::None => serializer.serialize_i32(1),
2439 Self::Required => serializer.serialize_i32(2),
2440 Self::UnknownValue(u) => u.0.serialize(serializer),
2441 }
2442 }
2443 }
2444
2445 impl<'de> serde::de::Deserialize<'de> for UserInteraction {
2446 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2447 where
2448 D: serde::Deserializer<'de>,
2449 {
2450 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
2451 ".grafeas.v1.CVSSv3.UserInteraction",
2452 ))
2453 }
2454 }
2455
2456 ///
2457 /// # Working with unknown values
2458 ///
2459 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2460 /// additional enum variants at any time. Adding new variants is not considered
2461 /// a breaking change. Applications should write their code in anticipation of:
2462 ///
2463 /// - New values appearing in future releases of the client library, **and**
2464 /// - New values received dynamically, without application changes.
2465 ///
2466 /// Please consult the [Working with enums] section in the user guide for some
2467 /// guidelines.
2468 ///
2469 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2470 #[derive(Clone, Debug, PartialEq)]
2471 #[non_exhaustive]
2472 pub enum Scope {
2473 Unspecified,
2474 Unchanged,
2475 Changed,
2476 /// If set, the enum was initialized with an unknown value.
2477 ///
2478 /// Applications can examine the value using [Scope::value] or
2479 /// [Scope::name].
2480 UnknownValue(scope::UnknownValue),
2481 }
2482
2483 #[doc(hidden)]
2484 pub mod scope {
2485 #[allow(unused_imports)]
2486 use super::*;
2487 #[derive(Clone, Debug, PartialEq)]
2488 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2489 }
2490
2491 impl Scope {
2492 /// Gets the enum value.
2493 ///
2494 /// Returns `None` if the enum contains an unknown value deserialized from
2495 /// the string representation of enums.
2496 pub fn value(&self) -> std::option::Option<i32> {
2497 match self {
2498 Self::Unspecified => std::option::Option::Some(0),
2499 Self::Unchanged => std::option::Option::Some(1),
2500 Self::Changed => std::option::Option::Some(2),
2501 Self::UnknownValue(u) => u.0.value(),
2502 }
2503 }
2504
2505 /// Gets the enum value as a string.
2506 ///
2507 /// Returns `None` if the enum contains an unknown value deserialized from
2508 /// the integer representation of enums.
2509 pub fn name(&self) -> std::option::Option<&str> {
2510 match self {
2511 Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
2512 Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
2513 Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
2514 Self::UnknownValue(u) => u.0.name(),
2515 }
2516 }
2517 }
2518
2519 impl std::default::Default for Scope {
2520 fn default() -> Self {
2521 use std::convert::From;
2522 Self::from(0)
2523 }
2524 }
2525
2526 impl std::fmt::Display for Scope {
2527 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2528 wkt::internal::display_enum(f, self.name(), self.value())
2529 }
2530 }
2531
2532 impl std::convert::From<i32> for Scope {
2533 fn from(value: i32) -> Self {
2534 match value {
2535 0 => Self::Unspecified,
2536 1 => Self::Unchanged,
2537 2 => Self::Changed,
2538 _ => Self::UnknownValue(scope::UnknownValue(
2539 wkt::internal::UnknownEnumValue::Integer(value),
2540 )),
2541 }
2542 }
2543 }
2544
2545 impl std::convert::From<&str> for Scope {
2546 fn from(value: &str) -> Self {
2547 use std::string::ToString;
2548 match value {
2549 "SCOPE_UNSPECIFIED" => Self::Unspecified,
2550 "SCOPE_UNCHANGED" => Self::Unchanged,
2551 "SCOPE_CHANGED" => Self::Changed,
2552 _ => Self::UnknownValue(scope::UnknownValue(
2553 wkt::internal::UnknownEnumValue::String(value.to_string()),
2554 )),
2555 }
2556 }
2557 }
2558
2559 impl serde::ser::Serialize for Scope {
2560 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2561 where
2562 S: serde::Serializer,
2563 {
2564 match self {
2565 Self::Unspecified => serializer.serialize_i32(0),
2566 Self::Unchanged => serializer.serialize_i32(1),
2567 Self::Changed => serializer.serialize_i32(2),
2568 Self::UnknownValue(u) => u.0.serialize(serializer),
2569 }
2570 }
2571 }
2572
2573 impl<'de> serde::de::Deserialize<'de> for Scope {
2574 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2575 where
2576 D: serde::Deserializer<'de>,
2577 {
2578 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
2579 ".grafeas.v1.CVSSv3.Scope",
2580 ))
2581 }
2582 }
2583
2584 ///
2585 /// # Working with unknown values
2586 ///
2587 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2588 /// additional enum variants at any time. Adding new variants is not considered
2589 /// a breaking change. Applications should write their code in anticipation of:
2590 ///
2591 /// - New values appearing in future releases of the client library, **and**
2592 /// - New values received dynamically, without application changes.
2593 ///
2594 /// Please consult the [Working with enums] section in the user guide for some
2595 /// guidelines.
2596 ///
2597 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2598 #[derive(Clone, Debug, PartialEq)]
2599 #[non_exhaustive]
2600 pub enum Impact {
2601 Unspecified,
2602 High,
2603 Low,
2604 None,
2605 /// If set, the enum was initialized with an unknown value.
2606 ///
2607 /// Applications can examine the value using [Impact::value] or
2608 /// [Impact::name].
2609 UnknownValue(impact::UnknownValue),
2610 }
2611
2612 #[doc(hidden)]
2613 pub mod impact {
2614 #[allow(unused_imports)]
2615 use super::*;
2616 #[derive(Clone, Debug, PartialEq)]
2617 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2618 }
2619
2620 impl Impact {
2621 /// Gets the enum value.
2622 ///
2623 /// Returns `None` if the enum contains an unknown value deserialized from
2624 /// the string representation of enums.
2625 pub fn value(&self) -> std::option::Option<i32> {
2626 match self {
2627 Self::Unspecified => std::option::Option::Some(0),
2628 Self::High => std::option::Option::Some(1),
2629 Self::Low => std::option::Option::Some(2),
2630 Self::None => std::option::Option::Some(3),
2631 Self::UnknownValue(u) => u.0.value(),
2632 }
2633 }
2634
2635 /// Gets the enum value as a string.
2636 ///
2637 /// Returns `None` if the enum contains an unknown value deserialized from
2638 /// the integer representation of enums.
2639 pub fn name(&self) -> std::option::Option<&str> {
2640 match self {
2641 Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
2642 Self::High => std::option::Option::Some("IMPACT_HIGH"),
2643 Self::Low => std::option::Option::Some("IMPACT_LOW"),
2644 Self::None => std::option::Option::Some("IMPACT_NONE"),
2645 Self::UnknownValue(u) => u.0.name(),
2646 }
2647 }
2648 }
2649
2650 impl std::default::Default for Impact {
2651 fn default() -> Self {
2652 use std::convert::From;
2653 Self::from(0)
2654 }
2655 }
2656
2657 impl std::fmt::Display for Impact {
2658 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2659 wkt::internal::display_enum(f, self.name(), self.value())
2660 }
2661 }
2662
2663 impl std::convert::From<i32> for Impact {
2664 fn from(value: i32) -> Self {
2665 match value {
2666 0 => Self::Unspecified,
2667 1 => Self::High,
2668 2 => Self::Low,
2669 3 => Self::None,
2670 _ => Self::UnknownValue(impact::UnknownValue(
2671 wkt::internal::UnknownEnumValue::Integer(value),
2672 )),
2673 }
2674 }
2675 }
2676
2677 impl std::convert::From<&str> for Impact {
2678 fn from(value: &str) -> Self {
2679 use std::string::ToString;
2680 match value {
2681 "IMPACT_UNSPECIFIED" => Self::Unspecified,
2682 "IMPACT_HIGH" => Self::High,
2683 "IMPACT_LOW" => Self::Low,
2684 "IMPACT_NONE" => Self::None,
2685 _ => Self::UnknownValue(impact::UnknownValue(
2686 wkt::internal::UnknownEnumValue::String(value.to_string()),
2687 )),
2688 }
2689 }
2690 }
2691
2692 impl serde::ser::Serialize for Impact {
2693 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2694 where
2695 S: serde::Serializer,
2696 {
2697 match self {
2698 Self::Unspecified => serializer.serialize_i32(0),
2699 Self::High => serializer.serialize_i32(1),
2700 Self::Low => serializer.serialize_i32(2),
2701 Self::None => serializer.serialize_i32(3),
2702 Self::UnknownValue(u) => u.0.serialize(serializer),
2703 }
2704 }
2705 }
2706
2707 impl<'de> serde::de::Deserialize<'de> for Impact {
2708 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2709 where
2710 D: serde::Deserializer<'de>,
2711 {
2712 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
2713 ".grafeas.v1.CVSSv3.Impact",
2714 ))
2715 }
2716 }
2717}
2718
2719/// Common Vulnerability Scoring System.
2720/// For details, see <https://www.first.org/cvss/specification-document>
2721/// This is a message we will try to use for storing various versions of CVSS
2722/// rather than making a separate proto for storing a specific version.
2723#[derive(Clone, Default, PartialEq)]
2724#[non_exhaustive]
2725pub struct Cvss {
2726 /// The base score is a function of the base metric scores.
2727 pub base_score: f32,
2728
2729 pub exploitability_score: f32,
2730
2731 pub impact_score: f32,
2732
2733 /// Base Metrics
2734 /// Represents the intrinsic characteristics of a vulnerability that are
2735 /// constant over time and across user environments.
2736 pub attack_vector: crate::model::cvss::AttackVector,
2737
2738 pub attack_complexity: crate::model::cvss::AttackComplexity,
2739
2740 pub authentication: crate::model::cvss::Authentication,
2741
2742 pub privileges_required: crate::model::cvss::PrivilegesRequired,
2743
2744 pub user_interaction: crate::model::cvss::UserInteraction,
2745
2746 pub scope: crate::model::cvss::Scope,
2747
2748 pub confidentiality_impact: crate::model::cvss::Impact,
2749
2750 pub integrity_impact: crate::model::cvss::Impact,
2751
2752 pub availability_impact: crate::model::cvss::Impact,
2753
2754 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2755}
2756
2757impl Cvss {
2758 pub fn new() -> Self {
2759 std::default::Default::default()
2760 }
2761
2762 /// Sets the value of [base_score][crate::model::Cvss::base_score].
2763 ///
2764 /// # Example
2765 /// ```ignore,no_run
2766 /// # use google_cloud_grafeas_v1::model::Cvss;
2767 /// let x = Cvss::new().set_base_score(42.0);
2768 /// ```
2769 pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2770 self.base_score = v.into();
2771 self
2772 }
2773
2774 /// Sets the value of [exploitability_score][crate::model::Cvss::exploitability_score].
2775 ///
2776 /// # Example
2777 /// ```ignore,no_run
2778 /// # use google_cloud_grafeas_v1::model::Cvss;
2779 /// let x = Cvss::new().set_exploitability_score(42.0);
2780 /// ```
2781 pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2782 self.exploitability_score = v.into();
2783 self
2784 }
2785
2786 /// Sets the value of [impact_score][crate::model::Cvss::impact_score].
2787 ///
2788 /// # Example
2789 /// ```ignore,no_run
2790 /// # use google_cloud_grafeas_v1::model::Cvss;
2791 /// let x = Cvss::new().set_impact_score(42.0);
2792 /// ```
2793 pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2794 self.impact_score = v.into();
2795 self
2796 }
2797
2798 /// Sets the value of [attack_vector][crate::model::Cvss::attack_vector].
2799 ///
2800 /// # Example
2801 /// ```ignore,no_run
2802 /// # use google_cloud_grafeas_v1::model::Cvss;
2803 /// use google_cloud_grafeas_v1::model::cvss::AttackVector;
2804 /// let x0 = Cvss::new().set_attack_vector(AttackVector::Network);
2805 /// let x1 = Cvss::new().set_attack_vector(AttackVector::Adjacent);
2806 /// let x2 = Cvss::new().set_attack_vector(AttackVector::Local);
2807 /// ```
2808 pub fn set_attack_vector<T: std::convert::Into<crate::model::cvss::AttackVector>>(
2809 mut self,
2810 v: T,
2811 ) -> Self {
2812 self.attack_vector = v.into();
2813 self
2814 }
2815
2816 /// Sets the value of [attack_complexity][crate::model::Cvss::attack_complexity].
2817 ///
2818 /// # Example
2819 /// ```ignore,no_run
2820 /// # use google_cloud_grafeas_v1::model::Cvss;
2821 /// use google_cloud_grafeas_v1::model::cvss::AttackComplexity;
2822 /// let x0 = Cvss::new().set_attack_complexity(AttackComplexity::Low);
2823 /// let x1 = Cvss::new().set_attack_complexity(AttackComplexity::High);
2824 /// let x2 = Cvss::new().set_attack_complexity(AttackComplexity::Medium);
2825 /// ```
2826 pub fn set_attack_complexity<T: std::convert::Into<crate::model::cvss::AttackComplexity>>(
2827 mut self,
2828 v: T,
2829 ) -> Self {
2830 self.attack_complexity = v.into();
2831 self
2832 }
2833
2834 /// Sets the value of [authentication][crate::model::Cvss::authentication].
2835 ///
2836 /// # Example
2837 /// ```ignore,no_run
2838 /// # use google_cloud_grafeas_v1::model::Cvss;
2839 /// use google_cloud_grafeas_v1::model::cvss::Authentication;
2840 /// let x0 = Cvss::new().set_authentication(Authentication::Multiple);
2841 /// let x1 = Cvss::new().set_authentication(Authentication::Single);
2842 /// let x2 = Cvss::new().set_authentication(Authentication::None);
2843 /// ```
2844 pub fn set_authentication<T: std::convert::Into<crate::model::cvss::Authentication>>(
2845 mut self,
2846 v: T,
2847 ) -> Self {
2848 self.authentication = v.into();
2849 self
2850 }
2851
2852 /// Sets the value of [privileges_required][crate::model::Cvss::privileges_required].
2853 ///
2854 /// # Example
2855 /// ```ignore,no_run
2856 /// # use google_cloud_grafeas_v1::model::Cvss;
2857 /// use google_cloud_grafeas_v1::model::cvss::PrivilegesRequired;
2858 /// let x0 = Cvss::new().set_privileges_required(PrivilegesRequired::None);
2859 /// let x1 = Cvss::new().set_privileges_required(PrivilegesRequired::Low);
2860 /// let x2 = Cvss::new().set_privileges_required(PrivilegesRequired::High);
2861 /// ```
2862 pub fn set_privileges_required<
2863 T: std::convert::Into<crate::model::cvss::PrivilegesRequired>,
2864 >(
2865 mut self,
2866 v: T,
2867 ) -> Self {
2868 self.privileges_required = v.into();
2869 self
2870 }
2871
2872 /// Sets the value of [user_interaction][crate::model::Cvss::user_interaction].
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_grafeas_v1::model::Cvss;
2877 /// use google_cloud_grafeas_v1::model::cvss::UserInteraction;
2878 /// let x0 = Cvss::new().set_user_interaction(UserInteraction::None);
2879 /// let x1 = Cvss::new().set_user_interaction(UserInteraction::Required);
2880 /// ```
2881 pub fn set_user_interaction<T: std::convert::Into<crate::model::cvss::UserInteraction>>(
2882 mut self,
2883 v: T,
2884 ) -> Self {
2885 self.user_interaction = v.into();
2886 self
2887 }
2888
2889 /// Sets the value of [scope][crate::model::Cvss::scope].
2890 ///
2891 /// # Example
2892 /// ```ignore,no_run
2893 /// # use google_cloud_grafeas_v1::model::Cvss;
2894 /// use google_cloud_grafeas_v1::model::cvss::Scope;
2895 /// let x0 = Cvss::new().set_scope(Scope::Unchanged);
2896 /// let x1 = Cvss::new().set_scope(Scope::Changed);
2897 /// ```
2898 pub fn set_scope<T: std::convert::Into<crate::model::cvss::Scope>>(mut self, v: T) -> Self {
2899 self.scope = v.into();
2900 self
2901 }
2902
2903 /// Sets the value of [confidentiality_impact][crate::model::Cvss::confidentiality_impact].
2904 ///
2905 /// # Example
2906 /// ```ignore,no_run
2907 /// # use google_cloud_grafeas_v1::model::Cvss;
2908 /// use google_cloud_grafeas_v1::model::cvss::Impact;
2909 /// let x0 = Cvss::new().set_confidentiality_impact(Impact::High);
2910 /// let x1 = Cvss::new().set_confidentiality_impact(Impact::Low);
2911 /// let x2 = Cvss::new().set_confidentiality_impact(Impact::None);
2912 /// ```
2913 pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
2914 mut self,
2915 v: T,
2916 ) -> Self {
2917 self.confidentiality_impact = v.into();
2918 self
2919 }
2920
2921 /// Sets the value of [integrity_impact][crate::model::Cvss::integrity_impact].
2922 ///
2923 /// # Example
2924 /// ```ignore,no_run
2925 /// # use google_cloud_grafeas_v1::model::Cvss;
2926 /// use google_cloud_grafeas_v1::model::cvss::Impact;
2927 /// let x0 = Cvss::new().set_integrity_impact(Impact::High);
2928 /// let x1 = Cvss::new().set_integrity_impact(Impact::Low);
2929 /// let x2 = Cvss::new().set_integrity_impact(Impact::None);
2930 /// ```
2931 pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
2932 mut self,
2933 v: T,
2934 ) -> Self {
2935 self.integrity_impact = v.into();
2936 self
2937 }
2938
2939 /// Sets the value of [availability_impact][crate::model::Cvss::availability_impact].
2940 ///
2941 /// # Example
2942 /// ```ignore,no_run
2943 /// # use google_cloud_grafeas_v1::model::Cvss;
2944 /// use google_cloud_grafeas_v1::model::cvss::Impact;
2945 /// let x0 = Cvss::new().set_availability_impact(Impact::High);
2946 /// let x1 = Cvss::new().set_availability_impact(Impact::Low);
2947 /// let x2 = Cvss::new().set_availability_impact(Impact::None);
2948 /// ```
2949 pub fn set_availability_impact<T: std::convert::Into<crate::model::cvss::Impact>>(
2950 mut self,
2951 v: T,
2952 ) -> Self {
2953 self.availability_impact = v.into();
2954 self
2955 }
2956}
2957
2958impl wkt::message::Message for Cvss {
2959 fn typename() -> &'static str {
2960 "type.googleapis.com/grafeas.v1.CVSS"
2961 }
2962}
2963
2964/// Defines additional types related to [Cvss].
2965pub mod cvss {
2966 #[allow(unused_imports)]
2967 use super::*;
2968
2969 ///
2970 /// # Working with unknown values
2971 ///
2972 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2973 /// additional enum variants at any time. Adding new variants is not considered
2974 /// a breaking change. Applications should write their code in anticipation of:
2975 ///
2976 /// - New values appearing in future releases of the client library, **and**
2977 /// - New values received dynamically, without application changes.
2978 ///
2979 /// Please consult the [Working with enums] section in the user guide for some
2980 /// guidelines.
2981 ///
2982 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2983 #[derive(Clone, Debug, PartialEq)]
2984 #[non_exhaustive]
2985 pub enum AttackVector {
2986 Unspecified,
2987 Network,
2988 Adjacent,
2989 Local,
2990 Physical,
2991 /// If set, the enum was initialized with an unknown value.
2992 ///
2993 /// Applications can examine the value using [AttackVector::value] or
2994 /// [AttackVector::name].
2995 UnknownValue(attack_vector::UnknownValue),
2996 }
2997
2998 #[doc(hidden)]
2999 pub mod attack_vector {
3000 #[allow(unused_imports)]
3001 use super::*;
3002 #[derive(Clone, Debug, PartialEq)]
3003 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3004 }
3005
3006 impl AttackVector {
3007 /// Gets the enum value.
3008 ///
3009 /// Returns `None` if the enum contains an unknown value deserialized from
3010 /// the string representation of enums.
3011 pub fn value(&self) -> std::option::Option<i32> {
3012 match self {
3013 Self::Unspecified => std::option::Option::Some(0),
3014 Self::Network => std::option::Option::Some(1),
3015 Self::Adjacent => std::option::Option::Some(2),
3016 Self::Local => std::option::Option::Some(3),
3017 Self::Physical => std::option::Option::Some(4),
3018 Self::UnknownValue(u) => u.0.value(),
3019 }
3020 }
3021
3022 /// Gets the enum value as a string.
3023 ///
3024 /// Returns `None` if the enum contains an unknown value deserialized from
3025 /// the integer representation of enums.
3026 pub fn name(&self) -> std::option::Option<&str> {
3027 match self {
3028 Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
3029 Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
3030 Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
3031 Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
3032 Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
3033 Self::UnknownValue(u) => u.0.name(),
3034 }
3035 }
3036 }
3037
3038 impl std::default::Default for AttackVector {
3039 fn default() -> Self {
3040 use std::convert::From;
3041 Self::from(0)
3042 }
3043 }
3044
3045 impl std::fmt::Display for AttackVector {
3046 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3047 wkt::internal::display_enum(f, self.name(), self.value())
3048 }
3049 }
3050
3051 impl std::convert::From<i32> for AttackVector {
3052 fn from(value: i32) -> Self {
3053 match value {
3054 0 => Self::Unspecified,
3055 1 => Self::Network,
3056 2 => Self::Adjacent,
3057 3 => Self::Local,
3058 4 => Self::Physical,
3059 _ => Self::UnknownValue(attack_vector::UnknownValue(
3060 wkt::internal::UnknownEnumValue::Integer(value),
3061 )),
3062 }
3063 }
3064 }
3065
3066 impl std::convert::From<&str> for AttackVector {
3067 fn from(value: &str) -> Self {
3068 use std::string::ToString;
3069 match value {
3070 "ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
3071 "ATTACK_VECTOR_NETWORK" => Self::Network,
3072 "ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
3073 "ATTACK_VECTOR_LOCAL" => Self::Local,
3074 "ATTACK_VECTOR_PHYSICAL" => Self::Physical,
3075 _ => Self::UnknownValue(attack_vector::UnknownValue(
3076 wkt::internal::UnknownEnumValue::String(value.to_string()),
3077 )),
3078 }
3079 }
3080 }
3081
3082 impl serde::ser::Serialize for AttackVector {
3083 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3084 where
3085 S: serde::Serializer,
3086 {
3087 match self {
3088 Self::Unspecified => serializer.serialize_i32(0),
3089 Self::Network => serializer.serialize_i32(1),
3090 Self::Adjacent => serializer.serialize_i32(2),
3091 Self::Local => serializer.serialize_i32(3),
3092 Self::Physical => serializer.serialize_i32(4),
3093 Self::UnknownValue(u) => u.0.serialize(serializer),
3094 }
3095 }
3096 }
3097
3098 impl<'de> serde::de::Deserialize<'de> for AttackVector {
3099 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3100 where
3101 D: serde::Deserializer<'de>,
3102 {
3103 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
3104 ".grafeas.v1.CVSS.AttackVector",
3105 ))
3106 }
3107 }
3108
3109 ///
3110 /// # Working with unknown values
3111 ///
3112 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3113 /// additional enum variants at any time. Adding new variants is not considered
3114 /// a breaking change. Applications should write their code in anticipation of:
3115 ///
3116 /// - New values appearing in future releases of the client library, **and**
3117 /// - New values received dynamically, without application changes.
3118 ///
3119 /// Please consult the [Working with enums] section in the user guide for some
3120 /// guidelines.
3121 ///
3122 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3123 #[derive(Clone, Debug, PartialEq)]
3124 #[non_exhaustive]
3125 pub enum AttackComplexity {
3126 Unspecified,
3127 Low,
3128 High,
3129 Medium,
3130 /// If set, the enum was initialized with an unknown value.
3131 ///
3132 /// Applications can examine the value using [AttackComplexity::value] or
3133 /// [AttackComplexity::name].
3134 UnknownValue(attack_complexity::UnknownValue),
3135 }
3136
3137 #[doc(hidden)]
3138 pub mod attack_complexity {
3139 #[allow(unused_imports)]
3140 use super::*;
3141 #[derive(Clone, Debug, PartialEq)]
3142 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3143 }
3144
3145 impl AttackComplexity {
3146 /// Gets the enum value.
3147 ///
3148 /// Returns `None` if the enum contains an unknown value deserialized from
3149 /// the string representation of enums.
3150 pub fn value(&self) -> std::option::Option<i32> {
3151 match self {
3152 Self::Unspecified => std::option::Option::Some(0),
3153 Self::Low => std::option::Option::Some(1),
3154 Self::High => std::option::Option::Some(2),
3155 Self::Medium => std::option::Option::Some(3),
3156 Self::UnknownValue(u) => u.0.value(),
3157 }
3158 }
3159
3160 /// Gets the enum value as a string.
3161 ///
3162 /// Returns `None` if the enum contains an unknown value deserialized from
3163 /// the integer representation of enums.
3164 pub fn name(&self) -> std::option::Option<&str> {
3165 match self {
3166 Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
3167 Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
3168 Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
3169 Self::Medium => std::option::Option::Some("ATTACK_COMPLEXITY_MEDIUM"),
3170 Self::UnknownValue(u) => u.0.name(),
3171 }
3172 }
3173 }
3174
3175 impl std::default::Default for AttackComplexity {
3176 fn default() -> Self {
3177 use std::convert::From;
3178 Self::from(0)
3179 }
3180 }
3181
3182 impl std::fmt::Display for AttackComplexity {
3183 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3184 wkt::internal::display_enum(f, self.name(), self.value())
3185 }
3186 }
3187
3188 impl std::convert::From<i32> for AttackComplexity {
3189 fn from(value: i32) -> Self {
3190 match value {
3191 0 => Self::Unspecified,
3192 1 => Self::Low,
3193 2 => Self::High,
3194 3 => Self::Medium,
3195 _ => Self::UnknownValue(attack_complexity::UnknownValue(
3196 wkt::internal::UnknownEnumValue::Integer(value),
3197 )),
3198 }
3199 }
3200 }
3201
3202 impl std::convert::From<&str> for AttackComplexity {
3203 fn from(value: &str) -> Self {
3204 use std::string::ToString;
3205 match value {
3206 "ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
3207 "ATTACK_COMPLEXITY_LOW" => Self::Low,
3208 "ATTACK_COMPLEXITY_HIGH" => Self::High,
3209 "ATTACK_COMPLEXITY_MEDIUM" => Self::Medium,
3210 _ => Self::UnknownValue(attack_complexity::UnknownValue(
3211 wkt::internal::UnknownEnumValue::String(value.to_string()),
3212 )),
3213 }
3214 }
3215 }
3216
3217 impl serde::ser::Serialize for AttackComplexity {
3218 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3219 where
3220 S: serde::Serializer,
3221 {
3222 match self {
3223 Self::Unspecified => serializer.serialize_i32(0),
3224 Self::Low => serializer.serialize_i32(1),
3225 Self::High => serializer.serialize_i32(2),
3226 Self::Medium => serializer.serialize_i32(3),
3227 Self::UnknownValue(u) => u.0.serialize(serializer),
3228 }
3229 }
3230 }
3231
3232 impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
3233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3234 where
3235 D: serde::Deserializer<'de>,
3236 {
3237 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
3238 ".grafeas.v1.CVSS.AttackComplexity",
3239 ))
3240 }
3241 }
3242
3243 ///
3244 /// # Working with unknown values
3245 ///
3246 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3247 /// additional enum variants at any time. Adding new variants is not considered
3248 /// a breaking change. Applications should write their code in anticipation of:
3249 ///
3250 /// - New values appearing in future releases of the client library, **and**
3251 /// - New values received dynamically, without application changes.
3252 ///
3253 /// Please consult the [Working with enums] section in the user guide for some
3254 /// guidelines.
3255 ///
3256 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3257 #[derive(Clone, Debug, PartialEq)]
3258 #[non_exhaustive]
3259 pub enum Authentication {
3260 Unspecified,
3261 Multiple,
3262 Single,
3263 None,
3264 /// If set, the enum was initialized with an unknown value.
3265 ///
3266 /// Applications can examine the value using [Authentication::value] or
3267 /// [Authentication::name].
3268 UnknownValue(authentication::UnknownValue),
3269 }
3270
3271 #[doc(hidden)]
3272 pub mod authentication {
3273 #[allow(unused_imports)]
3274 use super::*;
3275 #[derive(Clone, Debug, PartialEq)]
3276 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3277 }
3278
3279 impl Authentication {
3280 /// Gets the enum value.
3281 ///
3282 /// Returns `None` if the enum contains an unknown value deserialized from
3283 /// the string representation of enums.
3284 pub fn value(&self) -> std::option::Option<i32> {
3285 match self {
3286 Self::Unspecified => std::option::Option::Some(0),
3287 Self::Multiple => std::option::Option::Some(1),
3288 Self::Single => std::option::Option::Some(2),
3289 Self::None => std::option::Option::Some(3),
3290 Self::UnknownValue(u) => u.0.value(),
3291 }
3292 }
3293
3294 /// Gets the enum value as a string.
3295 ///
3296 /// Returns `None` if the enum contains an unknown value deserialized from
3297 /// the integer representation of enums.
3298 pub fn name(&self) -> std::option::Option<&str> {
3299 match self {
3300 Self::Unspecified => std::option::Option::Some("AUTHENTICATION_UNSPECIFIED"),
3301 Self::Multiple => std::option::Option::Some("AUTHENTICATION_MULTIPLE"),
3302 Self::Single => std::option::Option::Some("AUTHENTICATION_SINGLE"),
3303 Self::None => std::option::Option::Some("AUTHENTICATION_NONE"),
3304 Self::UnknownValue(u) => u.0.name(),
3305 }
3306 }
3307 }
3308
3309 impl std::default::Default for Authentication {
3310 fn default() -> Self {
3311 use std::convert::From;
3312 Self::from(0)
3313 }
3314 }
3315
3316 impl std::fmt::Display for Authentication {
3317 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3318 wkt::internal::display_enum(f, self.name(), self.value())
3319 }
3320 }
3321
3322 impl std::convert::From<i32> for Authentication {
3323 fn from(value: i32) -> Self {
3324 match value {
3325 0 => Self::Unspecified,
3326 1 => Self::Multiple,
3327 2 => Self::Single,
3328 3 => Self::None,
3329 _ => Self::UnknownValue(authentication::UnknownValue(
3330 wkt::internal::UnknownEnumValue::Integer(value),
3331 )),
3332 }
3333 }
3334 }
3335
3336 impl std::convert::From<&str> for Authentication {
3337 fn from(value: &str) -> Self {
3338 use std::string::ToString;
3339 match value {
3340 "AUTHENTICATION_UNSPECIFIED" => Self::Unspecified,
3341 "AUTHENTICATION_MULTIPLE" => Self::Multiple,
3342 "AUTHENTICATION_SINGLE" => Self::Single,
3343 "AUTHENTICATION_NONE" => Self::None,
3344 _ => Self::UnknownValue(authentication::UnknownValue(
3345 wkt::internal::UnknownEnumValue::String(value.to_string()),
3346 )),
3347 }
3348 }
3349 }
3350
3351 impl serde::ser::Serialize for Authentication {
3352 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3353 where
3354 S: serde::Serializer,
3355 {
3356 match self {
3357 Self::Unspecified => serializer.serialize_i32(0),
3358 Self::Multiple => serializer.serialize_i32(1),
3359 Self::Single => serializer.serialize_i32(2),
3360 Self::None => serializer.serialize_i32(3),
3361 Self::UnknownValue(u) => u.0.serialize(serializer),
3362 }
3363 }
3364 }
3365
3366 impl<'de> serde::de::Deserialize<'de> for Authentication {
3367 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3368 where
3369 D: serde::Deserializer<'de>,
3370 {
3371 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Authentication>::new(
3372 ".grafeas.v1.CVSS.Authentication",
3373 ))
3374 }
3375 }
3376
3377 ///
3378 /// # Working with unknown values
3379 ///
3380 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3381 /// additional enum variants at any time. Adding new variants is not considered
3382 /// a breaking change. Applications should write their code in anticipation of:
3383 ///
3384 /// - New values appearing in future releases of the client library, **and**
3385 /// - New values received dynamically, without application changes.
3386 ///
3387 /// Please consult the [Working with enums] section in the user guide for some
3388 /// guidelines.
3389 ///
3390 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3391 #[derive(Clone, Debug, PartialEq)]
3392 #[non_exhaustive]
3393 pub enum PrivilegesRequired {
3394 Unspecified,
3395 None,
3396 Low,
3397 High,
3398 /// If set, the enum was initialized with an unknown value.
3399 ///
3400 /// Applications can examine the value using [PrivilegesRequired::value] or
3401 /// [PrivilegesRequired::name].
3402 UnknownValue(privileges_required::UnknownValue),
3403 }
3404
3405 #[doc(hidden)]
3406 pub mod privileges_required {
3407 #[allow(unused_imports)]
3408 use super::*;
3409 #[derive(Clone, Debug, PartialEq)]
3410 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3411 }
3412
3413 impl PrivilegesRequired {
3414 /// Gets the enum value.
3415 ///
3416 /// Returns `None` if the enum contains an unknown value deserialized from
3417 /// the string representation of enums.
3418 pub fn value(&self) -> std::option::Option<i32> {
3419 match self {
3420 Self::Unspecified => std::option::Option::Some(0),
3421 Self::None => std::option::Option::Some(1),
3422 Self::Low => std::option::Option::Some(2),
3423 Self::High => std::option::Option::Some(3),
3424 Self::UnknownValue(u) => u.0.value(),
3425 }
3426 }
3427
3428 /// Gets the enum value as a string.
3429 ///
3430 /// Returns `None` if the enum contains an unknown value deserialized from
3431 /// the integer representation of enums.
3432 pub fn name(&self) -> std::option::Option<&str> {
3433 match self {
3434 Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
3435 Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
3436 Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
3437 Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
3438 Self::UnknownValue(u) => u.0.name(),
3439 }
3440 }
3441 }
3442
3443 impl std::default::Default for PrivilegesRequired {
3444 fn default() -> Self {
3445 use std::convert::From;
3446 Self::from(0)
3447 }
3448 }
3449
3450 impl std::fmt::Display for PrivilegesRequired {
3451 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3452 wkt::internal::display_enum(f, self.name(), self.value())
3453 }
3454 }
3455
3456 impl std::convert::From<i32> for PrivilegesRequired {
3457 fn from(value: i32) -> Self {
3458 match value {
3459 0 => Self::Unspecified,
3460 1 => Self::None,
3461 2 => Self::Low,
3462 3 => Self::High,
3463 _ => Self::UnknownValue(privileges_required::UnknownValue(
3464 wkt::internal::UnknownEnumValue::Integer(value),
3465 )),
3466 }
3467 }
3468 }
3469
3470 impl std::convert::From<&str> for PrivilegesRequired {
3471 fn from(value: &str) -> Self {
3472 use std::string::ToString;
3473 match value {
3474 "PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
3475 "PRIVILEGES_REQUIRED_NONE" => Self::None,
3476 "PRIVILEGES_REQUIRED_LOW" => Self::Low,
3477 "PRIVILEGES_REQUIRED_HIGH" => Self::High,
3478 _ => Self::UnknownValue(privileges_required::UnknownValue(
3479 wkt::internal::UnknownEnumValue::String(value.to_string()),
3480 )),
3481 }
3482 }
3483 }
3484
3485 impl serde::ser::Serialize for PrivilegesRequired {
3486 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3487 where
3488 S: serde::Serializer,
3489 {
3490 match self {
3491 Self::Unspecified => serializer.serialize_i32(0),
3492 Self::None => serializer.serialize_i32(1),
3493 Self::Low => serializer.serialize_i32(2),
3494 Self::High => serializer.serialize_i32(3),
3495 Self::UnknownValue(u) => u.0.serialize(serializer),
3496 }
3497 }
3498 }
3499
3500 impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
3501 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3502 where
3503 D: serde::Deserializer<'de>,
3504 {
3505 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
3506 ".grafeas.v1.CVSS.PrivilegesRequired",
3507 ))
3508 }
3509 }
3510
3511 ///
3512 /// # Working with unknown values
3513 ///
3514 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3515 /// additional enum variants at any time. Adding new variants is not considered
3516 /// a breaking change. Applications should write their code in anticipation of:
3517 ///
3518 /// - New values appearing in future releases of the client library, **and**
3519 /// - New values received dynamically, without application changes.
3520 ///
3521 /// Please consult the [Working with enums] section in the user guide for some
3522 /// guidelines.
3523 ///
3524 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3525 #[derive(Clone, Debug, PartialEq)]
3526 #[non_exhaustive]
3527 pub enum UserInteraction {
3528 Unspecified,
3529 None,
3530 Required,
3531 /// If set, the enum was initialized with an unknown value.
3532 ///
3533 /// Applications can examine the value using [UserInteraction::value] or
3534 /// [UserInteraction::name].
3535 UnknownValue(user_interaction::UnknownValue),
3536 }
3537
3538 #[doc(hidden)]
3539 pub mod user_interaction {
3540 #[allow(unused_imports)]
3541 use super::*;
3542 #[derive(Clone, Debug, PartialEq)]
3543 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3544 }
3545
3546 impl UserInteraction {
3547 /// Gets the enum value.
3548 ///
3549 /// Returns `None` if the enum contains an unknown value deserialized from
3550 /// the string representation of enums.
3551 pub fn value(&self) -> std::option::Option<i32> {
3552 match self {
3553 Self::Unspecified => std::option::Option::Some(0),
3554 Self::None => std::option::Option::Some(1),
3555 Self::Required => std::option::Option::Some(2),
3556 Self::UnknownValue(u) => u.0.value(),
3557 }
3558 }
3559
3560 /// Gets the enum value as a string.
3561 ///
3562 /// Returns `None` if the enum contains an unknown value deserialized from
3563 /// the integer representation of enums.
3564 pub fn name(&self) -> std::option::Option<&str> {
3565 match self {
3566 Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
3567 Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
3568 Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
3569 Self::UnknownValue(u) => u.0.name(),
3570 }
3571 }
3572 }
3573
3574 impl std::default::Default for UserInteraction {
3575 fn default() -> Self {
3576 use std::convert::From;
3577 Self::from(0)
3578 }
3579 }
3580
3581 impl std::fmt::Display for UserInteraction {
3582 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3583 wkt::internal::display_enum(f, self.name(), self.value())
3584 }
3585 }
3586
3587 impl std::convert::From<i32> for UserInteraction {
3588 fn from(value: i32) -> Self {
3589 match value {
3590 0 => Self::Unspecified,
3591 1 => Self::None,
3592 2 => Self::Required,
3593 _ => Self::UnknownValue(user_interaction::UnknownValue(
3594 wkt::internal::UnknownEnumValue::Integer(value),
3595 )),
3596 }
3597 }
3598 }
3599
3600 impl std::convert::From<&str> for UserInteraction {
3601 fn from(value: &str) -> Self {
3602 use std::string::ToString;
3603 match value {
3604 "USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
3605 "USER_INTERACTION_NONE" => Self::None,
3606 "USER_INTERACTION_REQUIRED" => Self::Required,
3607 _ => Self::UnknownValue(user_interaction::UnknownValue(
3608 wkt::internal::UnknownEnumValue::String(value.to_string()),
3609 )),
3610 }
3611 }
3612 }
3613
3614 impl serde::ser::Serialize for UserInteraction {
3615 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3616 where
3617 S: serde::Serializer,
3618 {
3619 match self {
3620 Self::Unspecified => serializer.serialize_i32(0),
3621 Self::None => serializer.serialize_i32(1),
3622 Self::Required => serializer.serialize_i32(2),
3623 Self::UnknownValue(u) => u.0.serialize(serializer),
3624 }
3625 }
3626 }
3627
3628 impl<'de> serde::de::Deserialize<'de> for UserInteraction {
3629 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3630 where
3631 D: serde::Deserializer<'de>,
3632 {
3633 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
3634 ".grafeas.v1.CVSS.UserInteraction",
3635 ))
3636 }
3637 }
3638
3639 ///
3640 /// # Working with unknown values
3641 ///
3642 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3643 /// additional enum variants at any time. Adding new variants is not considered
3644 /// a breaking change. Applications should write their code in anticipation of:
3645 ///
3646 /// - New values appearing in future releases of the client library, **and**
3647 /// - New values received dynamically, without application changes.
3648 ///
3649 /// Please consult the [Working with enums] section in the user guide for some
3650 /// guidelines.
3651 ///
3652 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3653 #[derive(Clone, Debug, PartialEq)]
3654 #[non_exhaustive]
3655 pub enum Scope {
3656 Unspecified,
3657 Unchanged,
3658 Changed,
3659 /// If set, the enum was initialized with an unknown value.
3660 ///
3661 /// Applications can examine the value using [Scope::value] or
3662 /// [Scope::name].
3663 UnknownValue(scope::UnknownValue),
3664 }
3665
3666 #[doc(hidden)]
3667 pub mod scope {
3668 #[allow(unused_imports)]
3669 use super::*;
3670 #[derive(Clone, Debug, PartialEq)]
3671 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3672 }
3673
3674 impl Scope {
3675 /// Gets the enum value.
3676 ///
3677 /// Returns `None` if the enum contains an unknown value deserialized from
3678 /// the string representation of enums.
3679 pub fn value(&self) -> std::option::Option<i32> {
3680 match self {
3681 Self::Unspecified => std::option::Option::Some(0),
3682 Self::Unchanged => std::option::Option::Some(1),
3683 Self::Changed => std::option::Option::Some(2),
3684 Self::UnknownValue(u) => u.0.value(),
3685 }
3686 }
3687
3688 /// Gets the enum value as a string.
3689 ///
3690 /// Returns `None` if the enum contains an unknown value deserialized from
3691 /// the integer representation of enums.
3692 pub fn name(&self) -> std::option::Option<&str> {
3693 match self {
3694 Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
3695 Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
3696 Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
3697 Self::UnknownValue(u) => u.0.name(),
3698 }
3699 }
3700 }
3701
3702 impl std::default::Default for Scope {
3703 fn default() -> Self {
3704 use std::convert::From;
3705 Self::from(0)
3706 }
3707 }
3708
3709 impl std::fmt::Display for Scope {
3710 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3711 wkt::internal::display_enum(f, self.name(), self.value())
3712 }
3713 }
3714
3715 impl std::convert::From<i32> for Scope {
3716 fn from(value: i32) -> Self {
3717 match value {
3718 0 => Self::Unspecified,
3719 1 => Self::Unchanged,
3720 2 => Self::Changed,
3721 _ => Self::UnknownValue(scope::UnknownValue(
3722 wkt::internal::UnknownEnumValue::Integer(value),
3723 )),
3724 }
3725 }
3726 }
3727
3728 impl std::convert::From<&str> for Scope {
3729 fn from(value: &str) -> Self {
3730 use std::string::ToString;
3731 match value {
3732 "SCOPE_UNSPECIFIED" => Self::Unspecified,
3733 "SCOPE_UNCHANGED" => Self::Unchanged,
3734 "SCOPE_CHANGED" => Self::Changed,
3735 _ => Self::UnknownValue(scope::UnknownValue(
3736 wkt::internal::UnknownEnumValue::String(value.to_string()),
3737 )),
3738 }
3739 }
3740 }
3741
3742 impl serde::ser::Serialize for Scope {
3743 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3744 where
3745 S: serde::Serializer,
3746 {
3747 match self {
3748 Self::Unspecified => serializer.serialize_i32(0),
3749 Self::Unchanged => serializer.serialize_i32(1),
3750 Self::Changed => serializer.serialize_i32(2),
3751 Self::UnknownValue(u) => u.0.serialize(serializer),
3752 }
3753 }
3754 }
3755
3756 impl<'de> serde::de::Deserialize<'de> for Scope {
3757 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3758 where
3759 D: serde::Deserializer<'de>,
3760 {
3761 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
3762 ".grafeas.v1.CVSS.Scope",
3763 ))
3764 }
3765 }
3766
3767 ///
3768 /// # Working with unknown values
3769 ///
3770 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3771 /// additional enum variants at any time. Adding new variants is not considered
3772 /// a breaking change. Applications should write their code in anticipation of:
3773 ///
3774 /// - New values appearing in future releases of the client library, **and**
3775 /// - New values received dynamically, without application changes.
3776 ///
3777 /// Please consult the [Working with enums] section in the user guide for some
3778 /// guidelines.
3779 ///
3780 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3781 #[derive(Clone, Debug, PartialEq)]
3782 #[non_exhaustive]
3783 pub enum Impact {
3784 Unspecified,
3785 High,
3786 Low,
3787 None,
3788 Partial,
3789 Complete,
3790 /// If set, the enum was initialized with an unknown value.
3791 ///
3792 /// Applications can examine the value using [Impact::value] or
3793 /// [Impact::name].
3794 UnknownValue(impact::UnknownValue),
3795 }
3796
3797 #[doc(hidden)]
3798 pub mod impact {
3799 #[allow(unused_imports)]
3800 use super::*;
3801 #[derive(Clone, Debug, PartialEq)]
3802 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3803 }
3804
3805 impl Impact {
3806 /// Gets the enum value.
3807 ///
3808 /// Returns `None` if the enum contains an unknown value deserialized from
3809 /// the string representation of enums.
3810 pub fn value(&self) -> std::option::Option<i32> {
3811 match self {
3812 Self::Unspecified => std::option::Option::Some(0),
3813 Self::High => std::option::Option::Some(1),
3814 Self::Low => std::option::Option::Some(2),
3815 Self::None => std::option::Option::Some(3),
3816 Self::Partial => std::option::Option::Some(4),
3817 Self::Complete => std::option::Option::Some(5),
3818 Self::UnknownValue(u) => u.0.value(),
3819 }
3820 }
3821
3822 /// Gets the enum value as a string.
3823 ///
3824 /// Returns `None` if the enum contains an unknown value deserialized from
3825 /// the integer representation of enums.
3826 pub fn name(&self) -> std::option::Option<&str> {
3827 match self {
3828 Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
3829 Self::High => std::option::Option::Some("IMPACT_HIGH"),
3830 Self::Low => std::option::Option::Some("IMPACT_LOW"),
3831 Self::None => std::option::Option::Some("IMPACT_NONE"),
3832 Self::Partial => std::option::Option::Some("IMPACT_PARTIAL"),
3833 Self::Complete => std::option::Option::Some("IMPACT_COMPLETE"),
3834 Self::UnknownValue(u) => u.0.name(),
3835 }
3836 }
3837 }
3838
3839 impl std::default::Default for Impact {
3840 fn default() -> Self {
3841 use std::convert::From;
3842 Self::from(0)
3843 }
3844 }
3845
3846 impl std::fmt::Display for Impact {
3847 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3848 wkt::internal::display_enum(f, self.name(), self.value())
3849 }
3850 }
3851
3852 impl std::convert::From<i32> for Impact {
3853 fn from(value: i32) -> Self {
3854 match value {
3855 0 => Self::Unspecified,
3856 1 => Self::High,
3857 2 => Self::Low,
3858 3 => Self::None,
3859 4 => Self::Partial,
3860 5 => Self::Complete,
3861 _ => Self::UnknownValue(impact::UnknownValue(
3862 wkt::internal::UnknownEnumValue::Integer(value),
3863 )),
3864 }
3865 }
3866 }
3867
3868 impl std::convert::From<&str> for Impact {
3869 fn from(value: &str) -> Self {
3870 use std::string::ToString;
3871 match value {
3872 "IMPACT_UNSPECIFIED" => Self::Unspecified,
3873 "IMPACT_HIGH" => Self::High,
3874 "IMPACT_LOW" => Self::Low,
3875 "IMPACT_NONE" => Self::None,
3876 "IMPACT_PARTIAL" => Self::Partial,
3877 "IMPACT_COMPLETE" => Self::Complete,
3878 _ => Self::UnknownValue(impact::UnknownValue(
3879 wkt::internal::UnknownEnumValue::String(value.to_string()),
3880 )),
3881 }
3882 }
3883 }
3884
3885 impl serde::ser::Serialize for Impact {
3886 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3887 where
3888 S: serde::Serializer,
3889 {
3890 match self {
3891 Self::Unspecified => serializer.serialize_i32(0),
3892 Self::High => serializer.serialize_i32(1),
3893 Self::Low => serializer.serialize_i32(2),
3894 Self::None => serializer.serialize_i32(3),
3895 Self::Partial => serializer.serialize_i32(4),
3896 Self::Complete => serializer.serialize_i32(5),
3897 Self::UnknownValue(u) => u.0.serialize(serializer),
3898 }
3899 }
3900 }
3901
3902 impl<'de> serde::de::Deserialize<'de> for Impact {
3903 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3904 where
3905 D: serde::Deserializer<'de>,
3906 {
3907 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
3908 ".grafeas.v1.CVSS.Impact",
3909 ))
3910 }
3911 }
3912}
3913
3914/// An artifact that can be deployed in some runtime.
3915#[derive(Clone, Default, PartialEq)]
3916#[non_exhaustive]
3917pub struct DeploymentNote {
3918 /// Required. Resource URI for the artifact being deployed.
3919 pub resource_uri: std::vec::Vec<std::string::String>,
3920
3921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3922}
3923
3924impl DeploymentNote {
3925 pub fn new() -> Self {
3926 std::default::Default::default()
3927 }
3928
3929 /// Sets the value of [resource_uri][crate::model::DeploymentNote::resource_uri].
3930 ///
3931 /// # Example
3932 /// ```ignore,no_run
3933 /// # use google_cloud_grafeas_v1::model::DeploymentNote;
3934 /// let x = DeploymentNote::new().set_resource_uri(["a", "b", "c"]);
3935 /// ```
3936 pub fn set_resource_uri<T, V>(mut self, v: T) -> Self
3937 where
3938 T: std::iter::IntoIterator<Item = V>,
3939 V: std::convert::Into<std::string::String>,
3940 {
3941 use std::iter::Iterator;
3942 self.resource_uri = v.into_iter().map(|i| i.into()).collect();
3943 self
3944 }
3945}
3946
3947impl wkt::message::Message for DeploymentNote {
3948 fn typename() -> &'static str {
3949 "type.googleapis.com/grafeas.v1.DeploymentNote"
3950 }
3951}
3952
3953/// The period during which some deployable was active in a runtime.
3954#[derive(Clone, Default, PartialEq)]
3955#[non_exhaustive]
3956pub struct DeploymentOccurrence {
3957 /// Identity of the user that triggered this deployment.
3958 pub user_email: std::string::String,
3959
3960 /// Required. Beginning of the lifetime of this deployment.
3961 pub deploy_time: std::option::Option<wkt::Timestamp>,
3962
3963 /// End of the lifetime of this deployment.
3964 pub undeploy_time: std::option::Option<wkt::Timestamp>,
3965
3966 /// Configuration used to create this deployment.
3967 pub config: std::string::String,
3968
3969 /// Address of the runtime element hosting this deployment.
3970 pub address: std::string::String,
3971
3972 /// Output only. Resource URI for the artifact being deployed taken from
3973 /// the deployable field with the same name.
3974 pub resource_uri: std::vec::Vec<std::string::String>,
3975
3976 /// Platform hosting this deployment.
3977 pub platform: crate::model::deployment_occurrence::Platform,
3978
3979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3980}
3981
3982impl DeploymentOccurrence {
3983 pub fn new() -> Self {
3984 std::default::Default::default()
3985 }
3986
3987 /// Sets the value of [user_email][crate::model::DeploymentOccurrence::user_email].
3988 ///
3989 /// # Example
3990 /// ```ignore,no_run
3991 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
3992 /// let x = DeploymentOccurrence::new().set_user_email("example");
3993 /// ```
3994 pub fn set_user_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3995 self.user_email = v.into();
3996 self
3997 }
3998
3999 /// Sets the value of [deploy_time][crate::model::DeploymentOccurrence::deploy_time].
4000 ///
4001 /// # Example
4002 /// ```ignore,no_run
4003 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4004 /// use wkt::Timestamp;
4005 /// let x = DeploymentOccurrence::new().set_deploy_time(Timestamp::default()/* use setters */);
4006 /// ```
4007 pub fn set_deploy_time<T>(mut self, v: T) -> Self
4008 where
4009 T: std::convert::Into<wkt::Timestamp>,
4010 {
4011 self.deploy_time = std::option::Option::Some(v.into());
4012 self
4013 }
4014
4015 /// Sets or clears the value of [deploy_time][crate::model::DeploymentOccurrence::deploy_time].
4016 ///
4017 /// # Example
4018 /// ```ignore,no_run
4019 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4020 /// use wkt::Timestamp;
4021 /// let x = DeploymentOccurrence::new().set_or_clear_deploy_time(Some(Timestamp::default()/* use setters */));
4022 /// let x = DeploymentOccurrence::new().set_or_clear_deploy_time(None::<Timestamp>);
4023 /// ```
4024 pub fn set_or_clear_deploy_time<T>(mut self, v: std::option::Option<T>) -> Self
4025 where
4026 T: std::convert::Into<wkt::Timestamp>,
4027 {
4028 self.deploy_time = v.map(|x| x.into());
4029 self
4030 }
4031
4032 /// Sets the value of [undeploy_time][crate::model::DeploymentOccurrence::undeploy_time].
4033 ///
4034 /// # Example
4035 /// ```ignore,no_run
4036 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4037 /// use wkt::Timestamp;
4038 /// let x = DeploymentOccurrence::new().set_undeploy_time(Timestamp::default()/* use setters */);
4039 /// ```
4040 pub fn set_undeploy_time<T>(mut self, v: T) -> Self
4041 where
4042 T: std::convert::Into<wkt::Timestamp>,
4043 {
4044 self.undeploy_time = std::option::Option::Some(v.into());
4045 self
4046 }
4047
4048 /// Sets or clears the value of [undeploy_time][crate::model::DeploymentOccurrence::undeploy_time].
4049 ///
4050 /// # Example
4051 /// ```ignore,no_run
4052 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4053 /// use wkt::Timestamp;
4054 /// let x = DeploymentOccurrence::new().set_or_clear_undeploy_time(Some(Timestamp::default()/* use setters */));
4055 /// let x = DeploymentOccurrence::new().set_or_clear_undeploy_time(None::<Timestamp>);
4056 /// ```
4057 pub fn set_or_clear_undeploy_time<T>(mut self, v: std::option::Option<T>) -> Self
4058 where
4059 T: std::convert::Into<wkt::Timestamp>,
4060 {
4061 self.undeploy_time = v.map(|x| x.into());
4062 self
4063 }
4064
4065 /// Sets the value of [config][crate::model::DeploymentOccurrence::config].
4066 ///
4067 /// # Example
4068 /// ```ignore,no_run
4069 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4070 /// let x = DeploymentOccurrence::new().set_config("example");
4071 /// ```
4072 pub fn set_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4073 self.config = v.into();
4074 self
4075 }
4076
4077 /// Sets the value of [address][crate::model::DeploymentOccurrence::address].
4078 ///
4079 /// # Example
4080 /// ```ignore,no_run
4081 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4082 /// let x = DeploymentOccurrence::new().set_address("example");
4083 /// ```
4084 pub fn set_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4085 self.address = v.into();
4086 self
4087 }
4088
4089 /// Sets the value of [resource_uri][crate::model::DeploymentOccurrence::resource_uri].
4090 ///
4091 /// # Example
4092 /// ```ignore,no_run
4093 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4094 /// let x = DeploymentOccurrence::new().set_resource_uri(["a", "b", "c"]);
4095 /// ```
4096 pub fn set_resource_uri<T, V>(mut self, v: T) -> Self
4097 where
4098 T: std::iter::IntoIterator<Item = V>,
4099 V: std::convert::Into<std::string::String>,
4100 {
4101 use std::iter::Iterator;
4102 self.resource_uri = v.into_iter().map(|i| i.into()).collect();
4103 self
4104 }
4105
4106 /// Sets the value of [platform][crate::model::DeploymentOccurrence::platform].
4107 ///
4108 /// # Example
4109 /// ```ignore,no_run
4110 /// # use google_cloud_grafeas_v1::model::DeploymentOccurrence;
4111 /// use google_cloud_grafeas_v1::model::deployment_occurrence::Platform;
4112 /// let x0 = DeploymentOccurrence::new().set_platform(Platform::Gke);
4113 /// let x1 = DeploymentOccurrence::new().set_platform(Platform::Flex);
4114 /// let x2 = DeploymentOccurrence::new().set_platform(Platform::Custom);
4115 /// ```
4116 pub fn set_platform<T: std::convert::Into<crate::model::deployment_occurrence::Platform>>(
4117 mut self,
4118 v: T,
4119 ) -> Self {
4120 self.platform = v.into();
4121 self
4122 }
4123}
4124
4125impl wkt::message::Message for DeploymentOccurrence {
4126 fn typename() -> &'static str {
4127 "type.googleapis.com/grafeas.v1.DeploymentOccurrence"
4128 }
4129}
4130
4131/// Defines additional types related to [DeploymentOccurrence].
4132pub mod deployment_occurrence {
4133 #[allow(unused_imports)]
4134 use super::*;
4135
4136 /// Types of platforms.
4137 ///
4138 /// # Working with unknown values
4139 ///
4140 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4141 /// additional enum variants at any time. Adding new variants is not considered
4142 /// a breaking change. Applications should write their code in anticipation of:
4143 ///
4144 /// - New values appearing in future releases of the client library, **and**
4145 /// - New values received dynamically, without application changes.
4146 ///
4147 /// Please consult the [Working with enums] section in the user guide for some
4148 /// guidelines.
4149 ///
4150 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4151 #[derive(Clone, Debug, PartialEq)]
4152 #[non_exhaustive]
4153 pub enum Platform {
4154 /// Unknown.
4155 Unspecified,
4156 /// Google Container Engine.
4157 Gke,
4158 /// Google App Engine: Flexible Environment.
4159 Flex,
4160 /// Custom user-defined platform.
4161 Custom,
4162 /// If set, the enum was initialized with an unknown value.
4163 ///
4164 /// Applications can examine the value using [Platform::value] or
4165 /// [Platform::name].
4166 UnknownValue(platform::UnknownValue),
4167 }
4168
4169 #[doc(hidden)]
4170 pub mod platform {
4171 #[allow(unused_imports)]
4172 use super::*;
4173 #[derive(Clone, Debug, PartialEq)]
4174 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4175 }
4176
4177 impl Platform {
4178 /// Gets the enum value.
4179 ///
4180 /// Returns `None` if the enum contains an unknown value deserialized from
4181 /// the string representation of enums.
4182 pub fn value(&self) -> std::option::Option<i32> {
4183 match self {
4184 Self::Unspecified => std::option::Option::Some(0),
4185 Self::Gke => std::option::Option::Some(1),
4186 Self::Flex => std::option::Option::Some(2),
4187 Self::Custom => std::option::Option::Some(3),
4188 Self::UnknownValue(u) => u.0.value(),
4189 }
4190 }
4191
4192 /// Gets the enum value as a string.
4193 ///
4194 /// Returns `None` if the enum contains an unknown value deserialized from
4195 /// the integer representation of enums.
4196 pub fn name(&self) -> std::option::Option<&str> {
4197 match self {
4198 Self::Unspecified => std::option::Option::Some("PLATFORM_UNSPECIFIED"),
4199 Self::Gke => std::option::Option::Some("GKE"),
4200 Self::Flex => std::option::Option::Some("FLEX"),
4201 Self::Custom => std::option::Option::Some("CUSTOM"),
4202 Self::UnknownValue(u) => u.0.name(),
4203 }
4204 }
4205 }
4206
4207 impl std::default::Default for Platform {
4208 fn default() -> Self {
4209 use std::convert::From;
4210 Self::from(0)
4211 }
4212 }
4213
4214 impl std::fmt::Display for Platform {
4215 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4216 wkt::internal::display_enum(f, self.name(), self.value())
4217 }
4218 }
4219
4220 impl std::convert::From<i32> for Platform {
4221 fn from(value: i32) -> Self {
4222 match value {
4223 0 => Self::Unspecified,
4224 1 => Self::Gke,
4225 2 => Self::Flex,
4226 3 => Self::Custom,
4227 _ => Self::UnknownValue(platform::UnknownValue(
4228 wkt::internal::UnknownEnumValue::Integer(value),
4229 )),
4230 }
4231 }
4232 }
4233
4234 impl std::convert::From<&str> for Platform {
4235 fn from(value: &str) -> Self {
4236 use std::string::ToString;
4237 match value {
4238 "PLATFORM_UNSPECIFIED" => Self::Unspecified,
4239 "GKE" => Self::Gke,
4240 "FLEX" => Self::Flex,
4241 "CUSTOM" => Self::Custom,
4242 _ => Self::UnknownValue(platform::UnknownValue(
4243 wkt::internal::UnknownEnumValue::String(value.to_string()),
4244 )),
4245 }
4246 }
4247 }
4248
4249 impl serde::ser::Serialize for Platform {
4250 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4251 where
4252 S: serde::Serializer,
4253 {
4254 match self {
4255 Self::Unspecified => serializer.serialize_i32(0),
4256 Self::Gke => serializer.serialize_i32(1),
4257 Self::Flex => serializer.serialize_i32(2),
4258 Self::Custom => serializer.serialize_i32(3),
4259 Self::UnknownValue(u) => u.0.serialize(serializer),
4260 }
4261 }
4262 }
4263
4264 impl<'de> serde::de::Deserialize<'de> for Platform {
4265 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4266 where
4267 D: serde::Deserializer<'de>,
4268 {
4269 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Platform>::new(
4270 ".grafeas.v1.DeploymentOccurrence.Platform",
4271 ))
4272 }
4273 }
4274}
4275
4276/// A note that indicates a type of analysis a provider would perform. This note
4277/// exists in a provider's project. A `Discovery` occurrence is created in a
4278/// consumer's project at the start of analysis.
4279#[derive(Clone, Default, PartialEq)]
4280#[non_exhaustive]
4281pub struct DiscoveryNote {
4282 /// Required. Immutable. The kind of analysis that is handled by this
4283 /// discovery.
4284 pub analysis_kind: crate::model::NoteKind,
4285
4286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4287}
4288
4289impl DiscoveryNote {
4290 pub fn new() -> Self {
4291 std::default::Default::default()
4292 }
4293
4294 /// Sets the value of [analysis_kind][crate::model::DiscoveryNote::analysis_kind].
4295 ///
4296 /// # Example
4297 /// ```ignore,no_run
4298 /// # use google_cloud_grafeas_v1::model::DiscoveryNote;
4299 /// use google_cloud_grafeas_v1::model::NoteKind;
4300 /// let x0 = DiscoveryNote::new().set_analysis_kind(NoteKind::Vulnerability);
4301 /// let x1 = DiscoveryNote::new().set_analysis_kind(NoteKind::Build);
4302 /// let x2 = DiscoveryNote::new().set_analysis_kind(NoteKind::Image);
4303 /// ```
4304 pub fn set_analysis_kind<T: std::convert::Into<crate::model::NoteKind>>(
4305 mut self,
4306 v: T,
4307 ) -> Self {
4308 self.analysis_kind = v.into();
4309 self
4310 }
4311}
4312
4313impl wkt::message::Message for DiscoveryNote {
4314 fn typename() -> &'static str {
4315 "type.googleapis.com/grafeas.v1.DiscoveryNote"
4316 }
4317}
4318
4319/// Provides information about the analysis status of a discovered resource.
4320#[derive(Clone, Default, PartialEq)]
4321#[non_exhaustive]
4322pub struct DiscoveryOccurrence {
4323 /// Whether the resource is continuously analyzed.
4324 pub continuous_analysis: crate::model::discovery_occurrence::ContinuousAnalysis,
4325
4326 /// The status of discovery for the resource.
4327 pub analysis_status: crate::model::discovery_occurrence::AnalysisStatus,
4328
4329 pub analysis_completed:
4330 std::option::Option<crate::model::discovery_occurrence::AnalysisCompleted>,
4331
4332 /// Indicates any errors encountered during analysis of a resource. There
4333 /// could be 0 or more of these errors.
4334 pub analysis_error: std::vec::Vec<google_cloud_rpc::model::Status>,
4335
4336 /// When an error is encountered this will contain a LocalizedMessage under
4337 /// details to show to the user. The LocalizedMessage is output only and
4338 /// populated by the API.
4339 pub analysis_status_error: std::option::Option<google_cloud_rpc::model::Status>,
4340
4341 /// The CPE of the resource being scanned.
4342 pub cpe: std::string::String,
4343
4344 /// The last time this resource was scanned.
4345 pub last_scan_time: std::option::Option<wkt::Timestamp>,
4346
4347 /// The time occurrences related to this discovery occurrence were archived.
4348 pub archive_time: std::option::Option<wkt::Timestamp>,
4349
4350 /// The status of an SBOM generation.
4351 pub sbom_status: std::option::Option<crate::model::discovery_occurrence::SBOMStatus>,
4352
4353 /// The status of an vulnerability attestation generation.
4354 pub vulnerability_attestation:
4355 std::option::Option<crate::model::discovery_occurrence::VulnerabilityAttestation>,
4356
4357 /// Files that make up the resource described by the occurrence.
4358 pub files: std::vec::Vec<crate::model::discovery_occurrence::File>,
4359
4360 /// The last time vulnerability scan results changed.
4361 pub last_vulnerability_update_time: std::option::Option<wkt::Timestamp>,
4362
4363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4364}
4365
4366impl DiscoveryOccurrence {
4367 pub fn new() -> Self {
4368 std::default::Default::default()
4369 }
4370
4371 /// Sets the value of [continuous_analysis][crate::model::DiscoveryOccurrence::continuous_analysis].
4372 ///
4373 /// # Example
4374 /// ```ignore,no_run
4375 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4376 /// use google_cloud_grafeas_v1::model::discovery_occurrence::ContinuousAnalysis;
4377 /// let x0 = DiscoveryOccurrence::new().set_continuous_analysis(ContinuousAnalysis::Active);
4378 /// let x1 = DiscoveryOccurrence::new().set_continuous_analysis(ContinuousAnalysis::Inactive);
4379 /// ```
4380 pub fn set_continuous_analysis<
4381 T: std::convert::Into<crate::model::discovery_occurrence::ContinuousAnalysis>,
4382 >(
4383 mut self,
4384 v: T,
4385 ) -> Self {
4386 self.continuous_analysis = v.into();
4387 self
4388 }
4389
4390 /// Sets the value of [analysis_status][crate::model::DiscoveryOccurrence::analysis_status].
4391 ///
4392 /// # Example
4393 /// ```ignore,no_run
4394 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4395 /// use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisStatus;
4396 /// let x0 = DiscoveryOccurrence::new().set_analysis_status(AnalysisStatus::Pending);
4397 /// let x1 = DiscoveryOccurrence::new().set_analysis_status(AnalysisStatus::Scanning);
4398 /// let x2 = DiscoveryOccurrence::new().set_analysis_status(AnalysisStatus::FinishedSuccess);
4399 /// ```
4400 pub fn set_analysis_status<
4401 T: std::convert::Into<crate::model::discovery_occurrence::AnalysisStatus>,
4402 >(
4403 mut self,
4404 v: T,
4405 ) -> Self {
4406 self.analysis_status = v.into();
4407 self
4408 }
4409
4410 /// Sets the value of [analysis_completed][crate::model::DiscoveryOccurrence::analysis_completed].
4411 ///
4412 /// # Example
4413 /// ```ignore,no_run
4414 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4415 /// use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisCompleted;
4416 /// let x = DiscoveryOccurrence::new().set_analysis_completed(AnalysisCompleted::default()/* use setters */);
4417 /// ```
4418 pub fn set_analysis_completed<T>(mut self, v: T) -> Self
4419 where
4420 T: std::convert::Into<crate::model::discovery_occurrence::AnalysisCompleted>,
4421 {
4422 self.analysis_completed = std::option::Option::Some(v.into());
4423 self
4424 }
4425
4426 /// Sets or clears the value of [analysis_completed][crate::model::DiscoveryOccurrence::analysis_completed].
4427 ///
4428 /// # Example
4429 /// ```ignore,no_run
4430 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4431 /// use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisCompleted;
4432 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_completed(Some(AnalysisCompleted::default()/* use setters */));
4433 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_completed(None::<AnalysisCompleted>);
4434 /// ```
4435 pub fn set_or_clear_analysis_completed<T>(mut self, v: std::option::Option<T>) -> Self
4436 where
4437 T: std::convert::Into<crate::model::discovery_occurrence::AnalysisCompleted>,
4438 {
4439 self.analysis_completed = v.map(|x| x.into());
4440 self
4441 }
4442
4443 /// Sets the value of [analysis_error][crate::model::DiscoveryOccurrence::analysis_error].
4444 ///
4445 /// # Example
4446 /// ```ignore,no_run
4447 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4448 /// use google_cloud_rpc::model::Status;
4449 /// let x = DiscoveryOccurrence::new()
4450 /// .set_analysis_error([
4451 /// Status::default()/* use setters */,
4452 /// Status::default()/* use (different) setters */,
4453 /// ]);
4454 /// ```
4455 pub fn set_analysis_error<T, V>(mut self, v: T) -> Self
4456 where
4457 T: std::iter::IntoIterator<Item = V>,
4458 V: std::convert::Into<google_cloud_rpc::model::Status>,
4459 {
4460 use std::iter::Iterator;
4461 self.analysis_error = v.into_iter().map(|i| i.into()).collect();
4462 self
4463 }
4464
4465 /// Sets the value of [analysis_status_error][crate::model::DiscoveryOccurrence::analysis_status_error].
4466 ///
4467 /// # Example
4468 /// ```ignore,no_run
4469 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4470 /// use google_cloud_rpc::model::Status;
4471 /// let x = DiscoveryOccurrence::new().set_analysis_status_error(Status::default()/* use setters */);
4472 /// ```
4473 pub fn set_analysis_status_error<T>(mut self, v: T) -> Self
4474 where
4475 T: std::convert::Into<google_cloud_rpc::model::Status>,
4476 {
4477 self.analysis_status_error = std::option::Option::Some(v.into());
4478 self
4479 }
4480
4481 /// Sets or clears the value of [analysis_status_error][crate::model::DiscoveryOccurrence::analysis_status_error].
4482 ///
4483 /// # Example
4484 /// ```ignore,no_run
4485 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4486 /// use google_cloud_rpc::model::Status;
4487 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_status_error(Some(Status::default()/* use setters */));
4488 /// let x = DiscoveryOccurrence::new().set_or_clear_analysis_status_error(None::<Status>);
4489 /// ```
4490 pub fn set_or_clear_analysis_status_error<T>(mut self, v: std::option::Option<T>) -> Self
4491 where
4492 T: std::convert::Into<google_cloud_rpc::model::Status>,
4493 {
4494 self.analysis_status_error = v.map(|x| x.into());
4495 self
4496 }
4497
4498 /// Sets the value of [cpe][crate::model::DiscoveryOccurrence::cpe].
4499 ///
4500 /// # Example
4501 /// ```ignore,no_run
4502 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4503 /// let x = DiscoveryOccurrence::new().set_cpe("example");
4504 /// ```
4505 pub fn set_cpe<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4506 self.cpe = v.into();
4507 self
4508 }
4509
4510 /// Sets the value of [last_scan_time][crate::model::DiscoveryOccurrence::last_scan_time].
4511 ///
4512 /// # Example
4513 /// ```ignore,no_run
4514 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4515 /// use wkt::Timestamp;
4516 /// let x = DiscoveryOccurrence::new().set_last_scan_time(Timestamp::default()/* use setters */);
4517 /// ```
4518 pub fn set_last_scan_time<T>(mut self, v: T) -> Self
4519 where
4520 T: std::convert::Into<wkt::Timestamp>,
4521 {
4522 self.last_scan_time = std::option::Option::Some(v.into());
4523 self
4524 }
4525
4526 /// Sets or clears the value of [last_scan_time][crate::model::DiscoveryOccurrence::last_scan_time].
4527 ///
4528 /// # Example
4529 /// ```ignore,no_run
4530 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4531 /// use wkt::Timestamp;
4532 /// let x = DiscoveryOccurrence::new().set_or_clear_last_scan_time(Some(Timestamp::default()/* use setters */));
4533 /// let x = DiscoveryOccurrence::new().set_or_clear_last_scan_time(None::<Timestamp>);
4534 /// ```
4535 pub fn set_or_clear_last_scan_time<T>(mut self, v: std::option::Option<T>) -> Self
4536 where
4537 T: std::convert::Into<wkt::Timestamp>,
4538 {
4539 self.last_scan_time = v.map(|x| x.into());
4540 self
4541 }
4542
4543 /// Sets the value of [archive_time][crate::model::DiscoveryOccurrence::archive_time].
4544 ///
4545 /// # Example
4546 /// ```ignore,no_run
4547 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4548 /// use wkt::Timestamp;
4549 /// let x = DiscoveryOccurrence::new().set_archive_time(Timestamp::default()/* use setters */);
4550 /// ```
4551 pub fn set_archive_time<T>(mut self, v: T) -> Self
4552 where
4553 T: std::convert::Into<wkt::Timestamp>,
4554 {
4555 self.archive_time = std::option::Option::Some(v.into());
4556 self
4557 }
4558
4559 /// Sets or clears the value of [archive_time][crate::model::DiscoveryOccurrence::archive_time].
4560 ///
4561 /// # Example
4562 /// ```ignore,no_run
4563 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4564 /// use wkt::Timestamp;
4565 /// let x = DiscoveryOccurrence::new().set_or_clear_archive_time(Some(Timestamp::default()/* use setters */));
4566 /// let x = DiscoveryOccurrence::new().set_or_clear_archive_time(None::<Timestamp>);
4567 /// ```
4568 pub fn set_or_clear_archive_time<T>(mut self, v: std::option::Option<T>) -> Self
4569 where
4570 T: std::convert::Into<wkt::Timestamp>,
4571 {
4572 self.archive_time = v.map(|x| x.into());
4573 self
4574 }
4575
4576 /// Sets the value of [sbom_status][crate::model::DiscoveryOccurrence::sbom_status].
4577 ///
4578 /// # Example
4579 /// ```ignore,no_run
4580 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4581 /// use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4582 /// let x = DiscoveryOccurrence::new().set_sbom_status(SBOMStatus::default()/* use setters */);
4583 /// ```
4584 pub fn set_sbom_status<T>(mut self, v: T) -> Self
4585 where
4586 T: std::convert::Into<crate::model::discovery_occurrence::SBOMStatus>,
4587 {
4588 self.sbom_status = std::option::Option::Some(v.into());
4589 self
4590 }
4591
4592 /// Sets or clears the value of [sbom_status][crate::model::DiscoveryOccurrence::sbom_status].
4593 ///
4594 /// # Example
4595 /// ```ignore,no_run
4596 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4597 /// use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4598 /// let x = DiscoveryOccurrence::new().set_or_clear_sbom_status(Some(SBOMStatus::default()/* use setters */));
4599 /// let x = DiscoveryOccurrence::new().set_or_clear_sbom_status(None::<SBOMStatus>);
4600 /// ```
4601 pub fn set_or_clear_sbom_status<T>(mut self, v: std::option::Option<T>) -> Self
4602 where
4603 T: std::convert::Into<crate::model::discovery_occurrence::SBOMStatus>,
4604 {
4605 self.sbom_status = v.map(|x| x.into());
4606 self
4607 }
4608
4609 /// Sets the value of [vulnerability_attestation][crate::model::DiscoveryOccurrence::vulnerability_attestation].
4610 ///
4611 /// # Example
4612 /// ```ignore,no_run
4613 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4614 /// use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4615 /// let x = DiscoveryOccurrence::new().set_vulnerability_attestation(VulnerabilityAttestation::default()/* use setters */);
4616 /// ```
4617 pub fn set_vulnerability_attestation<T>(mut self, v: T) -> Self
4618 where
4619 T: std::convert::Into<crate::model::discovery_occurrence::VulnerabilityAttestation>,
4620 {
4621 self.vulnerability_attestation = std::option::Option::Some(v.into());
4622 self
4623 }
4624
4625 /// Sets or clears the value of [vulnerability_attestation][crate::model::DiscoveryOccurrence::vulnerability_attestation].
4626 ///
4627 /// # Example
4628 /// ```ignore,no_run
4629 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4630 /// use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4631 /// let x = DiscoveryOccurrence::new().set_or_clear_vulnerability_attestation(Some(VulnerabilityAttestation::default()/* use setters */));
4632 /// let x = DiscoveryOccurrence::new().set_or_clear_vulnerability_attestation(None::<VulnerabilityAttestation>);
4633 /// ```
4634 pub fn set_or_clear_vulnerability_attestation<T>(mut self, v: std::option::Option<T>) -> Self
4635 where
4636 T: std::convert::Into<crate::model::discovery_occurrence::VulnerabilityAttestation>,
4637 {
4638 self.vulnerability_attestation = v.map(|x| x.into());
4639 self
4640 }
4641
4642 /// Sets the value of [files][crate::model::DiscoveryOccurrence::files].
4643 ///
4644 /// # Example
4645 /// ```ignore,no_run
4646 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4647 /// use google_cloud_grafeas_v1::model::discovery_occurrence::File;
4648 /// let x = DiscoveryOccurrence::new()
4649 /// .set_files([
4650 /// File::default()/* use setters */,
4651 /// File::default()/* use (different) setters */,
4652 /// ]);
4653 /// ```
4654 pub fn set_files<T, V>(mut self, v: T) -> Self
4655 where
4656 T: std::iter::IntoIterator<Item = V>,
4657 V: std::convert::Into<crate::model::discovery_occurrence::File>,
4658 {
4659 use std::iter::Iterator;
4660 self.files = v.into_iter().map(|i| i.into()).collect();
4661 self
4662 }
4663
4664 /// Sets the value of [last_vulnerability_update_time][crate::model::DiscoveryOccurrence::last_vulnerability_update_time].
4665 ///
4666 /// # Example
4667 /// ```ignore,no_run
4668 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4669 /// use wkt::Timestamp;
4670 /// let x = DiscoveryOccurrence::new().set_last_vulnerability_update_time(Timestamp::default()/* use setters */);
4671 /// ```
4672 pub fn set_last_vulnerability_update_time<T>(mut self, v: T) -> Self
4673 where
4674 T: std::convert::Into<wkt::Timestamp>,
4675 {
4676 self.last_vulnerability_update_time = std::option::Option::Some(v.into());
4677 self
4678 }
4679
4680 /// Sets or clears the value of [last_vulnerability_update_time][crate::model::DiscoveryOccurrence::last_vulnerability_update_time].
4681 ///
4682 /// # Example
4683 /// ```ignore,no_run
4684 /// # use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
4685 /// use wkt::Timestamp;
4686 /// let x = DiscoveryOccurrence::new().set_or_clear_last_vulnerability_update_time(Some(Timestamp::default()/* use setters */));
4687 /// let x = DiscoveryOccurrence::new().set_or_clear_last_vulnerability_update_time(None::<Timestamp>);
4688 /// ```
4689 pub fn set_or_clear_last_vulnerability_update_time<T>(
4690 mut self,
4691 v: std::option::Option<T>,
4692 ) -> Self
4693 where
4694 T: std::convert::Into<wkt::Timestamp>,
4695 {
4696 self.last_vulnerability_update_time = v.map(|x| x.into());
4697 self
4698 }
4699}
4700
4701impl wkt::message::Message for DiscoveryOccurrence {
4702 fn typename() -> &'static str {
4703 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence"
4704 }
4705}
4706
4707/// Defines additional types related to [DiscoveryOccurrence].
4708pub mod discovery_occurrence {
4709 #[allow(unused_imports)]
4710 use super::*;
4711
4712 /// Indicates which analysis completed successfully. Multiple types of
4713 /// analysis can be performed on a single resource.
4714 #[derive(Clone, Default, PartialEq)]
4715 #[non_exhaustive]
4716 pub struct AnalysisCompleted {
4717 pub analysis_type: std::vec::Vec<std::string::String>,
4718
4719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4720 }
4721
4722 impl AnalysisCompleted {
4723 pub fn new() -> Self {
4724 std::default::Default::default()
4725 }
4726
4727 /// Sets the value of [analysis_type][crate::model::discovery_occurrence::AnalysisCompleted::analysis_type].
4728 ///
4729 /// # Example
4730 /// ```ignore,no_run
4731 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::AnalysisCompleted;
4732 /// let x = AnalysisCompleted::new().set_analysis_type(["a", "b", "c"]);
4733 /// ```
4734 pub fn set_analysis_type<T, V>(mut self, v: T) -> Self
4735 where
4736 T: std::iter::IntoIterator<Item = V>,
4737 V: std::convert::Into<std::string::String>,
4738 {
4739 use std::iter::Iterator;
4740 self.analysis_type = v.into_iter().map(|i| i.into()).collect();
4741 self
4742 }
4743 }
4744
4745 impl wkt::message::Message for AnalysisCompleted {
4746 fn typename() -> &'static str {
4747 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.AnalysisCompleted"
4748 }
4749 }
4750
4751 /// The status of an SBOM generation.
4752 #[derive(Clone, Default, PartialEq)]
4753 #[non_exhaustive]
4754 pub struct SBOMStatus {
4755 /// The progress of the SBOM generation.
4756 pub sbom_state: crate::model::discovery_occurrence::sbom_status::SBOMState,
4757
4758 /// If there was an error generating an SBOM, this will indicate what that
4759 /// error was.
4760 pub error: std::string::String,
4761
4762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4763 }
4764
4765 impl SBOMStatus {
4766 pub fn new() -> Self {
4767 std::default::Default::default()
4768 }
4769
4770 /// Sets the value of [sbom_state][crate::model::discovery_occurrence::SBOMStatus::sbom_state].
4771 ///
4772 /// # Example
4773 /// ```ignore,no_run
4774 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4775 /// use google_cloud_grafeas_v1::model::discovery_occurrence::sbom_status::SBOMState;
4776 /// let x0 = SBOMStatus::new().set_sbom_state(SBOMState::Pending);
4777 /// let x1 = SBOMStatus::new().set_sbom_state(SBOMState::Complete);
4778 /// ```
4779 pub fn set_sbom_state<
4780 T: std::convert::Into<crate::model::discovery_occurrence::sbom_status::SBOMState>,
4781 >(
4782 mut self,
4783 v: T,
4784 ) -> Self {
4785 self.sbom_state = v.into();
4786 self
4787 }
4788
4789 /// Sets the value of [error][crate::model::discovery_occurrence::SBOMStatus::error].
4790 ///
4791 /// # Example
4792 /// ```ignore,no_run
4793 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::SBOMStatus;
4794 /// let x = SBOMStatus::new().set_error("example");
4795 /// ```
4796 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4797 self.error = v.into();
4798 self
4799 }
4800 }
4801
4802 impl wkt::message::Message for SBOMStatus {
4803 fn typename() -> &'static str {
4804 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.SBOMStatus"
4805 }
4806 }
4807
4808 /// Defines additional types related to [SBOMStatus].
4809 pub mod sbom_status {
4810 #[allow(unused_imports)]
4811 use super::*;
4812
4813 /// An enum indicating the progress of the SBOM generation.
4814 ///
4815 /// # Working with unknown values
4816 ///
4817 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4818 /// additional enum variants at any time. Adding new variants is not considered
4819 /// a breaking change. Applications should write their code in anticipation of:
4820 ///
4821 /// - New values appearing in future releases of the client library, **and**
4822 /// - New values received dynamically, without application changes.
4823 ///
4824 /// Please consult the [Working with enums] section in the user guide for some
4825 /// guidelines.
4826 ///
4827 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4828 #[derive(Clone, Debug, PartialEq)]
4829 #[non_exhaustive]
4830 pub enum SBOMState {
4831 /// Default unknown state.
4832 Unspecified,
4833 /// SBOM scanning is pending.
4834 Pending,
4835 /// SBOM scanning has completed.
4836 Complete,
4837 /// If set, the enum was initialized with an unknown value.
4838 ///
4839 /// Applications can examine the value using [SBOMState::value] or
4840 /// [SBOMState::name].
4841 UnknownValue(sbom_state::UnknownValue),
4842 }
4843
4844 #[doc(hidden)]
4845 pub mod sbom_state {
4846 #[allow(unused_imports)]
4847 use super::*;
4848 #[derive(Clone, Debug, PartialEq)]
4849 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4850 }
4851
4852 impl SBOMState {
4853 /// Gets the enum value.
4854 ///
4855 /// Returns `None` if the enum contains an unknown value deserialized from
4856 /// the string representation of enums.
4857 pub fn value(&self) -> std::option::Option<i32> {
4858 match self {
4859 Self::Unspecified => std::option::Option::Some(0),
4860 Self::Pending => std::option::Option::Some(1),
4861 Self::Complete => std::option::Option::Some(2),
4862 Self::UnknownValue(u) => u.0.value(),
4863 }
4864 }
4865
4866 /// Gets the enum value as a string.
4867 ///
4868 /// Returns `None` if the enum contains an unknown value deserialized from
4869 /// the integer representation of enums.
4870 pub fn name(&self) -> std::option::Option<&str> {
4871 match self {
4872 Self::Unspecified => std::option::Option::Some("SBOM_STATE_UNSPECIFIED"),
4873 Self::Pending => std::option::Option::Some("PENDING"),
4874 Self::Complete => std::option::Option::Some("COMPLETE"),
4875 Self::UnknownValue(u) => u.0.name(),
4876 }
4877 }
4878 }
4879
4880 impl std::default::Default for SBOMState {
4881 fn default() -> Self {
4882 use std::convert::From;
4883 Self::from(0)
4884 }
4885 }
4886
4887 impl std::fmt::Display for SBOMState {
4888 fn fmt(
4889 &self,
4890 f: &mut std::fmt::Formatter<'_>,
4891 ) -> std::result::Result<(), std::fmt::Error> {
4892 wkt::internal::display_enum(f, self.name(), self.value())
4893 }
4894 }
4895
4896 impl std::convert::From<i32> for SBOMState {
4897 fn from(value: i32) -> Self {
4898 match value {
4899 0 => Self::Unspecified,
4900 1 => Self::Pending,
4901 2 => Self::Complete,
4902 _ => Self::UnknownValue(sbom_state::UnknownValue(
4903 wkt::internal::UnknownEnumValue::Integer(value),
4904 )),
4905 }
4906 }
4907 }
4908
4909 impl std::convert::From<&str> for SBOMState {
4910 fn from(value: &str) -> Self {
4911 use std::string::ToString;
4912 match value {
4913 "SBOM_STATE_UNSPECIFIED" => Self::Unspecified,
4914 "PENDING" => Self::Pending,
4915 "COMPLETE" => Self::Complete,
4916 _ => Self::UnknownValue(sbom_state::UnknownValue(
4917 wkt::internal::UnknownEnumValue::String(value.to_string()),
4918 )),
4919 }
4920 }
4921 }
4922
4923 impl serde::ser::Serialize for SBOMState {
4924 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4925 where
4926 S: serde::Serializer,
4927 {
4928 match self {
4929 Self::Unspecified => serializer.serialize_i32(0),
4930 Self::Pending => serializer.serialize_i32(1),
4931 Self::Complete => serializer.serialize_i32(2),
4932 Self::UnknownValue(u) => u.0.serialize(serializer),
4933 }
4934 }
4935 }
4936
4937 impl<'de> serde::de::Deserialize<'de> for SBOMState {
4938 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4939 where
4940 D: serde::Deserializer<'de>,
4941 {
4942 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SBOMState>::new(
4943 ".grafeas.v1.DiscoveryOccurrence.SBOMStatus.SBOMState",
4944 ))
4945 }
4946 }
4947 }
4948
4949 /// The status of an vulnerability attestation generation.
4950 #[derive(Clone, Default, PartialEq)]
4951 #[non_exhaustive]
4952 pub struct VulnerabilityAttestation {
4953
4954 /// The last time we attempted to generate an attestation.
4955 pub last_attempt_time: std::option::Option<wkt::Timestamp>,
4956
4957 /// The success/failure state of the latest attestation attempt.
4958 pub state: crate::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState,
4959
4960 /// If failure, the error reason for why the attestation generation failed.
4961 pub error: std::string::String,
4962
4963 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4964 }
4965
4966 impl VulnerabilityAttestation {
4967 pub fn new() -> Self {
4968 std::default::Default::default()
4969 }
4970
4971 /// Sets the value of [last_attempt_time][crate::model::discovery_occurrence::VulnerabilityAttestation::last_attempt_time].
4972 ///
4973 /// # Example
4974 /// ```ignore,no_run
4975 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4976 /// use wkt::Timestamp;
4977 /// let x = VulnerabilityAttestation::new().set_last_attempt_time(Timestamp::default()/* use setters */);
4978 /// ```
4979 pub fn set_last_attempt_time<T>(mut self, v: T) -> Self
4980 where
4981 T: std::convert::Into<wkt::Timestamp>,
4982 {
4983 self.last_attempt_time = std::option::Option::Some(v.into());
4984 self
4985 }
4986
4987 /// Sets or clears the value of [last_attempt_time][crate::model::discovery_occurrence::VulnerabilityAttestation::last_attempt_time].
4988 ///
4989 /// # Example
4990 /// ```ignore,no_run
4991 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
4992 /// use wkt::Timestamp;
4993 /// let x = VulnerabilityAttestation::new().set_or_clear_last_attempt_time(Some(Timestamp::default()/* use setters */));
4994 /// let x = VulnerabilityAttestation::new().set_or_clear_last_attempt_time(None::<Timestamp>);
4995 /// ```
4996 pub fn set_or_clear_last_attempt_time<T>(mut self, v: std::option::Option<T>) -> Self
4997 where
4998 T: std::convert::Into<wkt::Timestamp>,
4999 {
5000 self.last_attempt_time = v.map(|x| x.into());
5001 self
5002 }
5003
5004 /// Sets the value of [state][crate::model::discovery_occurrence::VulnerabilityAttestation::state].
5005 ///
5006 /// # Example
5007 /// ```ignore,no_run
5008 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
5009 /// use google_cloud_grafeas_v1::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState;
5010 /// let x0 = VulnerabilityAttestation::new().set_state(VulnerabilityAttestationState::Success);
5011 /// let x1 = VulnerabilityAttestation::new().set_state(VulnerabilityAttestationState::Failure);
5012 /// ```
5013 pub fn set_state<T: std::convert::Into<crate::model::discovery_occurrence::vulnerability_attestation::VulnerabilityAttestationState>>(mut self, v: T) -> Self{
5014 self.state = v.into();
5015 self
5016 }
5017
5018 /// Sets the value of [error][crate::model::discovery_occurrence::VulnerabilityAttestation::error].
5019 ///
5020 /// # Example
5021 /// ```ignore,no_run
5022 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::VulnerabilityAttestation;
5023 /// let x = VulnerabilityAttestation::new().set_error("example");
5024 /// ```
5025 pub fn set_error<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5026 self.error = v.into();
5027 self
5028 }
5029 }
5030
5031 impl wkt::message::Message for VulnerabilityAttestation {
5032 fn typename() -> &'static str {
5033 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.VulnerabilityAttestation"
5034 }
5035 }
5036
5037 /// Defines additional types related to [VulnerabilityAttestation].
5038 pub mod vulnerability_attestation {
5039 #[allow(unused_imports)]
5040 use super::*;
5041
5042 /// An enum indicating the state of the attestation generation.
5043 ///
5044 /// # Working with unknown values
5045 ///
5046 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5047 /// additional enum variants at any time. Adding new variants is not considered
5048 /// a breaking change. Applications should write their code in anticipation of:
5049 ///
5050 /// - New values appearing in future releases of the client library, **and**
5051 /// - New values received dynamically, without application changes.
5052 ///
5053 /// Please consult the [Working with enums] section in the user guide for some
5054 /// guidelines.
5055 ///
5056 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5057 #[derive(Clone, Debug, PartialEq)]
5058 #[non_exhaustive]
5059 pub enum VulnerabilityAttestationState {
5060 /// Default unknown state.
5061 Unspecified,
5062 /// Attestation was successfully generated and stored.
5063 Success,
5064 /// Attestation was unsuccessfully generated and stored.
5065 Failure,
5066 /// If set, the enum was initialized with an unknown value.
5067 ///
5068 /// Applications can examine the value using [VulnerabilityAttestationState::value] or
5069 /// [VulnerabilityAttestationState::name].
5070 UnknownValue(vulnerability_attestation_state::UnknownValue),
5071 }
5072
5073 #[doc(hidden)]
5074 pub mod vulnerability_attestation_state {
5075 #[allow(unused_imports)]
5076 use super::*;
5077 #[derive(Clone, Debug, PartialEq)]
5078 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5079 }
5080
5081 impl VulnerabilityAttestationState {
5082 /// Gets the enum value.
5083 ///
5084 /// Returns `None` if the enum contains an unknown value deserialized from
5085 /// the string representation of enums.
5086 pub fn value(&self) -> std::option::Option<i32> {
5087 match self {
5088 Self::Unspecified => std::option::Option::Some(0),
5089 Self::Success => std::option::Option::Some(1),
5090 Self::Failure => std::option::Option::Some(2),
5091 Self::UnknownValue(u) => u.0.value(),
5092 }
5093 }
5094
5095 /// Gets the enum value as a string.
5096 ///
5097 /// Returns `None` if the enum contains an unknown value deserialized from
5098 /// the integer representation of enums.
5099 pub fn name(&self) -> std::option::Option<&str> {
5100 match self {
5101 Self::Unspecified => {
5102 std::option::Option::Some("VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED")
5103 }
5104 Self::Success => std::option::Option::Some("SUCCESS"),
5105 Self::Failure => std::option::Option::Some("FAILURE"),
5106 Self::UnknownValue(u) => u.0.name(),
5107 }
5108 }
5109 }
5110
5111 impl std::default::Default for VulnerabilityAttestationState {
5112 fn default() -> Self {
5113 use std::convert::From;
5114 Self::from(0)
5115 }
5116 }
5117
5118 impl std::fmt::Display for VulnerabilityAttestationState {
5119 fn fmt(
5120 &self,
5121 f: &mut std::fmt::Formatter<'_>,
5122 ) -> std::result::Result<(), std::fmt::Error> {
5123 wkt::internal::display_enum(f, self.name(), self.value())
5124 }
5125 }
5126
5127 impl std::convert::From<i32> for VulnerabilityAttestationState {
5128 fn from(value: i32) -> Self {
5129 match value {
5130 0 => Self::Unspecified,
5131 1 => Self::Success,
5132 2 => Self::Failure,
5133 _ => Self::UnknownValue(vulnerability_attestation_state::UnknownValue(
5134 wkt::internal::UnknownEnumValue::Integer(value),
5135 )),
5136 }
5137 }
5138 }
5139
5140 impl std::convert::From<&str> for VulnerabilityAttestationState {
5141 fn from(value: &str) -> Self {
5142 use std::string::ToString;
5143 match value {
5144 "VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED" => Self::Unspecified,
5145 "SUCCESS" => Self::Success,
5146 "FAILURE" => Self::Failure,
5147 _ => Self::UnknownValue(vulnerability_attestation_state::UnknownValue(
5148 wkt::internal::UnknownEnumValue::String(value.to_string()),
5149 )),
5150 }
5151 }
5152 }
5153
5154 impl serde::ser::Serialize for VulnerabilityAttestationState {
5155 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5156 where
5157 S: serde::Serializer,
5158 {
5159 match self {
5160 Self::Unspecified => serializer.serialize_i32(0),
5161 Self::Success => serializer.serialize_i32(1),
5162 Self::Failure => serializer.serialize_i32(2),
5163 Self::UnknownValue(u) => u.0.serialize(serializer),
5164 }
5165 }
5166 }
5167
5168 impl<'de> serde::de::Deserialize<'de> for VulnerabilityAttestationState {
5169 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5170 where
5171 D: serde::Deserializer<'de>,
5172 {
5173 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VulnerabilityAttestationState>::new(
5174 ".grafeas.v1.DiscoveryOccurrence.VulnerabilityAttestation.VulnerabilityAttestationState"))
5175 }
5176 }
5177 }
5178
5179 #[derive(Clone, Default, PartialEq)]
5180 #[non_exhaustive]
5181 pub struct File {
5182 pub name: std::string::String,
5183
5184 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
5185
5186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5187 }
5188
5189 impl File {
5190 pub fn new() -> Self {
5191 std::default::Default::default()
5192 }
5193
5194 /// Sets the value of [name][crate::model::discovery_occurrence::File::name].
5195 ///
5196 /// # Example
5197 /// ```ignore,no_run
5198 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::File;
5199 /// let x = File::new().set_name("example");
5200 /// ```
5201 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5202 self.name = v.into();
5203 self
5204 }
5205
5206 /// Sets the value of [digest][crate::model::discovery_occurrence::File::digest].
5207 ///
5208 /// # Example
5209 /// ```ignore,no_run
5210 /// # use google_cloud_grafeas_v1::model::discovery_occurrence::File;
5211 /// let x = File::new().set_digest([
5212 /// ("key0", "abc"),
5213 /// ("key1", "xyz"),
5214 /// ]);
5215 /// ```
5216 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
5217 where
5218 T: std::iter::IntoIterator<Item = (K, V)>,
5219 K: std::convert::Into<std::string::String>,
5220 V: std::convert::Into<std::string::String>,
5221 {
5222 use std::iter::Iterator;
5223 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5224 self
5225 }
5226 }
5227
5228 impl wkt::message::Message for File {
5229 fn typename() -> &'static str {
5230 "type.googleapis.com/grafeas.v1.DiscoveryOccurrence.File"
5231 }
5232 }
5233
5234 /// Whether the resource is continuously analyzed.
5235 ///
5236 /// # Working with unknown values
5237 ///
5238 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5239 /// additional enum variants at any time. Adding new variants is not considered
5240 /// a breaking change. Applications should write their code in anticipation of:
5241 ///
5242 /// - New values appearing in future releases of the client library, **and**
5243 /// - New values received dynamically, without application changes.
5244 ///
5245 /// Please consult the [Working with enums] section in the user guide for some
5246 /// guidelines.
5247 ///
5248 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5249 #[derive(Clone, Debug, PartialEq)]
5250 #[non_exhaustive]
5251 pub enum ContinuousAnalysis {
5252 /// Unknown.
5253 Unspecified,
5254 /// The resource is continuously analyzed.
5255 Active,
5256 /// The resource is ignored for continuous analysis.
5257 Inactive,
5258 /// If set, the enum was initialized with an unknown value.
5259 ///
5260 /// Applications can examine the value using [ContinuousAnalysis::value] or
5261 /// [ContinuousAnalysis::name].
5262 UnknownValue(continuous_analysis::UnknownValue),
5263 }
5264
5265 #[doc(hidden)]
5266 pub mod continuous_analysis {
5267 #[allow(unused_imports)]
5268 use super::*;
5269 #[derive(Clone, Debug, PartialEq)]
5270 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5271 }
5272
5273 impl ContinuousAnalysis {
5274 /// Gets the enum value.
5275 ///
5276 /// Returns `None` if the enum contains an unknown value deserialized from
5277 /// the string representation of enums.
5278 pub fn value(&self) -> std::option::Option<i32> {
5279 match self {
5280 Self::Unspecified => std::option::Option::Some(0),
5281 Self::Active => std::option::Option::Some(1),
5282 Self::Inactive => std::option::Option::Some(2),
5283 Self::UnknownValue(u) => u.0.value(),
5284 }
5285 }
5286
5287 /// Gets the enum value as a string.
5288 ///
5289 /// Returns `None` if the enum contains an unknown value deserialized from
5290 /// the integer representation of enums.
5291 pub fn name(&self) -> std::option::Option<&str> {
5292 match self {
5293 Self::Unspecified => std::option::Option::Some("CONTINUOUS_ANALYSIS_UNSPECIFIED"),
5294 Self::Active => std::option::Option::Some("ACTIVE"),
5295 Self::Inactive => std::option::Option::Some("INACTIVE"),
5296 Self::UnknownValue(u) => u.0.name(),
5297 }
5298 }
5299 }
5300
5301 impl std::default::Default for ContinuousAnalysis {
5302 fn default() -> Self {
5303 use std::convert::From;
5304 Self::from(0)
5305 }
5306 }
5307
5308 impl std::fmt::Display for ContinuousAnalysis {
5309 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5310 wkt::internal::display_enum(f, self.name(), self.value())
5311 }
5312 }
5313
5314 impl std::convert::From<i32> for ContinuousAnalysis {
5315 fn from(value: i32) -> Self {
5316 match value {
5317 0 => Self::Unspecified,
5318 1 => Self::Active,
5319 2 => Self::Inactive,
5320 _ => Self::UnknownValue(continuous_analysis::UnknownValue(
5321 wkt::internal::UnknownEnumValue::Integer(value),
5322 )),
5323 }
5324 }
5325 }
5326
5327 impl std::convert::From<&str> for ContinuousAnalysis {
5328 fn from(value: &str) -> Self {
5329 use std::string::ToString;
5330 match value {
5331 "CONTINUOUS_ANALYSIS_UNSPECIFIED" => Self::Unspecified,
5332 "ACTIVE" => Self::Active,
5333 "INACTIVE" => Self::Inactive,
5334 _ => Self::UnknownValue(continuous_analysis::UnknownValue(
5335 wkt::internal::UnknownEnumValue::String(value.to_string()),
5336 )),
5337 }
5338 }
5339 }
5340
5341 impl serde::ser::Serialize for ContinuousAnalysis {
5342 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5343 where
5344 S: serde::Serializer,
5345 {
5346 match self {
5347 Self::Unspecified => serializer.serialize_i32(0),
5348 Self::Active => serializer.serialize_i32(1),
5349 Self::Inactive => serializer.serialize_i32(2),
5350 Self::UnknownValue(u) => u.0.serialize(serializer),
5351 }
5352 }
5353 }
5354
5355 impl<'de> serde::de::Deserialize<'de> for ContinuousAnalysis {
5356 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5357 where
5358 D: serde::Deserializer<'de>,
5359 {
5360 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContinuousAnalysis>::new(
5361 ".grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis",
5362 ))
5363 }
5364 }
5365
5366 /// Analysis status for a resource. Currently for initial analysis only (not
5367 /// updated in continuous analysis).
5368 ///
5369 /// # Working with unknown values
5370 ///
5371 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5372 /// additional enum variants at any time. Adding new variants is not considered
5373 /// a breaking change. Applications should write their code in anticipation of:
5374 ///
5375 /// - New values appearing in future releases of the client library, **and**
5376 /// - New values received dynamically, without application changes.
5377 ///
5378 /// Please consult the [Working with enums] section in the user guide for some
5379 /// guidelines.
5380 ///
5381 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5382 #[derive(Clone, Debug, PartialEq)]
5383 #[non_exhaustive]
5384 pub enum AnalysisStatus {
5385 /// Unknown.
5386 Unspecified,
5387 /// Resource is known but no action has been taken yet.
5388 Pending,
5389 /// Resource is being analyzed.
5390 Scanning,
5391 /// Analysis has finished successfully.
5392 FinishedSuccess,
5393 /// Analysis has completed.
5394 Complete,
5395 /// Analysis has finished unsuccessfully, the analysis itself is in a bad
5396 /// state.
5397 FinishedFailed,
5398 /// The resource is known not to be supported.
5399 FinishedUnsupported,
5400 /// If set, the enum was initialized with an unknown value.
5401 ///
5402 /// Applications can examine the value using [AnalysisStatus::value] or
5403 /// [AnalysisStatus::name].
5404 UnknownValue(analysis_status::UnknownValue),
5405 }
5406
5407 #[doc(hidden)]
5408 pub mod analysis_status {
5409 #[allow(unused_imports)]
5410 use super::*;
5411 #[derive(Clone, Debug, PartialEq)]
5412 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5413 }
5414
5415 impl AnalysisStatus {
5416 /// Gets the enum value.
5417 ///
5418 /// Returns `None` if the enum contains an unknown value deserialized from
5419 /// the string representation of enums.
5420 pub fn value(&self) -> std::option::Option<i32> {
5421 match self {
5422 Self::Unspecified => std::option::Option::Some(0),
5423 Self::Pending => std::option::Option::Some(1),
5424 Self::Scanning => std::option::Option::Some(2),
5425 Self::FinishedSuccess => std::option::Option::Some(3),
5426 Self::Complete => std::option::Option::Some(3),
5427 Self::FinishedFailed => std::option::Option::Some(4),
5428 Self::FinishedUnsupported => std::option::Option::Some(5),
5429 Self::UnknownValue(u) => u.0.value(),
5430 }
5431 }
5432
5433 /// Gets the enum value as a string.
5434 ///
5435 /// Returns `None` if the enum contains an unknown value deserialized from
5436 /// the integer representation of enums.
5437 pub fn name(&self) -> std::option::Option<&str> {
5438 match self {
5439 Self::Unspecified => std::option::Option::Some("ANALYSIS_STATUS_UNSPECIFIED"),
5440 Self::Pending => std::option::Option::Some("PENDING"),
5441 Self::Scanning => std::option::Option::Some("SCANNING"),
5442 Self::FinishedSuccess => std::option::Option::Some("FINISHED_SUCCESS"),
5443 Self::Complete => std::option::Option::Some("COMPLETE"),
5444 Self::FinishedFailed => std::option::Option::Some("FINISHED_FAILED"),
5445 Self::FinishedUnsupported => std::option::Option::Some("FINISHED_UNSUPPORTED"),
5446 Self::UnknownValue(u) => u.0.name(),
5447 }
5448 }
5449 }
5450
5451 impl std::default::Default for AnalysisStatus {
5452 fn default() -> Self {
5453 use std::convert::From;
5454 Self::from(0)
5455 }
5456 }
5457
5458 impl std::fmt::Display for AnalysisStatus {
5459 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5460 wkt::internal::display_enum(f, self.name(), self.value())
5461 }
5462 }
5463
5464 impl std::convert::From<i32> for AnalysisStatus {
5465 fn from(value: i32) -> Self {
5466 match value {
5467 0 => Self::Unspecified,
5468 1 => Self::Pending,
5469 2 => Self::Scanning,
5470 3 => Self::Complete,
5471 4 => Self::FinishedFailed,
5472 5 => Self::FinishedUnsupported,
5473 _ => Self::UnknownValue(analysis_status::UnknownValue(
5474 wkt::internal::UnknownEnumValue::Integer(value),
5475 )),
5476 }
5477 }
5478 }
5479
5480 impl std::convert::From<&str> for AnalysisStatus {
5481 fn from(value: &str) -> Self {
5482 use std::string::ToString;
5483 match value {
5484 "ANALYSIS_STATUS_UNSPECIFIED" => Self::Unspecified,
5485 "PENDING" => Self::Pending,
5486 "SCANNING" => Self::Scanning,
5487 "FINISHED_SUCCESS" => Self::FinishedSuccess,
5488 "COMPLETE" => Self::Complete,
5489 "FINISHED_FAILED" => Self::FinishedFailed,
5490 "FINISHED_UNSUPPORTED" => Self::FinishedUnsupported,
5491 _ => Self::UnknownValue(analysis_status::UnknownValue(
5492 wkt::internal::UnknownEnumValue::String(value.to_string()),
5493 )),
5494 }
5495 }
5496 }
5497
5498 impl serde::ser::Serialize for AnalysisStatus {
5499 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5500 where
5501 S: serde::Serializer,
5502 {
5503 match self {
5504 Self::Unspecified => serializer.serialize_i32(0),
5505 Self::Pending => serializer.serialize_i32(1),
5506 Self::Scanning => serializer.serialize_i32(2),
5507 Self::FinishedSuccess => serializer.serialize_i32(3),
5508 Self::Complete => serializer.serialize_i32(3),
5509 Self::FinishedFailed => serializer.serialize_i32(4),
5510 Self::FinishedUnsupported => serializer.serialize_i32(5),
5511 Self::UnknownValue(u) => u.0.serialize(serializer),
5512 }
5513 }
5514 }
5515
5516 impl<'de> serde::de::Deserialize<'de> for AnalysisStatus {
5517 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5518 where
5519 D: serde::Deserializer<'de>,
5520 {
5521 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnalysisStatus>::new(
5522 ".grafeas.v1.DiscoveryOccurrence.AnalysisStatus",
5523 ))
5524 }
5525 }
5526}
5527
5528#[derive(Clone, Default, PartialEq)]
5529#[non_exhaustive]
5530pub struct DSSEAttestationNote {
5531 /// DSSEHint hints at the purpose of the attestation authority.
5532 pub hint: std::option::Option<crate::model::dsse_attestation_note::DSSEHint>,
5533
5534 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5535}
5536
5537impl DSSEAttestationNote {
5538 pub fn new() -> Self {
5539 std::default::Default::default()
5540 }
5541
5542 /// Sets the value of [hint][crate::model::DSSEAttestationNote::hint].
5543 ///
5544 /// # Example
5545 /// ```ignore,no_run
5546 /// # use google_cloud_grafeas_v1::model::DSSEAttestationNote;
5547 /// use google_cloud_grafeas_v1::model::dsse_attestation_note::DSSEHint;
5548 /// let x = DSSEAttestationNote::new().set_hint(DSSEHint::default()/* use setters */);
5549 /// ```
5550 pub fn set_hint<T>(mut self, v: T) -> Self
5551 where
5552 T: std::convert::Into<crate::model::dsse_attestation_note::DSSEHint>,
5553 {
5554 self.hint = std::option::Option::Some(v.into());
5555 self
5556 }
5557
5558 /// Sets or clears the value of [hint][crate::model::DSSEAttestationNote::hint].
5559 ///
5560 /// # Example
5561 /// ```ignore,no_run
5562 /// # use google_cloud_grafeas_v1::model::DSSEAttestationNote;
5563 /// use google_cloud_grafeas_v1::model::dsse_attestation_note::DSSEHint;
5564 /// let x = DSSEAttestationNote::new().set_or_clear_hint(Some(DSSEHint::default()/* use setters */));
5565 /// let x = DSSEAttestationNote::new().set_or_clear_hint(None::<DSSEHint>);
5566 /// ```
5567 pub fn set_or_clear_hint<T>(mut self, v: std::option::Option<T>) -> Self
5568 where
5569 T: std::convert::Into<crate::model::dsse_attestation_note::DSSEHint>,
5570 {
5571 self.hint = v.map(|x| x.into());
5572 self
5573 }
5574}
5575
5576impl wkt::message::Message for DSSEAttestationNote {
5577 fn typename() -> &'static str {
5578 "type.googleapis.com/grafeas.v1.DSSEAttestationNote"
5579 }
5580}
5581
5582/// Defines additional types related to [DSSEAttestationNote].
5583pub mod dsse_attestation_note {
5584 #[allow(unused_imports)]
5585 use super::*;
5586
5587 /// This submessage provides human-readable hints about the purpose of the
5588 /// authority. Because the name of a note acts as its resource reference, it is
5589 /// important to disambiguate the canonical name of the Note (which might be a
5590 /// UUID for security purposes) from "readable" names more suitable for debug
5591 /// output. Note that these hints should not be used to look up authorities in
5592 /// security sensitive contexts, such as when looking up attestations to
5593 /// verify.
5594 #[derive(Clone, Default, PartialEq)]
5595 #[non_exhaustive]
5596 pub struct DSSEHint {
5597 /// Required. The human readable name of this attestation authority, for
5598 /// example "cloudbuild-prod".
5599 pub human_readable_name: std::string::String,
5600
5601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5602 }
5603
5604 impl DSSEHint {
5605 pub fn new() -> Self {
5606 std::default::Default::default()
5607 }
5608
5609 /// Sets the value of [human_readable_name][crate::model::dsse_attestation_note::DSSEHint::human_readable_name].
5610 ///
5611 /// # Example
5612 /// ```ignore,no_run
5613 /// # use google_cloud_grafeas_v1::model::dsse_attestation_note::DSSEHint;
5614 /// let x = DSSEHint::new().set_human_readable_name("example");
5615 /// ```
5616 pub fn set_human_readable_name<T: std::convert::Into<std::string::String>>(
5617 mut self,
5618 v: T,
5619 ) -> Self {
5620 self.human_readable_name = v.into();
5621 self
5622 }
5623 }
5624
5625 impl wkt::message::Message for DSSEHint {
5626 fn typename() -> &'static str {
5627 "type.googleapis.com/grafeas.v1.DSSEAttestationNote.DSSEHint"
5628 }
5629 }
5630}
5631
5632/// Deprecated. Prefer to use a regular Occurrence, and populate the
5633/// Envelope at the top level of the Occurrence.
5634#[derive(Clone, Default, PartialEq)]
5635#[non_exhaustive]
5636pub struct DSSEAttestationOccurrence {
5637 /// If doing something security critical, make sure to verify the signatures in
5638 /// this metadata.
5639 pub envelope: std::option::Option<crate::model::Envelope>,
5640
5641 pub decoded_payload:
5642 std::option::Option<crate::model::dsse_attestation_occurrence::DecodedPayload>,
5643
5644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5645}
5646
5647impl DSSEAttestationOccurrence {
5648 pub fn new() -> Self {
5649 std::default::Default::default()
5650 }
5651
5652 /// Sets the value of [envelope][crate::model::DSSEAttestationOccurrence::envelope].
5653 ///
5654 /// # Example
5655 /// ```ignore,no_run
5656 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5657 /// use google_cloud_grafeas_v1::model::Envelope;
5658 /// let x = DSSEAttestationOccurrence::new().set_envelope(Envelope::default()/* use setters */);
5659 /// ```
5660 pub fn set_envelope<T>(mut self, v: T) -> Self
5661 where
5662 T: std::convert::Into<crate::model::Envelope>,
5663 {
5664 self.envelope = std::option::Option::Some(v.into());
5665 self
5666 }
5667
5668 /// Sets or clears the value of [envelope][crate::model::DSSEAttestationOccurrence::envelope].
5669 ///
5670 /// # Example
5671 /// ```ignore,no_run
5672 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5673 /// use google_cloud_grafeas_v1::model::Envelope;
5674 /// let x = DSSEAttestationOccurrence::new().set_or_clear_envelope(Some(Envelope::default()/* use setters */));
5675 /// let x = DSSEAttestationOccurrence::new().set_or_clear_envelope(None::<Envelope>);
5676 /// ```
5677 pub fn set_or_clear_envelope<T>(mut self, v: std::option::Option<T>) -> Self
5678 where
5679 T: std::convert::Into<crate::model::Envelope>,
5680 {
5681 self.envelope = v.map(|x| x.into());
5682 self
5683 }
5684
5685 /// Sets the value of [decoded_payload][crate::model::DSSEAttestationOccurrence::decoded_payload].
5686 ///
5687 /// Note that all the setters affecting `decoded_payload` are mutually
5688 /// exclusive.
5689 ///
5690 /// # Example
5691 /// ```ignore,no_run
5692 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5693 /// use google_cloud_grafeas_v1::model::InTotoStatement;
5694 /// let x = DSSEAttestationOccurrence::new().set_decoded_payload(Some(
5695 /// google_cloud_grafeas_v1::model::dsse_attestation_occurrence::DecodedPayload::Statement(InTotoStatement::default().into())));
5696 /// ```
5697 pub fn set_decoded_payload<
5698 T: std::convert::Into<
5699 std::option::Option<crate::model::dsse_attestation_occurrence::DecodedPayload>,
5700 >,
5701 >(
5702 mut self,
5703 v: T,
5704 ) -> Self {
5705 self.decoded_payload = v.into();
5706 self
5707 }
5708
5709 /// The value of [decoded_payload][crate::model::DSSEAttestationOccurrence::decoded_payload]
5710 /// if it holds a `Statement`, `None` if the field is not set or
5711 /// holds a different branch.
5712 pub fn statement(
5713 &self,
5714 ) -> std::option::Option<&std::boxed::Box<crate::model::InTotoStatement>> {
5715 #[allow(unreachable_patterns)]
5716 self.decoded_payload.as_ref().and_then(|v| match v {
5717 crate::model::dsse_attestation_occurrence::DecodedPayload::Statement(v) => {
5718 std::option::Option::Some(v)
5719 }
5720 _ => std::option::Option::None,
5721 })
5722 }
5723
5724 /// Sets the value of [decoded_payload][crate::model::DSSEAttestationOccurrence::decoded_payload]
5725 /// to hold a `Statement`.
5726 ///
5727 /// Note that all the setters affecting `decoded_payload` are
5728 /// mutually exclusive.
5729 ///
5730 /// # Example
5731 /// ```ignore,no_run
5732 /// # use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
5733 /// use google_cloud_grafeas_v1::model::InTotoStatement;
5734 /// let x = DSSEAttestationOccurrence::new().set_statement(InTotoStatement::default()/* use setters */);
5735 /// assert!(x.statement().is_some());
5736 /// ```
5737 pub fn set_statement<T: std::convert::Into<std::boxed::Box<crate::model::InTotoStatement>>>(
5738 mut self,
5739 v: T,
5740 ) -> Self {
5741 self.decoded_payload = std::option::Option::Some(
5742 crate::model::dsse_attestation_occurrence::DecodedPayload::Statement(v.into()),
5743 );
5744 self
5745 }
5746}
5747
5748impl wkt::message::Message for DSSEAttestationOccurrence {
5749 fn typename() -> &'static str {
5750 "type.googleapis.com/grafeas.v1.DSSEAttestationOccurrence"
5751 }
5752}
5753
5754/// Defines additional types related to [DSSEAttestationOccurrence].
5755pub mod dsse_attestation_occurrence {
5756 #[allow(unused_imports)]
5757 use super::*;
5758
5759 #[derive(Clone, Debug, PartialEq)]
5760 #[non_exhaustive]
5761 pub enum DecodedPayload {
5762 Statement(std::boxed::Box<crate::model::InTotoStatement>),
5763 }
5764}
5765
5766/// An instance of an analysis type that has been found on a resource.
5767#[derive(Clone, Default, PartialEq)]
5768#[non_exhaustive]
5769pub struct Occurrence {
5770 /// Output only. The name of the occurrence in the form of
5771 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
5772 pub name: std::string::String,
5773
5774 /// Required. Immutable. A URI that represents the resource for which the
5775 /// occurrence applies. For example,
5776 /// `<https://gcr.io/project/image@sha256:123abc>` for a Docker image.
5777 pub resource_uri: std::string::String,
5778
5779 /// Required. Immutable. The analysis note associated with this occurrence, in
5780 /// the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be
5781 /// used as a filter in list requests.
5782 pub note_name: std::string::String,
5783
5784 /// Output only. This explicitly denotes which of the occurrence details are
5785 /// specified. This field can be used as a filter in list requests.
5786 pub kind: crate::model::NoteKind,
5787
5788 /// A description of actions that can be taken to remedy the note.
5789 pub remediation: std::string::String,
5790
5791 /// Output only. The time this occurrence was created.
5792 pub create_time: std::option::Option<wkt::Timestamp>,
5793
5794 /// Output only. The time this occurrence was last updated.
5795 pub update_time: std::option::Option<wkt::Timestamp>,
5796
5797 /// <https://github.com/secure-systems-lab/dsse>
5798 pub envelope: std::option::Option<crate::model::Envelope>,
5799
5800 /// Required. Immutable. Describes the details of the note kind found on this
5801 /// resource.
5802 pub details: std::option::Option<crate::model::occurrence::Details>,
5803
5804 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5805}
5806
5807impl Occurrence {
5808 pub fn new() -> Self {
5809 std::default::Default::default()
5810 }
5811
5812 /// Sets the value of [name][crate::model::Occurrence::name].
5813 ///
5814 /// # Example
5815 /// ```ignore,no_run
5816 /// # use google_cloud_grafeas_v1::model::Occurrence;
5817 /// let x = Occurrence::new().set_name("example");
5818 /// ```
5819 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5820 self.name = v.into();
5821 self
5822 }
5823
5824 /// Sets the value of [resource_uri][crate::model::Occurrence::resource_uri].
5825 ///
5826 /// # Example
5827 /// ```ignore,no_run
5828 /// # use google_cloud_grafeas_v1::model::Occurrence;
5829 /// let x = Occurrence::new().set_resource_uri("example");
5830 /// ```
5831 pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5832 self.resource_uri = v.into();
5833 self
5834 }
5835
5836 /// Sets the value of [note_name][crate::model::Occurrence::note_name].
5837 ///
5838 /// # Example
5839 /// ```ignore,no_run
5840 /// # use google_cloud_grafeas_v1::model::Occurrence;
5841 /// let x = Occurrence::new().set_note_name("example");
5842 /// ```
5843 pub fn set_note_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5844 self.note_name = v.into();
5845 self
5846 }
5847
5848 /// Sets the value of [kind][crate::model::Occurrence::kind].
5849 ///
5850 /// # Example
5851 /// ```ignore,no_run
5852 /// # use google_cloud_grafeas_v1::model::Occurrence;
5853 /// use google_cloud_grafeas_v1::model::NoteKind;
5854 /// let x0 = Occurrence::new().set_kind(NoteKind::Vulnerability);
5855 /// let x1 = Occurrence::new().set_kind(NoteKind::Build);
5856 /// let x2 = Occurrence::new().set_kind(NoteKind::Image);
5857 /// ```
5858 pub fn set_kind<T: std::convert::Into<crate::model::NoteKind>>(mut self, v: T) -> Self {
5859 self.kind = v.into();
5860 self
5861 }
5862
5863 /// Sets the value of [remediation][crate::model::Occurrence::remediation].
5864 ///
5865 /// # Example
5866 /// ```ignore,no_run
5867 /// # use google_cloud_grafeas_v1::model::Occurrence;
5868 /// let x = Occurrence::new().set_remediation("example");
5869 /// ```
5870 pub fn set_remediation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5871 self.remediation = v.into();
5872 self
5873 }
5874
5875 /// Sets the value of [create_time][crate::model::Occurrence::create_time].
5876 ///
5877 /// # Example
5878 /// ```ignore,no_run
5879 /// # use google_cloud_grafeas_v1::model::Occurrence;
5880 /// use wkt::Timestamp;
5881 /// let x = Occurrence::new().set_create_time(Timestamp::default()/* use setters */);
5882 /// ```
5883 pub fn set_create_time<T>(mut self, v: T) -> Self
5884 where
5885 T: std::convert::Into<wkt::Timestamp>,
5886 {
5887 self.create_time = std::option::Option::Some(v.into());
5888 self
5889 }
5890
5891 /// Sets or clears the value of [create_time][crate::model::Occurrence::create_time].
5892 ///
5893 /// # Example
5894 /// ```ignore,no_run
5895 /// # use google_cloud_grafeas_v1::model::Occurrence;
5896 /// use wkt::Timestamp;
5897 /// let x = Occurrence::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
5898 /// let x = Occurrence::new().set_or_clear_create_time(None::<Timestamp>);
5899 /// ```
5900 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
5901 where
5902 T: std::convert::Into<wkt::Timestamp>,
5903 {
5904 self.create_time = v.map(|x| x.into());
5905 self
5906 }
5907
5908 /// Sets the value of [update_time][crate::model::Occurrence::update_time].
5909 ///
5910 /// # Example
5911 /// ```ignore,no_run
5912 /// # use google_cloud_grafeas_v1::model::Occurrence;
5913 /// use wkt::Timestamp;
5914 /// let x = Occurrence::new().set_update_time(Timestamp::default()/* use setters */);
5915 /// ```
5916 pub fn set_update_time<T>(mut self, v: T) -> Self
5917 where
5918 T: std::convert::Into<wkt::Timestamp>,
5919 {
5920 self.update_time = std::option::Option::Some(v.into());
5921 self
5922 }
5923
5924 /// Sets or clears the value of [update_time][crate::model::Occurrence::update_time].
5925 ///
5926 /// # Example
5927 /// ```ignore,no_run
5928 /// # use google_cloud_grafeas_v1::model::Occurrence;
5929 /// use wkt::Timestamp;
5930 /// let x = Occurrence::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
5931 /// let x = Occurrence::new().set_or_clear_update_time(None::<Timestamp>);
5932 /// ```
5933 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
5934 where
5935 T: std::convert::Into<wkt::Timestamp>,
5936 {
5937 self.update_time = v.map(|x| x.into());
5938 self
5939 }
5940
5941 /// Sets the value of [envelope][crate::model::Occurrence::envelope].
5942 ///
5943 /// # Example
5944 /// ```ignore,no_run
5945 /// # use google_cloud_grafeas_v1::model::Occurrence;
5946 /// use google_cloud_grafeas_v1::model::Envelope;
5947 /// let x = Occurrence::new().set_envelope(Envelope::default()/* use setters */);
5948 /// ```
5949 pub fn set_envelope<T>(mut self, v: T) -> Self
5950 where
5951 T: std::convert::Into<crate::model::Envelope>,
5952 {
5953 self.envelope = std::option::Option::Some(v.into());
5954 self
5955 }
5956
5957 /// Sets or clears the value of [envelope][crate::model::Occurrence::envelope].
5958 ///
5959 /// # Example
5960 /// ```ignore,no_run
5961 /// # use google_cloud_grafeas_v1::model::Occurrence;
5962 /// use google_cloud_grafeas_v1::model::Envelope;
5963 /// let x = Occurrence::new().set_or_clear_envelope(Some(Envelope::default()/* use setters */));
5964 /// let x = Occurrence::new().set_or_clear_envelope(None::<Envelope>);
5965 /// ```
5966 pub fn set_or_clear_envelope<T>(mut self, v: std::option::Option<T>) -> Self
5967 where
5968 T: std::convert::Into<crate::model::Envelope>,
5969 {
5970 self.envelope = v.map(|x| x.into());
5971 self
5972 }
5973
5974 /// Sets the value of [details][crate::model::Occurrence::details].
5975 ///
5976 /// Note that all the setters affecting `details` are mutually
5977 /// exclusive.
5978 ///
5979 /// # Example
5980 /// ```ignore,no_run
5981 /// # use google_cloud_grafeas_v1::model::Occurrence;
5982 /// use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
5983 /// let x = Occurrence::new().set_details(Some(
5984 /// google_cloud_grafeas_v1::model::occurrence::Details::Vulnerability(VulnerabilityOccurrence::default().into())));
5985 /// ```
5986 pub fn set_details<
5987 T: std::convert::Into<std::option::Option<crate::model::occurrence::Details>>,
5988 >(
5989 mut self,
5990 v: T,
5991 ) -> Self {
5992 self.details = v.into();
5993 self
5994 }
5995
5996 /// The value of [details][crate::model::Occurrence::details]
5997 /// if it holds a `Vulnerability`, `None` if the field is not set or
5998 /// holds a different branch.
5999 pub fn vulnerability(
6000 &self,
6001 ) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityOccurrence>> {
6002 #[allow(unreachable_patterns)]
6003 self.details.as_ref().and_then(|v| match v {
6004 crate::model::occurrence::Details::Vulnerability(v) => std::option::Option::Some(v),
6005 _ => std::option::Option::None,
6006 })
6007 }
6008
6009 /// Sets the value of [details][crate::model::Occurrence::details]
6010 /// to hold a `Vulnerability`.
6011 ///
6012 /// Note that all the setters affecting `details` are
6013 /// mutually exclusive.
6014 ///
6015 /// # Example
6016 /// ```ignore,no_run
6017 /// # use google_cloud_grafeas_v1::model::Occurrence;
6018 /// use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
6019 /// let x = Occurrence::new().set_vulnerability(VulnerabilityOccurrence::default()/* use setters */);
6020 /// assert!(x.vulnerability().is_some());
6021 /// assert!(x.build().is_none());
6022 /// assert!(x.image().is_none());
6023 /// assert!(x.package().is_none());
6024 /// assert!(x.deployment().is_none());
6025 /// assert!(x.discovery().is_none());
6026 /// assert!(x.attestation().is_none());
6027 /// assert!(x.upgrade().is_none());
6028 /// assert!(x.compliance().is_none());
6029 /// assert!(x.dsse_attestation().is_none());
6030 /// assert!(x.sbom_reference().is_none());
6031 /// assert!(x.secret().is_none());
6032 /// ```
6033 pub fn set_vulnerability<
6034 T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityOccurrence>>,
6035 >(
6036 mut self,
6037 v: T,
6038 ) -> Self {
6039 self.details =
6040 std::option::Option::Some(crate::model::occurrence::Details::Vulnerability(v.into()));
6041 self
6042 }
6043
6044 /// The value of [details][crate::model::Occurrence::details]
6045 /// if it holds a `Build`, `None` if the field is not set or
6046 /// holds a different branch.
6047 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::BuildOccurrence>> {
6048 #[allow(unreachable_patterns)]
6049 self.details.as_ref().and_then(|v| match v {
6050 crate::model::occurrence::Details::Build(v) => std::option::Option::Some(v),
6051 _ => std::option::Option::None,
6052 })
6053 }
6054
6055 /// Sets the value of [details][crate::model::Occurrence::details]
6056 /// to hold a `Build`.
6057 ///
6058 /// Note that all the setters affecting `details` are
6059 /// mutually exclusive.
6060 ///
6061 /// # Example
6062 /// ```ignore,no_run
6063 /// # use google_cloud_grafeas_v1::model::Occurrence;
6064 /// use google_cloud_grafeas_v1::model::BuildOccurrence;
6065 /// let x = Occurrence::new().set_build(BuildOccurrence::default()/* use setters */);
6066 /// assert!(x.build().is_some());
6067 /// assert!(x.vulnerability().is_none());
6068 /// assert!(x.image().is_none());
6069 /// assert!(x.package().is_none());
6070 /// assert!(x.deployment().is_none());
6071 /// assert!(x.discovery().is_none());
6072 /// assert!(x.attestation().is_none());
6073 /// assert!(x.upgrade().is_none());
6074 /// assert!(x.compliance().is_none());
6075 /// assert!(x.dsse_attestation().is_none());
6076 /// assert!(x.sbom_reference().is_none());
6077 /// assert!(x.secret().is_none());
6078 /// ```
6079 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::BuildOccurrence>>>(
6080 mut self,
6081 v: T,
6082 ) -> Self {
6083 self.details =
6084 std::option::Option::Some(crate::model::occurrence::Details::Build(v.into()));
6085 self
6086 }
6087
6088 /// The value of [details][crate::model::Occurrence::details]
6089 /// if it holds a `Image`, `None` if the field is not set or
6090 /// holds a different branch.
6091 pub fn image(&self) -> std::option::Option<&std::boxed::Box<crate::model::ImageOccurrence>> {
6092 #[allow(unreachable_patterns)]
6093 self.details.as_ref().and_then(|v| match v {
6094 crate::model::occurrence::Details::Image(v) => std::option::Option::Some(v),
6095 _ => std::option::Option::None,
6096 })
6097 }
6098
6099 /// Sets the value of [details][crate::model::Occurrence::details]
6100 /// to hold a `Image`.
6101 ///
6102 /// Note that all the setters affecting `details` are
6103 /// mutually exclusive.
6104 ///
6105 /// # Example
6106 /// ```ignore,no_run
6107 /// # use google_cloud_grafeas_v1::model::Occurrence;
6108 /// use google_cloud_grafeas_v1::model::ImageOccurrence;
6109 /// let x = Occurrence::new().set_image(ImageOccurrence::default()/* use setters */);
6110 /// assert!(x.image().is_some());
6111 /// assert!(x.vulnerability().is_none());
6112 /// assert!(x.build().is_none());
6113 /// assert!(x.package().is_none());
6114 /// assert!(x.deployment().is_none());
6115 /// assert!(x.discovery().is_none());
6116 /// assert!(x.attestation().is_none());
6117 /// assert!(x.upgrade().is_none());
6118 /// assert!(x.compliance().is_none());
6119 /// assert!(x.dsse_attestation().is_none());
6120 /// assert!(x.sbom_reference().is_none());
6121 /// assert!(x.secret().is_none());
6122 /// ```
6123 pub fn set_image<T: std::convert::Into<std::boxed::Box<crate::model::ImageOccurrence>>>(
6124 mut self,
6125 v: T,
6126 ) -> Self {
6127 self.details =
6128 std::option::Option::Some(crate::model::occurrence::Details::Image(v.into()));
6129 self
6130 }
6131
6132 /// The value of [details][crate::model::Occurrence::details]
6133 /// if it holds a `Package`, `None` if the field is not set or
6134 /// holds a different branch.
6135 pub fn package(
6136 &self,
6137 ) -> std::option::Option<&std::boxed::Box<crate::model::PackageOccurrence>> {
6138 #[allow(unreachable_patterns)]
6139 self.details.as_ref().and_then(|v| match v {
6140 crate::model::occurrence::Details::Package(v) => std::option::Option::Some(v),
6141 _ => std::option::Option::None,
6142 })
6143 }
6144
6145 /// Sets the value of [details][crate::model::Occurrence::details]
6146 /// to hold a `Package`.
6147 ///
6148 /// Note that all the setters affecting `details` are
6149 /// mutually exclusive.
6150 ///
6151 /// # Example
6152 /// ```ignore,no_run
6153 /// # use google_cloud_grafeas_v1::model::Occurrence;
6154 /// use google_cloud_grafeas_v1::model::PackageOccurrence;
6155 /// let x = Occurrence::new().set_package(PackageOccurrence::default()/* use setters */);
6156 /// assert!(x.package().is_some());
6157 /// assert!(x.vulnerability().is_none());
6158 /// assert!(x.build().is_none());
6159 /// assert!(x.image().is_none());
6160 /// assert!(x.deployment().is_none());
6161 /// assert!(x.discovery().is_none());
6162 /// assert!(x.attestation().is_none());
6163 /// assert!(x.upgrade().is_none());
6164 /// assert!(x.compliance().is_none());
6165 /// assert!(x.dsse_attestation().is_none());
6166 /// assert!(x.sbom_reference().is_none());
6167 /// assert!(x.secret().is_none());
6168 /// ```
6169 pub fn set_package<T: std::convert::Into<std::boxed::Box<crate::model::PackageOccurrence>>>(
6170 mut self,
6171 v: T,
6172 ) -> Self {
6173 self.details =
6174 std::option::Option::Some(crate::model::occurrence::Details::Package(v.into()));
6175 self
6176 }
6177
6178 /// The value of [details][crate::model::Occurrence::details]
6179 /// if it holds a `Deployment`, `None` if the field is not set or
6180 /// holds a different branch.
6181 pub fn deployment(
6182 &self,
6183 ) -> std::option::Option<&std::boxed::Box<crate::model::DeploymentOccurrence>> {
6184 #[allow(unreachable_patterns)]
6185 self.details.as_ref().and_then(|v| match v {
6186 crate::model::occurrence::Details::Deployment(v) => std::option::Option::Some(v),
6187 _ => std::option::Option::None,
6188 })
6189 }
6190
6191 /// Sets the value of [details][crate::model::Occurrence::details]
6192 /// to hold a `Deployment`.
6193 ///
6194 /// Note that all the setters affecting `details` are
6195 /// mutually exclusive.
6196 ///
6197 /// # Example
6198 /// ```ignore,no_run
6199 /// # use google_cloud_grafeas_v1::model::Occurrence;
6200 /// use google_cloud_grafeas_v1::model::DeploymentOccurrence;
6201 /// let x = Occurrence::new().set_deployment(DeploymentOccurrence::default()/* use setters */);
6202 /// assert!(x.deployment().is_some());
6203 /// assert!(x.vulnerability().is_none());
6204 /// assert!(x.build().is_none());
6205 /// assert!(x.image().is_none());
6206 /// assert!(x.package().is_none());
6207 /// assert!(x.discovery().is_none());
6208 /// assert!(x.attestation().is_none());
6209 /// assert!(x.upgrade().is_none());
6210 /// assert!(x.compliance().is_none());
6211 /// assert!(x.dsse_attestation().is_none());
6212 /// assert!(x.sbom_reference().is_none());
6213 /// assert!(x.secret().is_none());
6214 /// ```
6215 pub fn set_deployment<
6216 T: std::convert::Into<std::boxed::Box<crate::model::DeploymentOccurrence>>,
6217 >(
6218 mut self,
6219 v: T,
6220 ) -> Self {
6221 self.details =
6222 std::option::Option::Some(crate::model::occurrence::Details::Deployment(v.into()));
6223 self
6224 }
6225
6226 /// The value of [details][crate::model::Occurrence::details]
6227 /// if it holds a `Discovery`, `None` if the field is not set or
6228 /// holds a different branch.
6229 pub fn discovery(
6230 &self,
6231 ) -> std::option::Option<&std::boxed::Box<crate::model::DiscoveryOccurrence>> {
6232 #[allow(unreachable_patterns)]
6233 self.details.as_ref().and_then(|v| match v {
6234 crate::model::occurrence::Details::Discovery(v) => std::option::Option::Some(v),
6235 _ => std::option::Option::None,
6236 })
6237 }
6238
6239 /// Sets the value of [details][crate::model::Occurrence::details]
6240 /// to hold a `Discovery`.
6241 ///
6242 /// Note that all the setters affecting `details` are
6243 /// mutually exclusive.
6244 ///
6245 /// # Example
6246 /// ```ignore,no_run
6247 /// # use google_cloud_grafeas_v1::model::Occurrence;
6248 /// use google_cloud_grafeas_v1::model::DiscoveryOccurrence;
6249 /// let x = Occurrence::new().set_discovery(DiscoveryOccurrence::default()/* use setters */);
6250 /// assert!(x.discovery().is_some());
6251 /// assert!(x.vulnerability().is_none());
6252 /// assert!(x.build().is_none());
6253 /// assert!(x.image().is_none());
6254 /// assert!(x.package().is_none());
6255 /// assert!(x.deployment().is_none());
6256 /// assert!(x.attestation().is_none());
6257 /// assert!(x.upgrade().is_none());
6258 /// assert!(x.compliance().is_none());
6259 /// assert!(x.dsse_attestation().is_none());
6260 /// assert!(x.sbom_reference().is_none());
6261 /// assert!(x.secret().is_none());
6262 /// ```
6263 pub fn set_discovery<
6264 T: std::convert::Into<std::boxed::Box<crate::model::DiscoveryOccurrence>>,
6265 >(
6266 mut self,
6267 v: T,
6268 ) -> Self {
6269 self.details =
6270 std::option::Option::Some(crate::model::occurrence::Details::Discovery(v.into()));
6271 self
6272 }
6273
6274 /// The value of [details][crate::model::Occurrence::details]
6275 /// if it holds a `Attestation`, `None` if the field is not set or
6276 /// holds a different branch.
6277 pub fn attestation(
6278 &self,
6279 ) -> std::option::Option<&std::boxed::Box<crate::model::AttestationOccurrence>> {
6280 #[allow(unreachable_patterns)]
6281 self.details.as_ref().and_then(|v| match v {
6282 crate::model::occurrence::Details::Attestation(v) => std::option::Option::Some(v),
6283 _ => std::option::Option::None,
6284 })
6285 }
6286
6287 /// Sets the value of [details][crate::model::Occurrence::details]
6288 /// to hold a `Attestation`.
6289 ///
6290 /// Note that all the setters affecting `details` are
6291 /// mutually exclusive.
6292 ///
6293 /// # Example
6294 /// ```ignore,no_run
6295 /// # use google_cloud_grafeas_v1::model::Occurrence;
6296 /// use google_cloud_grafeas_v1::model::AttestationOccurrence;
6297 /// let x = Occurrence::new().set_attestation(AttestationOccurrence::default()/* use setters */);
6298 /// assert!(x.attestation().is_some());
6299 /// assert!(x.vulnerability().is_none());
6300 /// assert!(x.build().is_none());
6301 /// assert!(x.image().is_none());
6302 /// assert!(x.package().is_none());
6303 /// assert!(x.deployment().is_none());
6304 /// assert!(x.discovery().is_none());
6305 /// assert!(x.upgrade().is_none());
6306 /// assert!(x.compliance().is_none());
6307 /// assert!(x.dsse_attestation().is_none());
6308 /// assert!(x.sbom_reference().is_none());
6309 /// assert!(x.secret().is_none());
6310 /// ```
6311 pub fn set_attestation<
6312 T: std::convert::Into<std::boxed::Box<crate::model::AttestationOccurrence>>,
6313 >(
6314 mut self,
6315 v: T,
6316 ) -> Self {
6317 self.details =
6318 std::option::Option::Some(crate::model::occurrence::Details::Attestation(v.into()));
6319 self
6320 }
6321
6322 /// The value of [details][crate::model::Occurrence::details]
6323 /// if it holds a `Upgrade`, `None` if the field is not set or
6324 /// holds a different branch.
6325 pub fn upgrade(
6326 &self,
6327 ) -> std::option::Option<&std::boxed::Box<crate::model::UpgradeOccurrence>> {
6328 #[allow(unreachable_patterns)]
6329 self.details.as_ref().and_then(|v| match v {
6330 crate::model::occurrence::Details::Upgrade(v) => std::option::Option::Some(v),
6331 _ => std::option::Option::None,
6332 })
6333 }
6334
6335 /// Sets the value of [details][crate::model::Occurrence::details]
6336 /// to hold a `Upgrade`.
6337 ///
6338 /// Note that all the setters affecting `details` are
6339 /// mutually exclusive.
6340 ///
6341 /// # Example
6342 /// ```ignore,no_run
6343 /// # use google_cloud_grafeas_v1::model::Occurrence;
6344 /// use google_cloud_grafeas_v1::model::UpgradeOccurrence;
6345 /// let x = Occurrence::new().set_upgrade(UpgradeOccurrence::default()/* use setters */);
6346 /// assert!(x.upgrade().is_some());
6347 /// assert!(x.vulnerability().is_none());
6348 /// assert!(x.build().is_none());
6349 /// assert!(x.image().is_none());
6350 /// assert!(x.package().is_none());
6351 /// assert!(x.deployment().is_none());
6352 /// assert!(x.discovery().is_none());
6353 /// assert!(x.attestation().is_none());
6354 /// assert!(x.compliance().is_none());
6355 /// assert!(x.dsse_attestation().is_none());
6356 /// assert!(x.sbom_reference().is_none());
6357 /// assert!(x.secret().is_none());
6358 /// ```
6359 pub fn set_upgrade<T: std::convert::Into<std::boxed::Box<crate::model::UpgradeOccurrence>>>(
6360 mut self,
6361 v: T,
6362 ) -> Self {
6363 self.details =
6364 std::option::Option::Some(crate::model::occurrence::Details::Upgrade(v.into()));
6365 self
6366 }
6367
6368 /// The value of [details][crate::model::Occurrence::details]
6369 /// if it holds a `Compliance`, `None` if the field is not set or
6370 /// holds a different branch.
6371 pub fn compliance(
6372 &self,
6373 ) -> std::option::Option<&std::boxed::Box<crate::model::ComplianceOccurrence>> {
6374 #[allow(unreachable_patterns)]
6375 self.details.as_ref().and_then(|v| match v {
6376 crate::model::occurrence::Details::Compliance(v) => std::option::Option::Some(v),
6377 _ => std::option::Option::None,
6378 })
6379 }
6380
6381 /// Sets the value of [details][crate::model::Occurrence::details]
6382 /// to hold a `Compliance`.
6383 ///
6384 /// Note that all the setters affecting `details` are
6385 /// mutually exclusive.
6386 ///
6387 /// # Example
6388 /// ```ignore,no_run
6389 /// # use google_cloud_grafeas_v1::model::Occurrence;
6390 /// use google_cloud_grafeas_v1::model::ComplianceOccurrence;
6391 /// let x = Occurrence::new().set_compliance(ComplianceOccurrence::default()/* use setters */);
6392 /// assert!(x.compliance().is_some());
6393 /// assert!(x.vulnerability().is_none());
6394 /// assert!(x.build().is_none());
6395 /// assert!(x.image().is_none());
6396 /// assert!(x.package().is_none());
6397 /// assert!(x.deployment().is_none());
6398 /// assert!(x.discovery().is_none());
6399 /// assert!(x.attestation().is_none());
6400 /// assert!(x.upgrade().is_none());
6401 /// assert!(x.dsse_attestation().is_none());
6402 /// assert!(x.sbom_reference().is_none());
6403 /// assert!(x.secret().is_none());
6404 /// ```
6405 pub fn set_compliance<
6406 T: std::convert::Into<std::boxed::Box<crate::model::ComplianceOccurrence>>,
6407 >(
6408 mut self,
6409 v: T,
6410 ) -> Self {
6411 self.details =
6412 std::option::Option::Some(crate::model::occurrence::Details::Compliance(v.into()));
6413 self
6414 }
6415
6416 /// The value of [details][crate::model::Occurrence::details]
6417 /// if it holds a `DsseAttestation`, `None` if the field is not set or
6418 /// holds a different branch.
6419 pub fn dsse_attestation(
6420 &self,
6421 ) -> std::option::Option<&std::boxed::Box<crate::model::DSSEAttestationOccurrence>> {
6422 #[allow(unreachable_patterns)]
6423 self.details.as_ref().and_then(|v| match v {
6424 crate::model::occurrence::Details::DsseAttestation(v) => std::option::Option::Some(v),
6425 _ => std::option::Option::None,
6426 })
6427 }
6428
6429 /// Sets the value of [details][crate::model::Occurrence::details]
6430 /// to hold a `DsseAttestation`.
6431 ///
6432 /// Note that all the setters affecting `details` are
6433 /// mutually exclusive.
6434 ///
6435 /// # Example
6436 /// ```ignore,no_run
6437 /// # use google_cloud_grafeas_v1::model::Occurrence;
6438 /// use google_cloud_grafeas_v1::model::DSSEAttestationOccurrence;
6439 /// let x = Occurrence::new().set_dsse_attestation(DSSEAttestationOccurrence::default()/* use setters */);
6440 /// assert!(x.dsse_attestation().is_some());
6441 /// assert!(x.vulnerability().is_none());
6442 /// assert!(x.build().is_none());
6443 /// assert!(x.image().is_none());
6444 /// assert!(x.package().is_none());
6445 /// assert!(x.deployment().is_none());
6446 /// assert!(x.discovery().is_none());
6447 /// assert!(x.attestation().is_none());
6448 /// assert!(x.upgrade().is_none());
6449 /// assert!(x.compliance().is_none());
6450 /// assert!(x.sbom_reference().is_none());
6451 /// assert!(x.secret().is_none());
6452 /// ```
6453 pub fn set_dsse_attestation<
6454 T: std::convert::Into<std::boxed::Box<crate::model::DSSEAttestationOccurrence>>,
6455 >(
6456 mut self,
6457 v: T,
6458 ) -> Self {
6459 self.details =
6460 std::option::Option::Some(crate::model::occurrence::Details::DsseAttestation(v.into()));
6461 self
6462 }
6463
6464 /// The value of [details][crate::model::Occurrence::details]
6465 /// if it holds a `SbomReference`, `None` if the field is not set or
6466 /// holds a different branch.
6467 pub fn sbom_reference(
6468 &self,
6469 ) -> std::option::Option<&std::boxed::Box<crate::model::SBOMReferenceOccurrence>> {
6470 #[allow(unreachable_patterns)]
6471 self.details.as_ref().and_then(|v| match v {
6472 crate::model::occurrence::Details::SbomReference(v) => std::option::Option::Some(v),
6473 _ => std::option::Option::None,
6474 })
6475 }
6476
6477 /// Sets the value of [details][crate::model::Occurrence::details]
6478 /// to hold a `SbomReference`.
6479 ///
6480 /// Note that all the setters affecting `details` are
6481 /// mutually exclusive.
6482 ///
6483 /// # Example
6484 /// ```ignore,no_run
6485 /// # use google_cloud_grafeas_v1::model::Occurrence;
6486 /// use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
6487 /// let x = Occurrence::new().set_sbom_reference(SBOMReferenceOccurrence::default()/* use setters */);
6488 /// assert!(x.sbom_reference().is_some());
6489 /// assert!(x.vulnerability().is_none());
6490 /// assert!(x.build().is_none());
6491 /// assert!(x.image().is_none());
6492 /// assert!(x.package().is_none());
6493 /// assert!(x.deployment().is_none());
6494 /// assert!(x.discovery().is_none());
6495 /// assert!(x.attestation().is_none());
6496 /// assert!(x.upgrade().is_none());
6497 /// assert!(x.compliance().is_none());
6498 /// assert!(x.dsse_attestation().is_none());
6499 /// assert!(x.secret().is_none());
6500 /// ```
6501 pub fn set_sbom_reference<
6502 T: std::convert::Into<std::boxed::Box<crate::model::SBOMReferenceOccurrence>>,
6503 >(
6504 mut self,
6505 v: T,
6506 ) -> Self {
6507 self.details =
6508 std::option::Option::Some(crate::model::occurrence::Details::SbomReference(v.into()));
6509 self
6510 }
6511
6512 /// The value of [details][crate::model::Occurrence::details]
6513 /// if it holds a `Secret`, `None` if the field is not set or
6514 /// holds a different branch.
6515 pub fn secret(&self) -> std::option::Option<&std::boxed::Box<crate::model::SecretOccurrence>> {
6516 #[allow(unreachable_patterns)]
6517 self.details.as_ref().and_then(|v| match v {
6518 crate::model::occurrence::Details::Secret(v) => std::option::Option::Some(v),
6519 _ => std::option::Option::None,
6520 })
6521 }
6522
6523 /// Sets the value of [details][crate::model::Occurrence::details]
6524 /// to hold a `Secret`.
6525 ///
6526 /// Note that all the setters affecting `details` are
6527 /// mutually exclusive.
6528 ///
6529 /// # Example
6530 /// ```ignore,no_run
6531 /// # use google_cloud_grafeas_v1::model::Occurrence;
6532 /// use google_cloud_grafeas_v1::model::SecretOccurrence;
6533 /// let x = Occurrence::new().set_secret(SecretOccurrence::default()/* use setters */);
6534 /// assert!(x.secret().is_some());
6535 /// assert!(x.vulnerability().is_none());
6536 /// assert!(x.build().is_none());
6537 /// assert!(x.image().is_none());
6538 /// assert!(x.package().is_none());
6539 /// assert!(x.deployment().is_none());
6540 /// assert!(x.discovery().is_none());
6541 /// assert!(x.attestation().is_none());
6542 /// assert!(x.upgrade().is_none());
6543 /// assert!(x.compliance().is_none());
6544 /// assert!(x.dsse_attestation().is_none());
6545 /// assert!(x.sbom_reference().is_none());
6546 /// ```
6547 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretOccurrence>>>(
6548 mut self,
6549 v: T,
6550 ) -> Self {
6551 self.details =
6552 std::option::Option::Some(crate::model::occurrence::Details::Secret(v.into()));
6553 self
6554 }
6555}
6556
6557impl wkt::message::Message for Occurrence {
6558 fn typename() -> &'static str {
6559 "type.googleapis.com/grafeas.v1.Occurrence"
6560 }
6561}
6562
6563/// Defines additional types related to [Occurrence].
6564pub mod occurrence {
6565 #[allow(unused_imports)]
6566 use super::*;
6567
6568 /// Required. Immutable. Describes the details of the note kind found on this
6569 /// resource.
6570 #[derive(Clone, Debug, PartialEq)]
6571 #[non_exhaustive]
6572 pub enum Details {
6573 /// Describes a security vulnerability.
6574 Vulnerability(std::boxed::Box<crate::model::VulnerabilityOccurrence>),
6575 /// Describes a verifiable build.
6576 Build(std::boxed::Box<crate::model::BuildOccurrence>),
6577 /// Describes how this resource derives from the basis in the associated
6578 /// note.
6579 Image(std::boxed::Box<crate::model::ImageOccurrence>),
6580 /// Describes the installation of a package on the linked resource.
6581 Package(std::boxed::Box<crate::model::PackageOccurrence>),
6582 /// Describes the deployment of an artifact on a runtime.
6583 Deployment(std::boxed::Box<crate::model::DeploymentOccurrence>),
6584 /// Describes when a resource was discovered.
6585 Discovery(std::boxed::Box<crate::model::DiscoveryOccurrence>),
6586 /// Describes an attestation of an artifact.
6587 Attestation(std::boxed::Box<crate::model::AttestationOccurrence>),
6588 /// Describes an available package upgrade on the linked resource.
6589 Upgrade(std::boxed::Box<crate::model::UpgradeOccurrence>),
6590 /// Describes a compliance violation on a linked resource.
6591 Compliance(std::boxed::Box<crate::model::ComplianceOccurrence>),
6592 /// Describes an attestation of an artifact using dsse.
6593 DsseAttestation(std::boxed::Box<crate::model::DSSEAttestationOccurrence>),
6594 /// Describes a specific SBOM reference occurrences.
6595 SbomReference(std::boxed::Box<crate::model::SBOMReferenceOccurrence>),
6596 /// Describes a secret.
6597 Secret(std::boxed::Box<crate::model::SecretOccurrence>),
6598 }
6599}
6600
6601/// A type of analysis that can be done for a resource.
6602#[derive(Clone, Default, PartialEq)]
6603#[non_exhaustive]
6604pub struct Note {
6605 /// Output only. The name of the note in the form of
6606 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
6607 pub name: std::string::String,
6608
6609 /// A one sentence description of this note.
6610 pub short_description: std::string::String,
6611
6612 /// A detailed description of this note.
6613 pub long_description: std::string::String,
6614
6615 /// Output only. The type of analysis. This field can be used as a filter in
6616 /// list requests.
6617 pub kind: crate::model::NoteKind,
6618
6619 /// URLs associated with this note.
6620 pub related_url: std::vec::Vec<crate::model::RelatedUrl>,
6621
6622 /// Time of expiration for this note. Empty if note does not expire.
6623 pub expiration_time: std::option::Option<wkt::Timestamp>,
6624
6625 /// Output only. The time this note was created. This field can be used as a
6626 /// filter in list requests.
6627 pub create_time: std::option::Option<wkt::Timestamp>,
6628
6629 /// Output only. The time this note was last updated. This field can be used as
6630 /// a filter in list requests.
6631 pub update_time: std::option::Option<wkt::Timestamp>,
6632
6633 /// Other notes related to this note.
6634 pub related_note_names: std::vec::Vec<std::string::String>,
6635
6636 /// Required. Immutable. The type of analysis this note represents.
6637 pub r#type: std::option::Option<crate::model::note::Type>,
6638
6639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6640}
6641
6642impl Note {
6643 pub fn new() -> Self {
6644 std::default::Default::default()
6645 }
6646
6647 /// Sets the value of [name][crate::model::Note::name].
6648 ///
6649 /// # Example
6650 /// ```ignore,no_run
6651 /// # use google_cloud_grafeas_v1::model::Note;
6652 /// let x = Note::new().set_name("example");
6653 /// ```
6654 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6655 self.name = v.into();
6656 self
6657 }
6658
6659 /// Sets the value of [short_description][crate::model::Note::short_description].
6660 ///
6661 /// # Example
6662 /// ```ignore,no_run
6663 /// # use google_cloud_grafeas_v1::model::Note;
6664 /// let x = Note::new().set_short_description("example");
6665 /// ```
6666 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
6667 mut self,
6668 v: T,
6669 ) -> Self {
6670 self.short_description = v.into();
6671 self
6672 }
6673
6674 /// Sets the value of [long_description][crate::model::Note::long_description].
6675 ///
6676 /// # Example
6677 /// ```ignore,no_run
6678 /// # use google_cloud_grafeas_v1::model::Note;
6679 /// let x = Note::new().set_long_description("example");
6680 /// ```
6681 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
6682 mut self,
6683 v: T,
6684 ) -> Self {
6685 self.long_description = v.into();
6686 self
6687 }
6688
6689 /// Sets the value of [kind][crate::model::Note::kind].
6690 ///
6691 /// # Example
6692 /// ```ignore,no_run
6693 /// # use google_cloud_grafeas_v1::model::Note;
6694 /// use google_cloud_grafeas_v1::model::NoteKind;
6695 /// let x0 = Note::new().set_kind(NoteKind::Vulnerability);
6696 /// let x1 = Note::new().set_kind(NoteKind::Build);
6697 /// let x2 = Note::new().set_kind(NoteKind::Image);
6698 /// ```
6699 pub fn set_kind<T: std::convert::Into<crate::model::NoteKind>>(mut self, v: T) -> Self {
6700 self.kind = v.into();
6701 self
6702 }
6703
6704 /// Sets the value of [related_url][crate::model::Note::related_url].
6705 ///
6706 /// # Example
6707 /// ```ignore,no_run
6708 /// # use google_cloud_grafeas_v1::model::Note;
6709 /// use google_cloud_grafeas_v1::model::RelatedUrl;
6710 /// let x = Note::new()
6711 /// .set_related_url([
6712 /// RelatedUrl::default()/* use setters */,
6713 /// RelatedUrl::default()/* use (different) setters */,
6714 /// ]);
6715 /// ```
6716 pub fn set_related_url<T, V>(mut self, v: T) -> Self
6717 where
6718 T: std::iter::IntoIterator<Item = V>,
6719 V: std::convert::Into<crate::model::RelatedUrl>,
6720 {
6721 use std::iter::Iterator;
6722 self.related_url = v.into_iter().map(|i| i.into()).collect();
6723 self
6724 }
6725
6726 /// Sets the value of [expiration_time][crate::model::Note::expiration_time].
6727 ///
6728 /// # Example
6729 /// ```ignore,no_run
6730 /// # use google_cloud_grafeas_v1::model::Note;
6731 /// use wkt::Timestamp;
6732 /// let x = Note::new().set_expiration_time(Timestamp::default()/* use setters */);
6733 /// ```
6734 pub fn set_expiration_time<T>(mut self, v: T) -> Self
6735 where
6736 T: std::convert::Into<wkt::Timestamp>,
6737 {
6738 self.expiration_time = std::option::Option::Some(v.into());
6739 self
6740 }
6741
6742 /// Sets or clears the value of [expiration_time][crate::model::Note::expiration_time].
6743 ///
6744 /// # Example
6745 /// ```ignore,no_run
6746 /// # use google_cloud_grafeas_v1::model::Note;
6747 /// use wkt::Timestamp;
6748 /// let x = Note::new().set_or_clear_expiration_time(Some(Timestamp::default()/* use setters */));
6749 /// let x = Note::new().set_or_clear_expiration_time(None::<Timestamp>);
6750 /// ```
6751 pub fn set_or_clear_expiration_time<T>(mut self, v: std::option::Option<T>) -> Self
6752 where
6753 T: std::convert::Into<wkt::Timestamp>,
6754 {
6755 self.expiration_time = v.map(|x| x.into());
6756 self
6757 }
6758
6759 /// Sets the value of [create_time][crate::model::Note::create_time].
6760 ///
6761 /// # Example
6762 /// ```ignore,no_run
6763 /// # use google_cloud_grafeas_v1::model::Note;
6764 /// use wkt::Timestamp;
6765 /// let x = Note::new().set_create_time(Timestamp::default()/* use setters */);
6766 /// ```
6767 pub fn set_create_time<T>(mut self, v: T) -> Self
6768 where
6769 T: std::convert::Into<wkt::Timestamp>,
6770 {
6771 self.create_time = std::option::Option::Some(v.into());
6772 self
6773 }
6774
6775 /// Sets or clears the value of [create_time][crate::model::Note::create_time].
6776 ///
6777 /// # Example
6778 /// ```ignore,no_run
6779 /// # use google_cloud_grafeas_v1::model::Note;
6780 /// use wkt::Timestamp;
6781 /// let x = Note::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6782 /// let x = Note::new().set_or_clear_create_time(None::<Timestamp>);
6783 /// ```
6784 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6785 where
6786 T: std::convert::Into<wkt::Timestamp>,
6787 {
6788 self.create_time = v.map(|x| x.into());
6789 self
6790 }
6791
6792 /// Sets the value of [update_time][crate::model::Note::update_time].
6793 ///
6794 /// # Example
6795 /// ```ignore,no_run
6796 /// # use google_cloud_grafeas_v1::model::Note;
6797 /// use wkt::Timestamp;
6798 /// let x = Note::new().set_update_time(Timestamp::default()/* use setters */);
6799 /// ```
6800 pub fn set_update_time<T>(mut self, v: T) -> Self
6801 where
6802 T: std::convert::Into<wkt::Timestamp>,
6803 {
6804 self.update_time = std::option::Option::Some(v.into());
6805 self
6806 }
6807
6808 /// Sets or clears the value of [update_time][crate::model::Note::update_time].
6809 ///
6810 /// # Example
6811 /// ```ignore,no_run
6812 /// # use google_cloud_grafeas_v1::model::Note;
6813 /// use wkt::Timestamp;
6814 /// let x = Note::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6815 /// let x = Note::new().set_or_clear_update_time(None::<Timestamp>);
6816 /// ```
6817 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6818 where
6819 T: std::convert::Into<wkt::Timestamp>,
6820 {
6821 self.update_time = v.map(|x| x.into());
6822 self
6823 }
6824
6825 /// Sets the value of [related_note_names][crate::model::Note::related_note_names].
6826 ///
6827 /// # Example
6828 /// ```ignore,no_run
6829 /// # use google_cloud_grafeas_v1::model::Note;
6830 /// let x = Note::new().set_related_note_names(["a", "b", "c"]);
6831 /// ```
6832 pub fn set_related_note_names<T, V>(mut self, v: T) -> Self
6833 where
6834 T: std::iter::IntoIterator<Item = V>,
6835 V: std::convert::Into<std::string::String>,
6836 {
6837 use std::iter::Iterator;
6838 self.related_note_names = v.into_iter().map(|i| i.into()).collect();
6839 self
6840 }
6841
6842 /// Sets the value of [r#type][crate::model::Note::type].
6843 ///
6844 /// Note that all the setters affecting `r#type` are mutually
6845 /// exclusive.
6846 ///
6847 /// # Example
6848 /// ```ignore,no_run
6849 /// # use google_cloud_grafeas_v1::model::Note;
6850 /// use google_cloud_grafeas_v1::model::VulnerabilityNote;
6851 /// let x = Note::new().set_type(Some(
6852 /// google_cloud_grafeas_v1::model::note::Type::Vulnerability(VulnerabilityNote::default().into())));
6853 /// ```
6854 pub fn set_type<T: std::convert::Into<std::option::Option<crate::model::note::Type>>>(
6855 mut self,
6856 v: T,
6857 ) -> Self {
6858 self.r#type = v.into();
6859 self
6860 }
6861
6862 /// The value of [r#type][crate::model::Note::r#type]
6863 /// if it holds a `Vulnerability`, `None` if the field is not set or
6864 /// holds a different branch.
6865 pub fn vulnerability(
6866 &self,
6867 ) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityNote>> {
6868 #[allow(unreachable_patterns)]
6869 self.r#type.as_ref().and_then(|v| match v {
6870 crate::model::note::Type::Vulnerability(v) => std::option::Option::Some(v),
6871 _ => std::option::Option::None,
6872 })
6873 }
6874
6875 /// Sets the value of [r#type][crate::model::Note::r#type]
6876 /// to hold a `Vulnerability`.
6877 ///
6878 /// Note that all the setters affecting `r#type` are
6879 /// mutually exclusive.
6880 ///
6881 /// # Example
6882 /// ```ignore,no_run
6883 /// # use google_cloud_grafeas_v1::model::Note;
6884 /// use google_cloud_grafeas_v1::model::VulnerabilityNote;
6885 /// let x = Note::new().set_vulnerability(VulnerabilityNote::default()/* use setters */);
6886 /// assert!(x.vulnerability().is_some());
6887 /// assert!(x.build().is_none());
6888 /// assert!(x.image().is_none());
6889 /// assert!(x.package().is_none());
6890 /// assert!(x.deployment().is_none());
6891 /// assert!(x.discovery().is_none());
6892 /// assert!(x.attestation().is_none());
6893 /// assert!(x.upgrade().is_none());
6894 /// assert!(x.compliance().is_none());
6895 /// assert!(x.dsse_attestation().is_none());
6896 /// assert!(x.vulnerability_assessment().is_none());
6897 /// assert!(x.sbom_reference().is_none());
6898 /// assert!(x.secret().is_none());
6899 /// ```
6900 pub fn set_vulnerability<
6901 T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityNote>>,
6902 >(
6903 mut self,
6904 v: T,
6905 ) -> Self {
6906 self.r#type = std::option::Option::Some(crate::model::note::Type::Vulnerability(v.into()));
6907 self
6908 }
6909
6910 /// The value of [r#type][crate::model::Note::r#type]
6911 /// if it holds a `Build`, `None` if the field is not set or
6912 /// holds a different branch.
6913 pub fn build(&self) -> std::option::Option<&std::boxed::Box<crate::model::BuildNote>> {
6914 #[allow(unreachable_patterns)]
6915 self.r#type.as_ref().and_then(|v| match v {
6916 crate::model::note::Type::Build(v) => std::option::Option::Some(v),
6917 _ => std::option::Option::None,
6918 })
6919 }
6920
6921 /// Sets the value of [r#type][crate::model::Note::r#type]
6922 /// to hold a `Build`.
6923 ///
6924 /// Note that all the setters affecting `r#type` are
6925 /// mutually exclusive.
6926 ///
6927 /// # Example
6928 /// ```ignore,no_run
6929 /// # use google_cloud_grafeas_v1::model::Note;
6930 /// use google_cloud_grafeas_v1::model::BuildNote;
6931 /// let x = Note::new().set_build(BuildNote::default()/* use setters */);
6932 /// assert!(x.build().is_some());
6933 /// assert!(x.vulnerability().is_none());
6934 /// assert!(x.image().is_none());
6935 /// assert!(x.package().is_none());
6936 /// assert!(x.deployment().is_none());
6937 /// assert!(x.discovery().is_none());
6938 /// assert!(x.attestation().is_none());
6939 /// assert!(x.upgrade().is_none());
6940 /// assert!(x.compliance().is_none());
6941 /// assert!(x.dsse_attestation().is_none());
6942 /// assert!(x.vulnerability_assessment().is_none());
6943 /// assert!(x.sbom_reference().is_none());
6944 /// assert!(x.secret().is_none());
6945 /// ```
6946 pub fn set_build<T: std::convert::Into<std::boxed::Box<crate::model::BuildNote>>>(
6947 mut self,
6948 v: T,
6949 ) -> Self {
6950 self.r#type = std::option::Option::Some(crate::model::note::Type::Build(v.into()));
6951 self
6952 }
6953
6954 /// The value of [r#type][crate::model::Note::r#type]
6955 /// if it holds a `Image`, `None` if the field is not set or
6956 /// holds a different branch.
6957 pub fn image(&self) -> std::option::Option<&std::boxed::Box<crate::model::ImageNote>> {
6958 #[allow(unreachable_patterns)]
6959 self.r#type.as_ref().and_then(|v| match v {
6960 crate::model::note::Type::Image(v) => std::option::Option::Some(v),
6961 _ => std::option::Option::None,
6962 })
6963 }
6964
6965 /// Sets the value of [r#type][crate::model::Note::r#type]
6966 /// to hold a `Image`.
6967 ///
6968 /// Note that all the setters affecting `r#type` are
6969 /// mutually exclusive.
6970 ///
6971 /// # Example
6972 /// ```ignore,no_run
6973 /// # use google_cloud_grafeas_v1::model::Note;
6974 /// use google_cloud_grafeas_v1::model::ImageNote;
6975 /// let x = Note::new().set_image(ImageNote::default()/* use setters */);
6976 /// assert!(x.image().is_some());
6977 /// assert!(x.vulnerability().is_none());
6978 /// assert!(x.build().is_none());
6979 /// assert!(x.package().is_none());
6980 /// assert!(x.deployment().is_none());
6981 /// assert!(x.discovery().is_none());
6982 /// assert!(x.attestation().is_none());
6983 /// assert!(x.upgrade().is_none());
6984 /// assert!(x.compliance().is_none());
6985 /// assert!(x.dsse_attestation().is_none());
6986 /// assert!(x.vulnerability_assessment().is_none());
6987 /// assert!(x.sbom_reference().is_none());
6988 /// assert!(x.secret().is_none());
6989 /// ```
6990 pub fn set_image<T: std::convert::Into<std::boxed::Box<crate::model::ImageNote>>>(
6991 mut self,
6992 v: T,
6993 ) -> Self {
6994 self.r#type = std::option::Option::Some(crate::model::note::Type::Image(v.into()));
6995 self
6996 }
6997
6998 /// The value of [r#type][crate::model::Note::r#type]
6999 /// if it holds a `Package`, `None` if the field is not set or
7000 /// holds a different branch.
7001 pub fn package(&self) -> std::option::Option<&std::boxed::Box<crate::model::PackageNote>> {
7002 #[allow(unreachable_patterns)]
7003 self.r#type.as_ref().and_then(|v| match v {
7004 crate::model::note::Type::Package(v) => std::option::Option::Some(v),
7005 _ => std::option::Option::None,
7006 })
7007 }
7008
7009 /// Sets the value of [r#type][crate::model::Note::r#type]
7010 /// to hold a `Package`.
7011 ///
7012 /// Note that all the setters affecting `r#type` are
7013 /// mutually exclusive.
7014 ///
7015 /// # Example
7016 /// ```ignore,no_run
7017 /// # use google_cloud_grafeas_v1::model::Note;
7018 /// use google_cloud_grafeas_v1::model::PackageNote;
7019 /// let x = Note::new().set_package(PackageNote::default()/* use setters */);
7020 /// assert!(x.package().is_some());
7021 /// assert!(x.vulnerability().is_none());
7022 /// assert!(x.build().is_none());
7023 /// assert!(x.image().is_none());
7024 /// assert!(x.deployment().is_none());
7025 /// assert!(x.discovery().is_none());
7026 /// assert!(x.attestation().is_none());
7027 /// assert!(x.upgrade().is_none());
7028 /// assert!(x.compliance().is_none());
7029 /// assert!(x.dsse_attestation().is_none());
7030 /// assert!(x.vulnerability_assessment().is_none());
7031 /// assert!(x.sbom_reference().is_none());
7032 /// assert!(x.secret().is_none());
7033 /// ```
7034 pub fn set_package<T: std::convert::Into<std::boxed::Box<crate::model::PackageNote>>>(
7035 mut self,
7036 v: T,
7037 ) -> Self {
7038 self.r#type = std::option::Option::Some(crate::model::note::Type::Package(v.into()));
7039 self
7040 }
7041
7042 /// The value of [r#type][crate::model::Note::r#type]
7043 /// if it holds a `Deployment`, `None` if the field is not set or
7044 /// holds a different branch.
7045 pub fn deployment(
7046 &self,
7047 ) -> std::option::Option<&std::boxed::Box<crate::model::DeploymentNote>> {
7048 #[allow(unreachable_patterns)]
7049 self.r#type.as_ref().and_then(|v| match v {
7050 crate::model::note::Type::Deployment(v) => std::option::Option::Some(v),
7051 _ => std::option::Option::None,
7052 })
7053 }
7054
7055 /// Sets the value of [r#type][crate::model::Note::r#type]
7056 /// to hold a `Deployment`.
7057 ///
7058 /// Note that all the setters affecting `r#type` are
7059 /// mutually exclusive.
7060 ///
7061 /// # Example
7062 /// ```ignore,no_run
7063 /// # use google_cloud_grafeas_v1::model::Note;
7064 /// use google_cloud_grafeas_v1::model::DeploymentNote;
7065 /// let x = Note::new().set_deployment(DeploymentNote::default()/* use setters */);
7066 /// assert!(x.deployment().is_some());
7067 /// assert!(x.vulnerability().is_none());
7068 /// assert!(x.build().is_none());
7069 /// assert!(x.image().is_none());
7070 /// assert!(x.package().is_none());
7071 /// assert!(x.discovery().is_none());
7072 /// assert!(x.attestation().is_none());
7073 /// assert!(x.upgrade().is_none());
7074 /// assert!(x.compliance().is_none());
7075 /// assert!(x.dsse_attestation().is_none());
7076 /// assert!(x.vulnerability_assessment().is_none());
7077 /// assert!(x.sbom_reference().is_none());
7078 /// assert!(x.secret().is_none());
7079 /// ```
7080 pub fn set_deployment<T: std::convert::Into<std::boxed::Box<crate::model::DeploymentNote>>>(
7081 mut self,
7082 v: T,
7083 ) -> Self {
7084 self.r#type = std::option::Option::Some(crate::model::note::Type::Deployment(v.into()));
7085 self
7086 }
7087
7088 /// The value of [r#type][crate::model::Note::r#type]
7089 /// if it holds a `Discovery`, `None` if the field is not set or
7090 /// holds a different branch.
7091 pub fn discovery(&self) -> std::option::Option<&std::boxed::Box<crate::model::DiscoveryNote>> {
7092 #[allow(unreachable_patterns)]
7093 self.r#type.as_ref().and_then(|v| match v {
7094 crate::model::note::Type::Discovery(v) => std::option::Option::Some(v),
7095 _ => std::option::Option::None,
7096 })
7097 }
7098
7099 /// Sets the value of [r#type][crate::model::Note::r#type]
7100 /// to hold a `Discovery`.
7101 ///
7102 /// Note that all the setters affecting `r#type` are
7103 /// mutually exclusive.
7104 ///
7105 /// # Example
7106 /// ```ignore,no_run
7107 /// # use google_cloud_grafeas_v1::model::Note;
7108 /// use google_cloud_grafeas_v1::model::DiscoveryNote;
7109 /// let x = Note::new().set_discovery(DiscoveryNote::default()/* use setters */);
7110 /// assert!(x.discovery().is_some());
7111 /// assert!(x.vulnerability().is_none());
7112 /// assert!(x.build().is_none());
7113 /// assert!(x.image().is_none());
7114 /// assert!(x.package().is_none());
7115 /// assert!(x.deployment().is_none());
7116 /// assert!(x.attestation().is_none());
7117 /// assert!(x.upgrade().is_none());
7118 /// assert!(x.compliance().is_none());
7119 /// assert!(x.dsse_attestation().is_none());
7120 /// assert!(x.vulnerability_assessment().is_none());
7121 /// assert!(x.sbom_reference().is_none());
7122 /// assert!(x.secret().is_none());
7123 /// ```
7124 pub fn set_discovery<T: std::convert::Into<std::boxed::Box<crate::model::DiscoveryNote>>>(
7125 mut self,
7126 v: T,
7127 ) -> Self {
7128 self.r#type = std::option::Option::Some(crate::model::note::Type::Discovery(v.into()));
7129 self
7130 }
7131
7132 /// The value of [r#type][crate::model::Note::r#type]
7133 /// if it holds a `Attestation`, `None` if the field is not set or
7134 /// holds a different branch.
7135 pub fn attestation(
7136 &self,
7137 ) -> std::option::Option<&std::boxed::Box<crate::model::AttestationNote>> {
7138 #[allow(unreachable_patterns)]
7139 self.r#type.as_ref().and_then(|v| match v {
7140 crate::model::note::Type::Attestation(v) => std::option::Option::Some(v),
7141 _ => std::option::Option::None,
7142 })
7143 }
7144
7145 /// Sets the value of [r#type][crate::model::Note::r#type]
7146 /// to hold a `Attestation`.
7147 ///
7148 /// Note that all the setters affecting `r#type` are
7149 /// mutually exclusive.
7150 ///
7151 /// # Example
7152 /// ```ignore,no_run
7153 /// # use google_cloud_grafeas_v1::model::Note;
7154 /// use google_cloud_grafeas_v1::model::AttestationNote;
7155 /// let x = Note::new().set_attestation(AttestationNote::default()/* use setters */);
7156 /// assert!(x.attestation().is_some());
7157 /// assert!(x.vulnerability().is_none());
7158 /// assert!(x.build().is_none());
7159 /// assert!(x.image().is_none());
7160 /// assert!(x.package().is_none());
7161 /// assert!(x.deployment().is_none());
7162 /// assert!(x.discovery().is_none());
7163 /// assert!(x.upgrade().is_none());
7164 /// assert!(x.compliance().is_none());
7165 /// assert!(x.dsse_attestation().is_none());
7166 /// assert!(x.vulnerability_assessment().is_none());
7167 /// assert!(x.sbom_reference().is_none());
7168 /// assert!(x.secret().is_none());
7169 /// ```
7170 pub fn set_attestation<
7171 T: std::convert::Into<std::boxed::Box<crate::model::AttestationNote>>,
7172 >(
7173 mut self,
7174 v: T,
7175 ) -> Self {
7176 self.r#type = std::option::Option::Some(crate::model::note::Type::Attestation(v.into()));
7177 self
7178 }
7179
7180 /// The value of [r#type][crate::model::Note::r#type]
7181 /// if it holds a `Upgrade`, `None` if the field is not set or
7182 /// holds a different branch.
7183 pub fn upgrade(&self) -> std::option::Option<&std::boxed::Box<crate::model::UpgradeNote>> {
7184 #[allow(unreachable_patterns)]
7185 self.r#type.as_ref().and_then(|v| match v {
7186 crate::model::note::Type::Upgrade(v) => std::option::Option::Some(v),
7187 _ => std::option::Option::None,
7188 })
7189 }
7190
7191 /// Sets the value of [r#type][crate::model::Note::r#type]
7192 /// to hold a `Upgrade`.
7193 ///
7194 /// Note that all the setters affecting `r#type` are
7195 /// mutually exclusive.
7196 ///
7197 /// # Example
7198 /// ```ignore,no_run
7199 /// # use google_cloud_grafeas_v1::model::Note;
7200 /// use google_cloud_grafeas_v1::model::UpgradeNote;
7201 /// let x = Note::new().set_upgrade(UpgradeNote::default()/* use setters */);
7202 /// assert!(x.upgrade().is_some());
7203 /// assert!(x.vulnerability().is_none());
7204 /// assert!(x.build().is_none());
7205 /// assert!(x.image().is_none());
7206 /// assert!(x.package().is_none());
7207 /// assert!(x.deployment().is_none());
7208 /// assert!(x.discovery().is_none());
7209 /// assert!(x.attestation().is_none());
7210 /// assert!(x.compliance().is_none());
7211 /// assert!(x.dsse_attestation().is_none());
7212 /// assert!(x.vulnerability_assessment().is_none());
7213 /// assert!(x.sbom_reference().is_none());
7214 /// assert!(x.secret().is_none());
7215 /// ```
7216 pub fn set_upgrade<T: std::convert::Into<std::boxed::Box<crate::model::UpgradeNote>>>(
7217 mut self,
7218 v: T,
7219 ) -> Self {
7220 self.r#type = std::option::Option::Some(crate::model::note::Type::Upgrade(v.into()));
7221 self
7222 }
7223
7224 /// The value of [r#type][crate::model::Note::r#type]
7225 /// if it holds a `Compliance`, `None` if the field is not set or
7226 /// holds a different branch.
7227 pub fn compliance(
7228 &self,
7229 ) -> std::option::Option<&std::boxed::Box<crate::model::ComplianceNote>> {
7230 #[allow(unreachable_patterns)]
7231 self.r#type.as_ref().and_then(|v| match v {
7232 crate::model::note::Type::Compliance(v) => std::option::Option::Some(v),
7233 _ => std::option::Option::None,
7234 })
7235 }
7236
7237 /// Sets the value of [r#type][crate::model::Note::r#type]
7238 /// to hold a `Compliance`.
7239 ///
7240 /// Note that all the setters affecting `r#type` are
7241 /// mutually exclusive.
7242 ///
7243 /// # Example
7244 /// ```ignore,no_run
7245 /// # use google_cloud_grafeas_v1::model::Note;
7246 /// use google_cloud_grafeas_v1::model::ComplianceNote;
7247 /// let x = Note::new().set_compliance(ComplianceNote::default()/* use setters */);
7248 /// assert!(x.compliance().is_some());
7249 /// assert!(x.vulnerability().is_none());
7250 /// assert!(x.build().is_none());
7251 /// assert!(x.image().is_none());
7252 /// assert!(x.package().is_none());
7253 /// assert!(x.deployment().is_none());
7254 /// assert!(x.discovery().is_none());
7255 /// assert!(x.attestation().is_none());
7256 /// assert!(x.upgrade().is_none());
7257 /// assert!(x.dsse_attestation().is_none());
7258 /// assert!(x.vulnerability_assessment().is_none());
7259 /// assert!(x.sbom_reference().is_none());
7260 /// assert!(x.secret().is_none());
7261 /// ```
7262 pub fn set_compliance<T: std::convert::Into<std::boxed::Box<crate::model::ComplianceNote>>>(
7263 mut self,
7264 v: T,
7265 ) -> Self {
7266 self.r#type = std::option::Option::Some(crate::model::note::Type::Compliance(v.into()));
7267 self
7268 }
7269
7270 /// The value of [r#type][crate::model::Note::r#type]
7271 /// if it holds a `DsseAttestation`, `None` if the field is not set or
7272 /// holds a different branch.
7273 pub fn dsse_attestation(
7274 &self,
7275 ) -> std::option::Option<&std::boxed::Box<crate::model::DSSEAttestationNote>> {
7276 #[allow(unreachable_patterns)]
7277 self.r#type.as_ref().and_then(|v| match v {
7278 crate::model::note::Type::DsseAttestation(v) => std::option::Option::Some(v),
7279 _ => std::option::Option::None,
7280 })
7281 }
7282
7283 /// Sets the value of [r#type][crate::model::Note::r#type]
7284 /// to hold a `DsseAttestation`.
7285 ///
7286 /// Note that all the setters affecting `r#type` are
7287 /// mutually exclusive.
7288 ///
7289 /// # Example
7290 /// ```ignore,no_run
7291 /// # use google_cloud_grafeas_v1::model::Note;
7292 /// use google_cloud_grafeas_v1::model::DSSEAttestationNote;
7293 /// let x = Note::new().set_dsse_attestation(DSSEAttestationNote::default()/* use setters */);
7294 /// assert!(x.dsse_attestation().is_some());
7295 /// assert!(x.vulnerability().is_none());
7296 /// assert!(x.build().is_none());
7297 /// assert!(x.image().is_none());
7298 /// assert!(x.package().is_none());
7299 /// assert!(x.deployment().is_none());
7300 /// assert!(x.discovery().is_none());
7301 /// assert!(x.attestation().is_none());
7302 /// assert!(x.upgrade().is_none());
7303 /// assert!(x.compliance().is_none());
7304 /// assert!(x.vulnerability_assessment().is_none());
7305 /// assert!(x.sbom_reference().is_none());
7306 /// assert!(x.secret().is_none());
7307 /// ```
7308 pub fn set_dsse_attestation<
7309 T: std::convert::Into<std::boxed::Box<crate::model::DSSEAttestationNote>>,
7310 >(
7311 mut self,
7312 v: T,
7313 ) -> Self {
7314 self.r#type =
7315 std::option::Option::Some(crate::model::note::Type::DsseAttestation(v.into()));
7316 self
7317 }
7318
7319 /// The value of [r#type][crate::model::Note::r#type]
7320 /// if it holds a `VulnerabilityAssessment`, `None` if the field is not set or
7321 /// holds a different branch.
7322 pub fn vulnerability_assessment(
7323 &self,
7324 ) -> std::option::Option<&std::boxed::Box<crate::model::VulnerabilityAssessmentNote>> {
7325 #[allow(unreachable_patterns)]
7326 self.r#type.as_ref().and_then(|v| match v {
7327 crate::model::note::Type::VulnerabilityAssessment(v) => std::option::Option::Some(v),
7328 _ => std::option::Option::None,
7329 })
7330 }
7331
7332 /// Sets the value of [r#type][crate::model::Note::r#type]
7333 /// to hold a `VulnerabilityAssessment`.
7334 ///
7335 /// Note that all the setters affecting `r#type` are
7336 /// mutually exclusive.
7337 ///
7338 /// # Example
7339 /// ```ignore,no_run
7340 /// # use google_cloud_grafeas_v1::model::Note;
7341 /// use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
7342 /// let x = Note::new().set_vulnerability_assessment(VulnerabilityAssessmentNote::default()/* use setters */);
7343 /// assert!(x.vulnerability_assessment().is_some());
7344 /// assert!(x.vulnerability().is_none());
7345 /// assert!(x.build().is_none());
7346 /// assert!(x.image().is_none());
7347 /// assert!(x.package().is_none());
7348 /// assert!(x.deployment().is_none());
7349 /// assert!(x.discovery().is_none());
7350 /// assert!(x.attestation().is_none());
7351 /// assert!(x.upgrade().is_none());
7352 /// assert!(x.compliance().is_none());
7353 /// assert!(x.dsse_attestation().is_none());
7354 /// assert!(x.sbom_reference().is_none());
7355 /// assert!(x.secret().is_none());
7356 /// ```
7357 pub fn set_vulnerability_assessment<
7358 T: std::convert::Into<std::boxed::Box<crate::model::VulnerabilityAssessmentNote>>,
7359 >(
7360 mut self,
7361 v: T,
7362 ) -> Self {
7363 self.r#type =
7364 std::option::Option::Some(crate::model::note::Type::VulnerabilityAssessment(v.into()));
7365 self
7366 }
7367
7368 /// The value of [r#type][crate::model::Note::r#type]
7369 /// if it holds a `SbomReference`, `None` if the field is not set or
7370 /// holds a different branch.
7371 pub fn sbom_reference(
7372 &self,
7373 ) -> std::option::Option<&std::boxed::Box<crate::model::SBOMReferenceNote>> {
7374 #[allow(unreachable_patterns)]
7375 self.r#type.as_ref().and_then(|v| match v {
7376 crate::model::note::Type::SbomReference(v) => std::option::Option::Some(v),
7377 _ => std::option::Option::None,
7378 })
7379 }
7380
7381 /// Sets the value of [r#type][crate::model::Note::r#type]
7382 /// to hold a `SbomReference`.
7383 ///
7384 /// Note that all the setters affecting `r#type` are
7385 /// mutually exclusive.
7386 ///
7387 /// # Example
7388 /// ```ignore,no_run
7389 /// # use google_cloud_grafeas_v1::model::Note;
7390 /// use google_cloud_grafeas_v1::model::SBOMReferenceNote;
7391 /// let x = Note::new().set_sbom_reference(SBOMReferenceNote::default()/* use setters */);
7392 /// assert!(x.sbom_reference().is_some());
7393 /// assert!(x.vulnerability().is_none());
7394 /// assert!(x.build().is_none());
7395 /// assert!(x.image().is_none());
7396 /// assert!(x.package().is_none());
7397 /// assert!(x.deployment().is_none());
7398 /// assert!(x.discovery().is_none());
7399 /// assert!(x.attestation().is_none());
7400 /// assert!(x.upgrade().is_none());
7401 /// assert!(x.compliance().is_none());
7402 /// assert!(x.dsse_attestation().is_none());
7403 /// assert!(x.vulnerability_assessment().is_none());
7404 /// assert!(x.secret().is_none());
7405 /// ```
7406 pub fn set_sbom_reference<
7407 T: std::convert::Into<std::boxed::Box<crate::model::SBOMReferenceNote>>,
7408 >(
7409 mut self,
7410 v: T,
7411 ) -> Self {
7412 self.r#type = std::option::Option::Some(crate::model::note::Type::SbomReference(v.into()));
7413 self
7414 }
7415
7416 /// The value of [r#type][crate::model::Note::r#type]
7417 /// if it holds a `Secret`, `None` if the field is not set or
7418 /// holds a different branch.
7419 pub fn secret(&self) -> std::option::Option<&std::boxed::Box<crate::model::SecretNote>> {
7420 #[allow(unreachable_patterns)]
7421 self.r#type.as_ref().and_then(|v| match v {
7422 crate::model::note::Type::Secret(v) => std::option::Option::Some(v),
7423 _ => std::option::Option::None,
7424 })
7425 }
7426
7427 /// Sets the value of [r#type][crate::model::Note::r#type]
7428 /// to hold a `Secret`.
7429 ///
7430 /// Note that all the setters affecting `r#type` are
7431 /// mutually exclusive.
7432 ///
7433 /// # Example
7434 /// ```ignore,no_run
7435 /// # use google_cloud_grafeas_v1::model::Note;
7436 /// use google_cloud_grafeas_v1::model::SecretNote;
7437 /// let x = Note::new().set_secret(SecretNote::default()/* use setters */);
7438 /// assert!(x.secret().is_some());
7439 /// assert!(x.vulnerability().is_none());
7440 /// assert!(x.build().is_none());
7441 /// assert!(x.image().is_none());
7442 /// assert!(x.package().is_none());
7443 /// assert!(x.deployment().is_none());
7444 /// assert!(x.discovery().is_none());
7445 /// assert!(x.attestation().is_none());
7446 /// assert!(x.upgrade().is_none());
7447 /// assert!(x.compliance().is_none());
7448 /// assert!(x.dsse_attestation().is_none());
7449 /// assert!(x.vulnerability_assessment().is_none());
7450 /// assert!(x.sbom_reference().is_none());
7451 /// ```
7452 pub fn set_secret<T: std::convert::Into<std::boxed::Box<crate::model::SecretNote>>>(
7453 mut self,
7454 v: T,
7455 ) -> Self {
7456 self.r#type = std::option::Option::Some(crate::model::note::Type::Secret(v.into()));
7457 self
7458 }
7459}
7460
7461impl wkt::message::Message for Note {
7462 fn typename() -> &'static str {
7463 "type.googleapis.com/grafeas.v1.Note"
7464 }
7465}
7466
7467/// Defines additional types related to [Note].
7468pub mod note {
7469 #[allow(unused_imports)]
7470 use super::*;
7471
7472 /// Required. Immutable. The type of analysis this note represents.
7473 #[derive(Clone, Debug, PartialEq)]
7474 #[non_exhaustive]
7475 pub enum Type {
7476 /// A note describing a package vulnerability.
7477 Vulnerability(std::boxed::Box<crate::model::VulnerabilityNote>),
7478 /// A note describing build provenance for a verifiable build.
7479 Build(std::boxed::Box<crate::model::BuildNote>),
7480 /// A note describing a base image.
7481 Image(std::boxed::Box<crate::model::ImageNote>),
7482 /// A note describing a package hosted by various package managers.
7483 Package(std::boxed::Box<crate::model::PackageNote>),
7484 /// A note describing something that can be deployed.
7485 Deployment(std::boxed::Box<crate::model::DeploymentNote>),
7486 /// A note describing the initial analysis of a resource.
7487 Discovery(std::boxed::Box<crate::model::DiscoveryNote>),
7488 /// A note describing an attestation role.
7489 Attestation(std::boxed::Box<crate::model::AttestationNote>),
7490 /// A note describing available package upgrades.
7491 Upgrade(std::boxed::Box<crate::model::UpgradeNote>),
7492 /// A note describing a compliance check.
7493 Compliance(std::boxed::Box<crate::model::ComplianceNote>),
7494 /// A note describing a dsse attestation note.
7495 DsseAttestation(std::boxed::Box<crate::model::DSSEAttestationNote>),
7496 /// A note describing a vulnerability assessment.
7497 VulnerabilityAssessment(std::boxed::Box<crate::model::VulnerabilityAssessmentNote>),
7498 /// A note describing an SBOM reference.
7499 SbomReference(std::boxed::Box<crate::model::SBOMReferenceNote>),
7500 /// A note describing a secret.
7501 Secret(std::boxed::Box<crate::model::SecretNote>),
7502 }
7503}
7504
7505/// Request to get an occurrence.
7506#[derive(Clone, Default, PartialEq)]
7507#[non_exhaustive]
7508pub struct GetOccurrenceRequest {
7509 /// The name of the occurrence in the form of
7510 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7511 pub name: std::string::String,
7512
7513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7514}
7515
7516impl GetOccurrenceRequest {
7517 pub fn new() -> Self {
7518 std::default::Default::default()
7519 }
7520
7521 /// Sets the value of [name][crate::model::GetOccurrenceRequest::name].
7522 ///
7523 /// # Example
7524 /// ```ignore,no_run
7525 /// # use google_cloud_grafeas_v1::model::GetOccurrenceRequest;
7526 /// let x = GetOccurrenceRequest::new().set_name("example");
7527 /// ```
7528 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7529 self.name = v.into();
7530 self
7531 }
7532}
7533
7534impl wkt::message::Message for GetOccurrenceRequest {
7535 fn typename() -> &'static str {
7536 "type.googleapis.com/grafeas.v1.GetOccurrenceRequest"
7537 }
7538}
7539
7540/// Request to list occurrences.
7541#[derive(Clone, Default, PartialEq)]
7542#[non_exhaustive]
7543pub struct ListOccurrencesRequest {
7544 /// The name of the project to list occurrences for in the form of
7545 /// `projects/[PROJECT_ID]`.
7546 pub parent: std::string::String,
7547
7548 /// The filter expression.
7549 pub filter: std::string::String,
7550
7551 /// Number of occurrences to return in the list. Must be positive. Max allowed
7552 /// page size is 1000. If not specified, page size defaults to 20.
7553 pub page_size: i32,
7554
7555 /// Token to provide to skip to a particular spot in the list.
7556 pub page_token: std::string::String,
7557
7558 /// If set, the request will return all reachable Occurrences
7559 /// and report all unreachable regions in the `unreachable` field in
7560 /// the response.
7561 ///
7562 /// Only applicable for requests in the global region.
7563 pub return_partial_success: bool,
7564
7565 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7566}
7567
7568impl ListOccurrencesRequest {
7569 pub fn new() -> Self {
7570 std::default::Default::default()
7571 }
7572
7573 /// Sets the value of [parent][crate::model::ListOccurrencesRequest::parent].
7574 ///
7575 /// # Example
7576 /// ```ignore,no_run
7577 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7578 /// let x = ListOccurrencesRequest::new().set_parent("example");
7579 /// ```
7580 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7581 self.parent = v.into();
7582 self
7583 }
7584
7585 /// Sets the value of [filter][crate::model::ListOccurrencesRequest::filter].
7586 ///
7587 /// # Example
7588 /// ```ignore,no_run
7589 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7590 /// let x = ListOccurrencesRequest::new().set_filter("example");
7591 /// ```
7592 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7593 self.filter = v.into();
7594 self
7595 }
7596
7597 /// Sets the value of [page_size][crate::model::ListOccurrencesRequest::page_size].
7598 ///
7599 /// # Example
7600 /// ```ignore,no_run
7601 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7602 /// let x = ListOccurrencesRequest::new().set_page_size(42);
7603 /// ```
7604 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7605 self.page_size = v.into();
7606 self
7607 }
7608
7609 /// Sets the value of [page_token][crate::model::ListOccurrencesRequest::page_token].
7610 ///
7611 /// # Example
7612 /// ```ignore,no_run
7613 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7614 /// let x = ListOccurrencesRequest::new().set_page_token("example");
7615 /// ```
7616 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7617 self.page_token = v.into();
7618 self
7619 }
7620
7621 /// Sets the value of [return_partial_success][crate::model::ListOccurrencesRequest::return_partial_success].
7622 ///
7623 /// # Example
7624 /// ```ignore,no_run
7625 /// # use google_cloud_grafeas_v1::model::ListOccurrencesRequest;
7626 /// let x = ListOccurrencesRequest::new().set_return_partial_success(true);
7627 /// ```
7628 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7629 self.return_partial_success = v.into();
7630 self
7631 }
7632}
7633
7634impl wkt::message::Message for ListOccurrencesRequest {
7635 fn typename() -> &'static str {
7636 "type.googleapis.com/grafeas.v1.ListOccurrencesRequest"
7637 }
7638}
7639
7640/// Response for listing occurrences.
7641#[derive(Clone, Default, PartialEq)]
7642#[non_exhaustive]
7643pub struct ListOccurrencesResponse {
7644 /// The occurrences requested.
7645 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
7646
7647 /// The next pagination token in the list response. It should be used as
7648 /// `page_token` for the following request. An empty value means no more
7649 /// results.
7650 pub next_page_token: std::string::String,
7651
7652 /// Unreachable regions. Populated for requests from the global region
7653 /// when `return_partial_success` is set.
7654 ///
7655 /// Format: `projects/[PROJECT_ID]/locations/[LOCATION]`
7656 pub unreachable: std::vec::Vec<std::string::String>,
7657
7658 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7659}
7660
7661impl ListOccurrencesResponse {
7662 pub fn new() -> Self {
7663 std::default::Default::default()
7664 }
7665
7666 /// Sets the value of [occurrences][crate::model::ListOccurrencesResponse::occurrences].
7667 ///
7668 /// # Example
7669 /// ```ignore,no_run
7670 /// # use google_cloud_grafeas_v1::model::ListOccurrencesResponse;
7671 /// use google_cloud_grafeas_v1::model::Occurrence;
7672 /// let x = ListOccurrencesResponse::new()
7673 /// .set_occurrences([
7674 /// Occurrence::default()/* use setters */,
7675 /// Occurrence::default()/* use (different) setters */,
7676 /// ]);
7677 /// ```
7678 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
7679 where
7680 T: std::iter::IntoIterator<Item = V>,
7681 V: std::convert::Into<crate::model::Occurrence>,
7682 {
7683 use std::iter::Iterator;
7684 self.occurrences = v.into_iter().map(|i| i.into()).collect();
7685 self
7686 }
7687
7688 /// Sets the value of [next_page_token][crate::model::ListOccurrencesResponse::next_page_token].
7689 ///
7690 /// # Example
7691 /// ```ignore,no_run
7692 /// # use google_cloud_grafeas_v1::model::ListOccurrencesResponse;
7693 /// let x = ListOccurrencesResponse::new().set_next_page_token("example");
7694 /// ```
7695 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7696 self.next_page_token = v.into();
7697 self
7698 }
7699
7700 /// Sets the value of [unreachable][crate::model::ListOccurrencesResponse::unreachable].
7701 ///
7702 /// # Example
7703 /// ```ignore,no_run
7704 /// # use google_cloud_grafeas_v1::model::ListOccurrencesResponse;
7705 /// let x = ListOccurrencesResponse::new().set_unreachable(["a", "b", "c"]);
7706 /// ```
7707 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
7708 where
7709 T: std::iter::IntoIterator<Item = V>,
7710 V: std::convert::Into<std::string::String>,
7711 {
7712 use std::iter::Iterator;
7713 self.unreachable = v.into_iter().map(|i| i.into()).collect();
7714 self
7715 }
7716}
7717
7718impl wkt::message::Message for ListOccurrencesResponse {
7719 fn typename() -> &'static str {
7720 "type.googleapis.com/grafeas.v1.ListOccurrencesResponse"
7721 }
7722}
7723
7724#[doc(hidden)]
7725impl google_cloud_gax::paginator::internal::PageableResponse for ListOccurrencesResponse {
7726 type PageItem = crate::model::Occurrence;
7727
7728 fn items(self) -> std::vec::Vec<Self::PageItem> {
7729 self.occurrences
7730 }
7731
7732 fn next_page_token(&self) -> std::string::String {
7733 use std::clone::Clone;
7734 self.next_page_token.clone()
7735 }
7736}
7737
7738/// Request to delete an occurrence.
7739#[derive(Clone, Default, PartialEq)]
7740#[non_exhaustive]
7741pub struct DeleteOccurrenceRequest {
7742 /// The name of the occurrence in the form of
7743 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7744 pub name: std::string::String,
7745
7746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7747}
7748
7749impl DeleteOccurrenceRequest {
7750 pub fn new() -> Self {
7751 std::default::Default::default()
7752 }
7753
7754 /// Sets the value of [name][crate::model::DeleteOccurrenceRequest::name].
7755 ///
7756 /// # Example
7757 /// ```ignore,no_run
7758 /// # use google_cloud_grafeas_v1::model::DeleteOccurrenceRequest;
7759 /// let x = DeleteOccurrenceRequest::new().set_name("example");
7760 /// ```
7761 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7762 self.name = v.into();
7763 self
7764 }
7765}
7766
7767impl wkt::message::Message for DeleteOccurrenceRequest {
7768 fn typename() -> &'static str {
7769 "type.googleapis.com/grafeas.v1.DeleteOccurrenceRequest"
7770 }
7771}
7772
7773/// Request to create a new occurrence.
7774#[derive(Clone, Default, PartialEq)]
7775#[non_exhaustive]
7776pub struct CreateOccurrenceRequest {
7777 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
7778 /// the occurrence is to be created.
7779 pub parent: std::string::String,
7780
7781 /// The occurrence to create.
7782 pub occurrence: std::option::Option<crate::model::Occurrence>,
7783
7784 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7785}
7786
7787impl CreateOccurrenceRequest {
7788 pub fn new() -> Self {
7789 std::default::Default::default()
7790 }
7791
7792 /// Sets the value of [parent][crate::model::CreateOccurrenceRequest::parent].
7793 ///
7794 /// # Example
7795 /// ```ignore,no_run
7796 /// # use google_cloud_grafeas_v1::model::CreateOccurrenceRequest;
7797 /// let x = CreateOccurrenceRequest::new().set_parent("example");
7798 /// ```
7799 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7800 self.parent = v.into();
7801 self
7802 }
7803
7804 /// Sets the value of [occurrence][crate::model::CreateOccurrenceRequest::occurrence].
7805 ///
7806 /// # Example
7807 /// ```ignore,no_run
7808 /// # use google_cloud_grafeas_v1::model::CreateOccurrenceRequest;
7809 /// use google_cloud_grafeas_v1::model::Occurrence;
7810 /// let x = CreateOccurrenceRequest::new().set_occurrence(Occurrence::default()/* use setters */);
7811 /// ```
7812 pub fn set_occurrence<T>(mut self, v: T) -> Self
7813 where
7814 T: std::convert::Into<crate::model::Occurrence>,
7815 {
7816 self.occurrence = std::option::Option::Some(v.into());
7817 self
7818 }
7819
7820 /// Sets or clears the value of [occurrence][crate::model::CreateOccurrenceRequest::occurrence].
7821 ///
7822 /// # Example
7823 /// ```ignore,no_run
7824 /// # use google_cloud_grafeas_v1::model::CreateOccurrenceRequest;
7825 /// use google_cloud_grafeas_v1::model::Occurrence;
7826 /// let x = CreateOccurrenceRequest::new().set_or_clear_occurrence(Some(Occurrence::default()/* use setters */));
7827 /// let x = CreateOccurrenceRequest::new().set_or_clear_occurrence(None::<Occurrence>);
7828 /// ```
7829 pub fn set_or_clear_occurrence<T>(mut self, v: std::option::Option<T>) -> Self
7830 where
7831 T: std::convert::Into<crate::model::Occurrence>,
7832 {
7833 self.occurrence = v.map(|x| x.into());
7834 self
7835 }
7836}
7837
7838impl wkt::message::Message for CreateOccurrenceRequest {
7839 fn typename() -> &'static str {
7840 "type.googleapis.com/grafeas.v1.CreateOccurrenceRequest"
7841 }
7842}
7843
7844/// Request to update an occurrence.
7845#[derive(Clone, Default, PartialEq)]
7846#[non_exhaustive]
7847pub struct UpdateOccurrenceRequest {
7848 /// The name of the occurrence in the form of
7849 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7850 pub name: std::string::String,
7851
7852 /// The updated occurrence.
7853 pub occurrence: std::option::Option<crate::model::Occurrence>,
7854
7855 /// The fields to update.
7856 pub update_mask: std::option::Option<wkt::FieldMask>,
7857
7858 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7859}
7860
7861impl UpdateOccurrenceRequest {
7862 pub fn new() -> Self {
7863 std::default::Default::default()
7864 }
7865
7866 /// Sets the value of [name][crate::model::UpdateOccurrenceRequest::name].
7867 ///
7868 /// # Example
7869 /// ```ignore,no_run
7870 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7871 /// let x = UpdateOccurrenceRequest::new().set_name("example");
7872 /// ```
7873 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7874 self.name = v.into();
7875 self
7876 }
7877
7878 /// Sets the value of [occurrence][crate::model::UpdateOccurrenceRequest::occurrence].
7879 ///
7880 /// # Example
7881 /// ```ignore,no_run
7882 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7883 /// use google_cloud_grafeas_v1::model::Occurrence;
7884 /// let x = UpdateOccurrenceRequest::new().set_occurrence(Occurrence::default()/* use setters */);
7885 /// ```
7886 pub fn set_occurrence<T>(mut self, v: T) -> Self
7887 where
7888 T: std::convert::Into<crate::model::Occurrence>,
7889 {
7890 self.occurrence = std::option::Option::Some(v.into());
7891 self
7892 }
7893
7894 /// Sets or clears the value of [occurrence][crate::model::UpdateOccurrenceRequest::occurrence].
7895 ///
7896 /// # Example
7897 /// ```ignore,no_run
7898 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7899 /// use google_cloud_grafeas_v1::model::Occurrence;
7900 /// let x = UpdateOccurrenceRequest::new().set_or_clear_occurrence(Some(Occurrence::default()/* use setters */));
7901 /// let x = UpdateOccurrenceRequest::new().set_or_clear_occurrence(None::<Occurrence>);
7902 /// ```
7903 pub fn set_or_clear_occurrence<T>(mut self, v: std::option::Option<T>) -> Self
7904 where
7905 T: std::convert::Into<crate::model::Occurrence>,
7906 {
7907 self.occurrence = v.map(|x| x.into());
7908 self
7909 }
7910
7911 /// Sets the value of [update_mask][crate::model::UpdateOccurrenceRequest::update_mask].
7912 ///
7913 /// # Example
7914 /// ```ignore,no_run
7915 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7916 /// use wkt::FieldMask;
7917 /// let x = UpdateOccurrenceRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7918 /// ```
7919 pub fn set_update_mask<T>(mut self, v: T) -> Self
7920 where
7921 T: std::convert::Into<wkt::FieldMask>,
7922 {
7923 self.update_mask = std::option::Option::Some(v.into());
7924 self
7925 }
7926
7927 /// Sets or clears the value of [update_mask][crate::model::UpdateOccurrenceRequest::update_mask].
7928 ///
7929 /// # Example
7930 /// ```ignore,no_run
7931 /// # use google_cloud_grafeas_v1::model::UpdateOccurrenceRequest;
7932 /// use wkt::FieldMask;
7933 /// let x = UpdateOccurrenceRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7934 /// let x = UpdateOccurrenceRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7935 /// ```
7936 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7937 where
7938 T: std::convert::Into<wkt::FieldMask>,
7939 {
7940 self.update_mask = v.map(|x| x.into());
7941 self
7942 }
7943}
7944
7945impl wkt::message::Message for UpdateOccurrenceRequest {
7946 fn typename() -> &'static str {
7947 "type.googleapis.com/grafeas.v1.UpdateOccurrenceRequest"
7948 }
7949}
7950
7951/// Request to get a note.
7952#[derive(Clone, Default, PartialEq)]
7953#[non_exhaustive]
7954pub struct GetNoteRequest {
7955 /// The name of the note in the form of
7956 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
7957 pub name: std::string::String,
7958
7959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7960}
7961
7962impl GetNoteRequest {
7963 pub fn new() -> Self {
7964 std::default::Default::default()
7965 }
7966
7967 /// Sets the value of [name][crate::model::GetNoteRequest::name].
7968 ///
7969 /// # Example
7970 /// ```ignore,no_run
7971 /// # use google_cloud_grafeas_v1::model::GetNoteRequest;
7972 /// let x = GetNoteRequest::new().set_name("example");
7973 /// ```
7974 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7975 self.name = v.into();
7976 self
7977 }
7978}
7979
7980impl wkt::message::Message for GetNoteRequest {
7981 fn typename() -> &'static str {
7982 "type.googleapis.com/grafeas.v1.GetNoteRequest"
7983 }
7984}
7985
7986/// Request to get the note to which the specified occurrence is attached.
7987#[derive(Clone, Default, PartialEq)]
7988#[non_exhaustive]
7989pub struct GetOccurrenceNoteRequest {
7990 /// The name of the occurrence in the form of
7991 /// `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
7992 pub name: std::string::String,
7993
7994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7995}
7996
7997impl GetOccurrenceNoteRequest {
7998 pub fn new() -> Self {
7999 std::default::Default::default()
8000 }
8001
8002 /// Sets the value of [name][crate::model::GetOccurrenceNoteRequest::name].
8003 ///
8004 /// # Example
8005 /// ```ignore,no_run
8006 /// # use google_cloud_grafeas_v1::model::GetOccurrenceNoteRequest;
8007 /// let x = GetOccurrenceNoteRequest::new().set_name("example");
8008 /// ```
8009 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8010 self.name = v.into();
8011 self
8012 }
8013}
8014
8015impl wkt::message::Message for GetOccurrenceNoteRequest {
8016 fn typename() -> &'static str {
8017 "type.googleapis.com/grafeas.v1.GetOccurrenceNoteRequest"
8018 }
8019}
8020
8021/// Request to list notes.
8022#[derive(Clone, Default, PartialEq)]
8023#[non_exhaustive]
8024pub struct ListNotesRequest {
8025 /// The name of the project to list notes for in the form of
8026 /// `projects/[PROJECT_ID]`.
8027 pub parent: std::string::String,
8028
8029 /// The filter expression.
8030 pub filter: std::string::String,
8031
8032 /// Number of notes to return in the list. Must be positive. Max allowed page
8033 /// size is 1000. If not specified, page size defaults to 20.
8034 pub page_size: i32,
8035
8036 /// Token to provide to skip to a particular spot in the list.
8037 pub page_token: std::string::String,
8038
8039 /// If set, the request will return all reachable Notes
8040 /// and report all unreachable regions in the `unreachable` field in
8041 /// the response.
8042 ///
8043 /// Only applicable for requests in the global region.
8044 pub return_partial_success: bool,
8045
8046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8047}
8048
8049impl ListNotesRequest {
8050 pub fn new() -> Self {
8051 std::default::Default::default()
8052 }
8053
8054 /// Sets the value of [parent][crate::model::ListNotesRequest::parent].
8055 ///
8056 /// # Example
8057 /// ```ignore,no_run
8058 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8059 /// let x = ListNotesRequest::new().set_parent("example");
8060 /// ```
8061 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8062 self.parent = v.into();
8063 self
8064 }
8065
8066 /// Sets the value of [filter][crate::model::ListNotesRequest::filter].
8067 ///
8068 /// # Example
8069 /// ```ignore,no_run
8070 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8071 /// let x = ListNotesRequest::new().set_filter("example");
8072 /// ```
8073 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8074 self.filter = v.into();
8075 self
8076 }
8077
8078 /// Sets the value of [page_size][crate::model::ListNotesRequest::page_size].
8079 ///
8080 /// # Example
8081 /// ```ignore,no_run
8082 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8083 /// let x = ListNotesRequest::new().set_page_size(42);
8084 /// ```
8085 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8086 self.page_size = v.into();
8087 self
8088 }
8089
8090 /// Sets the value of [page_token][crate::model::ListNotesRequest::page_token].
8091 ///
8092 /// # Example
8093 /// ```ignore,no_run
8094 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8095 /// let x = ListNotesRequest::new().set_page_token("example");
8096 /// ```
8097 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8098 self.page_token = v.into();
8099 self
8100 }
8101
8102 /// Sets the value of [return_partial_success][crate::model::ListNotesRequest::return_partial_success].
8103 ///
8104 /// # Example
8105 /// ```ignore,no_run
8106 /// # use google_cloud_grafeas_v1::model::ListNotesRequest;
8107 /// let x = ListNotesRequest::new().set_return_partial_success(true);
8108 /// ```
8109 pub fn set_return_partial_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8110 self.return_partial_success = v.into();
8111 self
8112 }
8113}
8114
8115impl wkt::message::Message for ListNotesRequest {
8116 fn typename() -> &'static str {
8117 "type.googleapis.com/grafeas.v1.ListNotesRequest"
8118 }
8119}
8120
8121/// Response for listing notes.
8122#[derive(Clone, Default, PartialEq)]
8123#[non_exhaustive]
8124pub struct ListNotesResponse {
8125 /// The notes requested.
8126 pub notes: std::vec::Vec<crate::model::Note>,
8127
8128 /// The next pagination token in the list response. It should be used as
8129 /// `page_token` for the following request. An empty value means no more
8130 /// results.
8131 pub next_page_token: std::string::String,
8132
8133 /// Unreachable regions. Populated for requests from the global region
8134 /// when `return_partial_success` is set.
8135 ///
8136 /// Format: `projects/[PROJECT_ID]/locations/[LOCATION]`
8137 pub unreachable: std::vec::Vec<std::string::String>,
8138
8139 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8140}
8141
8142impl ListNotesResponse {
8143 pub fn new() -> Self {
8144 std::default::Default::default()
8145 }
8146
8147 /// Sets the value of [notes][crate::model::ListNotesResponse::notes].
8148 ///
8149 /// # Example
8150 /// ```ignore,no_run
8151 /// # use google_cloud_grafeas_v1::model::ListNotesResponse;
8152 /// use google_cloud_grafeas_v1::model::Note;
8153 /// let x = ListNotesResponse::new()
8154 /// .set_notes([
8155 /// Note::default()/* use setters */,
8156 /// Note::default()/* use (different) setters */,
8157 /// ]);
8158 /// ```
8159 pub fn set_notes<T, V>(mut self, v: T) -> Self
8160 where
8161 T: std::iter::IntoIterator<Item = V>,
8162 V: std::convert::Into<crate::model::Note>,
8163 {
8164 use std::iter::Iterator;
8165 self.notes = v.into_iter().map(|i| i.into()).collect();
8166 self
8167 }
8168
8169 /// Sets the value of [next_page_token][crate::model::ListNotesResponse::next_page_token].
8170 ///
8171 /// # Example
8172 /// ```ignore,no_run
8173 /// # use google_cloud_grafeas_v1::model::ListNotesResponse;
8174 /// let x = ListNotesResponse::new().set_next_page_token("example");
8175 /// ```
8176 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8177 self.next_page_token = v.into();
8178 self
8179 }
8180
8181 /// Sets the value of [unreachable][crate::model::ListNotesResponse::unreachable].
8182 ///
8183 /// # Example
8184 /// ```ignore,no_run
8185 /// # use google_cloud_grafeas_v1::model::ListNotesResponse;
8186 /// let x = ListNotesResponse::new().set_unreachable(["a", "b", "c"]);
8187 /// ```
8188 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
8189 where
8190 T: std::iter::IntoIterator<Item = V>,
8191 V: std::convert::Into<std::string::String>,
8192 {
8193 use std::iter::Iterator;
8194 self.unreachable = v.into_iter().map(|i| i.into()).collect();
8195 self
8196 }
8197}
8198
8199impl wkt::message::Message for ListNotesResponse {
8200 fn typename() -> &'static str {
8201 "type.googleapis.com/grafeas.v1.ListNotesResponse"
8202 }
8203}
8204
8205#[doc(hidden)]
8206impl google_cloud_gax::paginator::internal::PageableResponse for ListNotesResponse {
8207 type PageItem = crate::model::Note;
8208
8209 fn items(self) -> std::vec::Vec<Self::PageItem> {
8210 self.notes
8211 }
8212
8213 fn next_page_token(&self) -> std::string::String {
8214 use std::clone::Clone;
8215 self.next_page_token.clone()
8216 }
8217}
8218
8219/// Request to delete a note.
8220#[derive(Clone, Default, PartialEq)]
8221#[non_exhaustive]
8222pub struct DeleteNoteRequest {
8223 /// The name of the note in the form of
8224 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
8225 pub name: std::string::String,
8226
8227 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8228}
8229
8230impl DeleteNoteRequest {
8231 pub fn new() -> Self {
8232 std::default::Default::default()
8233 }
8234
8235 /// Sets the value of [name][crate::model::DeleteNoteRequest::name].
8236 ///
8237 /// # Example
8238 /// ```ignore,no_run
8239 /// # use google_cloud_grafeas_v1::model::DeleteNoteRequest;
8240 /// let x = DeleteNoteRequest::new().set_name("example");
8241 /// ```
8242 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8243 self.name = v.into();
8244 self
8245 }
8246}
8247
8248impl wkt::message::Message for DeleteNoteRequest {
8249 fn typename() -> &'static str {
8250 "type.googleapis.com/grafeas.v1.DeleteNoteRequest"
8251 }
8252}
8253
8254/// Request to create a new note.
8255#[derive(Clone, Default, PartialEq)]
8256#[non_exhaustive]
8257pub struct CreateNoteRequest {
8258 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
8259 /// the note is to be created.
8260 pub parent: std::string::String,
8261
8262 /// The ID to use for this note.
8263 pub note_id: std::string::String,
8264
8265 /// The note to create.
8266 pub note: std::option::Option<crate::model::Note>,
8267
8268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8269}
8270
8271impl CreateNoteRequest {
8272 pub fn new() -> Self {
8273 std::default::Default::default()
8274 }
8275
8276 /// Sets the value of [parent][crate::model::CreateNoteRequest::parent].
8277 ///
8278 /// # Example
8279 /// ```ignore,no_run
8280 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8281 /// let x = CreateNoteRequest::new().set_parent("example");
8282 /// ```
8283 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8284 self.parent = v.into();
8285 self
8286 }
8287
8288 /// Sets the value of [note_id][crate::model::CreateNoteRequest::note_id].
8289 ///
8290 /// # Example
8291 /// ```ignore,no_run
8292 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8293 /// let x = CreateNoteRequest::new().set_note_id("example");
8294 /// ```
8295 pub fn set_note_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8296 self.note_id = v.into();
8297 self
8298 }
8299
8300 /// Sets the value of [note][crate::model::CreateNoteRequest::note].
8301 ///
8302 /// # Example
8303 /// ```ignore,no_run
8304 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8305 /// use google_cloud_grafeas_v1::model::Note;
8306 /// let x = CreateNoteRequest::new().set_note(Note::default()/* use setters */);
8307 /// ```
8308 pub fn set_note<T>(mut self, v: T) -> Self
8309 where
8310 T: std::convert::Into<crate::model::Note>,
8311 {
8312 self.note = std::option::Option::Some(v.into());
8313 self
8314 }
8315
8316 /// Sets or clears the value of [note][crate::model::CreateNoteRequest::note].
8317 ///
8318 /// # Example
8319 /// ```ignore,no_run
8320 /// # use google_cloud_grafeas_v1::model::CreateNoteRequest;
8321 /// use google_cloud_grafeas_v1::model::Note;
8322 /// let x = CreateNoteRequest::new().set_or_clear_note(Some(Note::default()/* use setters */));
8323 /// let x = CreateNoteRequest::new().set_or_clear_note(None::<Note>);
8324 /// ```
8325 pub fn set_or_clear_note<T>(mut self, v: std::option::Option<T>) -> Self
8326 where
8327 T: std::convert::Into<crate::model::Note>,
8328 {
8329 self.note = v.map(|x| x.into());
8330 self
8331 }
8332}
8333
8334impl wkt::message::Message for CreateNoteRequest {
8335 fn typename() -> &'static str {
8336 "type.googleapis.com/grafeas.v1.CreateNoteRequest"
8337 }
8338}
8339
8340/// Request to update a note.
8341#[derive(Clone, Default, PartialEq)]
8342#[non_exhaustive]
8343pub struct UpdateNoteRequest {
8344 /// The name of the note in the form of
8345 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
8346 pub name: std::string::String,
8347
8348 /// The updated note.
8349 pub note: std::option::Option<crate::model::Note>,
8350
8351 /// The fields to update.
8352 pub update_mask: std::option::Option<wkt::FieldMask>,
8353
8354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8355}
8356
8357impl UpdateNoteRequest {
8358 pub fn new() -> Self {
8359 std::default::Default::default()
8360 }
8361
8362 /// Sets the value of [name][crate::model::UpdateNoteRequest::name].
8363 ///
8364 /// # Example
8365 /// ```ignore,no_run
8366 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8367 /// let x = UpdateNoteRequest::new().set_name("example");
8368 /// ```
8369 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8370 self.name = v.into();
8371 self
8372 }
8373
8374 /// Sets the value of [note][crate::model::UpdateNoteRequest::note].
8375 ///
8376 /// # Example
8377 /// ```ignore,no_run
8378 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8379 /// use google_cloud_grafeas_v1::model::Note;
8380 /// let x = UpdateNoteRequest::new().set_note(Note::default()/* use setters */);
8381 /// ```
8382 pub fn set_note<T>(mut self, v: T) -> Self
8383 where
8384 T: std::convert::Into<crate::model::Note>,
8385 {
8386 self.note = std::option::Option::Some(v.into());
8387 self
8388 }
8389
8390 /// Sets or clears the value of [note][crate::model::UpdateNoteRequest::note].
8391 ///
8392 /// # Example
8393 /// ```ignore,no_run
8394 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8395 /// use google_cloud_grafeas_v1::model::Note;
8396 /// let x = UpdateNoteRequest::new().set_or_clear_note(Some(Note::default()/* use setters */));
8397 /// let x = UpdateNoteRequest::new().set_or_clear_note(None::<Note>);
8398 /// ```
8399 pub fn set_or_clear_note<T>(mut self, v: std::option::Option<T>) -> Self
8400 where
8401 T: std::convert::Into<crate::model::Note>,
8402 {
8403 self.note = v.map(|x| x.into());
8404 self
8405 }
8406
8407 /// Sets the value of [update_mask][crate::model::UpdateNoteRequest::update_mask].
8408 ///
8409 /// # Example
8410 /// ```ignore,no_run
8411 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8412 /// use wkt::FieldMask;
8413 /// let x = UpdateNoteRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8414 /// ```
8415 pub fn set_update_mask<T>(mut self, v: T) -> Self
8416 where
8417 T: std::convert::Into<wkt::FieldMask>,
8418 {
8419 self.update_mask = std::option::Option::Some(v.into());
8420 self
8421 }
8422
8423 /// Sets or clears the value of [update_mask][crate::model::UpdateNoteRequest::update_mask].
8424 ///
8425 /// # Example
8426 /// ```ignore,no_run
8427 /// # use google_cloud_grafeas_v1::model::UpdateNoteRequest;
8428 /// use wkt::FieldMask;
8429 /// let x = UpdateNoteRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8430 /// let x = UpdateNoteRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8431 /// ```
8432 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8433 where
8434 T: std::convert::Into<wkt::FieldMask>,
8435 {
8436 self.update_mask = v.map(|x| x.into());
8437 self
8438 }
8439}
8440
8441impl wkt::message::Message for UpdateNoteRequest {
8442 fn typename() -> &'static str {
8443 "type.googleapis.com/grafeas.v1.UpdateNoteRequest"
8444 }
8445}
8446
8447/// Request to list occurrences for a note.
8448#[derive(Clone, Default, PartialEq)]
8449#[non_exhaustive]
8450pub struct ListNoteOccurrencesRequest {
8451 /// The name of the note to list occurrences for in the form of
8452 /// `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
8453 pub name: std::string::String,
8454
8455 /// The filter expression.
8456 pub filter: std::string::String,
8457
8458 /// Number of occurrences to return in the list.
8459 pub page_size: i32,
8460
8461 /// Token to provide to skip to a particular spot in the list.
8462 pub page_token: std::string::String,
8463
8464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8465}
8466
8467impl ListNoteOccurrencesRequest {
8468 pub fn new() -> Self {
8469 std::default::Default::default()
8470 }
8471
8472 /// Sets the value of [name][crate::model::ListNoteOccurrencesRequest::name].
8473 ///
8474 /// # Example
8475 /// ```ignore,no_run
8476 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8477 /// let x = ListNoteOccurrencesRequest::new().set_name("example");
8478 /// ```
8479 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8480 self.name = v.into();
8481 self
8482 }
8483
8484 /// Sets the value of [filter][crate::model::ListNoteOccurrencesRequest::filter].
8485 ///
8486 /// # Example
8487 /// ```ignore,no_run
8488 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8489 /// let x = ListNoteOccurrencesRequest::new().set_filter("example");
8490 /// ```
8491 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8492 self.filter = v.into();
8493 self
8494 }
8495
8496 /// Sets the value of [page_size][crate::model::ListNoteOccurrencesRequest::page_size].
8497 ///
8498 /// # Example
8499 /// ```ignore,no_run
8500 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8501 /// let x = ListNoteOccurrencesRequest::new().set_page_size(42);
8502 /// ```
8503 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8504 self.page_size = v.into();
8505 self
8506 }
8507
8508 /// Sets the value of [page_token][crate::model::ListNoteOccurrencesRequest::page_token].
8509 ///
8510 /// # Example
8511 /// ```ignore,no_run
8512 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesRequest;
8513 /// let x = ListNoteOccurrencesRequest::new().set_page_token("example");
8514 /// ```
8515 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8516 self.page_token = v.into();
8517 self
8518 }
8519}
8520
8521impl wkt::message::Message for ListNoteOccurrencesRequest {
8522 fn typename() -> &'static str {
8523 "type.googleapis.com/grafeas.v1.ListNoteOccurrencesRequest"
8524 }
8525}
8526
8527/// Response for listing occurrences for a note.
8528#[derive(Clone, Default, PartialEq)]
8529#[non_exhaustive]
8530pub struct ListNoteOccurrencesResponse {
8531 /// The occurrences attached to the specified note.
8532 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
8533
8534 /// Token to provide to skip to a particular spot in the list.
8535 pub next_page_token: std::string::String,
8536
8537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8538}
8539
8540impl ListNoteOccurrencesResponse {
8541 pub fn new() -> Self {
8542 std::default::Default::default()
8543 }
8544
8545 /// Sets the value of [occurrences][crate::model::ListNoteOccurrencesResponse::occurrences].
8546 ///
8547 /// # Example
8548 /// ```ignore,no_run
8549 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesResponse;
8550 /// use google_cloud_grafeas_v1::model::Occurrence;
8551 /// let x = ListNoteOccurrencesResponse::new()
8552 /// .set_occurrences([
8553 /// Occurrence::default()/* use setters */,
8554 /// Occurrence::default()/* use (different) setters */,
8555 /// ]);
8556 /// ```
8557 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
8558 where
8559 T: std::iter::IntoIterator<Item = V>,
8560 V: std::convert::Into<crate::model::Occurrence>,
8561 {
8562 use std::iter::Iterator;
8563 self.occurrences = v.into_iter().map(|i| i.into()).collect();
8564 self
8565 }
8566
8567 /// Sets the value of [next_page_token][crate::model::ListNoteOccurrencesResponse::next_page_token].
8568 ///
8569 /// # Example
8570 /// ```ignore,no_run
8571 /// # use google_cloud_grafeas_v1::model::ListNoteOccurrencesResponse;
8572 /// let x = ListNoteOccurrencesResponse::new().set_next_page_token("example");
8573 /// ```
8574 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8575 self.next_page_token = v.into();
8576 self
8577 }
8578}
8579
8580impl wkt::message::Message for ListNoteOccurrencesResponse {
8581 fn typename() -> &'static str {
8582 "type.googleapis.com/grafeas.v1.ListNoteOccurrencesResponse"
8583 }
8584}
8585
8586#[doc(hidden)]
8587impl google_cloud_gax::paginator::internal::PageableResponse for ListNoteOccurrencesResponse {
8588 type PageItem = crate::model::Occurrence;
8589
8590 fn items(self) -> std::vec::Vec<Self::PageItem> {
8591 self.occurrences
8592 }
8593
8594 fn next_page_token(&self) -> std::string::String {
8595 use std::clone::Clone;
8596 self.next_page_token.clone()
8597 }
8598}
8599
8600/// Request to create notes in batch.
8601#[derive(Clone, Default, PartialEq)]
8602#[non_exhaustive]
8603pub struct BatchCreateNotesRequest {
8604 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
8605 /// the notes are to be created.
8606 pub parent: std::string::String,
8607
8608 /// The notes to create. Max allowed length is 1000.
8609 pub notes: std::collections::HashMap<std::string::String, crate::model::Note>,
8610
8611 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8612}
8613
8614impl BatchCreateNotesRequest {
8615 pub fn new() -> Self {
8616 std::default::Default::default()
8617 }
8618
8619 /// Sets the value of [parent][crate::model::BatchCreateNotesRequest::parent].
8620 ///
8621 /// # Example
8622 /// ```ignore,no_run
8623 /// # use google_cloud_grafeas_v1::model::BatchCreateNotesRequest;
8624 /// let x = BatchCreateNotesRequest::new().set_parent("example");
8625 /// ```
8626 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8627 self.parent = v.into();
8628 self
8629 }
8630
8631 /// Sets the value of [notes][crate::model::BatchCreateNotesRequest::notes].
8632 ///
8633 /// # Example
8634 /// ```ignore,no_run
8635 /// # use google_cloud_grafeas_v1::model::BatchCreateNotesRequest;
8636 /// use google_cloud_grafeas_v1::model::Note;
8637 /// let x = BatchCreateNotesRequest::new().set_notes([
8638 /// ("key0", Note::default()/* use setters */),
8639 /// ("key1", Note::default()/* use (different) setters */),
8640 /// ]);
8641 /// ```
8642 pub fn set_notes<T, K, V>(mut self, v: T) -> Self
8643 where
8644 T: std::iter::IntoIterator<Item = (K, V)>,
8645 K: std::convert::Into<std::string::String>,
8646 V: std::convert::Into<crate::model::Note>,
8647 {
8648 use std::iter::Iterator;
8649 self.notes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8650 self
8651 }
8652}
8653
8654impl wkt::message::Message for BatchCreateNotesRequest {
8655 fn typename() -> &'static str {
8656 "type.googleapis.com/grafeas.v1.BatchCreateNotesRequest"
8657 }
8658}
8659
8660/// Response for creating notes in batch.
8661#[derive(Clone, Default, PartialEq)]
8662#[non_exhaustive]
8663pub struct BatchCreateNotesResponse {
8664 /// The notes that were created.
8665 pub notes: std::vec::Vec<crate::model::Note>,
8666
8667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8668}
8669
8670impl BatchCreateNotesResponse {
8671 pub fn new() -> Self {
8672 std::default::Default::default()
8673 }
8674
8675 /// Sets the value of [notes][crate::model::BatchCreateNotesResponse::notes].
8676 ///
8677 /// # Example
8678 /// ```ignore,no_run
8679 /// # use google_cloud_grafeas_v1::model::BatchCreateNotesResponse;
8680 /// use google_cloud_grafeas_v1::model::Note;
8681 /// let x = BatchCreateNotesResponse::new()
8682 /// .set_notes([
8683 /// Note::default()/* use setters */,
8684 /// Note::default()/* use (different) setters */,
8685 /// ]);
8686 /// ```
8687 pub fn set_notes<T, V>(mut self, v: T) -> Self
8688 where
8689 T: std::iter::IntoIterator<Item = V>,
8690 V: std::convert::Into<crate::model::Note>,
8691 {
8692 use std::iter::Iterator;
8693 self.notes = v.into_iter().map(|i| i.into()).collect();
8694 self
8695 }
8696}
8697
8698impl wkt::message::Message for BatchCreateNotesResponse {
8699 fn typename() -> &'static str {
8700 "type.googleapis.com/grafeas.v1.BatchCreateNotesResponse"
8701 }
8702}
8703
8704/// Request to create occurrences in batch.
8705#[derive(Clone, Default, PartialEq)]
8706#[non_exhaustive]
8707pub struct BatchCreateOccurrencesRequest {
8708 /// The name of the project in the form of `projects/[PROJECT_ID]`, under which
8709 /// the occurrences are to be created.
8710 pub parent: std::string::String,
8711
8712 /// The occurrences to create. Max allowed length is 1000.
8713 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
8714
8715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8716}
8717
8718impl BatchCreateOccurrencesRequest {
8719 pub fn new() -> Self {
8720 std::default::Default::default()
8721 }
8722
8723 /// Sets the value of [parent][crate::model::BatchCreateOccurrencesRequest::parent].
8724 ///
8725 /// # Example
8726 /// ```ignore,no_run
8727 /// # use google_cloud_grafeas_v1::model::BatchCreateOccurrencesRequest;
8728 /// let x = BatchCreateOccurrencesRequest::new().set_parent("example");
8729 /// ```
8730 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8731 self.parent = v.into();
8732 self
8733 }
8734
8735 /// Sets the value of [occurrences][crate::model::BatchCreateOccurrencesRequest::occurrences].
8736 ///
8737 /// # Example
8738 /// ```ignore,no_run
8739 /// # use google_cloud_grafeas_v1::model::BatchCreateOccurrencesRequest;
8740 /// use google_cloud_grafeas_v1::model::Occurrence;
8741 /// let x = BatchCreateOccurrencesRequest::new()
8742 /// .set_occurrences([
8743 /// Occurrence::default()/* use setters */,
8744 /// Occurrence::default()/* use (different) setters */,
8745 /// ]);
8746 /// ```
8747 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
8748 where
8749 T: std::iter::IntoIterator<Item = V>,
8750 V: std::convert::Into<crate::model::Occurrence>,
8751 {
8752 use std::iter::Iterator;
8753 self.occurrences = v.into_iter().map(|i| i.into()).collect();
8754 self
8755 }
8756}
8757
8758impl wkt::message::Message for BatchCreateOccurrencesRequest {
8759 fn typename() -> &'static str {
8760 "type.googleapis.com/grafeas.v1.BatchCreateOccurrencesRequest"
8761 }
8762}
8763
8764/// Response for creating occurrences in batch.
8765#[derive(Clone, Default, PartialEq)]
8766#[non_exhaustive]
8767pub struct BatchCreateOccurrencesResponse {
8768 /// The occurrences that were created.
8769 pub occurrences: std::vec::Vec<crate::model::Occurrence>,
8770
8771 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8772}
8773
8774impl BatchCreateOccurrencesResponse {
8775 pub fn new() -> Self {
8776 std::default::Default::default()
8777 }
8778
8779 /// Sets the value of [occurrences][crate::model::BatchCreateOccurrencesResponse::occurrences].
8780 ///
8781 /// # Example
8782 /// ```ignore,no_run
8783 /// # use google_cloud_grafeas_v1::model::BatchCreateOccurrencesResponse;
8784 /// use google_cloud_grafeas_v1::model::Occurrence;
8785 /// let x = BatchCreateOccurrencesResponse::new()
8786 /// .set_occurrences([
8787 /// Occurrence::default()/* use setters */,
8788 /// Occurrence::default()/* use (different) setters */,
8789 /// ]);
8790 /// ```
8791 pub fn set_occurrences<T, V>(mut self, v: T) -> Self
8792 where
8793 T: std::iter::IntoIterator<Item = V>,
8794 V: std::convert::Into<crate::model::Occurrence>,
8795 {
8796 use std::iter::Iterator;
8797 self.occurrences = v.into_iter().map(|i| i.into()).collect();
8798 self
8799 }
8800}
8801
8802impl wkt::message::Message for BatchCreateOccurrencesResponse {
8803 fn typename() -> &'static str {
8804 "type.googleapis.com/grafeas.v1.BatchCreateOccurrencesResponse"
8805 }
8806}
8807
8808/// Layer holds metadata specific to a layer of a Docker image.
8809#[derive(Clone, Default, PartialEq)]
8810#[non_exhaustive]
8811pub struct Layer {
8812 /// Required. The recovered Dockerfile directive used to construct this layer.
8813 /// See <https://docs.docker.com/engine/reference/builder/> for more information.
8814 pub directive: std::string::String,
8815
8816 /// The recovered arguments to the Dockerfile directive.
8817 pub arguments: std::string::String,
8818
8819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8820}
8821
8822impl Layer {
8823 pub fn new() -> Self {
8824 std::default::Default::default()
8825 }
8826
8827 /// Sets the value of [directive][crate::model::Layer::directive].
8828 ///
8829 /// # Example
8830 /// ```ignore,no_run
8831 /// # use google_cloud_grafeas_v1::model::Layer;
8832 /// let x = Layer::new().set_directive("example");
8833 /// ```
8834 pub fn set_directive<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8835 self.directive = v.into();
8836 self
8837 }
8838
8839 /// Sets the value of [arguments][crate::model::Layer::arguments].
8840 ///
8841 /// # Example
8842 /// ```ignore,no_run
8843 /// # use google_cloud_grafeas_v1::model::Layer;
8844 /// let x = Layer::new().set_arguments("example");
8845 /// ```
8846 pub fn set_arguments<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8847 self.arguments = v.into();
8848 self
8849 }
8850}
8851
8852impl wkt::message::Message for Layer {
8853 fn typename() -> &'static str {
8854 "type.googleapis.com/grafeas.v1.Layer"
8855 }
8856}
8857
8858/// A set of properties that uniquely identify a given Docker image.
8859#[derive(Clone, Default, PartialEq)]
8860#[non_exhaustive]
8861pub struct Fingerprint {
8862 /// Required. The layer ID of the final layer in the Docker image's v1
8863 /// representation.
8864 pub v1_name: std::string::String,
8865
8866 /// Required. The ordered list of v2 blobs that represent a given image.
8867 pub v2_blob: std::vec::Vec<std::string::String>,
8868
8869 /// Output only. The name of the image's v2 blobs computed via:
8870 /// [bottom] := v2_blob[bottom]
8871 /// [N] := sha256(v2_blob[N] + " " + v2_name[N+1])
8872 /// Only the name of the final blob is kept.
8873 pub v2_name: std::string::String,
8874
8875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8876}
8877
8878impl Fingerprint {
8879 pub fn new() -> Self {
8880 std::default::Default::default()
8881 }
8882
8883 /// Sets the value of [v1_name][crate::model::Fingerprint::v1_name].
8884 ///
8885 /// # Example
8886 /// ```ignore,no_run
8887 /// # use google_cloud_grafeas_v1::model::Fingerprint;
8888 /// let x = Fingerprint::new().set_v1_name("example");
8889 /// ```
8890 pub fn set_v1_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8891 self.v1_name = v.into();
8892 self
8893 }
8894
8895 /// Sets the value of [v2_blob][crate::model::Fingerprint::v2_blob].
8896 ///
8897 /// # Example
8898 /// ```ignore,no_run
8899 /// # use google_cloud_grafeas_v1::model::Fingerprint;
8900 /// let x = Fingerprint::new().set_v2_blob(["a", "b", "c"]);
8901 /// ```
8902 pub fn set_v2_blob<T, V>(mut self, v: T) -> Self
8903 where
8904 T: std::iter::IntoIterator<Item = V>,
8905 V: std::convert::Into<std::string::String>,
8906 {
8907 use std::iter::Iterator;
8908 self.v2_blob = v.into_iter().map(|i| i.into()).collect();
8909 self
8910 }
8911
8912 /// Sets the value of [v2_name][crate::model::Fingerprint::v2_name].
8913 ///
8914 /// # Example
8915 /// ```ignore,no_run
8916 /// # use google_cloud_grafeas_v1::model::Fingerprint;
8917 /// let x = Fingerprint::new().set_v2_name("example");
8918 /// ```
8919 pub fn set_v2_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8920 self.v2_name = v.into();
8921 self
8922 }
8923}
8924
8925impl wkt::message::Message for Fingerprint {
8926 fn typename() -> &'static str {
8927 "type.googleapis.com/grafeas.v1.Fingerprint"
8928 }
8929}
8930
8931/// Basis describes the base image portion (Note) of the DockerImage
8932/// relationship. Linked occurrences are derived from this or an equivalent image
8933/// via:
8934/// FROM <Basis.resource_url>
8935/// Or an equivalent reference, e.g., a tag of the resource_url.
8936#[derive(Clone, Default, PartialEq)]
8937#[non_exhaustive]
8938pub struct ImageNote {
8939 /// Required. Immutable. The resource_url for the resource representing the
8940 /// basis of associated occurrence images.
8941 pub resource_url: std::string::String,
8942
8943 /// Required. Immutable. The fingerprint of the base image.
8944 pub fingerprint: std::option::Option<crate::model::Fingerprint>,
8945
8946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8947}
8948
8949impl ImageNote {
8950 pub fn new() -> Self {
8951 std::default::Default::default()
8952 }
8953
8954 /// Sets the value of [resource_url][crate::model::ImageNote::resource_url].
8955 ///
8956 /// # Example
8957 /// ```ignore,no_run
8958 /// # use google_cloud_grafeas_v1::model::ImageNote;
8959 /// let x = ImageNote::new().set_resource_url("example");
8960 /// ```
8961 pub fn set_resource_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8962 self.resource_url = v.into();
8963 self
8964 }
8965
8966 /// Sets the value of [fingerprint][crate::model::ImageNote::fingerprint].
8967 ///
8968 /// # Example
8969 /// ```ignore,no_run
8970 /// # use google_cloud_grafeas_v1::model::ImageNote;
8971 /// use google_cloud_grafeas_v1::model::Fingerprint;
8972 /// let x = ImageNote::new().set_fingerprint(Fingerprint::default()/* use setters */);
8973 /// ```
8974 pub fn set_fingerprint<T>(mut self, v: T) -> Self
8975 where
8976 T: std::convert::Into<crate::model::Fingerprint>,
8977 {
8978 self.fingerprint = std::option::Option::Some(v.into());
8979 self
8980 }
8981
8982 /// Sets or clears the value of [fingerprint][crate::model::ImageNote::fingerprint].
8983 ///
8984 /// # Example
8985 /// ```ignore,no_run
8986 /// # use google_cloud_grafeas_v1::model::ImageNote;
8987 /// use google_cloud_grafeas_v1::model::Fingerprint;
8988 /// let x = ImageNote::new().set_or_clear_fingerprint(Some(Fingerprint::default()/* use setters */));
8989 /// let x = ImageNote::new().set_or_clear_fingerprint(None::<Fingerprint>);
8990 /// ```
8991 pub fn set_or_clear_fingerprint<T>(mut self, v: std::option::Option<T>) -> Self
8992 where
8993 T: std::convert::Into<crate::model::Fingerprint>,
8994 {
8995 self.fingerprint = v.map(|x| x.into());
8996 self
8997 }
8998}
8999
9000impl wkt::message::Message for ImageNote {
9001 fn typename() -> &'static str {
9002 "type.googleapis.com/grafeas.v1.ImageNote"
9003 }
9004}
9005
9006/// Details of the derived image portion of the DockerImage relationship. This
9007/// image would be produced from a Dockerfile with FROM <DockerImage.Basis in
9008/// attached Note>.
9009#[derive(Clone, Default, PartialEq)]
9010#[non_exhaustive]
9011pub struct ImageOccurrence {
9012 /// Required. The fingerprint of the derived image.
9013 pub fingerprint: std::option::Option<crate::model::Fingerprint>,
9014
9015 /// Output only. The number of layers by which this image differs from the
9016 /// associated image basis.
9017 pub distance: i32,
9018
9019 /// This contains layer-specific metadata, if populated it has length
9020 /// "distance" and is ordered with [distance] being the layer immediately
9021 /// following the base image and [1] being the final layer.
9022 pub layer_info: std::vec::Vec<crate::model::Layer>,
9023
9024 /// Output only. This contains the base image URL for the derived image
9025 /// occurrence.
9026 pub base_resource_url: std::string::String,
9027
9028 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9029}
9030
9031impl ImageOccurrence {
9032 pub fn new() -> Self {
9033 std::default::Default::default()
9034 }
9035
9036 /// Sets the value of [fingerprint][crate::model::ImageOccurrence::fingerprint].
9037 ///
9038 /// # Example
9039 /// ```ignore,no_run
9040 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9041 /// use google_cloud_grafeas_v1::model::Fingerprint;
9042 /// let x = ImageOccurrence::new().set_fingerprint(Fingerprint::default()/* use setters */);
9043 /// ```
9044 pub fn set_fingerprint<T>(mut self, v: T) -> Self
9045 where
9046 T: std::convert::Into<crate::model::Fingerprint>,
9047 {
9048 self.fingerprint = std::option::Option::Some(v.into());
9049 self
9050 }
9051
9052 /// Sets or clears the value of [fingerprint][crate::model::ImageOccurrence::fingerprint].
9053 ///
9054 /// # Example
9055 /// ```ignore,no_run
9056 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9057 /// use google_cloud_grafeas_v1::model::Fingerprint;
9058 /// let x = ImageOccurrence::new().set_or_clear_fingerprint(Some(Fingerprint::default()/* use setters */));
9059 /// let x = ImageOccurrence::new().set_or_clear_fingerprint(None::<Fingerprint>);
9060 /// ```
9061 pub fn set_or_clear_fingerprint<T>(mut self, v: std::option::Option<T>) -> Self
9062 where
9063 T: std::convert::Into<crate::model::Fingerprint>,
9064 {
9065 self.fingerprint = v.map(|x| x.into());
9066 self
9067 }
9068
9069 /// Sets the value of [distance][crate::model::ImageOccurrence::distance].
9070 ///
9071 /// # Example
9072 /// ```ignore,no_run
9073 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9074 /// let x = ImageOccurrence::new().set_distance(42);
9075 /// ```
9076 pub fn set_distance<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9077 self.distance = v.into();
9078 self
9079 }
9080
9081 /// Sets the value of [layer_info][crate::model::ImageOccurrence::layer_info].
9082 ///
9083 /// # Example
9084 /// ```ignore,no_run
9085 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9086 /// use google_cloud_grafeas_v1::model::Layer;
9087 /// let x = ImageOccurrence::new()
9088 /// .set_layer_info([
9089 /// Layer::default()/* use setters */,
9090 /// Layer::default()/* use (different) setters */,
9091 /// ]);
9092 /// ```
9093 pub fn set_layer_info<T, V>(mut self, v: T) -> Self
9094 where
9095 T: std::iter::IntoIterator<Item = V>,
9096 V: std::convert::Into<crate::model::Layer>,
9097 {
9098 use std::iter::Iterator;
9099 self.layer_info = v.into_iter().map(|i| i.into()).collect();
9100 self
9101 }
9102
9103 /// Sets the value of [base_resource_url][crate::model::ImageOccurrence::base_resource_url].
9104 ///
9105 /// # Example
9106 /// ```ignore,no_run
9107 /// # use google_cloud_grafeas_v1::model::ImageOccurrence;
9108 /// let x = ImageOccurrence::new().set_base_resource_url("example");
9109 /// ```
9110 pub fn set_base_resource_url<T: std::convert::Into<std::string::String>>(
9111 mut self,
9112 v: T,
9113 ) -> Self {
9114 self.base_resource_url = v.into();
9115 self
9116 }
9117}
9118
9119impl wkt::message::Message for ImageOccurrence {
9120 fn typename() -> &'static str {
9121 "type.googleapis.com/grafeas.v1.ImageOccurrence"
9122 }
9123}
9124
9125/// Steps taken to build the artifact.
9126/// For a TaskRun, typically each container corresponds to one step in the
9127/// recipe.
9128#[derive(Clone, Default, PartialEq)]
9129#[non_exhaustive]
9130pub struct Recipe {
9131 /// URI indicating what type of recipe was performed. It determines the meaning
9132 /// of recipe.entryPoint, recipe.arguments, recipe.environment, and materials.
9133 pub r#type: std::string::String,
9134
9135 /// Index in materials containing the recipe steps that are not implied by
9136 /// recipe.type. For example, if the recipe type were "make", then this would
9137 /// point to the source containing the Makefile, not the make program itself.
9138 /// Set to -1 if the recipe doesn't come from a material, as zero is default
9139 /// unset value for int64.
9140 pub defined_in_material: i64,
9141
9142 /// String identifying the entry point into the build.
9143 /// This is often a path to a configuration file and/or a target label within
9144 /// that file. The syntax and meaning are defined by recipe.type. For example,
9145 /// if the recipe type were "make", then this would reference the directory in
9146 /// which to run make as well as which target to use.
9147 pub entry_point: std::string::String,
9148
9149 /// Collection of all external inputs that influenced the build on top of
9150 /// recipe.definedInMaterial and recipe.entryPoint. For example, if the recipe
9151 /// type were "make", then this might be the flags passed to make aside from
9152 /// the target, which is captured in recipe.entryPoint. Since the arguments
9153 /// field can greatly vary in structure, depending on the builder and recipe
9154 /// type, this is of form "Any".
9155 pub arguments: std::vec::Vec<wkt::Any>,
9156
9157 /// Any other builder-controlled inputs necessary for correctly evaluating the
9158 /// recipe. Usually only needed for reproducing the build but not evaluated as
9159 /// part of policy. Since the environment field can greatly vary in structure,
9160 /// depending on the builder and recipe type, this is of form "Any".
9161 pub environment: std::vec::Vec<wkt::Any>,
9162
9163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9164}
9165
9166impl Recipe {
9167 pub fn new() -> Self {
9168 std::default::Default::default()
9169 }
9170
9171 /// Sets the value of [r#type][crate::model::Recipe::type].
9172 ///
9173 /// # Example
9174 /// ```ignore,no_run
9175 /// # use google_cloud_grafeas_v1::model::Recipe;
9176 /// let x = Recipe::new().set_type("example");
9177 /// ```
9178 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9179 self.r#type = v.into();
9180 self
9181 }
9182
9183 /// Sets the value of [defined_in_material][crate::model::Recipe::defined_in_material].
9184 ///
9185 /// # Example
9186 /// ```ignore,no_run
9187 /// # use google_cloud_grafeas_v1::model::Recipe;
9188 /// let x = Recipe::new().set_defined_in_material(42);
9189 /// ```
9190 pub fn set_defined_in_material<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
9191 self.defined_in_material = v.into();
9192 self
9193 }
9194
9195 /// Sets the value of [entry_point][crate::model::Recipe::entry_point].
9196 ///
9197 /// # Example
9198 /// ```ignore,no_run
9199 /// # use google_cloud_grafeas_v1::model::Recipe;
9200 /// let x = Recipe::new().set_entry_point("example");
9201 /// ```
9202 pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9203 self.entry_point = v.into();
9204 self
9205 }
9206
9207 /// Sets the value of [arguments][crate::model::Recipe::arguments].
9208 ///
9209 /// # Example
9210 /// ```ignore,no_run
9211 /// # use google_cloud_grafeas_v1::model::Recipe;
9212 /// use wkt::Any;
9213 /// let x = Recipe::new()
9214 /// .set_arguments([
9215 /// Any::default()/* use setters */,
9216 /// Any::default()/* use (different) setters */,
9217 /// ]);
9218 /// ```
9219 pub fn set_arguments<T, V>(mut self, v: T) -> Self
9220 where
9221 T: std::iter::IntoIterator<Item = V>,
9222 V: std::convert::Into<wkt::Any>,
9223 {
9224 use std::iter::Iterator;
9225 self.arguments = v.into_iter().map(|i| i.into()).collect();
9226 self
9227 }
9228
9229 /// Sets the value of [environment][crate::model::Recipe::environment].
9230 ///
9231 /// # Example
9232 /// ```ignore,no_run
9233 /// # use google_cloud_grafeas_v1::model::Recipe;
9234 /// use wkt::Any;
9235 /// let x = Recipe::new()
9236 /// .set_environment([
9237 /// Any::default()/* use setters */,
9238 /// Any::default()/* use (different) setters */,
9239 /// ]);
9240 /// ```
9241 pub fn set_environment<T, V>(mut self, v: T) -> Self
9242 where
9243 T: std::iter::IntoIterator<Item = V>,
9244 V: std::convert::Into<wkt::Any>,
9245 {
9246 use std::iter::Iterator;
9247 self.environment = v.into_iter().map(|i| i.into()).collect();
9248 self
9249 }
9250}
9251
9252impl wkt::message::Message for Recipe {
9253 fn typename() -> &'static str {
9254 "type.googleapis.com/grafeas.v1.Recipe"
9255 }
9256}
9257
9258/// Indicates that the builder claims certain fields in this message to be
9259/// complete.
9260#[derive(Clone, Default, PartialEq)]
9261#[non_exhaustive]
9262pub struct Completeness {
9263 /// If true, the builder claims that recipe.arguments is complete, meaning that
9264 /// all external inputs are properly captured in the recipe.
9265 pub arguments: bool,
9266
9267 /// If true, the builder claims that recipe.environment is claimed to be
9268 /// complete.
9269 pub environment: bool,
9270
9271 /// If true, the builder claims that materials are complete, usually through
9272 /// some controls to prevent network access. Sometimes called "hermetic".
9273 pub materials: bool,
9274
9275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9276}
9277
9278impl Completeness {
9279 pub fn new() -> Self {
9280 std::default::Default::default()
9281 }
9282
9283 /// Sets the value of [arguments][crate::model::Completeness::arguments].
9284 ///
9285 /// # Example
9286 /// ```ignore,no_run
9287 /// # use google_cloud_grafeas_v1::model::Completeness;
9288 /// let x = Completeness::new().set_arguments(true);
9289 /// ```
9290 pub fn set_arguments<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9291 self.arguments = v.into();
9292 self
9293 }
9294
9295 /// Sets the value of [environment][crate::model::Completeness::environment].
9296 ///
9297 /// # Example
9298 /// ```ignore,no_run
9299 /// # use google_cloud_grafeas_v1::model::Completeness;
9300 /// let x = Completeness::new().set_environment(true);
9301 /// ```
9302 pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9303 self.environment = v.into();
9304 self
9305 }
9306
9307 /// Sets the value of [materials][crate::model::Completeness::materials].
9308 ///
9309 /// # Example
9310 /// ```ignore,no_run
9311 /// # use google_cloud_grafeas_v1::model::Completeness;
9312 /// let x = Completeness::new().set_materials(true);
9313 /// ```
9314 pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9315 self.materials = v.into();
9316 self
9317 }
9318}
9319
9320impl wkt::message::Message for Completeness {
9321 fn typename() -> &'static str {
9322 "type.googleapis.com/grafeas.v1.Completeness"
9323 }
9324}
9325
9326/// Other properties of the build.
9327#[derive(Clone, Default, PartialEq)]
9328#[non_exhaustive]
9329pub struct Metadata {
9330 /// Identifies the particular build invocation, which can be useful for finding
9331 /// associated logs or other ad-hoc analysis. The value SHOULD be globally
9332 /// unique, per in-toto Provenance spec.
9333 pub build_invocation_id: std::string::String,
9334
9335 /// The timestamp of when the build started.
9336 pub build_started_on: std::option::Option<wkt::Timestamp>,
9337
9338 /// The timestamp of when the build completed.
9339 pub build_finished_on: std::option::Option<wkt::Timestamp>,
9340
9341 /// Indicates that the builder claims certain fields in this message to be
9342 /// complete.
9343 pub completeness: std::option::Option<crate::model::Completeness>,
9344
9345 /// If true, the builder claims that running the recipe on materials will
9346 /// produce bit-for-bit identical output.
9347 pub reproducible: bool,
9348
9349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9350}
9351
9352impl Metadata {
9353 pub fn new() -> Self {
9354 std::default::Default::default()
9355 }
9356
9357 /// Sets the value of [build_invocation_id][crate::model::Metadata::build_invocation_id].
9358 ///
9359 /// # Example
9360 /// ```ignore,no_run
9361 /// # use google_cloud_grafeas_v1::model::Metadata;
9362 /// let x = Metadata::new().set_build_invocation_id("example");
9363 /// ```
9364 pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
9365 mut self,
9366 v: T,
9367 ) -> Self {
9368 self.build_invocation_id = v.into();
9369 self
9370 }
9371
9372 /// Sets the value of [build_started_on][crate::model::Metadata::build_started_on].
9373 ///
9374 /// # Example
9375 /// ```ignore,no_run
9376 /// # use google_cloud_grafeas_v1::model::Metadata;
9377 /// use wkt::Timestamp;
9378 /// let x = Metadata::new().set_build_started_on(Timestamp::default()/* use setters */);
9379 /// ```
9380 pub fn set_build_started_on<T>(mut self, v: T) -> Self
9381 where
9382 T: std::convert::Into<wkt::Timestamp>,
9383 {
9384 self.build_started_on = std::option::Option::Some(v.into());
9385 self
9386 }
9387
9388 /// Sets or clears the value of [build_started_on][crate::model::Metadata::build_started_on].
9389 ///
9390 /// # Example
9391 /// ```ignore,no_run
9392 /// # use google_cloud_grafeas_v1::model::Metadata;
9393 /// use wkt::Timestamp;
9394 /// let x = Metadata::new().set_or_clear_build_started_on(Some(Timestamp::default()/* use setters */));
9395 /// let x = Metadata::new().set_or_clear_build_started_on(None::<Timestamp>);
9396 /// ```
9397 pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
9398 where
9399 T: std::convert::Into<wkt::Timestamp>,
9400 {
9401 self.build_started_on = v.map(|x| x.into());
9402 self
9403 }
9404
9405 /// Sets the value of [build_finished_on][crate::model::Metadata::build_finished_on].
9406 ///
9407 /// # Example
9408 /// ```ignore,no_run
9409 /// # use google_cloud_grafeas_v1::model::Metadata;
9410 /// use wkt::Timestamp;
9411 /// let x = Metadata::new().set_build_finished_on(Timestamp::default()/* use setters */);
9412 /// ```
9413 pub fn set_build_finished_on<T>(mut self, v: T) -> Self
9414 where
9415 T: std::convert::Into<wkt::Timestamp>,
9416 {
9417 self.build_finished_on = std::option::Option::Some(v.into());
9418 self
9419 }
9420
9421 /// Sets or clears the value of [build_finished_on][crate::model::Metadata::build_finished_on].
9422 ///
9423 /// # Example
9424 /// ```ignore,no_run
9425 /// # use google_cloud_grafeas_v1::model::Metadata;
9426 /// use wkt::Timestamp;
9427 /// let x = Metadata::new().set_or_clear_build_finished_on(Some(Timestamp::default()/* use setters */));
9428 /// let x = Metadata::new().set_or_clear_build_finished_on(None::<Timestamp>);
9429 /// ```
9430 pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
9431 where
9432 T: std::convert::Into<wkt::Timestamp>,
9433 {
9434 self.build_finished_on = v.map(|x| x.into());
9435 self
9436 }
9437
9438 /// Sets the value of [completeness][crate::model::Metadata::completeness].
9439 ///
9440 /// # Example
9441 /// ```ignore,no_run
9442 /// # use google_cloud_grafeas_v1::model::Metadata;
9443 /// use google_cloud_grafeas_v1::model::Completeness;
9444 /// let x = Metadata::new().set_completeness(Completeness::default()/* use setters */);
9445 /// ```
9446 pub fn set_completeness<T>(mut self, v: T) -> Self
9447 where
9448 T: std::convert::Into<crate::model::Completeness>,
9449 {
9450 self.completeness = std::option::Option::Some(v.into());
9451 self
9452 }
9453
9454 /// Sets or clears the value of [completeness][crate::model::Metadata::completeness].
9455 ///
9456 /// # Example
9457 /// ```ignore,no_run
9458 /// # use google_cloud_grafeas_v1::model::Metadata;
9459 /// use google_cloud_grafeas_v1::model::Completeness;
9460 /// let x = Metadata::new().set_or_clear_completeness(Some(Completeness::default()/* use setters */));
9461 /// let x = Metadata::new().set_or_clear_completeness(None::<Completeness>);
9462 /// ```
9463 pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
9464 where
9465 T: std::convert::Into<crate::model::Completeness>,
9466 {
9467 self.completeness = v.map(|x| x.into());
9468 self
9469 }
9470
9471 /// Sets the value of [reproducible][crate::model::Metadata::reproducible].
9472 ///
9473 /// # Example
9474 /// ```ignore,no_run
9475 /// # use google_cloud_grafeas_v1::model::Metadata;
9476 /// let x = Metadata::new().set_reproducible(true);
9477 /// ```
9478 pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9479 self.reproducible = v.into();
9480 self
9481 }
9482}
9483
9484impl wkt::message::Message for Metadata {
9485 fn typename() -> &'static str {
9486 "type.googleapis.com/grafeas.v1.Metadata"
9487 }
9488}
9489
9490#[derive(Clone, Default, PartialEq)]
9491#[non_exhaustive]
9492pub struct BuilderConfig {
9493 pub id: std::string::String,
9494
9495 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9496}
9497
9498impl BuilderConfig {
9499 pub fn new() -> Self {
9500 std::default::Default::default()
9501 }
9502
9503 /// Sets the value of [id][crate::model::BuilderConfig::id].
9504 ///
9505 /// # Example
9506 /// ```ignore,no_run
9507 /// # use google_cloud_grafeas_v1::model::BuilderConfig;
9508 /// let x = BuilderConfig::new().set_id("example");
9509 /// ```
9510 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9511 self.id = v.into();
9512 self
9513 }
9514}
9515
9516impl wkt::message::Message for BuilderConfig {
9517 fn typename() -> &'static str {
9518 "type.googleapis.com/grafeas.v1.BuilderConfig"
9519 }
9520}
9521
9522#[derive(Clone, Default, PartialEq)]
9523#[non_exhaustive]
9524pub struct InTotoProvenance {
9525 pub builder_config: std::option::Option<crate::model::BuilderConfig>,
9526
9527 /// Identifies the configuration used for the build.
9528 /// When combined with materials, this SHOULD fully describe the build,
9529 /// such that re-running this recipe results in bit-for-bit identical output
9530 /// (if the build is reproducible).
9531 pub recipe: std::option::Option<crate::model::Recipe>,
9532
9533 pub metadata: std::option::Option<crate::model::Metadata>,
9534
9535 /// The collection of artifacts that influenced the build including sources,
9536 /// dependencies, build tools, base images, and so on. This is considered to be
9537 /// incomplete unless metadata.completeness.materials is true. Unset or null is
9538 /// equivalent to empty.
9539 pub materials: std::vec::Vec<std::string::String>,
9540
9541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9542}
9543
9544impl InTotoProvenance {
9545 pub fn new() -> Self {
9546 std::default::Default::default()
9547 }
9548
9549 /// Sets the value of [builder_config][crate::model::InTotoProvenance::builder_config].
9550 ///
9551 /// # Example
9552 /// ```ignore,no_run
9553 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9554 /// use google_cloud_grafeas_v1::model::BuilderConfig;
9555 /// let x = InTotoProvenance::new().set_builder_config(BuilderConfig::default()/* use setters */);
9556 /// ```
9557 pub fn set_builder_config<T>(mut self, v: T) -> Self
9558 where
9559 T: std::convert::Into<crate::model::BuilderConfig>,
9560 {
9561 self.builder_config = std::option::Option::Some(v.into());
9562 self
9563 }
9564
9565 /// Sets or clears the value of [builder_config][crate::model::InTotoProvenance::builder_config].
9566 ///
9567 /// # Example
9568 /// ```ignore,no_run
9569 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9570 /// use google_cloud_grafeas_v1::model::BuilderConfig;
9571 /// let x = InTotoProvenance::new().set_or_clear_builder_config(Some(BuilderConfig::default()/* use setters */));
9572 /// let x = InTotoProvenance::new().set_or_clear_builder_config(None::<BuilderConfig>);
9573 /// ```
9574 pub fn set_or_clear_builder_config<T>(mut self, v: std::option::Option<T>) -> Self
9575 where
9576 T: std::convert::Into<crate::model::BuilderConfig>,
9577 {
9578 self.builder_config = v.map(|x| x.into());
9579 self
9580 }
9581
9582 /// Sets the value of [recipe][crate::model::InTotoProvenance::recipe].
9583 ///
9584 /// # Example
9585 /// ```ignore,no_run
9586 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9587 /// use google_cloud_grafeas_v1::model::Recipe;
9588 /// let x = InTotoProvenance::new().set_recipe(Recipe::default()/* use setters */);
9589 /// ```
9590 pub fn set_recipe<T>(mut self, v: T) -> Self
9591 where
9592 T: std::convert::Into<crate::model::Recipe>,
9593 {
9594 self.recipe = std::option::Option::Some(v.into());
9595 self
9596 }
9597
9598 /// Sets or clears the value of [recipe][crate::model::InTotoProvenance::recipe].
9599 ///
9600 /// # Example
9601 /// ```ignore,no_run
9602 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9603 /// use google_cloud_grafeas_v1::model::Recipe;
9604 /// let x = InTotoProvenance::new().set_or_clear_recipe(Some(Recipe::default()/* use setters */));
9605 /// let x = InTotoProvenance::new().set_or_clear_recipe(None::<Recipe>);
9606 /// ```
9607 pub fn set_or_clear_recipe<T>(mut self, v: std::option::Option<T>) -> Self
9608 where
9609 T: std::convert::Into<crate::model::Recipe>,
9610 {
9611 self.recipe = v.map(|x| x.into());
9612 self
9613 }
9614
9615 /// Sets the value of [metadata][crate::model::InTotoProvenance::metadata].
9616 ///
9617 /// # Example
9618 /// ```ignore,no_run
9619 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9620 /// use google_cloud_grafeas_v1::model::Metadata;
9621 /// let x = InTotoProvenance::new().set_metadata(Metadata::default()/* use setters */);
9622 /// ```
9623 pub fn set_metadata<T>(mut self, v: T) -> Self
9624 where
9625 T: std::convert::Into<crate::model::Metadata>,
9626 {
9627 self.metadata = std::option::Option::Some(v.into());
9628 self
9629 }
9630
9631 /// Sets or clears the value of [metadata][crate::model::InTotoProvenance::metadata].
9632 ///
9633 /// # Example
9634 /// ```ignore,no_run
9635 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9636 /// use google_cloud_grafeas_v1::model::Metadata;
9637 /// let x = InTotoProvenance::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
9638 /// let x = InTotoProvenance::new().set_or_clear_metadata(None::<Metadata>);
9639 /// ```
9640 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
9641 where
9642 T: std::convert::Into<crate::model::Metadata>,
9643 {
9644 self.metadata = v.map(|x| x.into());
9645 self
9646 }
9647
9648 /// Sets the value of [materials][crate::model::InTotoProvenance::materials].
9649 ///
9650 /// # Example
9651 /// ```ignore,no_run
9652 /// # use google_cloud_grafeas_v1::model::InTotoProvenance;
9653 /// let x = InTotoProvenance::new().set_materials(["a", "b", "c"]);
9654 /// ```
9655 pub fn set_materials<T, V>(mut self, v: T) -> Self
9656 where
9657 T: std::iter::IntoIterator<Item = V>,
9658 V: std::convert::Into<std::string::String>,
9659 {
9660 use std::iter::Iterator;
9661 self.materials = v.into_iter().map(|i| i.into()).collect();
9662 self
9663 }
9664}
9665
9666impl wkt::message::Message for InTotoProvenance {
9667 fn typename() -> &'static str {
9668 "type.googleapis.com/grafeas.v1.InTotoProvenance"
9669 }
9670}
9671
9672/// Spec defined at
9673/// <https://github.com/in-toto/attestation/tree/main/spec#statement> The
9674/// serialized InTotoStatement will be stored as Envelope.payload.
9675/// Envelope.payloadType is always "application/vnd.in-toto+json".
9676#[derive(Clone, Default, PartialEq)]
9677#[non_exhaustive]
9678pub struct InTotoStatement {
9679 /// Always `<https://in-toto.io/Statement/v0.1>`.
9680 pub r#type: std::string::String,
9681
9682 pub subject: std::vec::Vec<crate::model::Subject>,
9683
9684 /// `<https://slsa.dev/provenance/v0.1>` for SlsaProvenance.
9685 pub predicate_type: std::string::String,
9686
9687 pub predicate: std::option::Option<crate::model::in_toto_statement::Predicate>,
9688
9689 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9690}
9691
9692impl InTotoStatement {
9693 pub fn new() -> Self {
9694 std::default::Default::default()
9695 }
9696
9697 /// Sets the value of [r#type][crate::model::InTotoStatement::type].
9698 ///
9699 /// # Example
9700 /// ```ignore,no_run
9701 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9702 /// let x = InTotoStatement::new().set_type("example");
9703 /// ```
9704 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9705 self.r#type = v.into();
9706 self
9707 }
9708
9709 /// Sets the value of [subject][crate::model::InTotoStatement::subject].
9710 ///
9711 /// # Example
9712 /// ```ignore,no_run
9713 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9714 /// use google_cloud_grafeas_v1::model::Subject;
9715 /// let x = InTotoStatement::new()
9716 /// .set_subject([
9717 /// Subject::default()/* use setters */,
9718 /// Subject::default()/* use (different) setters */,
9719 /// ]);
9720 /// ```
9721 pub fn set_subject<T, V>(mut self, v: T) -> Self
9722 where
9723 T: std::iter::IntoIterator<Item = V>,
9724 V: std::convert::Into<crate::model::Subject>,
9725 {
9726 use std::iter::Iterator;
9727 self.subject = v.into_iter().map(|i| i.into()).collect();
9728 self
9729 }
9730
9731 /// Sets the value of [predicate_type][crate::model::InTotoStatement::predicate_type].
9732 ///
9733 /// # Example
9734 /// ```ignore,no_run
9735 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9736 /// let x = InTotoStatement::new().set_predicate_type("example");
9737 /// ```
9738 pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9739 self.predicate_type = v.into();
9740 self
9741 }
9742
9743 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate].
9744 ///
9745 /// Note that all the setters affecting `predicate` are mutually
9746 /// exclusive.
9747 ///
9748 /// # Example
9749 /// ```ignore,no_run
9750 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9751 /// use google_cloud_grafeas_v1::model::InTotoProvenance;
9752 /// let x = InTotoStatement::new().set_predicate(Some(
9753 /// google_cloud_grafeas_v1::model::in_toto_statement::Predicate::Provenance(InTotoProvenance::default().into())));
9754 /// ```
9755 pub fn set_predicate<
9756 T: std::convert::Into<std::option::Option<crate::model::in_toto_statement::Predicate>>,
9757 >(
9758 mut self,
9759 v: T,
9760 ) -> Self {
9761 self.predicate = v.into();
9762 self
9763 }
9764
9765 /// The value of [predicate][crate::model::InTotoStatement::predicate]
9766 /// if it holds a `Provenance`, `None` if the field is not set or
9767 /// holds a different branch.
9768 pub fn provenance(
9769 &self,
9770 ) -> std::option::Option<&std::boxed::Box<crate::model::InTotoProvenance>> {
9771 #[allow(unreachable_patterns)]
9772 self.predicate.as_ref().and_then(|v| match v {
9773 crate::model::in_toto_statement::Predicate::Provenance(v) => {
9774 std::option::Option::Some(v)
9775 }
9776 _ => std::option::Option::None,
9777 })
9778 }
9779
9780 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate]
9781 /// to hold a `Provenance`.
9782 ///
9783 /// Note that all the setters affecting `predicate` are
9784 /// mutually exclusive.
9785 ///
9786 /// # Example
9787 /// ```ignore,no_run
9788 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9789 /// use google_cloud_grafeas_v1::model::InTotoProvenance;
9790 /// let x = InTotoStatement::new().set_provenance(InTotoProvenance::default()/* use setters */);
9791 /// assert!(x.provenance().is_some());
9792 /// assert!(x.slsa_provenance().is_none());
9793 /// assert!(x.slsa_provenance_zero_two().is_none());
9794 /// ```
9795 pub fn set_provenance<
9796 T: std::convert::Into<std::boxed::Box<crate::model::InTotoProvenance>>,
9797 >(
9798 mut self,
9799 v: T,
9800 ) -> Self {
9801 self.predicate = std::option::Option::Some(
9802 crate::model::in_toto_statement::Predicate::Provenance(v.into()),
9803 );
9804 self
9805 }
9806
9807 /// The value of [predicate][crate::model::InTotoStatement::predicate]
9808 /// if it holds a `SlsaProvenance`, `None` if the field is not set or
9809 /// holds a different branch.
9810 pub fn slsa_provenance(
9811 &self,
9812 ) -> std::option::Option<&std::boxed::Box<crate::model::SlsaProvenance>> {
9813 #[allow(unreachable_patterns)]
9814 self.predicate.as_ref().and_then(|v| match v {
9815 crate::model::in_toto_statement::Predicate::SlsaProvenance(v) => {
9816 std::option::Option::Some(v)
9817 }
9818 _ => std::option::Option::None,
9819 })
9820 }
9821
9822 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate]
9823 /// to hold a `SlsaProvenance`.
9824 ///
9825 /// Note that all the setters affecting `predicate` are
9826 /// mutually exclusive.
9827 ///
9828 /// # Example
9829 /// ```ignore,no_run
9830 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9831 /// use google_cloud_grafeas_v1::model::SlsaProvenance;
9832 /// let x = InTotoStatement::new().set_slsa_provenance(SlsaProvenance::default()/* use setters */);
9833 /// assert!(x.slsa_provenance().is_some());
9834 /// assert!(x.provenance().is_none());
9835 /// assert!(x.slsa_provenance_zero_two().is_none());
9836 /// ```
9837 pub fn set_slsa_provenance<
9838 T: std::convert::Into<std::boxed::Box<crate::model::SlsaProvenance>>,
9839 >(
9840 mut self,
9841 v: T,
9842 ) -> Self {
9843 self.predicate = std::option::Option::Some(
9844 crate::model::in_toto_statement::Predicate::SlsaProvenance(v.into()),
9845 );
9846 self
9847 }
9848
9849 /// The value of [predicate][crate::model::InTotoStatement::predicate]
9850 /// if it holds a `SlsaProvenanceZeroTwo`, `None` if the field is not set or
9851 /// holds a different branch.
9852 pub fn slsa_provenance_zero_two(
9853 &self,
9854 ) -> std::option::Option<&std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>> {
9855 #[allow(unreachable_patterns)]
9856 self.predicate.as_ref().and_then(|v| match v {
9857 crate::model::in_toto_statement::Predicate::SlsaProvenanceZeroTwo(v) => {
9858 std::option::Option::Some(v)
9859 }
9860 _ => std::option::Option::None,
9861 })
9862 }
9863
9864 /// Sets the value of [predicate][crate::model::InTotoStatement::predicate]
9865 /// to hold a `SlsaProvenanceZeroTwo`.
9866 ///
9867 /// Note that all the setters affecting `predicate` are
9868 /// mutually exclusive.
9869 ///
9870 /// # Example
9871 /// ```ignore,no_run
9872 /// # use google_cloud_grafeas_v1::model::InTotoStatement;
9873 /// use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
9874 /// let x = InTotoStatement::new().set_slsa_provenance_zero_two(SlsaProvenanceZeroTwo::default()/* use setters */);
9875 /// assert!(x.slsa_provenance_zero_two().is_some());
9876 /// assert!(x.provenance().is_none());
9877 /// assert!(x.slsa_provenance().is_none());
9878 /// ```
9879 pub fn set_slsa_provenance_zero_two<
9880 T: std::convert::Into<std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>>,
9881 >(
9882 mut self,
9883 v: T,
9884 ) -> Self {
9885 self.predicate = std::option::Option::Some(
9886 crate::model::in_toto_statement::Predicate::SlsaProvenanceZeroTwo(v.into()),
9887 );
9888 self
9889 }
9890}
9891
9892impl wkt::message::Message for InTotoStatement {
9893 fn typename() -> &'static str {
9894 "type.googleapis.com/grafeas.v1.InTotoStatement"
9895 }
9896}
9897
9898/// Defines additional types related to [InTotoStatement].
9899pub mod in_toto_statement {
9900 #[allow(unused_imports)]
9901 use super::*;
9902
9903 #[derive(Clone, Debug, PartialEq)]
9904 #[non_exhaustive]
9905 pub enum Predicate {
9906 Provenance(std::boxed::Box<crate::model::InTotoProvenance>),
9907 SlsaProvenance(std::boxed::Box<crate::model::SlsaProvenance>),
9908 SlsaProvenanceZeroTwo(std::boxed::Box<crate::model::SlsaProvenanceZeroTwo>),
9909 }
9910}
9911
9912#[derive(Clone, Default, PartialEq)]
9913#[non_exhaustive]
9914pub struct Subject {
9915 pub name: std::string::String,
9916
9917 /// `"<ALGORITHM>": "<HEX_VALUE>"`
9918 /// Algorithms can be e.g. sha256, sha512
9919 /// See
9920 /// <https://github.com/in-toto/attestation/blob/main/spec/field_types.md#DigestSet>
9921 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
9922
9923 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9924}
9925
9926impl Subject {
9927 pub fn new() -> Self {
9928 std::default::Default::default()
9929 }
9930
9931 /// Sets the value of [name][crate::model::Subject::name].
9932 ///
9933 /// # Example
9934 /// ```ignore,no_run
9935 /// # use google_cloud_grafeas_v1::model::Subject;
9936 /// let x = Subject::new().set_name("example");
9937 /// ```
9938 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9939 self.name = v.into();
9940 self
9941 }
9942
9943 /// Sets the value of [digest][crate::model::Subject::digest].
9944 ///
9945 /// # Example
9946 /// ```ignore,no_run
9947 /// # use google_cloud_grafeas_v1::model::Subject;
9948 /// let x = Subject::new().set_digest([
9949 /// ("key0", "abc"),
9950 /// ("key1", "xyz"),
9951 /// ]);
9952 /// ```
9953 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
9954 where
9955 T: std::iter::IntoIterator<Item = (K, V)>,
9956 K: std::convert::Into<std::string::String>,
9957 V: std::convert::Into<std::string::String>,
9958 {
9959 use std::iter::Iterator;
9960 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9961 self
9962 }
9963}
9964
9965impl wkt::message::Message for Subject {
9966 fn typename() -> &'static str {
9967 "type.googleapis.com/grafeas.v1.Subject"
9968 }
9969}
9970
9971#[derive(Clone, Default, PartialEq)]
9972#[non_exhaustive]
9973pub struct InTotoSlsaProvenanceV1 {
9974 /// InToto spec defined at
9975 /// <https://github.com/in-toto/attestation/tree/main/spec#statement>
9976 pub r#type: std::string::String,
9977
9978 pub subject: std::vec::Vec<crate::model::Subject>,
9979
9980 pub predicate_type: std::string::String,
9981
9982 pub predicate: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
9983
9984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9985}
9986
9987impl InTotoSlsaProvenanceV1 {
9988 pub fn new() -> Self {
9989 std::default::Default::default()
9990 }
9991
9992 /// Sets the value of [r#type][crate::model::InTotoSlsaProvenanceV1::type].
9993 ///
9994 /// # Example
9995 /// ```ignore,no_run
9996 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
9997 /// let x = InTotoSlsaProvenanceV1::new().set_type("example");
9998 /// ```
9999 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10000 self.r#type = v.into();
10001 self
10002 }
10003
10004 /// Sets the value of [subject][crate::model::InTotoSlsaProvenanceV1::subject].
10005 ///
10006 /// # Example
10007 /// ```ignore,no_run
10008 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
10009 /// use google_cloud_grafeas_v1::model::Subject;
10010 /// let x = InTotoSlsaProvenanceV1::new()
10011 /// .set_subject([
10012 /// Subject::default()/* use setters */,
10013 /// Subject::default()/* use (different) setters */,
10014 /// ]);
10015 /// ```
10016 pub fn set_subject<T, V>(mut self, v: T) -> Self
10017 where
10018 T: std::iter::IntoIterator<Item = V>,
10019 V: std::convert::Into<crate::model::Subject>,
10020 {
10021 use std::iter::Iterator;
10022 self.subject = v.into_iter().map(|i| i.into()).collect();
10023 self
10024 }
10025
10026 /// Sets the value of [predicate_type][crate::model::InTotoSlsaProvenanceV1::predicate_type].
10027 ///
10028 /// # Example
10029 /// ```ignore,no_run
10030 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
10031 /// let x = InTotoSlsaProvenanceV1::new().set_predicate_type("example");
10032 /// ```
10033 pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10034 self.predicate_type = v.into();
10035 self
10036 }
10037
10038 /// Sets the value of [predicate][crate::model::InTotoSlsaProvenanceV1::predicate].
10039 ///
10040 /// # Example
10041 /// ```ignore,no_run
10042 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
10043 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10044 /// let x = InTotoSlsaProvenanceV1::new().set_predicate(SlsaProvenanceV1::default()/* use setters */);
10045 /// ```
10046 pub fn set_predicate<T>(mut self, v: T) -> Self
10047 where
10048 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
10049 {
10050 self.predicate = std::option::Option::Some(v.into());
10051 self
10052 }
10053
10054 /// Sets or clears the value of [predicate][crate::model::InTotoSlsaProvenanceV1::predicate].
10055 ///
10056 /// # Example
10057 /// ```ignore,no_run
10058 /// # use google_cloud_grafeas_v1::model::InTotoSlsaProvenanceV1;
10059 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10060 /// let x = InTotoSlsaProvenanceV1::new().set_or_clear_predicate(Some(SlsaProvenanceV1::default()/* use setters */));
10061 /// let x = InTotoSlsaProvenanceV1::new().set_or_clear_predicate(None::<SlsaProvenanceV1>);
10062 /// ```
10063 pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
10064 where
10065 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1>,
10066 {
10067 self.predicate = v.map(|x| x.into());
10068 self
10069 }
10070}
10071
10072impl wkt::message::Message for InTotoSlsaProvenanceV1 {
10073 fn typename() -> &'static str {
10074 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1"
10075 }
10076}
10077
10078/// Defines additional types related to [InTotoSlsaProvenanceV1].
10079pub mod in_toto_slsa_provenance_v_1 {
10080 #[allow(unused_imports)]
10081 use super::*;
10082
10083 /// Keep in sync with schema at
10084 /// <https://github.com/slsa-framework/slsa/blob/main/docs/provenance/schema/v1/provenance.proto>
10085 /// Builder renamed to ProvenanceBuilder because of Java conflicts.
10086 #[derive(Clone, Default, PartialEq)]
10087 #[non_exhaustive]
10088 pub struct SlsaProvenanceV1 {
10089 pub build_definition:
10090 std::option::Option<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
10091
10092 pub run_details: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
10093
10094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10095 }
10096
10097 impl SlsaProvenanceV1 {
10098 pub fn new() -> Self {
10099 std::default::Default::default()
10100 }
10101
10102 /// Sets the value of [build_definition][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::build_definition].
10103 ///
10104 /// # Example
10105 /// ```ignore,no_run
10106 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10107 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10108 /// let x = SlsaProvenanceV1::new().set_build_definition(BuildDefinition::default()/* use setters */);
10109 /// ```
10110 pub fn set_build_definition<T>(mut self, v: T) -> Self
10111 where
10112 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
10113 {
10114 self.build_definition = std::option::Option::Some(v.into());
10115 self
10116 }
10117
10118 /// Sets or clears the value of [build_definition][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::build_definition].
10119 ///
10120 /// # Example
10121 /// ```ignore,no_run
10122 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10123 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10124 /// let x = SlsaProvenanceV1::new().set_or_clear_build_definition(Some(BuildDefinition::default()/* use setters */));
10125 /// let x = SlsaProvenanceV1::new().set_or_clear_build_definition(None::<BuildDefinition>);
10126 /// ```
10127 pub fn set_or_clear_build_definition<T>(mut self, v: std::option::Option<T>) -> Self
10128 where
10129 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildDefinition>,
10130 {
10131 self.build_definition = v.map(|x| x.into());
10132 self
10133 }
10134
10135 /// Sets the value of [run_details][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::run_details].
10136 ///
10137 /// # Example
10138 /// ```ignore,no_run
10139 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10140 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10141 /// let x = SlsaProvenanceV1::new().set_run_details(RunDetails::default()/* use setters */);
10142 /// ```
10143 pub fn set_run_details<T>(mut self, v: T) -> Self
10144 where
10145 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
10146 {
10147 self.run_details = std::option::Option::Some(v.into());
10148 self
10149 }
10150
10151 /// Sets or clears the value of [run_details][crate::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1::run_details].
10152 ///
10153 /// # Example
10154 /// ```ignore,no_run
10155 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::SlsaProvenanceV1;
10156 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10157 /// let x = SlsaProvenanceV1::new().set_or_clear_run_details(Some(RunDetails::default()/* use setters */));
10158 /// let x = SlsaProvenanceV1::new().set_or_clear_run_details(None::<RunDetails>);
10159 /// ```
10160 pub fn set_or_clear_run_details<T>(mut self, v: std::option::Option<T>) -> Self
10161 where
10162 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::RunDetails>,
10163 {
10164 self.run_details = v.map(|x| x.into());
10165 self
10166 }
10167 }
10168
10169 impl wkt::message::Message for SlsaProvenanceV1 {
10170 fn typename() -> &'static str {
10171 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.SlsaProvenanceV1"
10172 }
10173 }
10174
10175 #[derive(Clone, Default, PartialEq)]
10176 #[non_exhaustive]
10177 pub struct BuildDefinition {
10178 pub build_type: std::string::String,
10179
10180 pub external_parameters: std::option::Option<wkt::Struct>,
10181
10182 pub internal_parameters: std::option::Option<wkt::Struct>,
10183
10184 pub resolved_dependencies:
10185 std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10186
10187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10188 }
10189
10190 impl BuildDefinition {
10191 pub fn new() -> Self {
10192 std::default::Default::default()
10193 }
10194
10195 /// Sets the value of [build_type][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::build_type].
10196 ///
10197 /// # Example
10198 /// ```ignore,no_run
10199 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10200 /// let x = BuildDefinition::new().set_build_type("example");
10201 /// ```
10202 pub fn set_build_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10203 self.build_type = v.into();
10204 self
10205 }
10206
10207 /// Sets the value of [external_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::external_parameters].
10208 ///
10209 /// # Example
10210 /// ```ignore,no_run
10211 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10212 /// use wkt::Struct;
10213 /// let x = BuildDefinition::new().set_external_parameters(Struct::default()/* use setters */);
10214 /// ```
10215 pub fn set_external_parameters<T>(mut self, v: T) -> Self
10216 where
10217 T: std::convert::Into<wkt::Struct>,
10218 {
10219 self.external_parameters = std::option::Option::Some(v.into());
10220 self
10221 }
10222
10223 /// Sets or clears the value of [external_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::external_parameters].
10224 ///
10225 /// # Example
10226 /// ```ignore,no_run
10227 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10228 /// use wkt::Struct;
10229 /// let x = BuildDefinition::new().set_or_clear_external_parameters(Some(Struct::default()/* use setters */));
10230 /// let x = BuildDefinition::new().set_or_clear_external_parameters(None::<Struct>);
10231 /// ```
10232 pub fn set_or_clear_external_parameters<T>(mut self, v: std::option::Option<T>) -> Self
10233 where
10234 T: std::convert::Into<wkt::Struct>,
10235 {
10236 self.external_parameters = v.map(|x| x.into());
10237 self
10238 }
10239
10240 /// Sets the value of [internal_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::internal_parameters].
10241 ///
10242 /// # Example
10243 /// ```ignore,no_run
10244 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10245 /// use wkt::Struct;
10246 /// let x = BuildDefinition::new().set_internal_parameters(Struct::default()/* use setters */);
10247 /// ```
10248 pub fn set_internal_parameters<T>(mut self, v: T) -> Self
10249 where
10250 T: std::convert::Into<wkt::Struct>,
10251 {
10252 self.internal_parameters = std::option::Option::Some(v.into());
10253 self
10254 }
10255
10256 /// Sets or clears the value of [internal_parameters][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::internal_parameters].
10257 ///
10258 /// # Example
10259 /// ```ignore,no_run
10260 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10261 /// use wkt::Struct;
10262 /// let x = BuildDefinition::new().set_or_clear_internal_parameters(Some(Struct::default()/* use setters */));
10263 /// let x = BuildDefinition::new().set_or_clear_internal_parameters(None::<Struct>);
10264 /// ```
10265 pub fn set_or_clear_internal_parameters<T>(mut self, v: std::option::Option<T>) -> Self
10266 where
10267 T: std::convert::Into<wkt::Struct>,
10268 {
10269 self.internal_parameters = v.map(|x| x.into());
10270 self
10271 }
10272
10273 /// Sets the value of [resolved_dependencies][crate::model::in_toto_slsa_provenance_v_1::BuildDefinition::resolved_dependencies].
10274 ///
10275 /// # Example
10276 /// ```ignore,no_run
10277 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildDefinition;
10278 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10279 /// let x = BuildDefinition::new()
10280 /// .set_resolved_dependencies([
10281 /// ResourceDescriptor::default()/* use setters */,
10282 /// ResourceDescriptor::default()/* use (different) setters */,
10283 /// ]);
10284 /// ```
10285 pub fn set_resolved_dependencies<T, V>(mut self, v: T) -> Self
10286 where
10287 T: std::iter::IntoIterator<Item = V>,
10288 V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10289 {
10290 use std::iter::Iterator;
10291 self.resolved_dependencies = v.into_iter().map(|i| i.into()).collect();
10292 self
10293 }
10294 }
10295
10296 impl wkt::message::Message for BuildDefinition {
10297 fn typename() -> &'static str {
10298 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.BuildDefinition"
10299 }
10300 }
10301
10302 #[derive(Clone, Default, PartialEq)]
10303 #[non_exhaustive]
10304 pub struct ResourceDescriptor {
10305 pub name: std::string::String,
10306
10307 pub uri: std::string::String,
10308
10309 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
10310
10311 pub content: ::bytes::Bytes,
10312
10313 pub download_location: std::string::String,
10314
10315 pub media_type: std::string::String,
10316
10317 pub annotations: std::collections::HashMap<std::string::String, wkt::Value>,
10318
10319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10320 }
10321
10322 impl ResourceDescriptor {
10323 pub fn new() -> Self {
10324 std::default::Default::default()
10325 }
10326
10327 /// Sets the value of [name][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::name].
10328 ///
10329 /// # Example
10330 /// ```ignore,no_run
10331 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10332 /// let x = ResourceDescriptor::new().set_name("example");
10333 /// ```
10334 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10335 self.name = v.into();
10336 self
10337 }
10338
10339 /// Sets the value of [uri][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::uri].
10340 ///
10341 /// # Example
10342 /// ```ignore,no_run
10343 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10344 /// let x = ResourceDescriptor::new().set_uri("example");
10345 /// ```
10346 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10347 self.uri = v.into();
10348 self
10349 }
10350
10351 /// Sets the value of [digest][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::digest].
10352 ///
10353 /// # Example
10354 /// ```ignore,no_run
10355 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10356 /// let x = ResourceDescriptor::new().set_digest([
10357 /// ("key0", "abc"),
10358 /// ("key1", "xyz"),
10359 /// ]);
10360 /// ```
10361 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
10362 where
10363 T: std::iter::IntoIterator<Item = (K, V)>,
10364 K: std::convert::Into<std::string::String>,
10365 V: std::convert::Into<std::string::String>,
10366 {
10367 use std::iter::Iterator;
10368 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10369 self
10370 }
10371
10372 /// Sets the value of [content][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::content].
10373 ///
10374 /// # Example
10375 /// ```ignore,no_run
10376 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10377 /// let x = ResourceDescriptor::new().set_content(bytes::Bytes::from_static(b"example"));
10378 /// ```
10379 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10380 self.content = v.into();
10381 self
10382 }
10383
10384 /// Sets the value of [download_location][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::download_location].
10385 ///
10386 /// # Example
10387 /// ```ignore,no_run
10388 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10389 /// let x = ResourceDescriptor::new().set_download_location("example");
10390 /// ```
10391 pub fn set_download_location<T: std::convert::Into<std::string::String>>(
10392 mut self,
10393 v: T,
10394 ) -> Self {
10395 self.download_location = v.into();
10396 self
10397 }
10398
10399 /// Sets the value of [media_type][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::media_type].
10400 ///
10401 /// # Example
10402 /// ```ignore,no_run
10403 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10404 /// let x = ResourceDescriptor::new().set_media_type("example");
10405 /// ```
10406 pub fn set_media_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10407 self.media_type = v.into();
10408 self
10409 }
10410
10411 /// Sets the value of [annotations][crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor::annotations].
10412 ///
10413 /// # Example
10414 /// ```ignore,no_run
10415 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10416 /// use wkt::Value;
10417 /// let x = ResourceDescriptor::new().set_annotations([
10418 /// ("key0", Value::default()/* use setters */),
10419 /// ("key1", Value::default()/* use (different) setters */),
10420 /// ]);
10421 /// ```
10422 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
10423 where
10424 T: std::iter::IntoIterator<Item = (K, V)>,
10425 K: std::convert::Into<std::string::String>,
10426 V: std::convert::Into<wkt::Value>,
10427 {
10428 use std::iter::Iterator;
10429 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10430 self
10431 }
10432 }
10433
10434 impl wkt::message::Message for ResourceDescriptor {
10435 fn typename() -> &'static str {
10436 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.ResourceDescriptor"
10437 }
10438 }
10439
10440 #[derive(Clone, Default, PartialEq)]
10441 #[non_exhaustive]
10442 pub struct RunDetails {
10443 pub builder:
10444 std::option::Option<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
10445
10446 pub metadata: std::option::Option<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
10447
10448 pub byproducts:
10449 std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10450
10451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10452 }
10453
10454 impl RunDetails {
10455 pub fn new() -> Self {
10456 std::default::Default::default()
10457 }
10458
10459 /// Sets the value of [builder][crate::model::in_toto_slsa_provenance_v_1::RunDetails::builder].
10460 ///
10461 /// # Example
10462 /// ```ignore,no_run
10463 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10464 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10465 /// let x = RunDetails::new().set_builder(ProvenanceBuilder::default()/* use setters */);
10466 /// ```
10467 pub fn set_builder<T>(mut self, v: T) -> Self
10468 where
10469 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
10470 {
10471 self.builder = std::option::Option::Some(v.into());
10472 self
10473 }
10474
10475 /// Sets or clears the value of [builder][crate::model::in_toto_slsa_provenance_v_1::RunDetails::builder].
10476 ///
10477 /// # Example
10478 /// ```ignore,no_run
10479 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10480 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10481 /// let x = RunDetails::new().set_or_clear_builder(Some(ProvenanceBuilder::default()/* use setters */));
10482 /// let x = RunDetails::new().set_or_clear_builder(None::<ProvenanceBuilder>);
10483 /// ```
10484 pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
10485 where
10486 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder>,
10487 {
10488 self.builder = v.map(|x| x.into());
10489 self
10490 }
10491
10492 /// Sets the value of [metadata][crate::model::in_toto_slsa_provenance_v_1::RunDetails::metadata].
10493 ///
10494 /// # Example
10495 /// ```ignore,no_run
10496 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10497 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10498 /// let x = RunDetails::new().set_metadata(BuildMetadata::default()/* use setters */);
10499 /// ```
10500 pub fn set_metadata<T>(mut self, v: T) -> Self
10501 where
10502 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
10503 {
10504 self.metadata = std::option::Option::Some(v.into());
10505 self
10506 }
10507
10508 /// Sets or clears the value of [metadata][crate::model::in_toto_slsa_provenance_v_1::RunDetails::metadata].
10509 ///
10510 /// # Example
10511 /// ```ignore,no_run
10512 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10513 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10514 /// let x = RunDetails::new().set_or_clear_metadata(Some(BuildMetadata::default()/* use setters */));
10515 /// let x = RunDetails::new().set_or_clear_metadata(None::<BuildMetadata>);
10516 /// ```
10517 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
10518 where
10519 T: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::BuildMetadata>,
10520 {
10521 self.metadata = v.map(|x| x.into());
10522 self
10523 }
10524
10525 /// Sets the value of [byproducts][crate::model::in_toto_slsa_provenance_v_1::RunDetails::byproducts].
10526 ///
10527 /// # Example
10528 /// ```ignore,no_run
10529 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::RunDetails;
10530 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10531 /// let x = RunDetails::new()
10532 /// .set_byproducts([
10533 /// ResourceDescriptor::default()/* use setters */,
10534 /// ResourceDescriptor::default()/* use (different) setters */,
10535 /// ]);
10536 /// ```
10537 pub fn set_byproducts<T, V>(mut self, v: T) -> Self
10538 where
10539 T: std::iter::IntoIterator<Item = V>,
10540 V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10541 {
10542 use std::iter::Iterator;
10543 self.byproducts = v.into_iter().map(|i| i.into()).collect();
10544 self
10545 }
10546 }
10547
10548 impl wkt::message::Message for RunDetails {
10549 fn typename() -> &'static str {
10550 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.RunDetails"
10551 }
10552 }
10553
10554 #[derive(Clone, Default, PartialEq)]
10555 #[non_exhaustive]
10556 pub struct ProvenanceBuilder {
10557 pub id: std::string::String,
10558
10559 pub version: std::collections::HashMap<std::string::String, std::string::String>,
10560
10561 pub builder_dependencies:
10562 std::vec::Vec<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10563
10564 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10565 }
10566
10567 impl ProvenanceBuilder {
10568 pub fn new() -> Self {
10569 std::default::Default::default()
10570 }
10571
10572 /// Sets the value of [id][crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder::id].
10573 ///
10574 /// # Example
10575 /// ```ignore,no_run
10576 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10577 /// let x = ProvenanceBuilder::new().set_id("example");
10578 /// ```
10579 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10580 self.id = v.into();
10581 self
10582 }
10583
10584 /// Sets the value of [version][crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder::version].
10585 ///
10586 /// # Example
10587 /// ```ignore,no_run
10588 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10589 /// let x = ProvenanceBuilder::new().set_version([
10590 /// ("key0", "abc"),
10591 /// ("key1", "xyz"),
10592 /// ]);
10593 /// ```
10594 pub fn set_version<T, K, V>(mut self, v: T) -> Self
10595 where
10596 T: std::iter::IntoIterator<Item = (K, V)>,
10597 K: std::convert::Into<std::string::String>,
10598 V: std::convert::Into<std::string::String>,
10599 {
10600 use std::iter::Iterator;
10601 self.version = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10602 self
10603 }
10604
10605 /// Sets the value of [builder_dependencies][crate::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder::builder_dependencies].
10606 ///
10607 /// # Example
10608 /// ```ignore,no_run
10609 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ProvenanceBuilder;
10610 /// use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::ResourceDescriptor;
10611 /// let x = ProvenanceBuilder::new()
10612 /// .set_builder_dependencies([
10613 /// ResourceDescriptor::default()/* use setters */,
10614 /// ResourceDescriptor::default()/* use (different) setters */,
10615 /// ]);
10616 /// ```
10617 pub fn set_builder_dependencies<T, V>(mut self, v: T) -> Self
10618 where
10619 T: std::iter::IntoIterator<Item = V>,
10620 V: std::convert::Into<crate::model::in_toto_slsa_provenance_v_1::ResourceDescriptor>,
10621 {
10622 use std::iter::Iterator;
10623 self.builder_dependencies = v.into_iter().map(|i| i.into()).collect();
10624 self
10625 }
10626 }
10627
10628 impl wkt::message::Message for ProvenanceBuilder {
10629 fn typename() -> &'static str {
10630 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.ProvenanceBuilder"
10631 }
10632 }
10633
10634 #[derive(Clone, Default, PartialEq)]
10635 #[non_exhaustive]
10636 pub struct BuildMetadata {
10637 pub invocation_id: std::string::String,
10638
10639 pub started_on: std::option::Option<wkt::Timestamp>,
10640
10641 pub finished_on: std::option::Option<wkt::Timestamp>,
10642
10643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10644 }
10645
10646 impl BuildMetadata {
10647 pub fn new() -> Self {
10648 std::default::Default::default()
10649 }
10650
10651 /// Sets the value of [invocation_id][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::invocation_id].
10652 ///
10653 /// # Example
10654 /// ```ignore,no_run
10655 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10656 /// let x = BuildMetadata::new().set_invocation_id("example");
10657 /// ```
10658 pub fn set_invocation_id<T: std::convert::Into<std::string::String>>(
10659 mut self,
10660 v: T,
10661 ) -> Self {
10662 self.invocation_id = v.into();
10663 self
10664 }
10665
10666 /// Sets the value of [started_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::started_on].
10667 ///
10668 /// # Example
10669 /// ```ignore,no_run
10670 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10671 /// use wkt::Timestamp;
10672 /// let x = BuildMetadata::new().set_started_on(Timestamp::default()/* use setters */);
10673 /// ```
10674 pub fn set_started_on<T>(mut self, v: T) -> Self
10675 where
10676 T: std::convert::Into<wkt::Timestamp>,
10677 {
10678 self.started_on = std::option::Option::Some(v.into());
10679 self
10680 }
10681
10682 /// Sets or clears the value of [started_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::started_on].
10683 ///
10684 /// # Example
10685 /// ```ignore,no_run
10686 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10687 /// use wkt::Timestamp;
10688 /// let x = BuildMetadata::new().set_or_clear_started_on(Some(Timestamp::default()/* use setters */));
10689 /// let x = BuildMetadata::new().set_or_clear_started_on(None::<Timestamp>);
10690 /// ```
10691 pub fn set_or_clear_started_on<T>(mut self, v: std::option::Option<T>) -> Self
10692 where
10693 T: std::convert::Into<wkt::Timestamp>,
10694 {
10695 self.started_on = v.map(|x| x.into());
10696 self
10697 }
10698
10699 /// Sets the value of [finished_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::finished_on].
10700 ///
10701 /// # Example
10702 /// ```ignore,no_run
10703 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10704 /// use wkt::Timestamp;
10705 /// let x = BuildMetadata::new().set_finished_on(Timestamp::default()/* use setters */);
10706 /// ```
10707 pub fn set_finished_on<T>(mut self, v: T) -> Self
10708 where
10709 T: std::convert::Into<wkt::Timestamp>,
10710 {
10711 self.finished_on = std::option::Option::Some(v.into());
10712 self
10713 }
10714
10715 /// Sets or clears the value of [finished_on][crate::model::in_toto_slsa_provenance_v_1::BuildMetadata::finished_on].
10716 ///
10717 /// # Example
10718 /// ```ignore,no_run
10719 /// # use google_cloud_grafeas_v1::model::in_toto_slsa_provenance_v_1::BuildMetadata;
10720 /// use wkt::Timestamp;
10721 /// let x = BuildMetadata::new().set_or_clear_finished_on(Some(Timestamp::default()/* use setters */));
10722 /// let x = BuildMetadata::new().set_or_clear_finished_on(None::<Timestamp>);
10723 /// ```
10724 pub fn set_or_clear_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
10725 where
10726 T: std::convert::Into<wkt::Timestamp>,
10727 {
10728 self.finished_on = v.map(|x| x.into());
10729 self
10730 }
10731 }
10732
10733 impl wkt::message::Message for BuildMetadata {
10734 fn typename() -> &'static str {
10735 "type.googleapis.com/grafeas.v1.InTotoSlsaProvenanceV1.BuildMetadata"
10736 }
10737 }
10738}
10739
10740/// This represents a particular channel of distribution for a given package.
10741/// E.g., Debian's jessie-backports dpkg mirror.
10742#[derive(Clone, Default, PartialEq)]
10743#[non_exhaustive]
10744pub struct Distribution {
10745 /// The cpe_uri in [CPE format](https://cpe.mitre.org/specification/)
10746 /// denoting the package manager version distributing a package.
10747 pub cpe_uri: std::string::String,
10748
10749 /// The CPU architecture for which packages in this distribution channel were
10750 /// built.
10751 pub architecture: crate::model::Architecture,
10752
10753 /// The latest available version of this package in this distribution channel.
10754 pub latest_version: std::option::Option<crate::model::Version>,
10755
10756 /// A freeform string denoting the maintainer of this package.
10757 pub maintainer: std::string::String,
10758
10759 /// The distribution channel-specific homepage for this package.
10760 pub url: std::string::String,
10761
10762 /// The distribution channel-specific description of this package.
10763 pub description: std::string::String,
10764
10765 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10766}
10767
10768impl Distribution {
10769 pub fn new() -> Self {
10770 std::default::Default::default()
10771 }
10772
10773 /// Sets the value of [cpe_uri][crate::model::Distribution::cpe_uri].
10774 ///
10775 /// # Example
10776 /// ```ignore,no_run
10777 /// # use google_cloud_grafeas_v1::model::Distribution;
10778 /// let x = Distribution::new().set_cpe_uri("example");
10779 /// ```
10780 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10781 self.cpe_uri = v.into();
10782 self
10783 }
10784
10785 /// Sets the value of [architecture][crate::model::Distribution::architecture].
10786 ///
10787 /// # Example
10788 /// ```ignore,no_run
10789 /// # use google_cloud_grafeas_v1::model::Distribution;
10790 /// use google_cloud_grafeas_v1::model::Architecture;
10791 /// let x0 = Distribution::new().set_architecture(Architecture::X86);
10792 /// let x1 = Distribution::new().set_architecture(Architecture::X64);
10793 /// ```
10794 pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
10795 mut self,
10796 v: T,
10797 ) -> Self {
10798 self.architecture = v.into();
10799 self
10800 }
10801
10802 /// Sets the value of [latest_version][crate::model::Distribution::latest_version].
10803 ///
10804 /// # Example
10805 /// ```ignore,no_run
10806 /// # use google_cloud_grafeas_v1::model::Distribution;
10807 /// use google_cloud_grafeas_v1::model::Version;
10808 /// let x = Distribution::new().set_latest_version(Version::default()/* use setters */);
10809 /// ```
10810 pub fn set_latest_version<T>(mut self, v: T) -> Self
10811 where
10812 T: std::convert::Into<crate::model::Version>,
10813 {
10814 self.latest_version = std::option::Option::Some(v.into());
10815 self
10816 }
10817
10818 /// Sets or clears the value of [latest_version][crate::model::Distribution::latest_version].
10819 ///
10820 /// # Example
10821 /// ```ignore,no_run
10822 /// # use google_cloud_grafeas_v1::model::Distribution;
10823 /// use google_cloud_grafeas_v1::model::Version;
10824 /// let x = Distribution::new().set_or_clear_latest_version(Some(Version::default()/* use setters */));
10825 /// let x = Distribution::new().set_or_clear_latest_version(None::<Version>);
10826 /// ```
10827 pub fn set_or_clear_latest_version<T>(mut self, v: std::option::Option<T>) -> Self
10828 where
10829 T: std::convert::Into<crate::model::Version>,
10830 {
10831 self.latest_version = v.map(|x| x.into());
10832 self
10833 }
10834
10835 /// Sets the value of [maintainer][crate::model::Distribution::maintainer].
10836 ///
10837 /// # Example
10838 /// ```ignore,no_run
10839 /// # use google_cloud_grafeas_v1::model::Distribution;
10840 /// let x = Distribution::new().set_maintainer("example");
10841 /// ```
10842 pub fn set_maintainer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10843 self.maintainer = v.into();
10844 self
10845 }
10846
10847 /// Sets the value of [url][crate::model::Distribution::url].
10848 ///
10849 /// # Example
10850 /// ```ignore,no_run
10851 /// # use google_cloud_grafeas_v1::model::Distribution;
10852 /// let x = Distribution::new().set_url("example");
10853 /// ```
10854 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10855 self.url = v.into();
10856 self
10857 }
10858
10859 /// Sets the value of [description][crate::model::Distribution::description].
10860 ///
10861 /// # Example
10862 /// ```ignore,no_run
10863 /// # use google_cloud_grafeas_v1::model::Distribution;
10864 /// let x = Distribution::new().set_description("example");
10865 /// ```
10866 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10867 self.description = v.into();
10868 self
10869 }
10870}
10871
10872impl wkt::message::Message for Distribution {
10873 fn typename() -> &'static str {
10874 "type.googleapis.com/grafeas.v1.Distribution"
10875 }
10876}
10877
10878/// An occurrence of a particular package installation found within a system's
10879/// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`.
10880#[derive(Clone, Default, PartialEq)]
10881#[non_exhaustive]
10882pub struct Location {
10883 /// Deprecated.
10884 /// The CPE URI in [CPE format](https://cpe.mitre.org/specification/)
10885 pub cpe_uri: std::string::String,
10886
10887 /// Deprecated.
10888 /// The version installed at this location.
10889 pub version: std::option::Option<crate::model::Version>,
10890
10891 /// The path from which we gathered that this package/version is installed.
10892 pub path: std::string::String,
10893
10894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10895}
10896
10897impl Location {
10898 pub fn new() -> Self {
10899 std::default::Default::default()
10900 }
10901
10902 /// Sets the value of [cpe_uri][crate::model::Location::cpe_uri].
10903 ///
10904 /// # Example
10905 /// ```ignore,no_run
10906 /// # use google_cloud_grafeas_v1::model::Location;
10907 /// let x = Location::new().set_cpe_uri("example");
10908 /// ```
10909 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10910 self.cpe_uri = v.into();
10911 self
10912 }
10913
10914 /// Sets the value of [version][crate::model::Location::version].
10915 ///
10916 /// # Example
10917 /// ```ignore,no_run
10918 /// # use google_cloud_grafeas_v1::model::Location;
10919 /// use google_cloud_grafeas_v1::model::Version;
10920 /// let x = Location::new().set_version(Version::default()/* use setters */);
10921 /// ```
10922 pub fn set_version<T>(mut self, v: T) -> Self
10923 where
10924 T: std::convert::Into<crate::model::Version>,
10925 {
10926 self.version = std::option::Option::Some(v.into());
10927 self
10928 }
10929
10930 /// Sets or clears the value of [version][crate::model::Location::version].
10931 ///
10932 /// # Example
10933 /// ```ignore,no_run
10934 /// # use google_cloud_grafeas_v1::model::Location;
10935 /// use google_cloud_grafeas_v1::model::Version;
10936 /// let x = Location::new().set_or_clear_version(Some(Version::default()/* use setters */));
10937 /// let x = Location::new().set_or_clear_version(None::<Version>);
10938 /// ```
10939 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
10940 where
10941 T: std::convert::Into<crate::model::Version>,
10942 {
10943 self.version = v.map(|x| x.into());
10944 self
10945 }
10946
10947 /// Sets the value of [path][crate::model::Location::path].
10948 ///
10949 /// # Example
10950 /// ```ignore,no_run
10951 /// # use google_cloud_grafeas_v1::model::Location;
10952 /// let x = Location::new().set_path("example");
10953 /// ```
10954 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10955 self.path = v.into();
10956 self
10957 }
10958}
10959
10960impl wkt::message::Message for Location {
10961 fn typename() -> &'static str {
10962 "type.googleapis.com/grafeas.v1.Location"
10963 }
10964}
10965
10966/// PackageNote represents a particular package version.
10967#[derive(Clone, Default, PartialEq)]
10968#[non_exhaustive]
10969pub struct PackageNote {
10970 /// The name of the package.
10971 pub name: std::string::String,
10972
10973 /// Deprecated.
10974 /// The various channels by which a package is distributed.
10975 pub distribution: std::vec::Vec<crate::model::Distribution>,
10976
10977 /// The type of package; whether native or non native (e.g., ruby gems,
10978 /// node.js packages, etc.).
10979 pub package_type: std::string::String,
10980
10981 /// The cpe_uri in [CPE format](https://cpe.mitre.org/specification/)
10982 /// denoting the package manager version distributing a package.
10983 /// The cpe_uri will be blank for language packages.
10984 pub cpe_uri: std::string::String,
10985
10986 /// The CPU architecture for which packages in this distribution channel were
10987 /// built. Architecture will be blank for language packages.
10988 pub architecture: crate::model::Architecture,
10989
10990 /// The version of the package.
10991 pub version: std::option::Option<crate::model::Version>,
10992
10993 /// A freeform text denoting the maintainer of this package.
10994 pub maintainer: std::string::String,
10995
10996 /// The homepage for this package.
10997 pub url: std::string::String,
10998
10999 /// The description of this package.
11000 pub description: std::string::String,
11001
11002 /// Licenses that have been declared by the authors of the package.
11003 pub license: std::option::Option<crate::model::License>,
11004
11005 /// Hash value, typically a file digest, that allows unique
11006 /// identification a specific package.
11007 pub digest: std::vec::Vec<crate::model::Digest>,
11008
11009 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11010}
11011
11012impl PackageNote {
11013 pub fn new() -> Self {
11014 std::default::Default::default()
11015 }
11016
11017 /// Sets the value of [name][crate::model::PackageNote::name].
11018 ///
11019 /// # Example
11020 /// ```ignore,no_run
11021 /// # use google_cloud_grafeas_v1::model::PackageNote;
11022 /// let x = PackageNote::new().set_name("example");
11023 /// ```
11024 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11025 self.name = v.into();
11026 self
11027 }
11028
11029 /// Sets the value of [distribution][crate::model::PackageNote::distribution].
11030 ///
11031 /// # Example
11032 /// ```ignore,no_run
11033 /// # use google_cloud_grafeas_v1::model::PackageNote;
11034 /// use google_cloud_grafeas_v1::model::Distribution;
11035 /// let x = PackageNote::new()
11036 /// .set_distribution([
11037 /// Distribution::default()/* use setters */,
11038 /// Distribution::default()/* use (different) setters */,
11039 /// ]);
11040 /// ```
11041 pub fn set_distribution<T, V>(mut self, v: T) -> Self
11042 where
11043 T: std::iter::IntoIterator<Item = V>,
11044 V: std::convert::Into<crate::model::Distribution>,
11045 {
11046 use std::iter::Iterator;
11047 self.distribution = v.into_iter().map(|i| i.into()).collect();
11048 self
11049 }
11050
11051 /// Sets the value of [package_type][crate::model::PackageNote::package_type].
11052 ///
11053 /// # Example
11054 /// ```ignore,no_run
11055 /// # use google_cloud_grafeas_v1::model::PackageNote;
11056 /// let x = PackageNote::new().set_package_type("example");
11057 /// ```
11058 pub fn set_package_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11059 self.package_type = v.into();
11060 self
11061 }
11062
11063 /// Sets the value of [cpe_uri][crate::model::PackageNote::cpe_uri].
11064 ///
11065 /// # Example
11066 /// ```ignore,no_run
11067 /// # use google_cloud_grafeas_v1::model::PackageNote;
11068 /// let x = PackageNote::new().set_cpe_uri("example");
11069 /// ```
11070 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11071 self.cpe_uri = v.into();
11072 self
11073 }
11074
11075 /// Sets the value of [architecture][crate::model::PackageNote::architecture].
11076 ///
11077 /// # Example
11078 /// ```ignore,no_run
11079 /// # use google_cloud_grafeas_v1::model::PackageNote;
11080 /// use google_cloud_grafeas_v1::model::Architecture;
11081 /// let x0 = PackageNote::new().set_architecture(Architecture::X86);
11082 /// let x1 = PackageNote::new().set_architecture(Architecture::X64);
11083 /// ```
11084 pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
11085 mut self,
11086 v: T,
11087 ) -> Self {
11088 self.architecture = v.into();
11089 self
11090 }
11091
11092 /// Sets the value of [version][crate::model::PackageNote::version].
11093 ///
11094 /// # Example
11095 /// ```ignore,no_run
11096 /// # use google_cloud_grafeas_v1::model::PackageNote;
11097 /// use google_cloud_grafeas_v1::model::Version;
11098 /// let x = PackageNote::new().set_version(Version::default()/* use setters */);
11099 /// ```
11100 pub fn set_version<T>(mut self, v: T) -> Self
11101 where
11102 T: std::convert::Into<crate::model::Version>,
11103 {
11104 self.version = std::option::Option::Some(v.into());
11105 self
11106 }
11107
11108 /// Sets or clears the value of [version][crate::model::PackageNote::version].
11109 ///
11110 /// # Example
11111 /// ```ignore,no_run
11112 /// # use google_cloud_grafeas_v1::model::PackageNote;
11113 /// use google_cloud_grafeas_v1::model::Version;
11114 /// let x = PackageNote::new().set_or_clear_version(Some(Version::default()/* use setters */));
11115 /// let x = PackageNote::new().set_or_clear_version(None::<Version>);
11116 /// ```
11117 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
11118 where
11119 T: std::convert::Into<crate::model::Version>,
11120 {
11121 self.version = v.map(|x| x.into());
11122 self
11123 }
11124
11125 /// Sets the value of [maintainer][crate::model::PackageNote::maintainer].
11126 ///
11127 /// # Example
11128 /// ```ignore,no_run
11129 /// # use google_cloud_grafeas_v1::model::PackageNote;
11130 /// let x = PackageNote::new().set_maintainer("example");
11131 /// ```
11132 pub fn set_maintainer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11133 self.maintainer = v.into();
11134 self
11135 }
11136
11137 /// Sets the value of [url][crate::model::PackageNote::url].
11138 ///
11139 /// # Example
11140 /// ```ignore,no_run
11141 /// # use google_cloud_grafeas_v1::model::PackageNote;
11142 /// let x = PackageNote::new().set_url("example");
11143 /// ```
11144 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11145 self.url = v.into();
11146 self
11147 }
11148
11149 /// Sets the value of [description][crate::model::PackageNote::description].
11150 ///
11151 /// # Example
11152 /// ```ignore,no_run
11153 /// # use google_cloud_grafeas_v1::model::PackageNote;
11154 /// let x = PackageNote::new().set_description("example");
11155 /// ```
11156 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11157 self.description = v.into();
11158 self
11159 }
11160
11161 /// Sets the value of [license][crate::model::PackageNote::license].
11162 ///
11163 /// # Example
11164 /// ```ignore,no_run
11165 /// # use google_cloud_grafeas_v1::model::PackageNote;
11166 /// use google_cloud_grafeas_v1::model::License;
11167 /// let x = PackageNote::new().set_license(License::default()/* use setters */);
11168 /// ```
11169 pub fn set_license<T>(mut self, v: T) -> Self
11170 where
11171 T: std::convert::Into<crate::model::License>,
11172 {
11173 self.license = std::option::Option::Some(v.into());
11174 self
11175 }
11176
11177 /// Sets or clears the value of [license][crate::model::PackageNote::license].
11178 ///
11179 /// # Example
11180 /// ```ignore,no_run
11181 /// # use google_cloud_grafeas_v1::model::PackageNote;
11182 /// use google_cloud_grafeas_v1::model::License;
11183 /// let x = PackageNote::new().set_or_clear_license(Some(License::default()/* use setters */));
11184 /// let x = PackageNote::new().set_or_clear_license(None::<License>);
11185 /// ```
11186 pub fn set_or_clear_license<T>(mut self, v: std::option::Option<T>) -> Self
11187 where
11188 T: std::convert::Into<crate::model::License>,
11189 {
11190 self.license = v.map(|x| x.into());
11191 self
11192 }
11193
11194 /// Sets the value of [digest][crate::model::PackageNote::digest].
11195 ///
11196 /// # Example
11197 /// ```ignore,no_run
11198 /// # use google_cloud_grafeas_v1::model::PackageNote;
11199 /// use google_cloud_grafeas_v1::model::Digest;
11200 /// let x = PackageNote::new()
11201 /// .set_digest([
11202 /// Digest::default()/* use setters */,
11203 /// Digest::default()/* use (different) setters */,
11204 /// ]);
11205 /// ```
11206 pub fn set_digest<T, V>(mut self, v: T) -> Self
11207 where
11208 T: std::iter::IntoIterator<Item = V>,
11209 V: std::convert::Into<crate::model::Digest>,
11210 {
11211 use std::iter::Iterator;
11212 self.digest = v.into_iter().map(|i| i.into()).collect();
11213 self
11214 }
11215}
11216
11217impl wkt::message::Message for PackageNote {
11218 fn typename() -> &'static str {
11219 "type.googleapis.com/grafeas.v1.PackageNote"
11220 }
11221}
11222
11223/// Details on how a particular software package was installed on a system.
11224#[derive(Clone, Default, PartialEq)]
11225#[non_exhaustive]
11226pub struct PackageOccurrence {
11227 /// The name of the installed package.
11228 pub name: std::string::String,
11229
11230 /// All of the places within the filesystem versions of this package
11231 /// have been found.
11232 pub location: std::vec::Vec<crate::model::Location>,
11233
11234 /// The type of package; whether native or non native (e.g., ruby gems,
11235 /// node.js packages, etc.).
11236 pub package_type: std::string::String,
11237
11238 /// The cpe_uri in [CPE format](https://cpe.mitre.org/specification/)
11239 /// denoting the package manager version distributing a package.
11240 /// The cpe_uri will be blank for language packages.
11241 pub cpe_uri: std::string::String,
11242
11243 /// The CPU architecture for which packages in this distribution channel were
11244 /// built. Architecture will be blank for language packages.
11245 pub architecture: crate::model::Architecture,
11246
11247 /// Licenses that have been declared by the authors of the package.
11248 pub license: std::option::Option<crate::model::License>,
11249
11250 /// The version of the package.
11251 pub version: std::option::Option<crate::model::Version>,
11252
11253 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11254}
11255
11256impl PackageOccurrence {
11257 pub fn new() -> Self {
11258 std::default::Default::default()
11259 }
11260
11261 /// Sets the value of [name][crate::model::PackageOccurrence::name].
11262 ///
11263 /// # Example
11264 /// ```ignore,no_run
11265 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11266 /// let x = PackageOccurrence::new().set_name("example");
11267 /// ```
11268 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11269 self.name = v.into();
11270 self
11271 }
11272
11273 /// Sets the value of [location][crate::model::PackageOccurrence::location].
11274 ///
11275 /// # Example
11276 /// ```ignore,no_run
11277 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11278 /// use google_cloud_grafeas_v1::model::Location;
11279 /// let x = PackageOccurrence::new()
11280 /// .set_location([
11281 /// Location::default()/* use setters */,
11282 /// Location::default()/* use (different) setters */,
11283 /// ]);
11284 /// ```
11285 pub fn set_location<T, V>(mut self, v: T) -> Self
11286 where
11287 T: std::iter::IntoIterator<Item = V>,
11288 V: std::convert::Into<crate::model::Location>,
11289 {
11290 use std::iter::Iterator;
11291 self.location = v.into_iter().map(|i| i.into()).collect();
11292 self
11293 }
11294
11295 /// Sets the value of [package_type][crate::model::PackageOccurrence::package_type].
11296 ///
11297 /// # Example
11298 /// ```ignore,no_run
11299 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11300 /// let x = PackageOccurrence::new().set_package_type("example");
11301 /// ```
11302 pub fn set_package_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11303 self.package_type = v.into();
11304 self
11305 }
11306
11307 /// Sets the value of [cpe_uri][crate::model::PackageOccurrence::cpe_uri].
11308 ///
11309 /// # Example
11310 /// ```ignore,no_run
11311 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11312 /// let x = PackageOccurrence::new().set_cpe_uri("example");
11313 /// ```
11314 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11315 self.cpe_uri = v.into();
11316 self
11317 }
11318
11319 /// Sets the value of [architecture][crate::model::PackageOccurrence::architecture].
11320 ///
11321 /// # Example
11322 /// ```ignore,no_run
11323 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11324 /// use google_cloud_grafeas_v1::model::Architecture;
11325 /// let x0 = PackageOccurrence::new().set_architecture(Architecture::X86);
11326 /// let x1 = PackageOccurrence::new().set_architecture(Architecture::X64);
11327 /// ```
11328 pub fn set_architecture<T: std::convert::Into<crate::model::Architecture>>(
11329 mut self,
11330 v: T,
11331 ) -> Self {
11332 self.architecture = v.into();
11333 self
11334 }
11335
11336 /// Sets the value of [license][crate::model::PackageOccurrence::license].
11337 ///
11338 /// # Example
11339 /// ```ignore,no_run
11340 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11341 /// use google_cloud_grafeas_v1::model::License;
11342 /// let x = PackageOccurrence::new().set_license(License::default()/* use setters */);
11343 /// ```
11344 pub fn set_license<T>(mut self, v: T) -> Self
11345 where
11346 T: std::convert::Into<crate::model::License>,
11347 {
11348 self.license = std::option::Option::Some(v.into());
11349 self
11350 }
11351
11352 /// Sets or clears the value of [license][crate::model::PackageOccurrence::license].
11353 ///
11354 /// # Example
11355 /// ```ignore,no_run
11356 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11357 /// use google_cloud_grafeas_v1::model::License;
11358 /// let x = PackageOccurrence::new().set_or_clear_license(Some(License::default()/* use setters */));
11359 /// let x = PackageOccurrence::new().set_or_clear_license(None::<License>);
11360 /// ```
11361 pub fn set_or_clear_license<T>(mut self, v: std::option::Option<T>) -> Self
11362 where
11363 T: std::convert::Into<crate::model::License>,
11364 {
11365 self.license = v.map(|x| x.into());
11366 self
11367 }
11368
11369 /// Sets the value of [version][crate::model::PackageOccurrence::version].
11370 ///
11371 /// # Example
11372 /// ```ignore,no_run
11373 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11374 /// use google_cloud_grafeas_v1::model::Version;
11375 /// let x = PackageOccurrence::new().set_version(Version::default()/* use setters */);
11376 /// ```
11377 pub fn set_version<T>(mut self, v: T) -> Self
11378 where
11379 T: std::convert::Into<crate::model::Version>,
11380 {
11381 self.version = std::option::Option::Some(v.into());
11382 self
11383 }
11384
11385 /// Sets or clears the value of [version][crate::model::PackageOccurrence::version].
11386 ///
11387 /// # Example
11388 /// ```ignore,no_run
11389 /// # use google_cloud_grafeas_v1::model::PackageOccurrence;
11390 /// use google_cloud_grafeas_v1::model::Version;
11391 /// let x = PackageOccurrence::new().set_or_clear_version(Some(Version::default()/* use setters */));
11392 /// let x = PackageOccurrence::new().set_or_clear_version(None::<Version>);
11393 /// ```
11394 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
11395 where
11396 T: std::convert::Into<crate::model::Version>,
11397 {
11398 self.version = v.map(|x| x.into());
11399 self
11400 }
11401}
11402
11403impl wkt::message::Message for PackageOccurrence {
11404 fn typename() -> &'static str {
11405 "type.googleapis.com/grafeas.v1.PackageOccurrence"
11406 }
11407}
11408
11409/// Version contains structured information about the version of a package.
11410#[derive(Clone, Default, PartialEq)]
11411#[non_exhaustive]
11412pub struct Version {
11413 /// Used to correct mistakes in the version numbering scheme.
11414 pub epoch: i32,
11415
11416 /// Required only when version kind is NORMAL. The main part of the version
11417 /// name.
11418 pub name: std::string::String,
11419
11420 /// The iteration of the package build from the above version.
11421 pub revision: std::string::String,
11422
11423 /// Whether this version is specifying part of an inclusive range. Grafeas
11424 /// does not have the capability to specify version ranges; instead we have
11425 /// fields that specify start version and end versions. At times this is
11426 /// insufficient - we also need to specify whether the version is included in
11427 /// the range or is excluded from the range. This boolean is expected to be set
11428 /// to true when the version is included in a range.
11429 pub inclusive: bool,
11430
11431 /// Required. Distinguishes between sentinel MIN/MAX versions and normal
11432 /// versions.
11433 pub kind: crate::model::version::VersionKind,
11434
11435 /// Human readable version string. This string is of the form
11436 /// \<epoch\>:\<name\>-\<revision\> and is only set when kind is NORMAL.
11437 pub full_name: std::string::String,
11438
11439 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11440}
11441
11442impl Version {
11443 pub fn new() -> Self {
11444 std::default::Default::default()
11445 }
11446
11447 /// Sets the value of [epoch][crate::model::Version::epoch].
11448 ///
11449 /// # Example
11450 /// ```ignore,no_run
11451 /// # use google_cloud_grafeas_v1::model::Version;
11452 /// let x = Version::new().set_epoch(42);
11453 /// ```
11454 pub fn set_epoch<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11455 self.epoch = v.into();
11456 self
11457 }
11458
11459 /// Sets the value of [name][crate::model::Version::name].
11460 ///
11461 /// # Example
11462 /// ```ignore,no_run
11463 /// # use google_cloud_grafeas_v1::model::Version;
11464 /// let x = Version::new().set_name("example");
11465 /// ```
11466 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11467 self.name = v.into();
11468 self
11469 }
11470
11471 /// Sets the value of [revision][crate::model::Version::revision].
11472 ///
11473 /// # Example
11474 /// ```ignore,no_run
11475 /// # use google_cloud_grafeas_v1::model::Version;
11476 /// let x = Version::new().set_revision("example");
11477 /// ```
11478 pub fn set_revision<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11479 self.revision = v.into();
11480 self
11481 }
11482
11483 /// Sets the value of [inclusive][crate::model::Version::inclusive].
11484 ///
11485 /// # Example
11486 /// ```ignore,no_run
11487 /// # use google_cloud_grafeas_v1::model::Version;
11488 /// let x = Version::new().set_inclusive(true);
11489 /// ```
11490 pub fn set_inclusive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11491 self.inclusive = v.into();
11492 self
11493 }
11494
11495 /// Sets the value of [kind][crate::model::Version::kind].
11496 ///
11497 /// # Example
11498 /// ```ignore,no_run
11499 /// # use google_cloud_grafeas_v1::model::Version;
11500 /// use google_cloud_grafeas_v1::model::version::VersionKind;
11501 /// let x0 = Version::new().set_kind(VersionKind::Normal);
11502 /// let x1 = Version::new().set_kind(VersionKind::Minimum);
11503 /// let x2 = Version::new().set_kind(VersionKind::Maximum);
11504 /// ```
11505 pub fn set_kind<T: std::convert::Into<crate::model::version::VersionKind>>(
11506 mut self,
11507 v: T,
11508 ) -> Self {
11509 self.kind = v.into();
11510 self
11511 }
11512
11513 /// Sets the value of [full_name][crate::model::Version::full_name].
11514 ///
11515 /// # Example
11516 /// ```ignore,no_run
11517 /// # use google_cloud_grafeas_v1::model::Version;
11518 /// let x = Version::new().set_full_name("example");
11519 /// ```
11520 pub fn set_full_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11521 self.full_name = v.into();
11522 self
11523 }
11524}
11525
11526impl wkt::message::Message for Version {
11527 fn typename() -> &'static str {
11528 "type.googleapis.com/grafeas.v1.Version"
11529 }
11530}
11531
11532/// Defines additional types related to [Version].
11533pub mod version {
11534 #[allow(unused_imports)]
11535 use super::*;
11536
11537 /// Whether this is an ordinary package version or a sentinel MIN/MAX version.
11538 ///
11539 /// # Working with unknown values
11540 ///
11541 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11542 /// additional enum variants at any time. Adding new variants is not considered
11543 /// a breaking change. Applications should write their code in anticipation of:
11544 ///
11545 /// - New values appearing in future releases of the client library, **and**
11546 /// - New values received dynamically, without application changes.
11547 ///
11548 /// Please consult the [Working with enums] section in the user guide for some
11549 /// guidelines.
11550 ///
11551 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11552 #[derive(Clone, Debug, PartialEq)]
11553 #[non_exhaustive]
11554 pub enum VersionKind {
11555 /// Unknown.
11556 Unspecified,
11557 /// A standard package version.
11558 Normal,
11559 /// A special version representing negative infinity.
11560 Minimum,
11561 /// A special version representing positive infinity.
11562 Maximum,
11563 /// If set, the enum was initialized with an unknown value.
11564 ///
11565 /// Applications can examine the value using [VersionKind::value] or
11566 /// [VersionKind::name].
11567 UnknownValue(version_kind::UnknownValue),
11568 }
11569
11570 #[doc(hidden)]
11571 pub mod version_kind {
11572 #[allow(unused_imports)]
11573 use super::*;
11574 #[derive(Clone, Debug, PartialEq)]
11575 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11576 }
11577
11578 impl VersionKind {
11579 /// Gets the enum value.
11580 ///
11581 /// Returns `None` if the enum contains an unknown value deserialized from
11582 /// the string representation of enums.
11583 pub fn value(&self) -> std::option::Option<i32> {
11584 match self {
11585 Self::Unspecified => std::option::Option::Some(0),
11586 Self::Normal => std::option::Option::Some(1),
11587 Self::Minimum => std::option::Option::Some(2),
11588 Self::Maximum => std::option::Option::Some(3),
11589 Self::UnknownValue(u) => u.0.value(),
11590 }
11591 }
11592
11593 /// Gets the enum value as a string.
11594 ///
11595 /// Returns `None` if the enum contains an unknown value deserialized from
11596 /// the integer representation of enums.
11597 pub fn name(&self) -> std::option::Option<&str> {
11598 match self {
11599 Self::Unspecified => std::option::Option::Some("VERSION_KIND_UNSPECIFIED"),
11600 Self::Normal => std::option::Option::Some("NORMAL"),
11601 Self::Minimum => std::option::Option::Some("MINIMUM"),
11602 Self::Maximum => std::option::Option::Some("MAXIMUM"),
11603 Self::UnknownValue(u) => u.0.name(),
11604 }
11605 }
11606 }
11607
11608 impl std::default::Default for VersionKind {
11609 fn default() -> Self {
11610 use std::convert::From;
11611 Self::from(0)
11612 }
11613 }
11614
11615 impl std::fmt::Display for VersionKind {
11616 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11617 wkt::internal::display_enum(f, self.name(), self.value())
11618 }
11619 }
11620
11621 impl std::convert::From<i32> for VersionKind {
11622 fn from(value: i32) -> Self {
11623 match value {
11624 0 => Self::Unspecified,
11625 1 => Self::Normal,
11626 2 => Self::Minimum,
11627 3 => Self::Maximum,
11628 _ => Self::UnknownValue(version_kind::UnknownValue(
11629 wkt::internal::UnknownEnumValue::Integer(value),
11630 )),
11631 }
11632 }
11633 }
11634
11635 impl std::convert::From<&str> for VersionKind {
11636 fn from(value: &str) -> Self {
11637 use std::string::ToString;
11638 match value {
11639 "VERSION_KIND_UNSPECIFIED" => Self::Unspecified,
11640 "NORMAL" => Self::Normal,
11641 "MINIMUM" => Self::Minimum,
11642 "MAXIMUM" => Self::Maximum,
11643 _ => Self::UnknownValue(version_kind::UnknownValue(
11644 wkt::internal::UnknownEnumValue::String(value.to_string()),
11645 )),
11646 }
11647 }
11648 }
11649
11650 impl serde::ser::Serialize for VersionKind {
11651 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11652 where
11653 S: serde::Serializer,
11654 {
11655 match self {
11656 Self::Unspecified => serializer.serialize_i32(0),
11657 Self::Normal => serializer.serialize_i32(1),
11658 Self::Minimum => serializer.serialize_i32(2),
11659 Self::Maximum => serializer.serialize_i32(3),
11660 Self::UnknownValue(u) => u.0.serialize(serializer),
11661 }
11662 }
11663 }
11664
11665 impl<'de> serde::de::Deserialize<'de> for VersionKind {
11666 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11667 where
11668 D: serde::Deserializer<'de>,
11669 {
11670 deserializer.deserialize_any(wkt::internal::EnumVisitor::<VersionKind>::new(
11671 ".grafeas.v1.Version.VersionKind",
11672 ))
11673 }
11674 }
11675}
11676
11677/// Provenance of a build. Contains all information needed to verify the full
11678/// details about the build from source to completion.
11679#[derive(Clone, Default, PartialEq)]
11680#[non_exhaustive]
11681pub struct BuildProvenance {
11682 /// Required. Unique identifier of the build.
11683 pub id: std::string::String,
11684
11685 /// ID of the project.
11686 pub project_id: std::string::String,
11687
11688 /// Commands requested by the build.
11689 pub commands: std::vec::Vec<crate::model::Command>,
11690
11691 /// Output of the build.
11692 pub built_artifacts: std::vec::Vec<crate::model::Artifact>,
11693
11694 /// Time at which the build was created.
11695 pub create_time: std::option::Option<wkt::Timestamp>,
11696
11697 /// Time at which execution of the build was started.
11698 pub start_time: std::option::Option<wkt::Timestamp>,
11699
11700 /// Time at which execution of the build was finished.
11701 pub end_time: std::option::Option<wkt::Timestamp>,
11702
11703 /// E-mail address of the user who initiated this build. Note that this was the
11704 /// user's e-mail address at the time the build was initiated; this address may
11705 /// not represent the same end-user for all time.
11706 pub creator: std::string::String,
11707
11708 /// URI where any logs for this provenance were written.
11709 pub logs_uri: std::string::String,
11710
11711 /// Details of the Source input to the build.
11712 pub source_provenance: std::option::Option<crate::model::Source>,
11713
11714 /// Trigger identifier if the build was triggered automatically; empty if not.
11715 pub trigger_id: std::string::String,
11716
11717 /// Special options applied to this build. This is a catch-all field where
11718 /// build providers can enter any desired additional details.
11719 pub build_options: std::collections::HashMap<std::string::String, std::string::String>,
11720
11721 /// Version string of the builder at the time this build was executed.
11722 pub builder_version: std::string::String,
11723
11724 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11725}
11726
11727impl BuildProvenance {
11728 pub fn new() -> Self {
11729 std::default::Default::default()
11730 }
11731
11732 /// Sets the value of [id][crate::model::BuildProvenance::id].
11733 ///
11734 /// # Example
11735 /// ```ignore,no_run
11736 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11737 /// let x = BuildProvenance::new().set_id("example");
11738 /// ```
11739 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11740 self.id = v.into();
11741 self
11742 }
11743
11744 /// Sets the value of [project_id][crate::model::BuildProvenance::project_id].
11745 ///
11746 /// # Example
11747 /// ```ignore,no_run
11748 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11749 /// let x = BuildProvenance::new().set_project_id("example");
11750 /// ```
11751 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11752 self.project_id = v.into();
11753 self
11754 }
11755
11756 /// Sets the value of [commands][crate::model::BuildProvenance::commands].
11757 ///
11758 /// # Example
11759 /// ```ignore,no_run
11760 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11761 /// use google_cloud_grafeas_v1::model::Command;
11762 /// let x = BuildProvenance::new()
11763 /// .set_commands([
11764 /// Command::default()/* use setters */,
11765 /// Command::default()/* use (different) setters */,
11766 /// ]);
11767 /// ```
11768 pub fn set_commands<T, V>(mut self, v: T) -> Self
11769 where
11770 T: std::iter::IntoIterator<Item = V>,
11771 V: std::convert::Into<crate::model::Command>,
11772 {
11773 use std::iter::Iterator;
11774 self.commands = v.into_iter().map(|i| i.into()).collect();
11775 self
11776 }
11777
11778 /// Sets the value of [built_artifacts][crate::model::BuildProvenance::built_artifacts].
11779 ///
11780 /// # Example
11781 /// ```ignore,no_run
11782 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11783 /// use google_cloud_grafeas_v1::model::Artifact;
11784 /// let x = BuildProvenance::new()
11785 /// .set_built_artifacts([
11786 /// Artifact::default()/* use setters */,
11787 /// Artifact::default()/* use (different) setters */,
11788 /// ]);
11789 /// ```
11790 pub fn set_built_artifacts<T, V>(mut self, v: T) -> Self
11791 where
11792 T: std::iter::IntoIterator<Item = V>,
11793 V: std::convert::Into<crate::model::Artifact>,
11794 {
11795 use std::iter::Iterator;
11796 self.built_artifacts = v.into_iter().map(|i| i.into()).collect();
11797 self
11798 }
11799
11800 /// Sets the value of [create_time][crate::model::BuildProvenance::create_time].
11801 ///
11802 /// # Example
11803 /// ```ignore,no_run
11804 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11805 /// use wkt::Timestamp;
11806 /// let x = BuildProvenance::new().set_create_time(Timestamp::default()/* use setters */);
11807 /// ```
11808 pub fn set_create_time<T>(mut self, v: T) -> Self
11809 where
11810 T: std::convert::Into<wkt::Timestamp>,
11811 {
11812 self.create_time = std::option::Option::Some(v.into());
11813 self
11814 }
11815
11816 /// Sets or clears the value of [create_time][crate::model::BuildProvenance::create_time].
11817 ///
11818 /// # Example
11819 /// ```ignore,no_run
11820 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11821 /// use wkt::Timestamp;
11822 /// let x = BuildProvenance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11823 /// let x = BuildProvenance::new().set_or_clear_create_time(None::<Timestamp>);
11824 /// ```
11825 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11826 where
11827 T: std::convert::Into<wkt::Timestamp>,
11828 {
11829 self.create_time = v.map(|x| x.into());
11830 self
11831 }
11832
11833 /// Sets the value of [start_time][crate::model::BuildProvenance::start_time].
11834 ///
11835 /// # Example
11836 /// ```ignore,no_run
11837 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11838 /// use wkt::Timestamp;
11839 /// let x = BuildProvenance::new().set_start_time(Timestamp::default()/* use setters */);
11840 /// ```
11841 pub fn set_start_time<T>(mut self, v: T) -> Self
11842 where
11843 T: std::convert::Into<wkt::Timestamp>,
11844 {
11845 self.start_time = std::option::Option::Some(v.into());
11846 self
11847 }
11848
11849 /// Sets or clears the value of [start_time][crate::model::BuildProvenance::start_time].
11850 ///
11851 /// # Example
11852 /// ```ignore,no_run
11853 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11854 /// use wkt::Timestamp;
11855 /// let x = BuildProvenance::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
11856 /// let x = BuildProvenance::new().set_or_clear_start_time(None::<Timestamp>);
11857 /// ```
11858 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
11859 where
11860 T: std::convert::Into<wkt::Timestamp>,
11861 {
11862 self.start_time = v.map(|x| x.into());
11863 self
11864 }
11865
11866 /// Sets the value of [end_time][crate::model::BuildProvenance::end_time].
11867 ///
11868 /// # Example
11869 /// ```ignore,no_run
11870 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11871 /// use wkt::Timestamp;
11872 /// let x = BuildProvenance::new().set_end_time(Timestamp::default()/* use setters */);
11873 /// ```
11874 pub fn set_end_time<T>(mut self, v: T) -> Self
11875 where
11876 T: std::convert::Into<wkt::Timestamp>,
11877 {
11878 self.end_time = std::option::Option::Some(v.into());
11879 self
11880 }
11881
11882 /// Sets or clears the value of [end_time][crate::model::BuildProvenance::end_time].
11883 ///
11884 /// # Example
11885 /// ```ignore,no_run
11886 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11887 /// use wkt::Timestamp;
11888 /// let x = BuildProvenance::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
11889 /// let x = BuildProvenance::new().set_or_clear_end_time(None::<Timestamp>);
11890 /// ```
11891 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
11892 where
11893 T: std::convert::Into<wkt::Timestamp>,
11894 {
11895 self.end_time = v.map(|x| x.into());
11896 self
11897 }
11898
11899 /// Sets the value of [creator][crate::model::BuildProvenance::creator].
11900 ///
11901 /// # Example
11902 /// ```ignore,no_run
11903 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11904 /// let x = BuildProvenance::new().set_creator("example");
11905 /// ```
11906 pub fn set_creator<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11907 self.creator = v.into();
11908 self
11909 }
11910
11911 /// Sets the value of [logs_uri][crate::model::BuildProvenance::logs_uri].
11912 ///
11913 /// # Example
11914 /// ```ignore,no_run
11915 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11916 /// let x = BuildProvenance::new().set_logs_uri("example");
11917 /// ```
11918 pub fn set_logs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11919 self.logs_uri = v.into();
11920 self
11921 }
11922
11923 /// Sets the value of [source_provenance][crate::model::BuildProvenance::source_provenance].
11924 ///
11925 /// # Example
11926 /// ```ignore,no_run
11927 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11928 /// use google_cloud_grafeas_v1::model::Source;
11929 /// let x = BuildProvenance::new().set_source_provenance(Source::default()/* use setters */);
11930 /// ```
11931 pub fn set_source_provenance<T>(mut self, v: T) -> Self
11932 where
11933 T: std::convert::Into<crate::model::Source>,
11934 {
11935 self.source_provenance = std::option::Option::Some(v.into());
11936 self
11937 }
11938
11939 /// Sets or clears the value of [source_provenance][crate::model::BuildProvenance::source_provenance].
11940 ///
11941 /// # Example
11942 /// ```ignore,no_run
11943 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11944 /// use google_cloud_grafeas_v1::model::Source;
11945 /// let x = BuildProvenance::new().set_or_clear_source_provenance(Some(Source::default()/* use setters */));
11946 /// let x = BuildProvenance::new().set_or_clear_source_provenance(None::<Source>);
11947 /// ```
11948 pub fn set_or_clear_source_provenance<T>(mut self, v: std::option::Option<T>) -> Self
11949 where
11950 T: std::convert::Into<crate::model::Source>,
11951 {
11952 self.source_provenance = v.map(|x| x.into());
11953 self
11954 }
11955
11956 /// Sets the value of [trigger_id][crate::model::BuildProvenance::trigger_id].
11957 ///
11958 /// # Example
11959 /// ```ignore,no_run
11960 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11961 /// let x = BuildProvenance::new().set_trigger_id("example");
11962 /// ```
11963 pub fn set_trigger_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11964 self.trigger_id = v.into();
11965 self
11966 }
11967
11968 /// Sets the value of [build_options][crate::model::BuildProvenance::build_options].
11969 ///
11970 /// # Example
11971 /// ```ignore,no_run
11972 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11973 /// let x = BuildProvenance::new().set_build_options([
11974 /// ("key0", "abc"),
11975 /// ("key1", "xyz"),
11976 /// ]);
11977 /// ```
11978 pub fn set_build_options<T, K, V>(mut self, v: T) -> Self
11979 where
11980 T: std::iter::IntoIterator<Item = (K, V)>,
11981 K: std::convert::Into<std::string::String>,
11982 V: std::convert::Into<std::string::String>,
11983 {
11984 use std::iter::Iterator;
11985 self.build_options = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11986 self
11987 }
11988
11989 /// Sets the value of [builder_version][crate::model::BuildProvenance::builder_version].
11990 ///
11991 /// # Example
11992 /// ```ignore,no_run
11993 /// # use google_cloud_grafeas_v1::model::BuildProvenance;
11994 /// let x = BuildProvenance::new().set_builder_version("example");
11995 /// ```
11996 pub fn set_builder_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11997 self.builder_version = v.into();
11998 self
11999 }
12000}
12001
12002impl wkt::message::Message for BuildProvenance {
12003 fn typename() -> &'static str {
12004 "type.googleapis.com/grafeas.v1.BuildProvenance"
12005 }
12006}
12007
12008/// Source describes the location of the source used for the build.
12009#[derive(Clone, Default, PartialEq)]
12010#[non_exhaustive]
12011pub struct Source {
12012 /// If provided, the input binary artifacts for the build came from this
12013 /// location.
12014 pub artifact_storage_source_uri: std::string::String,
12015
12016 /// Hash(es) of the build source, which can be used to verify that the original
12017 /// source integrity was maintained in the build.
12018 ///
12019 /// The keys to this map are file paths used as build source and the values
12020 /// contain the hash values for those files.
12021 ///
12022 /// If the build source came in a single package such as a gzipped tarfile
12023 /// (.tar.gz), the FileHash will be for the single path to that file.
12024 pub file_hashes: std::collections::HashMap<std::string::String, crate::model::FileHashes>,
12025
12026 /// If provided, the source code used for the build came from this location.
12027 pub context: std::option::Option<crate::model::SourceContext>,
12028
12029 /// If provided, some of the source code used for the build may be found in
12030 /// these locations, in the case where the source repository had multiple
12031 /// remotes or submodules. This list will not include the context specified in
12032 /// the context field.
12033 pub additional_contexts: std::vec::Vec<crate::model::SourceContext>,
12034
12035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12036}
12037
12038impl Source {
12039 pub fn new() -> Self {
12040 std::default::Default::default()
12041 }
12042
12043 /// Sets the value of [artifact_storage_source_uri][crate::model::Source::artifact_storage_source_uri].
12044 ///
12045 /// # Example
12046 /// ```ignore,no_run
12047 /// # use google_cloud_grafeas_v1::model::Source;
12048 /// let x = Source::new().set_artifact_storage_source_uri("example");
12049 /// ```
12050 pub fn set_artifact_storage_source_uri<T: std::convert::Into<std::string::String>>(
12051 mut self,
12052 v: T,
12053 ) -> Self {
12054 self.artifact_storage_source_uri = v.into();
12055 self
12056 }
12057
12058 /// Sets the value of [file_hashes][crate::model::Source::file_hashes].
12059 ///
12060 /// # Example
12061 /// ```ignore,no_run
12062 /// # use google_cloud_grafeas_v1::model::Source;
12063 /// use google_cloud_grafeas_v1::model::FileHashes;
12064 /// let x = Source::new().set_file_hashes([
12065 /// ("key0", FileHashes::default()/* use setters */),
12066 /// ("key1", FileHashes::default()/* use (different) setters */),
12067 /// ]);
12068 /// ```
12069 pub fn set_file_hashes<T, K, V>(mut self, v: T) -> Self
12070 where
12071 T: std::iter::IntoIterator<Item = (K, V)>,
12072 K: std::convert::Into<std::string::String>,
12073 V: std::convert::Into<crate::model::FileHashes>,
12074 {
12075 use std::iter::Iterator;
12076 self.file_hashes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12077 self
12078 }
12079
12080 /// Sets the value of [context][crate::model::Source::context].
12081 ///
12082 /// # Example
12083 /// ```ignore,no_run
12084 /// # use google_cloud_grafeas_v1::model::Source;
12085 /// use google_cloud_grafeas_v1::model::SourceContext;
12086 /// let x = Source::new().set_context(SourceContext::default()/* use setters */);
12087 /// ```
12088 pub fn set_context<T>(mut self, v: T) -> Self
12089 where
12090 T: std::convert::Into<crate::model::SourceContext>,
12091 {
12092 self.context = std::option::Option::Some(v.into());
12093 self
12094 }
12095
12096 /// Sets or clears the value of [context][crate::model::Source::context].
12097 ///
12098 /// # Example
12099 /// ```ignore,no_run
12100 /// # use google_cloud_grafeas_v1::model::Source;
12101 /// use google_cloud_grafeas_v1::model::SourceContext;
12102 /// let x = Source::new().set_or_clear_context(Some(SourceContext::default()/* use setters */));
12103 /// let x = Source::new().set_or_clear_context(None::<SourceContext>);
12104 /// ```
12105 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
12106 where
12107 T: std::convert::Into<crate::model::SourceContext>,
12108 {
12109 self.context = v.map(|x| x.into());
12110 self
12111 }
12112
12113 /// Sets the value of [additional_contexts][crate::model::Source::additional_contexts].
12114 ///
12115 /// # Example
12116 /// ```ignore,no_run
12117 /// # use google_cloud_grafeas_v1::model::Source;
12118 /// use google_cloud_grafeas_v1::model::SourceContext;
12119 /// let x = Source::new()
12120 /// .set_additional_contexts([
12121 /// SourceContext::default()/* use setters */,
12122 /// SourceContext::default()/* use (different) setters */,
12123 /// ]);
12124 /// ```
12125 pub fn set_additional_contexts<T, V>(mut self, v: T) -> Self
12126 where
12127 T: std::iter::IntoIterator<Item = V>,
12128 V: std::convert::Into<crate::model::SourceContext>,
12129 {
12130 use std::iter::Iterator;
12131 self.additional_contexts = v.into_iter().map(|i| i.into()).collect();
12132 self
12133 }
12134}
12135
12136impl wkt::message::Message for Source {
12137 fn typename() -> &'static str {
12138 "type.googleapis.com/grafeas.v1.Source"
12139 }
12140}
12141
12142/// Container message for hashes of byte content of files, used in source
12143/// messages to verify integrity of source input to the build.
12144#[derive(Clone, Default, PartialEq)]
12145#[non_exhaustive]
12146pub struct FileHashes {
12147 /// Required. Collection of file hashes.
12148 pub file_hash: std::vec::Vec<crate::model::Hash>,
12149
12150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12151}
12152
12153impl FileHashes {
12154 pub fn new() -> Self {
12155 std::default::Default::default()
12156 }
12157
12158 /// Sets the value of [file_hash][crate::model::FileHashes::file_hash].
12159 ///
12160 /// # Example
12161 /// ```ignore,no_run
12162 /// # use google_cloud_grafeas_v1::model::FileHashes;
12163 /// use google_cloud_grafeas_v1::model::Hash;
12164 /// let x = FileHashes::new()
12165 /// .set_file_hash([
12166 /// Hash::default()/* use setters */,
12167 /// Hash::default()/* use (different) setters */,
12168 /// ]);
12169 /// ```
12170 pub fn set_file_hash<T, V>(mut self, v: T) -> Self
12171 where
12172 T: std::iter::IntoIterator<Item = V>,
12173 V: std::convert::Into<crate::model::Hash>,
12174 {
12175 use std::iter::Iterator;
12176 self.file_hash = v.into_iter().map(|i| i.into()).collect();
12177 self
12178 }
12179}
12180
12181impl wkt::message::Message for FileHashes {
12182 fn typename() -> &'static str {
12183 "type.googleapis.com/grafeas.v1.FileHashes"
12184 }
12185}
12186
12187/// Container message for hash values.
12188#[derive(Clone, Default, PartialEq)]
12189#[non_exhaustive]
12190pub struct Hash {
12191 /// Required. The type of hash that was performed, e.g. "SHA-256".
12192 pub r#type: std::string::String,
12193
12194 /// Required. The hash value.
12195 pub value: ::bytes::Bytes,
12196
12197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12198}
12199
12200impl Hash {
12201 pub fn new() -> Self {
12202 std::default::Default::default()
12203 }
12204
12205 /// Sets the value of [r#type][crate::model::Hash::type].
12206 ///
12207 /// # Example
12208 /// ```ignore,no_run
12209 /// # use google_cloud_grafeas_v1::model::Hash;
12210 /// let x = Hash::new().set_type("example");
12211 /// ```
12212 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12213 self.r#type = v.into();
12214 self
12215 }
12216
12217 /// Sets the value of [value][crate::model::Hash::value].
12218 ///
12219 /// # Example
12220 /// ```ignore,no_run
12221 /// # use google_cloud_grafeas_v1::model::Hash;
12222 /// let x = Hash::new().set_value(bytes::Bytes::from_static(b"example"));
12223 /// ```
12224 pub fn set_value<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12225 self.value = v.into();
12226 self
12227 }
12228}
12229
12230impl wkt::message::Message for Hash {
12231 fn typename() -> &'static str {
12232 "type.googleapis.com/grafeas.v1.Hash"
12233 }
12234}
12235
12236/// Command describes a step performed as part of the build pipeline.
12237#[derive(Clone, Default, PartialEq)]
12238#[non_exhaustive]
12239pub struct Command {
12240 /// Required. Name of the command, as presented on the command line, or if the
12241 /// command is packaged as a Docker container, as presented to `docker pull`.
12242 pub name: std::string::String,
12243
12244 /// Environment variables set before running this command.
12245 pub env: std::vec::Vec<std::string::String>,
12246
12247 /// Command-line arguments used when executing this command.
12248 pub args: std::vec::Vec<std::string::String>,
12249
12250 /// Working directory (relative to project source root) used when running this
12251 /// command.
12252 pub dir: std::string::String,
12253
12254 /// Optional unique identifier for this command, used in wait_for to reference
12255 /// this command as a dependency.
12256 pub id: std::string::String,
12257
12258 /// The ID(s) of the command(s) that this command depends on.
12259 pub wait_for: std::vec::Vec<std::string::String>,
12260
12261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12262}
12263
12264impl Command {
12265 pub fn new() -> Self {
12266 std::default::Default::default()
12267 }
12268
12269 /// Sets the value of [name][crate::model::Command::name].
12270 ///
12271 /// # Example
12272 /// ```ignore,no_run
12273 /// # use google_cloud_grafeas_v1::model::Command;
12274 /// let x = Command::new().set_name("example");
12275 /// ```
12276 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12277 self.name = v.into();
12278 self
12279 }
12280
12281 /// Sets the value of [env][crate::model::Command::env].
12282 ///
12283 /// # Example
12284 /// ```ignore,no_run
12285 /// # use google_cloud_grafeas_v1::model::Command;
12286 /// let x = Command::new().set_env(["a", "b", "c"]);
12287 /// ```
12288 pub fn set_env<T, V>(mut self, v: T) -> Self
12289 where
12290 T: std::iter::IntoIterator<Item = V>,
12291 V: std::convert::Into<std::string::String>,
12292 {
12293 use std::iter::Iterator;
12294 self.env = v.into_iter().map(|i| i.into()).collect();
12295 self
12296 }
12297
12298 /// Sets the value of [args][crate::model::Command::args].
12299 ///
12300 /// # Example
12301 /// ```ignore,no_run
12302 /// # use google_cloud_grafeas_v1::model::Command;
12303 /// let x = Command::new().set_args(["a", "b", "c"]);
12304 /// ```
12305 pub fn set_args<T, V>(mut self, v: T) -> Self
12306 where
12307 T: std::iter::IntoIterator<Item = V>,
12308 V: std::convert::Into<std::string::String>,
12309 {
12310 use std::iter::Iterator;
12311 self.args = v.into_iter().map(|i| i.into()).collect();
12312 self
12313 }
12314
12315 /// Sets the value of [dir][crate::model::Command::dir].
12316 ///
12317 /// # Example
12318 /// ```ignore,no_run
12319 /// # use google_cloud_grafeas_v1::model::Command;
12320 /// let x = Command::new().set_dir("example");
12321 /// ```
12322 pub fn set_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12323 self.dir = v.into();
12324 self
12325 }
12326
12327 /// Sets the value of [id][crate::model::Command::id].
12328 ///
12329 /// # Example
12330 /// ```ignore,no_run
12331 /// # use google_cloud_grafeas_v1::model::Command;
12332 /// let x = Command::new().set_id("example");
12333 /// ```
12334 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12335 self.id = v.into();
12336 self
12337 }
12338
12339 /// Sets the value of [wait_for][crate::model::Command::wait_for].
12340 ///
12341 /// # Example
12342 /// ```ignore,no_run
12343 /// # use google_cloud_grafeas_v1::model::Command;
12344 /// let x = Command::new().set_wait_for(["a", "b", "c"]);
12345 /// ```
12346 pub fn set_wait_for<T, V>(mut self, v: T) -> Self
12347 where
12348 T: std::iter::IntoIterator<Item = V>,
12349 V: std::convert::Into<std::string::String>,
12350 {
12351 use std::iter::Iterator;
12352 self.wait_for = v.into_iter().map(|i| i.into()).collect();
12353 self
12354 }
12355}
12356
12357impl wkt::message::Message for Command {
12358 fn typename() -> &'static str {
12359 "type.googleapis.com/grafeas.v1.Command"
12360 }
12361}
12362
12363/// Artifact describes a build product.
12364#[derive(Clone, Default, PartialEq)]
12365#[non_exhaustive]
12366pub struct Artifact {
12367 /// Hash or checksum value of a binary, or Docker Registry 2.0 digest of a
12368 /// container.
12369 pub checksum: std::string::String,
12370
12371 /// Artifact ID, if any; for container images, this will be a URL by digest
12372 /// like `gcr.io/projectID/imagename@sha256:123456`.
12373 pub id: std::string::String,
12374
12375 /// Related artifact names. This may be the path to a binary or jar file, or in
12376 /// the case of a container build, the name used to push the container image to
12377 /// Google Container Registry, as presented to `docker push`. Note that a
12378 /// single Artifact ID can have multiple names, for example if two tags are
12379 /// applied to one image.
12380 pub names: std::vec::Vec<std::string::String>,
12381
12382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12383}
12384
12385impl Artifact {
12386 pub fn new() -> Self {
12387 std::default::Default::default()
12388 }
12389
12390 /// Sets the value of [checksum][crate::model::Artifact::checksum].
12391 ///
12392 /// # Example
12393 /// ```ignore,no_run
12394 /// # use google_cloud_grafeas_v1::model::Artifact;
12395 /// let x = Artifact::new().set_checksum("example");
12396 /// ```
12397 pub fn set_checksum<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12398 self.checksum = v.into();
12399 self
12400 }
12401
12402 /// Sets the value of [id][crate::model::Artifact::id].
12403 ///
12404 /// # Example
12405 /// ```ignore,no_run
12406 /// # use google_cloud_grafeas_v1::model::Artifact;
12407 /// let x = Artifact::new().set_id("example");
12408 /// ```
12409 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12410 self.id = v.into();
12411 self
12412 }
12413
12414 /// Sets the value of [names][crate::model::Artifact::names].
12415 ///
12416 /// # Example
12417 /// ```ignore,no_run
12418 /// # use google_cloud_grafeas_v1::model::Artifact;
12419 /// let x = Artifact::new().set_names(["a", "b", "c"]);
12420 /// ```
12421 pub fn set_names<T, V>(mut self, v: T) -> Self
12422 where
12423 T: std::iter::IntoIterator<Item = V>,
12424 V: std::convert::Into<std::string::String>,
12425 {
12426 use std::iter::Iterator;
12427 self.names = v.into_iter().map(|i| i.into()).collect();
12428 self
12429 }
12430}
12431
12432impl wkt::message::Message for Artifact {
12433 fn typename() -> &'static str {
12434 "type.googleapis.com/grafeas.v1.Artifact"
12435 }
12436}
12437
12438/// A SourceContext is a reference to a tree of files. A SourceContext together
12439/// with a path point to a unique revision of a single file or directory.
12440#[derive(Clone, Default, PartialEq)]
12441#[non_exhaustive]
12442pub struct SourceContext {
12443 /// Labels with user defined metadata.
12444 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
12445
12446 /// A SourceContext can refer any one of the following types of repositories.
12447 pub context: std::option::Option<crate::model::source_context::Context>,
12448
12449 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12450}
12451
12452impl SourceContext {
12453 pub fn new() -> Self {
12454 std::default::Default::default()
12455 }
12456
12457 /// Sets the value of [labels][crate::model::SourceContext::labels].
12458 ///
12459 /// # Example
12460 /// ```ignore,no_run
12461 /// # use google_cloud_grafeas_v1::model::SourceContext;
12462 /// let x = SourceContext::new().set_labels([
12463 /// ("key0", "abc"),
12464 /// ("key1", "xyz"),
12465 /// ]);
12466 /// ```
12467 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
12468 where
12469 T: std::iter::IntoIterator<Item = (K, V)>,
12470 K: std::convert::Into<std::string::String>,
12471 V: std::convert::Into<std::string::String>,
12472 {
12473 use std::iter::Iterator;
12474 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12475 self
12476 }
12477
12478 /// Sets the value of [context][crate::model::SourceContext::context].
12479 ///
12480 /// Note that all the setters affecting `context` are mutually
12481 /// exclusive.
12482 ///
12483 /// # Example
12484 /// ```ignore,no_run
12485 /// # use google_cloud_grafeas_v1::model::SourceContext;
12486 /// use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12487 /// let x = SourceContext::new().set_context(Some(
12488 /// google_cloud_grafeas_v1::model::source_context::Context::CloudRepo(CloudRepoSourceContext::default().into())));
12489 /// ```
12490 pub fn set_context<
12491 T: std::convert::Into<std::option::Option<crate::model::source_context::Context>>,
12492 >(
12493 mut self,
12494 v: T,
12495 ) -> Self {
12496 self.context = v.into();
12497 self
12498 }
12499
12500 /// The value of [context][crate::model::SourceContext::context]
12501 /// if it holds a `CloudRepo`, `None` if the field is not set or
12502 /// holds a different branch.
12503 pub fn cloud_repo(
12504 &self,
12505 ) -> std::option::Option<&std::boxed::Box<crate::model::CloudRepoSourceContext>> {
12506 #[allow(unreachable_patterns)]
12507 self.context.as_ref().and_then(|v| match v {
12508 crate::model::source_context::Context::CloudRepo(v) => std::option::Option::Some(v),
12509 _ => std::option::Option::None,
12510 })
12511 }
12512
12513 /// Sets the value of [context][crate::model::SourceContext::context]
12514 /// to hold a `CloudRepo`.
12515 ///
12516 /// Note that all the setters affecting `context` are
12517 /// mutually exclusive.
12518 ///
12519 /// # Example
12520 /// ```ignore,no_run
12521 /// # use google_cloud_grafeas_v1::model::SourceContext;
12522 /// use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12523 /// let x = SourceContext::new().set_cloud_repo(CloudRepoSourceContext::default()/* use setters */);
12524 /// assert!(x.cloud_repo().is_some());
12525 /// assert!(x.gerrit().is_none());
12526 /// assert!(x.git().is_none());
12527 /// ```
12528 pub fn set_cloud_repo<
12529 T: std::convert::Into<std::boxed::Box<crate::model::CloudRepoSourceContext>>,
12530 >(
12531 mut self,
12532 v: T,
12533 ) -> Self {
12534 self.context =
12535 std::option::Option::Some(crate::model::source_context::Context::CloudRepo(v.into()));
12536 self
12537 }
12538
12539 /// The value of [context][crate::model::SourceContext::context]
12540 /// if it holds a `Gerrit`, `None` if the field is not set or
12541 /// holds a different branch.
12542 pub fn gerrit(
12543 &self,
12544 ) -> std::option::Option<&std::boxed::Box<crate::model::GerritSourceContext>> {
12545 #[allow(unreachable_patterns)]
12546 self.context.as_ref().and_then(|v| match v {
12547 crate::model::source_context::Context::Gerrit(v) => std::option::Option::Some(v),
12548 _ => std::option::Option::None,
12549 })
12550 }
12551
12552 /// Sets the value of [context][crate::model::SourceContext::context]
12553 /// to hold a `Gerrit`.
12554 ///
12555 /// Note that all the setters affecting `context` are
12556 /// mutually exclusive.
12557 ///
12558 /// # Example
12559 /// ```ignore,no_run
12560 /// # use google_cloud_grafeas_v1::model::SourceContext;
12561 /// use google_cloud_grafeas_v1::model::GerritSourceContext;
12562 /// let x = SourceContext::new().set_gerrit(GerritSourceContext::default()/* use setters */);
12563 /// assert!(x.gerrit().is_some());
12564 /// assert!(x.cloud_repo().is_none());
12565 /// assert!(x.git().is_none());
12566 /// ```
12567 pub fn set_gerrit<T: std::convert::Into<std::boxed::Box<crate::model::GerritSourceContext>>>(
12568 mut self,
12569 v: T,
12570 ) -> Self {
12571 self.context =
12572 std::option::Option::Some(crate::model::source_context::Context::Gerrit(v.into()));
12573 self
12574 }
12575
12576 /// The value of [context][crate::model::SourceContext::context]
12577 /// if it holds a `Git`, `None` if the field is not set or
12578 /// holds a different branch.
12579 pub fn git(&self) -> std::option::Option<&std::boxed::Box<crate::model::GitSourceContext>> {
12580 #[allow(unreachable_patterns)]
12581 self.context.as_ref().and_then(|v| match v {
12582 crate::model::source_context::Context::Git(v) => std::option::Option::Some(v),
12583 _ => std::option::Option::None,
12584 })
12585 }
12586
12587 /// Sets the value of [context][crate::model::SourceContext::context]
12588 /// to hold a `Git`.
12589 ///
12590 /// Note that all the setters affecting `context` are
12591 /// mutually exclusive.
12592 ///
12593 /// # Example
12594 /// ```ignore,no_run
12595 /// # use google_cloud_grafeas_v1::model::SourceContext;
12596 /// use google_cloud_grafeas_v1::model::GitSourceContext;
12597 /// let x = SourceContext::new().set_git(GitSourceContext::default()/* use setters */);
12598 /// assert!(x.git().is_some());
12599 /// assert!(x.cloud_repo().is_none());
12600 /// assert!(x.gerrit().is_none());
12601 /// ```
12602 pub fn set_git<T: std::convert::Into<std::boxed::Box<crate::model::GitSourceContext>>>(
12603 mut self,
12604 v: T,
12605 ) -> Self {
12606 self.context =
12607 std::option::Option::Some(crate::model::source_context::Context::Git(v.into()));
12608 self
12609 }
12610}
12611
12612impl wkt::message::Message for SourceContext {
12613 fn typename() -> &'static str {
12614 "type.googleapis.com/grafeas.v1.SourceContext"
12615 }
12616}
12617
12618/// Defines additional types related to [SourceContext].
12619pub mod source_context {
12620 #[allow(unused_imports)]
12621 use super::*;
12622
12623 /// A SourceContext can refer any one of the following types of repositories.
12624 #[derive(Clone, Debug, PartialEq)]
12625 #[non_exhaustive]
12626 pub enum Context {
12627 /// A SourceContext referring to a revision in a Google Cloud Source Repo.
12628 CloudRepo(std::boxed::Box<crate::model::CloudRepoSourceContext>),
12629 /// A SourceContext referring to a Gerrit project.
12630 Gerrit(std::boxed::Box<crate::model::GerritSourceContext>),
12631 /// A SourceContext referring to any third party Git repo (e.g., GitHub).
12632 Git(std::boxed::Box<crate::model::GitSourceContext>),
12633 }
12634}
12635
12636/// An alias to a repo revision.
12637#[derive(Clone, Default, PartialEq)]
12638#[non_exhaustive]
12639pub struct AliasContext {
12640 /// The alias kind.
12641 pub kind: crate::model::alias_context::Kind,
12642
12643 /// The alias name.
12644 pub name: std::string::String,
12645
12646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12647}
12648
12649impl AliasContext {
12650 pub fn new() -> Self {
12651 std::default::Default::default()
12652 }
12653
12654 /// Sets the value of [kind][crate::model::AliasContext::kind].
12655 ///
12656 /// # Example
12657 /// ```ignore,no_run
12658 /// # use google_cloud_grafeas_v1::model::AliasContext;
12659 /// use google_cloud_grafeas_v1::model::alias_context::Kind;
12660 /// let x0 = AliasContext::new().set_kind(Kind::Fixed);
12661 /// let x1 = AliasContext::new().set_kind(Kind::Movable);
12662 /// let x2 = AliasContext::new().set_kind(Kind::Other);
12663 /// ```
12664 pub fn set_kind<T: std::convert::Into<crate::model::alias_context::Kind>>(
12665 mut self,
12666 v: T,
12667 ) -> Self {
12668 self.kind = v.into();
12669 self
12670 }
12671
12672 /// Sets the value of [name][crate::model::AliasContext::name].
12673 ///
12674 /// # Example
12675 /// ```ignore,no_run
12676 /// # use google_cloud_grafeas_v1::model::AliasContext;
12677 /// let x = AliasContext::new().set_name("example");
12678 /// ```
12679 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12680 self.name = v.into();
12681 self
12682 }
12683}
12684
12685impl wkt::message::Message for AliasContext {
12686 fn typename() -> &'static str {
12687 "type.googleapis.com/grafeas.v1.AliasContext"
12688 }
12689}
12690
12691/// Defines additional types related to [AliasContext].
12692pub mod alias_context {
12693 #[allow(unused_imports)]
12694 use super::*;
12695
12696 /// The type of an alias.
12697 ///
12698 /// # Working with unknown values
12699 ///
12700 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12701 /// additional enum variants at any time. Adding new variants is not considered
12702 /// a breaking change. Applications should write their code in anticipation of:
12703 ///
12704 /// - New values appearing in future releases of the client library, **and**
12705 /// - New values received dynamically, without application changes.
12706 ///
12707 /// Please consult the [Working with enums] section in the user guide for some
12708 /// guidelines.
12709 ///
12710 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12711 #[derive(Clone, Debug, PartialEq)]
12712 #[non_exhaustive]
12713 pub enum Kind {
12714 /// Unknown.
12715 Unspecified,
12716 /// Git tag.
12717 Fixed,
12718 /// Git branch.
12719 Movable,
12720 /// Used to specify non-standard aliases. For example, if a Git repo has a
12721 /// ref named "refs/foo/bar".
12722 Other,
12723 /// If set, the enum was initialized with an unknown value.
12724 ///
12725 /// Applications can examine the value using [Kind::value] or
12726 /// [Kind::name].
12727 UnknownValue(kind::UnknownValue),
12728 }
12729
12730 #[doc(hidden)]
12731 pub mod kind {
12732 #[allow(unused_imports)]
12733 use super::*;
12734 #[derive(Clone, Debug, PartialEq)]
12735 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12736 }
12737
12738 impl Kind {
12739 /// Gets the enum value.
12740 ///
12741 /// Returns `None` if the enum contains an unknown value deserialized from
12742 /// the string representation of enums.
12743 pub fn value(&self) -> std::option::Option<i32> {
12744 match self {
12745 Self::Unspecified => std::option::Option::Some(0),
12746 Self::Fixed => std::option::Option::Some(1),
12747 Self::Movable => std::option::Option::Some(2),
12748 Self::Other => std::option::Option::Some(4),
12749 Self::UnknownValue(u) => u.0.value(),
12750 }
12751 }
12752
12753 /// Gets the enum value as a string.
12754 ///
12755 /// Returns `None` if the enum contains an unknown value deserialized from
12756 /// the integer representation of enums.
12757 pub fn name(&self) -> std::option::Option<&str> {
12758 match self {
12759 Self::Unspecified => std::option::Option::Some("KIND_UNSPECIFIED"),
12760 Self::Fixed => std::option::Option::Some("FIXED"),
12761 Self::Movable => std::option::Option::Some("MOVABLE"),
12762 Self::Other => std::option::Option::Some("OTHER"),
12763 Self::UnknownValue(u) => u.0.name(),
12764 }
12765 }
12766 }
12767
12768 impl std::default::Default for Kind {
12769 fn default() -> Self {
12770 use std::convert::From;
12771 Self::from(0)
12772 }
12773 }
12774
12775 impl std::fmt::Display for Kind {
12776 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12777 wkt::internal::display_enum(f, self.name(), self.value())
12778 }
12779 }
12780
12781 impl std::convert::From<i32> for Kind {
12782 fn from(value: i32) -> Self {
12783 match value {
12784 0 => Self::Unspecified,
12785 1 => Self::Fixed,
12786 2 => Self::Movable,
12787 4 => Self::Other,
12788 _ => Self::UnknownValue(kind::UnknownValue(
12789 wkt::internal::UnknownEnumValue::Integer(value),
12790 )),
12791 }
12792 }
12793 }
12794
12795 impl std::convert::From<&str> for Kind {
12796 fn from(value: &str) -> Self {
12797 use std::string::ToString;
12798 match value {
12799 "KIND_UNSPECIFIED" => Self::Unspecified,
12800 "FIXED" => Self::Fixed,
12801 "MOVABLE" => Self::Movable,
12802 "OTHER" => Self::Other,
12803 _ => Self::UnknownValue(kind::UnknownValue(
12804 wkt::internal::UnknownEnumValue::String(value.to_string()),
12805 )),
12806 }
12807 }
12808 }
12809
12810 impl serde::ser::Serialize for Kind {
12811 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12812 where
12813 S: serde::Serializer,
12814 {
12815 match self {
12816 Self::Unspecified => serializer.serialize_i32(0),
12817 Self::Fixed => serializer.serialize_i32(1),
12818 Self::Movable => serializer.serialize_i32(2),
12819 Self::Other => serializer.serialize_i32(4),
12820 Self::UnknownValue(u) => u.0.serialize(serializer),
12821 }
12822 }
12823 }
12824
12825 impl<'de> serde::de::Deserialize<'de> for Kind {
12826 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12827 where
12828 D: serde::Deserializer<'de>,
12829 {
12830 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
12831 ".grafeas.v1.AliasContext.Kind",
12832 ))
12833 }
12834 }
12835}
12836
12837/// A CloudRepoSourceContext denotes a particular revision in a Google Cloud
12838/// Source Repo.
12839#[derive(Clone, Default, PartialEq)]
12840#[non_exhaustive]
12841pub struct CloudRepoSourceContext {
12842 /// The ID of the repo.
12843 pub repo_id: std::option::Option<crate::model::RepoId>,
12844
12845 /// A revision in a Cloud Repo can be identified by either its revision ID or
12846 /// its alias.
12847 pub revision: std::option::Option<crate::model::cloud_repo_source_context::Revision>,
12848
12849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12850}
12851
12852impl CloudRepoSourceContext {
12853 pub fn new() -> Self {
12854 std::default::Default::default()
12855 }
12856
12857 /// Sets the value of [repo_id][crate::model::CloudRepoSourceContext::repo_id].
12858 ///
12859 /// # Example
12860 /// ```ignore,no_run
12861 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12862 /// use google_cloud_grafeas_v1::model::RepoId;
12863 /// let x = CloudRepoSourceContext::new().set_repo_id(RepoId::default()/* use setters */);
12864 /// ```
12865 pub fn set_repo_id<T>(mut self, v: T) -> Self
12866 where
12867 T: std::convert::Into<crate::model::RepoId>,
12868 {
12869 self.repo_id = std::option::Option::Some(v.into());
12870 self
12871 }
12872
12873 /// Sets or clears the value of [repo_id][crate::model::CloudRepoSourceContext::repo_id].
12874 ///
12875 /// # Example
12876 /// ```ignore,no_run
12877 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12878 /// use google_cloud_grafeas_v1::model::RepoId;
12879 /// let x = CloudRepoSourceContext::new().set_or_clear_repo_id(Some(RepoId::default()/* use setters */));
12880 /// let x = CloudRepoSourceContext::new().set_or_clear_repo_id(None::<RepoId>);
12881 /// ```
12882 pub fn set_or_clear_repo_id<T>(mut self, v: std::option::Option<T>) -> Self
12883 where
12884 T: std::convert::Into<crate::model::RepoId>,
12885 {
12886 self.repo_id = v.map(|x| x.into());
12887 self
12888 }
12889
12890 /// Sets the value of [revision][crate::model::CloudRepoSourceContext::revision].
12891 ///
12892 /// Note that all the setters affecting `revision` are mutually
12893 /// exclusive.
12894 ///
12895 /// # Example
12896 /// ```ignore,no_run
12897 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12898 /// use google_cloud_grafeas_v1::model::cloud_repo_source_context::Revision;
12899 /// let x = CloudRepoSourceContext::new().set_revision(Some(Revision::RevisionId("example".to_string())));
12900 /// ```
12901 pub fn set_revision<
12902 T: std::convert::Into<std::option::Option<crate::model::cloud_repo_source_context::Revision>>,
12903 >(
12904 mut self,
12905 v: T,
12906 ) -> Self {
12907 self.revision = v.into();
12908 self
12909 }
12910
12911 /// The value of [revision][crate::model::CloudRepoSourceContext::revision]
12912 /// if it holds a `RevisionId`, `None` if the field is not set or
12913 /// holds a different branch.
12914 pub fn revision_id(&self) -> std::option::Option<&std::string::String> {
12915 #[allow(unreachable_patterns)]
12916 self.revision.as_ref().and_then(|v| match v {
12917 crate::model::cloud_repo_source_context::Revision::RevisionId(v) => {
12918 std::option::Option::Some(v)
12919 }
12920 _ => std::option::Option::None,
12921 })
12922 }
12923
12924 /// Sets the value of [revision][crate::model::CloudRepoSourceContext::revision]
12925 /// to hold a `RevisionId`.
12926 ///
12927 /// Note that all the setters affecting `revision` are
12928 /// mutually exclusive.
12929 ///
12930 /// # Example
12931 /// ```ignore,no_run
12932 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12933 /// let x = CloudRepoSourceContext::new().set_revision_id("example");
12934 /// assert!(x.revision_id().is_some());
12935 /// assert!(x.alias_context().is_none());
12936 /// ```
12937 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12938 self.revision = std::option::Option::Some(
12939 crate::model::cloud_repo_source_context::Revision::RevisionId(v.into()),
12940 );
12941 self
12942 }
12943
12944 /// The value of [revision][crate::model::CloudRepoSourceContext::revision]
12945 /// if it holds a `AliasContext`, `None` if the field is not set or
12946 /// holds a different branch.
12947 pub fn alias_context(
12948 &self,
12949 ) -> std::option::Option<&std::boxed::Box<crate::model::AliasContext>> {
12950 #[allow(unreachable_patterns)]
12951 self.revision.as_ref().and_then(|v| match v {
12952 crate::model::cloud_repo_source_context::Revision::AliasContext(v) => {
12953 std::option::Option::Some(v)
12954 }
12955 _ => std::option::Option::None,
12956 })
12957 }
12958
12959 /// Sets the value of [revision][crate::model::CloudRepoSourceContext::revision]
12960 /// to hold a `AliasContext`.
12961 ///
12962 /// Note that all the setters affecting `revision` are
12963 /// mutually exclusive.
12964 ///
12965 /// # Example
12966 /// ```ignore,no_run
12967 /// # use google_cloud_grafeas_v1::model::CloudRepoSourceContext;
12968 /// use google_cloud_grafeas_v1::model::AliasContext;
12969 /// let x = CloudRepoSourceContext::new().set_alias_context(AliasContext::default()/* use setters */);
12970 /// assert!(x.alias_context().is_some());
12971 /// assert!(x.revision_id().is_none());
12972 /// ```
12973 pub fn set_alias_context<T: std::convert::Into<std::boxed::Box<crate::model::AliasContext>>>(
12974 mut self,
12975 v: T,
12976 ) -> Self {
12977 self.revision = std::option::Option::Some(
12978 crate::model::cloud_repo_source_context::Revision::AliasContext(v.into()),
12979 );
12980 self
12981 }
12982}
12983
12984impl wkt::message::Message for CloudRepoSourceContext {
12985 fn typename() -> &'static str {
12986 "type.googleapis.com/grafeas.v1.CloudRepoSourceContext"
12987 }
12988}
12989
12990/// Defines additional types related to [CloudRepoSourceContext].
12991pub mod cloud_repo_source_context {
12992 #[allow(unused_imports)]
12993 use super::*;
12994
12995 /// A revision in a Cloud Repo can be identified by either its revision ID or
12996 /// its alias.
12997 #[derive(Clone, Debug, PartialEq)]
12998 #[non_exhaustive]
12999 pub enum Revision {
13000 /// A revision ID.
13001 RevisionId(std::string::String),
13002 /// An alias, which may be a branch or tag.
13003 AliasContext(std::boxed::Box<crate::model::AliasContext>),
13004 }
13005}
13006
13007/// A SourceContext referring to a Gerrit project.
13008#[derive(Clone, Default, PartialEq)]
13009#[non_exhaustive]
13010pub struct GerritSourceContext {
13011 /// The URI of a running Gerrit instance.
13012 pub host_uri: std::string::String,
13013
13014 /// The full project name within the host. Projects may be nested, so
13015 /// "project/subproject" is a valid project name. The "repo name" is the
13016 /// hostURI/project.
13017 pub gerrit_project: std::string::String,
13018
13019 /// A revision in a Gerrit project can be identified by either its revision ID
13020 /// or its alias.
13021 pub revision: std::option::Option<crate::model::gerrit_source_context::Revision>,
13022
13023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13024}
13025
13026impl GerritSourceContext {
13027 pub fn new() -> Self {
13028 std::default::Default::default()
13029 }
13030
13031 /// Sets the value of [host_uri][crate::model::GerritSourceContext::host_uri].
13032 ///
13033 /// # Example
13034 /// ```ignore,no_run
13035 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13036 /// let x = GerritSourceContext::new().set_host_uri("example");
13037 /// ```
13038 pub fn set_host_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13039 self.host_uri = v.into();
13040 self
13041 }
13042
13043 /// Sets the value of [gerrit_project][crate::model::GerritSourceContext::gerrit_project].
13044 ///
13045 /// # Example
13046 /// ```ignore,no_run
13047 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13048 /// let x = GerritSourceContext::new().set_gerrit_project("example");
13049 /// ```
13050 pub fn set_gerrit_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13051 self.gerrit_project = v.into();
13052 self
13053 }
13054
13055 /// Sets the value of [revision][crate::model::GerritSourceContext::revision].
13056 ///
13057 /// Note that all the setters affecting `revision` are mutually
13058 /// exclusive.
13059 ///
13060 /// # Example
13061 /// ```ignore,no_run
13062 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13063 /// use google_cloud_grafeas_v1::model::gerrit_source_context::Revision;
13064 /// let x = GerritSourceContext::new().set_revision(Some(Revision::RevisionId("example".to_string())));
13065 /// ```
13066 pub fn set_revision<
13067 T: std::convert::Into<std::option::Option<crate::model::gerrit_source_context::Revision>>,
13068 >(
13069 mut self,
13070 v: T,
13071 ) -> Self {
13072 self.revision = v.into();
13073 self
13074 }
13075
13076 /// The value of [revision][crate::model::GerritSourceContext::revision]
13077 /// if it holds a `RevisionId`, `None` if the field is not set or
13078 /// holds a different branch.
13079 pub fn revision_id(&self) -> std::option::Option<&std::string::String> {
13080 #[allow(unreachable_patterns)]
13081 self.revision.as_ref().and_then(|v| match v {
13082 crate::model::gerrit_source_context::Revision::RevisionId(v) => {
13083 std::option::Option::Some(v)
13084 }
13085 _ => std::option::Option::None,
13086 })
13087 }
13088
13089 /// Sets the value of [revision][crate::model::GerritSourceContext::revision]
13090 /// to hold a `RevisionId`.
13091 ///
13092 /// Note that all the setters affecting `revision` are
13093 /// mutually exclusive.
13094 ///
13095 /// # Example
13096 /// ```ignore,no_run
13097 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13098 /// let x = GerritSourceContext::new().set_revision_id("example");
13099 /// assert!(x.revision_id().is_some());
13100 /// assert!(x.alias_context().is_none());
13101 /// ```
13102 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13103 self.revision = std::option::Option::Some(
13104 crate::model::gerrit_source_context::Revision::RevisionId(v.into()),
13105 );
13106 self
13107 }
13108
13109 /// The value of [revision][crate::model::GerritSourceContext::revision]
13110 /// if it holds a `AliasContext`, `None` if the field is not set or
13111 /// holds a different branch.
13112 pub fn alias_context(
13113 &self,
13114 ) -> std::option::Option<&std::boxed::Box<crate::model::AliasContext>> {
13115 #[allow(unreachable_patterns)]
13116 self.revision.as_ref().and_then(|v| match v {
13117 crate::model::gerrit_source_context::Revision::AliasContext(v) => {
13118 std::option::Option::Some(v)
13119 }
13120 _ => std::option::Option::None,
13121 })
13122 }
13123
13124 /// Sets the value of [revision][crate::model::GerritSourceContext::revision]
13125 /// to hold a `AliasContext`.
13126 ///
13127 /// Note that all the setters affecting `revision` are
13128 /// mutually exclusive.
13129 ///
13130 /// # Example
13131 /// ```ignore,no_run
13132 /// # use google_cloud_grafeas_v1::model::GerritSourceContext;
13133 /// use google_cloud_grafeas_v1::model::AliasContext;
13134 /// let x = GerritSourceContext::new().set_alias_context(AliasContext::default()/* use setters */);
13135 /// assert!(x.alias_context().is_some());
13136 /// assert!(x.revision_id().is_none());
13137 /// ```
13138 pub fn set_alias_context<T: std::convert::Into<std::boxed::Box<crate::model::AliasContext>>>(
13139 mut self,
13140 v: T,
13141 ) -> Self {
13142 self.revision = std::option::Option::Some(
13143 crate::model::gerrit_source_context::Revision::AliasContext(v.into()),
13144 );
13145 self
13146 }
13147}
13148
13149impl wkt::message::Message for GerritSourceContext {
13150 fn typename() -> &'static str {
13151 "type.googleapis.com/grafeas.v1.GerritSourceContext"
13152 }
13153}
13154
13155/// Defines additional types related to [GerritSourceContext].
13156pub mod gerrit_source_context {
13157 #[allow(unused_imports)]
13158 use super::*;
13159
13160 /// A revision in a Gerrit project can be identified by either its revision ID
13161 /// or its alias.
13162 #[derive(Clone, Debug, PartialEq)]
13163 #[non_exhaustive]
13164 pub enum Revision {
13165 /// A revision (commit) ID.
13166 RevisionId(std::string::String),
13167 /// An alias, which may be a branch or tag.
13168 AliasContext(std::boxed::Box<crate::model::AliasContext>),
13169 }
13170}
13171
13172/// A GitSourceContext denotes a particular revision in a third party Git
13173/// repository (e.g., GitHub).
13174#[derive(Clone, Default, PartialEq)]
13175#[non_exhaustive]
13176pub struct GitSourceContext {
13177 /// Git repository URL.
13178 pub url: std::string::String,
13179
13180 /// Git commit hash.
13181 pub revision_id: std::string::String,
13182
13183 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13184}
13185
13186impl GitSourceContext {
13187 pub fn new() -> Self {
13188 std::default::Default::default()
13189 }
13190
13191 /// Sets the value of [url][crate::model::GitSourceContext::url].
13192 ///
13193 /// # Example
13194 /// ```ignore,no_run
13195 /// # use google_cloud_grafeas_v1::model::GitSourceContext;
13196 /// let x = GitSourceContext::new().set_url("example");
13197 /// ```
13198 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13199 self.url = v.into();
13200 self
13201 }
13202
13203 /// Sets the value of [revision_id][crate::model::GitSourceContext::revision_id].
13204 ///
13205 /// # Example
13206 /// ```ignore,no_run
13207 /// # use google_cloud_grafeas_v1::model::GitSourceContext;
13208 /// let x = GitSourceContext::new().set_revision_id("example");
13209 /// ```
13210 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13211 self.revision_id = v.into();
13212 self
13213 }
13214}
13215
13216impl wkt::message::Message for GitSourceContext {
13217 fn typename() -> &'static str {
13218 "type.googleapis.com/grafeas.v1.GitSourceContext"
13219 }
13220}
13221
13222/// A unique identifier for a Cloud Repo.
13223#[derive(Clone, Default, PartialEq)]
13224#[non_exhaustive]
13225pub struct RepoId {
13226 /// A cloud repo can be identified by either its project ID and repository name
13227 /// combination, or its globally unique identifier.
13228 pub id: std::option::Option<crate::model::repo_id::Id>,
13229
13230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13231}
13232
13233impl RepoId {
13234 pub fn new() -> Self {
13235 std::default::Default::default()
13236 }
13237
13238 /// Sets the value of [id][crate::model::RepoId::id].
13239 ///
13240 /// Note that all the setters affecting `id` are mutually
13241 /// exclusive.
13242 ///
13243 /// # Example
13244 /// ```ignore,no_run
13245 /// # use google_cloud_grafeas_v1::model::RepoId;
13246 /// use google_cloud_grafeas_v1::model::repo_id::Id;
13247 /// let x = RepoId::new().set_id(Some(Id::Uid("example".to_string())));
13248 /// ```
13249 pub fn set_id<T: std::convert::Into<std::option::Option<crate::model::repo_id::Id>>>(
13250 mut self,
13251 v: T,
13252 ) -> Self {
13253 self.id = v.into();
13254 self
13255 }
13256
13257 /// The value of [id][crate::model::RepoId::id]
13258 /// if it holds a `ProjectRepoId`, `None` if the field is not set or
13259 /// holds a different branch.
13260 pub fn project_repo_id(
13261 &self,
13262 ) -> std::option::Option<&std::boxed::Box<crate::model::ProjectRepoId>> {
13263 #[allow(unreachable_patterns)]
13264 self.id.as_ref().and_then(|v| match v {
13265 crate::model::repo_id::Id::ProjectRepoId(v) => std::option::Option::Some(v),
13266 _ => std::option::Option::None,
13267 })
13268 }
13269
13270 /// Sets the value of [id][crate::model::RepoId::id]
13271 /// to hold a `ProjectRepoId`.
13272 ///
13273 /// Note that all the setters affecting `id` are
13274 /// mutually exclusive.
13275 ///
13276 /// # Example
13277 /// ```ignore,no_run
13278 /// # use google_cloud_grafeas_v1::model::RepoId;
13279 /// use google_cloud_grafeas_v1::model::ProjectRepoId;
13280 /// let x = RepoId::new().set_project_repo_id(ProjectRepoId::default()/* use setters */);
13281 /// assert!(x.project_repo_id().is_some());
13282 /// assert!(x.uid().is_none());
13283 /// ```
13284 pub fn set_project_repo_id<
13285 T: std::convert::Into<std::boxed::Box<crate::model::ProjectRepoId>>,
13286 >(
13287 mut self,
13288 v: T,
13289 ) -> Self {
13290 self.id = std::option::Option::Some(crate::model::repo_id::Id::ProjectRepoId(v.into()));
13291 self
13292 }
13293
13294 /// The value of [id][crate::model::RepoId::id]
13295 /// if it holds a `Uid`, `None` if the field is not set or
13296 /// holds a different branch.
13297 pub fn uid(&self) -> std::option::Option<&std::string::String> {
13298 #[allow(unreachable_patterns)]
13299 self.id.as_ref().and_then(|v| match v {
13300 crate::model::repo_id::Id::Uid(v) => std::option::Option::Some(v),
13301 _ => std::option::Option::None,
13302 })
13303 }
13304
13305 /// Sets the value of [id][crate::model::RepoId::id]
13306 /// to hold a `Uid`.
13307 ///
13308 /// Note that all the setters affecting `id` are
13309 /// mutually exclusive.
13310 ///
13311 /// # Example
13312 /// ```ignore,no_run
13313 /// # use google_cloud_grafeas_v1::model::RepoId;
13314 /// let x = RepoId::new().set_uid("example");
13315 /// assert!(x.uid().is_some());
13316 /// assert!(x.project_repo_id().is_none());
13317 /// ```
13318 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13319 self.id = std::option::Option::Some(crate::model::repo_id::Id::Uid(v.into()));
13320 self
13321 }
13322}
13323
13324impl wkt::message::Message for RepoId {
13325 fn typename() -> &'static str {
13326 "type.googleapis.com/grafeas.v1.RepoId"
13327 }
13328}
13329
13330/// Defines additional types related to [RepoId].
13331pub mod repo_id {
13332 #[allow(unused_imports)]
13333 use super::*;
13334
13335 /// A cloud repo can be identified by either its project ID and repository name
13336 /// combination, or its globally unique identifier.
13337 #[derive(Clone, Debug, PartialEq)]
13338 #[non_exhaustive]
13339 pub enum Id {
13340 /// A combination of a project ID and a repo name.
13341 ProjectRepoId(std::boxed::Box<crate::model::ProjectRepoId>),
13342 /// A server-assigned, globally unique identifier.
13343 Uid(std::string::String),
13344 }
13345}
13346
13347/// Selects a repo using a Google Cloud Platform project ID (e.g.,
13348/// winged-cargo-31) and a repo name within that project.
13349#[derive(Clone, Default, PartialEq)]
13350#[non_exhaustive]
13351pub struct ProjectRepoId {
13352 /// The ID of the project.
13353 pub project_id: std::string::String,
13354
13355 /// The name of the repo. Leave empty for the default repo.
13356 pub repo_name: std::string::String,
13357
13358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13359}
13360
13361impl ProjectRepoId {
13362 pub fn new() -> Self {
13363 std::default::Default::default()
13364 }
13365
13366 /// Sets the value of [project_id][crate::model::ProjectRepoId::project_id].
13367 ///
13368 /// # Example
13369 /// ```ignore,no_run
13370 /// # use google_cloud_grafeas_v1::model::ProjectRepoId;
13371 /// let x = ProjectRepoId::new().set_project_id("example");
13372 /// ```
13373 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13374 self.project_id = v.into();
13375 self
13376 }
13377
13378 /// Sets the value of [repo_name][crate::model::ProjectRepoId::repo_name].
13379 ///
13380 /// # Example
13381 /// ```ignore,no_run
13382 /// # use google_cloud_grafeas_v1::model::ProjectRepoId;
13383 /// let x = ProjectRepoId::new().set_repo_name("example");
13384 /// ```
13385 pub fn set_repo_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13386 self.repo_name = v.into();
13387 self
13388 }
13389}
13390
13391impl wkt::message::Message for ProjectRepoId {
13392 fn typename() -> &'static str {
13393 "type.googleapis.com/grafeas.v1.ProjectRepoId"
13394 }
13395}
13396
13397#[derive(Clone, Default, PartialEq)]
13398#[non_exhaustive]
13399pub struct Risk {
13400 /// CISA maintains the authoritative source of vulnerabilities that have been
13401 /// exploited in the wild.
13402 pub cisa_kev: std::option::Option<crate::model::CISAKnownExploitedVulnerabilities>,
13403
13404 /// The Exploit Prediction Scoring System (EPSS) estimates the likelihood
13405 /// (probability) that a software vulnerability will be exploited in the wild.
13406 pub epss: std::option::Option<crate::model::ExploitPredictionScoringSystem>,
13407
13408 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13409}
13410
13411impl Risk {
13412 pub fn new() -> Self {
13413 std::default::Default::default()
13414 }
13415
13416 /// Sets the value of [cisa_kev][crate::model::Risk::cisa_kev].
13417 ///
13418 /// # Example
13419 /// ```ignore,no_run
13420 /// # use google_cloud_grafeas_v1::model::Risk;
13421 /// use google_cloud_grafeas_v1::model::CISAKnownExploitedVulnerabilities;
13422 /// let x = Risk::new().set_cisa_kev(CISAKnownExploitedVulnerabilities::default()/* use setters */);
13423 /// ```
13424 pub fn set_cisa_kev<T>(mut self, v: T) -> Self
13425 where
13426 T: std::convert::Into<crate::model::CISAKnownExploitedVulnerabilities>,
13427 {
13428 self.cisa_kev = std::option::Option::Some(v.into());
13429 self
13430 }
13431
13432 /// Sets or clears the value of [cisa_kev][crate::model::Risk::cisa_kev].
13433 ///
13434 /// # Example
13435 /// ```ignore,no_run
13436 /// # use google_cloud_grafeas_v1::model::Risk;
13437 /// use google_cloud_grafeas_v1::model::CISAKnownExploitedVulnerabilities;
13438 /// let x = Risk::new().set_or_clear_cisa_kev(Some(CISAKnownExploitedVulnerabilities::default()/* use setters */));
13439 /// let x = Risk::new().set_or_clear_cisa_kev(None::<CISAKnownExploitedVulnerabilities>);
13440 /// ```
13441 pub fn set_or_clear_cisa_kev<T>(mut self, v: std::option::Option<T>) -> Self
13442 where
13443 T: std::convert::Into<crate::model::CISAKnownExploitedVulnerabilities>,
13444 {
13445 self.cisa_kev = v.map(|x| x.into());
13446 self
13447 }
13448
13449 /// Sets the value of [epss][crate::model::Risk::epss].
13450 ///
13451 /// # Example
13452 /// ```ignore,no_run
13453 /// # use google_cloud_grafeas_v1::model::Risk;
13454 /// use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13455 /// let x = Risk::new().set_epss(ExploitPredictionScoringSystem::default()/* use setters */);
13456 /// ```
13457 pub fn set_epss<T>(mut self, v: T) -> Self
13458 where
13459 T: std::convert::Into<crate::model::ExploitPredictionScoringSystem>,
13460 {
13461 self.epss = std::option::Option::Some(v.into());
13462 self
13463 }
13464
13465 /// Sets or clears the value of [epss][crate::model::Risk::epss].
13466 ///
13467 /// # Example
13468 /// ```ignore,no_run
13469 /// # use google_cloud_grafeas_v1::model::Risk;
13470 /// use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13471 /// let x = Risk::new().set_or_clear_epss(Some(ExploitPredictionScoringSystem::default()/* use setters */));
13472 /// let x = Risk::new().set_or_clear_epss(None::<ExploitPredictionScoringSystem>);
13473 /// ```
13474 pub fn set_or_clear_epss<T>(mut self, v: std::option::Option<T>) -> Self
13475 where
13476 T: std::convert::Into<crate::model::ExploitPredictionScoringSystem>,
13477 {
13478 self.epss = v.map(|x| x.into());
13479 self
13480 }
13481}
13482
13483impl wkt::message::Message for Risk {
13484 fn typename() -> &'static str {
13485 "type.googleapis.com/grafeas.v1.Risk"
13486 }
13487}
13488
13489#[derive(Clone, Default, PartialEq)]
13490#[non_exhaustive]
13491pub struct CISAKnownExploitedVulnerabilities {
13492 /// Whether the vulnerability is known to have been leveraged as part of a
13493 /// ransomware campaign.
13494 pub known_ransomware_campaign_use: std::string::String,
13495
13496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13497}
13498
13499impl CISAKnownExploitedVulnerabilities {
13500 pub fn new() -> Self {
13501 std::default::Default::default()
13502 }
13503
13504 /// Sets the value of [known_ransomware_campaign_use][crate::model::CISAKnownExploitedVulnerabilities::known_ransomware_campaign_use].
13505 ///
13506 /// # Example
13507 /// ```ignore,no_run
13508 /// # use google_cloud_grafeas_v1::model::CISAKnownExploitedVulnerabilities;
13509 /// let x = CISAKnownExploitedVulnerabilities::new().set_known_ransomware_campaign_use("example");
13510 /// ```
13511 pub fn set_known_ransomware_campaign_use<T: std::convert::Into<std::string::String>>(
13512 mut self,
13513 v: T,
13514 ) -> Self {
13515 self.known_ransomware_campaign_use = v.into();
13516 self
13517 }
13518}
13519
13520impl wkt::message::Message for CISAKnownExploitedVulnerabilities {
13521 fn typename() -> &'static str {
13522 "type.googleapis.com/grafeas.v1.CISAKnownExploitedVulnerabilities"
13523 }
13524}
13525
13526#[derive(Clone, Default, PartialEq)]
13527#[non_exhaustive]
13528pub struct ExploitPredictionScoringSystem {
13529 /// The percentile of the current score, the proportion of all scored
13530 /// vulnerabilities with the same or a lower EPSS score
13531 pub percentile: f64,
13532
13533 /// The EPSS score representing the probability [0-1] of exploitation in the
13534 /// wild in the next 30 days
13535 pub score: f64,
13536
13537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13538}
13539
13540impl ExploitPredictionScoringSystem {
13541 pub fn new() -> Self {
13542 std::default::Default::default()
13543 }
13544
13545 /// Sets the value of [percentile][crate::model::ExploitPredictionScoringSystem::percentile].
13546 ///
13547 /// # Example
13548 /// ```ignore,no_run
13549 /// # use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13550 /// let x = ExploitPredictionScoringSystem::new().set_percentile(42.0);
13551 /// ```
13552 pub fn set_percentile<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
13553 self.percentile = v.into();
13554 self
13555 }
13556
13557 /// Sets the value of [score][crate::model::ExploitPredictionScoringSystem::score].
13558 ///
13559 /// # Example
13560 /// ```ignore,no_run
13561 /// # use google_cloud_grafeas_v1::model::ExploitPredictionScoringSystem;
13562 /// let x = ExploitPredictionScoringSystem::new().set_score(42.0);
13563 /// ```
13564 pub fn set_score<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
13565 self.score = v.into();
13566 self
13567 }
13568}
13569
13570impl wkt::message::Message for ExploitPredictionScoringSystem {
13571 fn typename() -> &'static str {
13572 "type.googleapis.com/grafeas.v1.ExploitPredictionScoringSystem"
13573 }
13574}
13575
13576/// The note representing an SBOM reference.
13577#[derive(Clone, Default, PartialEq)]
13578#[non_exhaustive]
13579pub struct SBOMReferenceNote {
13580 /// The format that SBOM takes. E.g. may be spdx, cyclonedx, etc...
13581 pub format: std::string::String,
13582
13583 /// The version of the format that the SBOM takes. E.g. if the format
13584 /// is spdx, the version may be 2.3.
13585 pub version: std::string::String,
13586
13587 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13588}
13589
13590impl SBOMReferenceNote {
13591 pub fn new() -> Self {
13592 std::default::Default::default()
13593 }
13594
13595 /// Sets the value of [format][crate::model::SBOMReferenceNote::format].
13596 ///
13597 /// # Example
13598 /// ```ignore,no_run
13599 /// # use google_cloud_grafeas_v1::model::SBOMReferenceNote;
13600 /// let x = SBOMReferenceNote::new().set_format("example");
13601 /// ```
13602 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13603 self.format = v.into();
13604 self
13605 }
13606
13607 /// Sets the value of [version][crate::model::SBOMReferenceNote::version].
13608 ///
13609 /// # Example
13610 /// ```ignore,no_run
13611 /// # use google_cloud_grafeas_v1::model::SBOMReferenceNote;
13612 /// let x = SBOMReferenceNote::new().set_version("example");
13613 /// ```
13614 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13615 self.version = v.into();
13616 self
13617 }
13618}
13619
13620impl wkt::message::Message for SBOMReferenceNote {
13621 fn typename() -> &'static str {
13622 "type.googleapis.com/grafeas.v1.SBOMReferenceNote"
13623 }
13624}
13625
13626/// The occurrence representing an SBOM reference as applied to a specific
13627/// resource. The occurrence follows the DSSE specification. See
13628/// <https://github.com/secure-systems-lab/dsse/blob/master/envelope.md> for more
13629/// details.
13630#[derive(Clone, Default, PartialEq)]
13631#[non_exhaustive]
13632pub struct SBOMReferenceOccurrence {
13633 /// The actual payload that contains the SBOM reference data.
13634 pub payload: std::option::Option<crate::model::SbomReferenceIntotoPayload>,
13635
13636 /// The kind of payload that SbomReferenceIntotoPayload takes. Since it's in
13637 /// the intoto format, this value is expected to be
13638 /// 'application/vnd.in-toto+json'.
13639 pub payload_type: std::string::String,
13640
13641 /// The signatures over the payload.
13642 pub signatures: std::vec::Vec<crate::model::EnvelopeSignature>,
13643
13644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13645}
13646
13647impl SBOMReferenceOccurrence {
13648 pub fn new() -> Self {
13649 std::default::Default::default()
13650 }
13651
13652 /// Sets the value of [payload][crate::model::SBOMReferenceOccurrence::payload].
13653 ///
13654 /// # Example
13655 /// ```ignore,no_run
13656 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13657 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13658 /// let x = SBOMReferenceOccurrence::new().set_payload(SbomReferenceIntotoPayload::default()/* use setters */);
13659 /// ```
13660 pub fn set_payload<T>(mut self, v: T) -> Self
13661 where
13662 T: std::convert::Into<crate::model::SbomReferenceIntotoPayload>,
13663 {
13664 self.payload = std::option::Option::Some(v.into());
13665 self
13666 }
13667
13668 /// Sets or clears the value of [payload][crate::model::SBOMReferenceOccurrence::payload].
13669 ///
13670 /// # Example
13671 /// ```ignore,no_run
13672 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13673 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13674 /// let x = SBOMReferenceOccurrence::new().set_or_clear_payload(Some(SbomReferenceIntotoPayload::default()/* use setters */));
13675 /// let x = SBOMReferenceOccurrence::new().set_or_clear_payload(None::<SbomReferenceIntotoPayload>);
13676 /// ```
13677 pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
13678 where
13679 T: std::convert::Into<crate::model::SbomReferenceIntotoPayload>,
13680 {
13681 self.payload = v.map(|x| x.into());
13682 self
13683 }
13684
13685 /// Sets the value of [payload_type][crate::model::SBOMReferenceOccurrence::payload_type].
13686 ///
13687 /// # Example
13688 /// ```ignore,no_run
13689 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13690 /// let x = SBOMReferenceOccurrence::new().set_payload_type("example");
13691 /// ```
13692 pub fn set_payload_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13693 self.payload_type = v.into();
13694 self
13695 }
13696
13697 /// Sets the value of [signatures][crate::model::SBOMReferenceOccurrence::signatures].
13698 ///
13699 /// # Example
13700 /// ```ignore,no_run
13701 /// # use google_cloud_grafeas_v1::model::SBOMReferenceOccurrence;
13702 /// use google_cloud_grafeas_v1::model::EnvelopeSignature;
13703 /// let x = SBOMReferenceOccurrence::new()
13704 /// .set_signatures([
13705 /// EnvelopeSignature::default()/* use setters */,
13706 /// EnvelopeSignature::default()/* use (different) setters */,
13707 /// ]);
13708 /// ```
13709 pub fn set_signatures<T, V>(mut self, v: T) -> Self
13710 where
13711 T: std::iter::IntoIterator<Item = V>,
13712 V: std::convert::Into<crate::model::EnvelopeSignature>,
13713 {
13714 use std::iter::Iterator;
13715 self.signatures = v.into_iter().map(|i| i.into()).collect();
13716 self
13717 }
13718}
13719
13720impl wkt::message::Message for SBOMReferenceOccurrence {
13721 fn typename() -> &'static str {
13722 "type.googleapis.com/grafeas.v1.SBOMReferenceOccurrence"
13723 }
13724}
13725
13726/// The actual payload that contains the SBOM Reference data.
13727/// The payload follows the intoto statement specification. See
13728/// <https://github.com/in-toto/attestation/blob/main/spec/v1.0/statement.md>
13729/// for more details.
13730#[derive(Clone, Default, PartialEq)]
13731#[non_exhaustive]
13732pub struct SbomReferenceIntotoPayload {
13733 /// Identifier for the schema of the Statement.
13734 pub r#type: std::string::String,
13735
13736 /// URI identifying the type of the Predicate.
13737 pub predicate_type: std::string::String,
13738
13739 /// Set of software artifacts that the attestation applies to. Each element
13740 /// represents a single software artifact.
13741 pub subject: std::vec::Vec<crate::model::Subject>,
13742
13743 /// Additional parameters of the Predicate. Includes the actual data about the
13744 /// SBOM.
13745 pub predicate: std::option::Option<crate::model::SbomReferenceIntotoPredicate>,
13746
13747 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13748}
13749
13750impl SbomReferenceIntotoPayload {
13751 pub fn new() -> Self {
13752 std::default::Default::default()
13753 }
13754
13755 /// Sets the value of [r#type][crate::model::SbomReferenceIntotoPayload::type].
13756 ///
13757 /// # Example
13758 /// ```ignore,no_run
13759 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13760 /// let x = SbomReferenceIntotoPayload::new().set_type("example");
13761 /// ```
13762 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13763 self.r#type = v.into();
13764 self
13765 }
13766
13767 /// Sets the value of [predicate_type][crate::model::SbomReferenceIntotoPayload::predicate_type].
13768 ///
13769 /// # Example
13770 /// ```ignore,no_run
13771 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13772 /// let x = SbomReferenceIntotoPayload::new().set_predicate_type("example");
13773 /// ```
13774 pub fn set_predicate_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13775 self.predicate_type = v.into();
13776 self
13777 }
13778
13779 /// Sets the value of [subject][crate::model::SbomReferenceIntotoPayload::subject].
13780 ///
13781 /// # Example
13782 /// ```ignore,no_run
13783 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13784 /// use google_cloud_grafeas_v1::model::Subject;
13785 /// let x = SbomReferenceIntotoPayload::new()
13786 /// .set_subject([
13787 /// Subject::default()/* use setters */,
13788 /// Subject::default()/* use (different) setters */,
13789 /// ]);
13790 /// ```
13791 pub fn set_subject<T, V>(mut self, v: T) -> Self
13792 where
13793 T: std::iter::IntoIterator<Item = V>,
13794 V: std::convert::Into<crate::model::Subject>,
13795 {
13796 use std::iter::Iterator;
13797 self.subject = v.into_iter().map(|i| i.into()).collect();
13798 self
13799 }
13800
13801 /// Sets the value of [predicate][crate::model::SbomReferenceIntotoPayload::predicate].
13802 ///
13803 /// # Example
13804 /// ```ignore,no_run
13805 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13806 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13807 /// let x = SbomReferenceIntotoPayload::new().set_predicate(SbomReferenceIntotoPredicate::default()/* use setters */);
13808 /// ```
13809 pub fn set_predicate<T>(mut self, v: T) -> Self
13810 where
13811 T: std::convert::Into<crate::model::SbomReferenceIntotoPredicate>,
13812 {
13813 self.predicate = std::option::Option::Some(v.into());
13814 self
13815 }
13816
13817 /// Sets or clears the value of [predicate][crate::model::SbomReferenceIntotoPayload::predicate].
13818 ///
13819 /// # Example
13820 /// ```ignore,no_run
13821 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPayload;
13822 /// use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13823 /// let x = SbomReferenceIntotoPayload::new().set_or_clear_predicate(Some(SbomReferenceIntotoPredicate::default()/* use setters */));
13824 /// let x = SbomReferenceIntotoPayload::new().set_or_clear_predicate(None::<SbomReferenceIntotoPredicate>);
13825 /// ```
13826 pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
13827 where
13828 T: std::convert::Into<crate::model::SbomReferenceIntotoPredicate>,
13829 {
13830 self.predicate = v.map(|x| x.into());
13831 self
13832 }
13833}
13834
13835impl wkt::message::Message for SbomReferenceIntotoPayload {
13836 fn typename() -> &'static str {
13837 "type.googleapis.com/grafeas.v1.SbomReferenceIntotoPayload"
13838 }
13839}
13840
13841/// A predicate which describes the SBOM being referenced.
13842#[derive(Clone, Default, PartialEq)]
13843#[non_exhaustive]
13844pub struct SbomReferenceIntotoPredicate {
13845 /// The person or system referring this predicate to the consumer.
13846 pub referrer_id: std::string::String,
13847
13848 /// The location of the SBOM.
13849 pub location: std::string::String,
13850
13851 /// The mime type of the SBOM.
13852 pub mime_type: std::string::String,
13853
13854 /// A map of algorithm to digest of the contents of the SBOM.
13855 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
13856
13857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13858}
13859
13860impl SbomReferenceIntotoPredicate {
13861 pub fn new() -> Self {
13862 std::default::Default::default()
13863 }
13864
13865 /// Sets the value of [referrer_id][crate::model::SbomReferenceIntotoPredicate::referrer_id].
13866 ///
13867 /// # Example
13868 /// ```ignore,no_run
13869 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13870 /// let x = SbomReferenceIntotoPredicate::new().set_referrer_id("example");
13871 /// ```
13872 pub fn set_referrer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13873 self.referrer_id = v.into();
13874 self
13875 }
13876
13877 /// Sets the value of [location][crate::model::SbomReferenceIntotoPredicate::location].
13878 ///
13879 /// # Example
13880 /// ```ignore,no_run
13881 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13882 /// let x = SbomReferenceIntotoPredicate::new().set_location("example");
13883 /// ```
13884 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13885 self.location = v.into();
13886 self
13887 }
13888
13889 /// Sets the value of [mime_type][crate::model::SbomReferenceIntotoPredicate::mime_type].
13890 ///
13891 /// # Example
13892 /// ```ignore,no_run
13893 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13894 /// let x = SbomReferenceIntotoPredicate::new().set_mime_type("example");
13895 /// ```
13896 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13897 self.mime_type = v.into();
13898 self
13899 }
13900
13901 /// Sets the value of [digest][crate::model::SbomReferenceIntotoPredicate::digest].
13902 ///
13903 /// # Example
13904 /// ```ignore,no_run
13905 /// # use google_cloud_grafeas_v1::model::SbomReferenceIntotoPredicate;
13906 /// let x = SbomReferenceIntotoPredicate::new().set_digest([
13907 /// ("key0", "abc"),
13908 /// ("key1", "xyz"),
13909 /// ]);
13910 /// ```
13911 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
13912 where
13913 T: std::iter::IntoIterator<Item = (K, V)>,
13914 K: std::convert::Into<std::string::String>,
13915 V: std::convert::Into<std::string::String>,
13916 {
13917 use std::iter::Iterator;
13918 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
13919 self
13920 }
13921}
13922
13923impl wkt::message::Message for SbomReferenceIntotoPredicate {
13924 fn typename() -> &'static str {
13925 "type.googleapis.com/grafeas.v1.SbomReferenceIntotoPredicate"
13926 }
13927}
13928
13929/// The note representing a secret.
13930#[derive(Clone, Default, PartialEq)]
13931#[non_exhaustive]
13932pub struct SecretNote {
13933 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13934}
13935
13936impl SecretNote {
13937 pub fn new() -> Self {
13938 std::default::Default::default()
13939 }
13940}
13941
13942impl wkt::message::Message for SecretNote {
13943 fn typename() -> &'static str {
13944 "type.googleapis.com/grafeas.v1.SecretNote"
13945 }
13946}
13947
13948/// The occurrence provides details of a secret.
13949#[derive(Clone, Default, PartialEq)]
13950#[non_exhaustive]
13951pub struct SecretOccurrence {
13952 /// Type of secret.
13953 pub kind: crate::model::SecretKind,
13954
13955 /// Locations where the secret is detected.
13956 pub locations: std::vec::Vec<crate::model::SecretLocation>,
13957
13958 /// Status of the secret.
13959 pub statuses: std::vec::Vec<crate::model::SecretStatus>,
13960
13961 /// Scan result of the secret.
13962 pub data: std::option::Option<wkt::Any>,
13963
13964 /// Hash value, typically a digest for the secret data, that allows unique
13965 /// identification of a specific secret.
13966 pub digest: std::option::Option<crate::model::Digest>,
13967
13968 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13969}
13970
13971impl SecretOccurrence {
13972 pub fn new() -> Self {
13973 std::default::Default::default()
13974 }
13975
13976 /// Sets the value of [kind][crate::model::SecretOccurrence::kind].
13977 ///
13978 /// # Example
13979 /// ```ignore,no_run
13980 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
13981 /// use google_cloud_grafeas_v1::model::SecretKind;
13982 /// let x0 = SecretOccurrence::new().set_kind(SecretKind::Unknown);
13983 /// let x1 = SecretOccurrence::new().set_kind(SecretKind::GcpServiceAccountKey);
13984 /// let x2 = SecretOccurrence::new().set_kind(SecretKind::GcpApiKey);
13985 /// ```
13986 pub fn set_kind<T: std::convert::Into<crate::model::SecretKind>>(mut self, v: T) -> Self {
13987 self.kind = v.into();
13988 self
13989 }
13990
13991 /// Sets the value of [locations][crate::model::SecretOccurrence::locations].
13992 ///
13993 /// # Example
13994 /// ```ignore,no_run
13995 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
13996 /// use google_cloud_grafeas_v1::model::SecretLocation;
13997 /// let x = SecretOccurrence::new()
13998 /// .set_locations([
13999 /// SecretLocation::default()/* use setters */,
14000 /// SecretLocation::default()/* use (different) setters */,
14001 /// ]);
14002 /// ```
14003 pub fn set_locations<T, V>(mut self, v: T) -> Self
14004 where
14005 T: std::iter::IntoIterator<Item = V>,
14006 V: std::convert::Into<crate::model::SecretLocation>,
14007 {
14008 use std::iter::Iterator;
14009 self.locations = v.into_iter().map(|i| i.into()).collect();
14010 self
14011 }
14012
14013 /// Sets the value of [statuses][crate::model::SecretOccurrence::statuses].
14014 ///
14015 /// # Example
14016 /// ```ignore,no_run
14017 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14018 /// use google_cloud_grafeas_v1::model::SecretStatus;
14019 /// let x = SecretOccurrence::new()
14020 /// .set_statuses([
14021 /// SecretStatus::default()/* use setters */,
14022 /// SecretStatus::default()/* use (different) setters */,
14023 /// ]);
14024 /// ```
14025 pub fn set_statuses<T, V>(mut self, v: T) -> Self
14026 where
14027 T: std::iter::IntoIterator<Item = V>,
14028 V: std::convert::Into<crate::model::SecretStatus>,
14029 {
14030 use std::iter::Iterator;
14031 self.statuses = v.into_iter().map(|i| i.into()).collect();
14032 self
14033 }
14034
14035 /// Sets the value of [data][crate::model::SecretOccurrence::data].
14036 ///
14037 /// # Example
14038 /// ```ignore,no_run
14039 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14040 /// use wkt::Any;
14041 /// let x = SecretOccurrence::new().set_data(Any::default()/* use setters */);
14042 /// ```
14043 pub fn set_data<T>(mut self, v: T) -> Self
14044 where
14045 T: std::convert::Into<wkt::Any>,
14046 {
14047 self.data = std::option::Option::Some(v.into());
14048 self
14049 }
14050
14051 /// Sets or clears the value of [data][crate::model::SecretOccurrence::data].
14052 ///
14053 /// # Example
14054 /// ```ignore,no_run
14055 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14056 /// use wkt::Any;
14057 /// let x = SecretOccurrence::new().set_or_clear_data(Some(Any::default()/* use setters */));
14058 /// let x = SecretOccurrence::new().set_or_clear_data(None::<Any>);
14059 /// ```
14060 pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
14061 where
14062 T: std::convert::Into<wkt::Any>,
14063 {
14064 self.data = v.map(|x| x.into());
14065 self
14066 }
14067
14068 /// Sets the value of [digest][crate::model::SecretOccurrence::digest].
14069 ///
14070 /// # Example
14071 /// ```ignore,no_run
14072 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14073 /// use google_cloud_grafeas_v1::model::Digest;
14074 /// let x = SecretOccurrence::new().set_digest(Digest::default()/* use setters */);
14075 /// ```
14076 pub fn set_digest<T>(mut self, v: T) -> Self
14077 where
14078 T: std::convert::Into<crate::model::Digest>,
14079 {
14080 self.digest = std::option::Option::Some(v.into());
14081 self
14082 }
14083
14084 /// Sets or clears the value of [digest][crate::model::SecretOccurrence::digest].
14085 ///
14086 /// # Example
14087 /// ```ignore,no_run
14088 /// # use google_cloud_grafeas_v1::model::SecretOccurrence;
14089 /// use google_cloud_grafeas_v1::model::Digest;
14090 /// let x = SecretOccurrence::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
14091 /// let x = SecretOccurrence::new().set_or_clear_digest(None::<Digest>);
14092 /// ```
14093 pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
14094 where
14095 T: std::convert::Into<crate::model::Digest>,
14096 {
14097 self.digest = v.map(|x| x.into());
14098 self
14099 }
14100}
14101
14102impl wkt::message::Message for SecretOccurrence {
14103 fn typename() -> &'static str {
14104 "type.googleapis.com/grafeas.v1.SecretOccurrence"
14105 }
14106}
14107
14108/// The location of the secret.
14109#[derive(Clone, Default, PartialEq)]
14110#[non_exhaustive]
14111pub struct SecretLocation {
14112 /// The detailed location of the secret.
14113 pub location: std::option::Option<crate::model::secret_location::Location>,
14114
14115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14116}
14117
14118impl SecretLocation {
14119 pub fn new() -> Self {
14120 std::default::Default::default()
14121 }
14122
14123 /// Sets the value of [location][crate::model::SecretLocation::location].
14124 ///
14125 /// Note that all the setters affecting `location` are mutually
14126 /// exclusive.
14127 ///
14128 /// # Example
14129 /// ```ignore,no_run
14130 /// # use google_cloud_grafeas_v1::model::SecretLocation;
14131 /// use google_cloud_grafeas_v1::model::FileLocation;
14132 /// let x = SecretLocation::new().set_location(Some(
14133 /// google_cloud_grafeas_v1::model::secret_location::Location::FileLocation(FileLocation::default().into())));
14134 /// ```
14135 pub fn set_location<
14136 T: std::convert::Into<std::option::Option<crate::model::secret_location::Location>>,
14137 >(
14138 mut self,
14139 v: T,
14140 ) -> Self {
14141 self.location = v.into();
14142 self
14143 }
14144
14145 /// The value of [location][crate::model::SecretLocation::location]
14146 /// if it holds a `FileLocation`, `None` if the field is not set or
14147 /// holds a different branch.
14148 pub fn file_location(
14149 &self,
14150 ) -> std::option::Option<&std::boxed::Box<crate::model::FileLocation>> {
14151 #[allow(unreachable_patterns)]
14152 self.location.as_ref().and_then(|v| match v {
14153 crate::model::secret_location::Location::FileLocation(v) => {
14154 std::option::Option::Some(v)
14155 }
14156 _ => std::option::Option::None,
14157 })
14158 }
14159
14160 /// Sets the value of [location][crate::model::SecretLocation::location]
14161 /// to hold a `FileLocation`.
14162 ///
14163 /// Note that all the setters affecting `location` are
14164 /// mutually exclusive.
14165 ///
14166 /// # Example
14167 /// ```ignore,no_run
14168 /// # use google_cloud_grafeas_v1::model::SecretLocation;
14169 /// use google_cloud_grafeas_v1::model::FileLocation;
14170 /// let x = SecretLocation::new().set_file_location(FileLocation::default()/* use setters */);
14171 /// assert!(x.file_location().is_some());
14172 /// ```
14173 pub fn set_file_location<T: std::convert::Into<std::boxed::Box<crate::model::FileLocation>>>(
14174 mut self,
14175 v: T,
14176 ) -> Self {
14177 self.location = std::option::Option::Some(
14178 crate::model::secret_location::Location::FileLocation(v.into()),
14179 );
14180 self
14181 }
14182}
14183
14184impl wkt::message::Message for SecretLocation {
14185 fn typename() -> &'static str {
14186 "type.googleapis.com/grafeas.v1.SecretLocation"
14187 }
14188}
14189
14190/// Defines additional types related to [SecretLocation].
14191pub mod secret_location {
14192 #[allow(unused_imports)]
14193 use super::*;
14194
14195 /// The detailed location of the secret.
14196 #[derive(Clone, Debug, PartialEq)]
14197 #[non_exhaustive]
14198 pub enum Location {
14199 /// The secret is found from a file.
14200 FileLocation(std::boxed::Box<crate::model::FileLocation>),
14201 }
14202}
14203
14204/// The status of the secret with a timestamp.
14205#[derive(Clone, Default, PartialEq)]
14206#[non_exhaustive]
14207pub struct SecretStatus {
14208 /// The status of the secret.
14209 pub status: crate::model::secret_status::Status,
14210
14211 /// The time the secret status was last updated.
14212 pub update_time: std::option::Option<wkt::Timestamp>,
14213
14214 /// Optional message about the status code.
14215 pub message: std::string::String,
14216
14217 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14218}
14219
14220impl SecretStatus {
14221 pub fn new() -> Self {
14222 std::default::Default::default()
14223 }
14224
14225 /// Sets the value of [status][crate::model::SecretStatus::status].
14226 ///
14227 /// # Example
14228 /// ```ignore,no_run
14229 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14230 /// use google_cloud_grafeas_v1::model::secret_status::Status;
14231 /// let x0 = SecretStatus::new().set_status(Status::Unknown);
14232 /// let x1 = SecretStatus::new().set_status(Status::Valid);
14233 /// let x2 = SecretStatus::new().set_status(Status::Invalid);
14234 /// ```
14235 pub fn set_status<T: std::convert::Into<crate::model::secret_status::Status>>(
14236 mut self,
14237 v: T,
14238 ) -> Self {
14239 self.status = v.into();
14240 self
14241 }
14242
14243 /// Sets the value of [update_time][crate::model::SecretStatus::update_time].
14244 ///
14245 /// # Example
14246 /// ```ignore,no_run
14247 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14248 /// use wkt::Timestamp;
14249 /// let x = SecretStatus::new().set_update_time(Timestamp::default()/* use setters */);
14250 /// ```
14251 pub fn set_update_time<T>(mut self, v: T) -> Self
14252 where
14253 T: std::convert::Into<wkt::Timestamp>,
14254 {
14255 self.update_time = std::option::Option::Some(v.into());
14256 self
14257 }
14258
14259 /// Sets or clears the value of [update_time][crate::model::SecretStatus::update_time].
14260 ///
14261 /// # Example
14262 /// ```ignore,no_run
14263 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14264 /// use wkt::Timestamp;
14265 /// let x = SecretStatus::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
14266 /// let x = SecretStatus::new().set_or_clear_update_time(None::<Timestamp>);
14267 /// ```
14268 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
14269 where
14270 T: std::convert::Into<wkt::Timestamp>,
14271 {
14272 self.update_time = v.map(|x| x.into());
14273 self
14274 }
14275
14276 /// Sets the value of [message][crate::model::SecretStatus::message].
14277 ///
14278 /// # Example
14279 /// ```ignore,no_run
14280 /// # use google_cloud_grafeas_v1::model::SecretStatus;
14281 /// let x = SecretStatus::new().set_message("example");
14282 /// ```
14283 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14284 self.message = v.into();
14285 self
14286 }
14287}
14288
14289impl wkt::message::Message for SecretStatus {
14290 fn typename() -> &'static str {
14291 "type.googleapis.com/grafeas.v1.SecretStatus"
14292 }
14293}
14294
14295/// Defines additional types related to [SecretStatus].
14296pub mod secret_status {
14297 #[allow(unused_imports)]
14298 use super::*;
14299
14300 /// The status of the secret.
14301 ///
14302 /// # Working with unknown values
14303 ///
14304 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14305 /// additional enum variants at any time. Adding new variants is not considered
14306 /// a breaking change. Applications should write their code in anticipation of:
14307 ///
14308 /// - New values appearing in future releases of the client library, **and**
14309 /// - New values received dynamically, without application changes.
14310 ///
14311 /// Please consult the [Working with enums] section in the user guide for some
14312 /// guidelines.
14313 ///
14314 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14315 #[derive(Clone, Debug, PartialEq)]
14316 #[non_exhaustive]
14317 pub enum Status {
14318 /// Unspecified
14319 Unspecified,
14320 /// The status of the secret is unknown.
14321 Unknown,
14322 /// The secret is valid.
14323 Valid,
14324 /// The secret is invalid.
14325 Invalid,
14326 /// If set, the enum was initialized with an unknown value.
14327 ///
14328 /// Applications can examine the value using [Status::value] or
14329 /// [Status::name].
14330 UnknownValue(status::UnknownValue),
14331 }
14332
14333 #[doc(hidden)]
14334 pub mod status {
14335 #[allow(unused_imports)]
14336 use super::*;
14337 #[derive(Clone, Debug, PartialEq)]
14338 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14339 }
14340
14341 impl Status {
14342 /// Gets the enum value.
14343 ///
14344 /// Returns `None` if the enum contains an unknown value deserialized from
14345 /// the string representation of enums.
14346 pub fn value(&self) -> std::option::Option<i32> {
14347 match self {
14348 Self::Unspecified => std::option::Option::Some(0),
14349 Self::Unknown => std::option::Option::Some(1),
14350 Self::Valid => std::option::Option::Some(2),
14351 Self::Invalid => std::option::Option::Some(3),
14352 Self::UnknownValue(u) => u.0.value(),
14353 }
14354 }
14355
14356 /// Gets the enum value as a string.
14357 ///
14358 /// Returns `None` if the enum contains an unknown value deserialized from
14359 /// the integer representation of enums.
14360 pub fn name(&self) -> std::option::Option<&str> {
14361 match self {
14362 Self::Unspecified => std::option::Option::Some("STATUS_UNSPECIFIED"),
14363 Self::Unknown => std::option::Option::Some("UNKNOWN"),
14364 Self::Valid => std::option::Option::Some("VALID"),
14365 Self::Invalid => std::option::Option::Some("INVALID"),
14366 Self::UnknownValue(u) => u.0.name(),
14367 }
14368 }
14369 }
14370
14371 impl std::default::Default for Status {
14372 fn default() -> Self {
14373 use std::convert::From;
14374 Self::from(0)
14375 }
14376 }
14377
14378 impl std::fmt::Display for Status {
14379 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14380 wkt::internal::display_enum(f, self.name(), self.value())
14381 }
14382 }
14383
14384 impl std::convert::From<i32> for Status {
14385 fn from(value: i32) -> Self {
14386 match value {
14387 0 => Self::Unspecified,
14388 1 => Self::Unknown,
14389 2 => Self::Valid,
14390 3 => Self::Invalid,
14391 _ => Self::UnknownValue(status::UnknownValue(
14392 wkt::internal::UnknownEnumValue::Integer(value),
14393 )),
14394 }
14395 }
14396 }
14397
14398 impl std::convert::From<&str> for Status {
14399 fn from(value: &str) -> Self {
14400 use std::string::ToString;
14401 match value {
14402 "STATUS_UNSPECIFIED" => Self::Unspecified,
14403 "UNKNOWN" => Self::Unknown,
14404 "VALID" => Self::Valid,
14405 "INVALID" => Self::Invalid,
14406 _ => Self::UnknownValue(status::UnknownValue(
14407 wkt::internal::UnknownEnumValue::String(value.to_string()),
14408 )),
14409 }
14410 }
14411 }
14412
14413 impl serde::ser::Serialize for Status {
14414 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14415 where
14416 S: serde::Serializer,
14417 {
14418 match self {
14419 Self::Unspecified => serializer.serialize_i32(0),
14420 Self::Unknown => serializer.serialize_i32(1),
14421 Self::Valid => serializer.serialize_i32(2),
14422 Self::Invalid => serializer.serialize_i32(3),
14423 Self::UnknownValue(u) => u.0.serialize(serializer),
14424 }
14425 }
14426 }
14427
14428 impl<'de> serde::de::Deserialize<'de> for Status {
14429 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14430 where
14431 D: serde::Deserializer<'de>,
14432 {
14433 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Status>::new(
14434 ".grafeas.v1.SecretStatus.Status",
14435 ))
14436 }
14437 }
14438}
14439
14440#[derive(Clone, Default, PartialEq)]
14441#[non_exhaustive]
14442pub struct SlsaProvenance {
14443 pub builder: std::option::Option<crate::model::slsa_provenance::SlsaBuilder>,
14444
14445 /// Identifies the configuration used for the build.
14446 /// When combined with materials, this SHOULD fully describe the build,
14447 /// such that re-running this recipe results in bit-for-bit identical output
14448 /// (if the build is reproducible).
14449 pub recipe: std::option::Option<crate::model::slsa_provenance::SlsaRecipe>,
14450
14451 pub metadata: std::option::Option<crate::model::slsa_provenance::SlsaMetadata>,
14452
14453 /// The collection of artifacts that influenced the build including sources,
14454 /// dependencies, build tools, base images, and so on. This is considered to be
14455 /// incomplete unless metadata.completeness.materials is true. Unset or null is
14456 /// equivalent to empty.
14457 pub materials: std::vec::Vec<crate::model::slsa_provenance::Material>,
14458
14459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14460}
14461
14462impl SlsaProvenance {
14463 pub fn new() -> Self {
14464 std::default::Default::default()
14465 }
14466
14467 /// Sets the value of [builder][crate::model::SlsaProvenance::builder].
14468 ///
14469 /// # Example
14470 /// ```ignore,no_run
14471 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14472 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaBuilder;
14473 /// let x = SlsaProvenance::new().set_builder(SlsaBuilder::default()/* use setters */);
14474 /// ```
14475 pub fn set_builder<T>(mut self, v: T) -> Self
14476 where
14477 T: std::convert::Into<crate::model::slsa_provenance::SlsaBuilder>,
14478 {
14479 self.builder = std::option::Option::Some(v.into());
14480 self
14481 }
14482
14483 /// Sets or clears the value of [builder][crate::model::SlsaProvenance::builder].
14484 ///
14485 /// # Example
14486 /// ```ignore,no_run
14487 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14488 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaBuilder;
14489 /// let x = SlsaProvenance::new().set_or_clear_builder(Some(SlsaBuilder::default()/* use setters */));
14490 /// let x = SlsaProvenance::new().set_or_clear_builder(None::<SlsaBuilder>);
14491 /// ```
14492 pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
14493 where
14494 T: std::convert::Into<crate::model::slsa_provenance::SlsaBuilder>,
14495 {
14496 self.builder = v.map(|x| x.into());
14497 self
14498 }
14499
14500 /// Sets the value of [recipe][crate::model::SlsaProvenance::recipe].
14501 ///
14502 /// # Example
14503 /// ```ignore,no_run
14504 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14505 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14506 /// let x = SlsaProvenance::new().set_recipe(SlsaRecipe::default()/* use setters */);
14507 /// ```
14508 pub fn set_recipe<T>(mut self, v: T) -> Self
14509 where
14510 T: std::convert::Into<crate::model::slsa_provenance::SlsaRecipe>,
14511 {
14512 self.recipe = std::option::Option::Some(v.into());
14513 self
14514 }
14515
14516 /// Sets or clears the value of [recipe][crate::model::SlsaProvenance::recipe].
14517 ///
14518 /// # Example
14519 /// ```ignore,no_run
14520 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14521 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14522 /// let x = SlsaProvenance::new().set_or_clear_recipe(Some(SlsaRecipe::default()/* use setters */));
14523 /// let x = SlsaProvenance::new().set_or_clear_recipe(None::<SlsaRecipe>);
14524 /// ```
14525 pub fn set_or_clear_recipe<T>(mut self, v: std::option::Option<T>) -> Self
14526 where
14527 T: std::convert::Into<crate::model::slsa_provenance::SlsaRecipe>,
14528 {
14529 self.recipe = v.map(|x| x.into());
14530 self
14531 }
14532
14533 /// Sets the value of [metadata][crate::model::SlsaProvenance::metadata].
14534 ///
14535 /// # Example
14536 /// ```ignore,no_run
14537 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14538 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14539 /// let x = SlsaProvenance::new().set_metadata(SlsaMetadata::default()/* use setters */);
14540 /// ```
14541 pub fn set_metadata<T>(mut self, v: T) -> Self
14542 where
14543 T: std::convert::Into<crate::model::slsa_provenance::SlsaMetadata>,
14544 {
14545 self.metadata = std::option::Option::Some(v.into());
14546 self
14547 }
14548
14549 /// Sets or clears the value of [metadata][crate::model::SlsaProvenance::metadata].
14550 ///
14551 /// # Example
14552 /// ```ignore,no_run
14553 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14554 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14555 /// let x = SlsaProvenance::new().set_or_clear_metadata(Some(SlsaMetadata::default()/* use setters */));
14556 /// let x = SlsaProvenance::new().set_or_clear_metadata(None::<SlsaMetadata>);
14557 /// ```
14558 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14559 where
14560 T: std::convert::Into<crate::model::slsa_provenance::SlsaMetadata>,
14561 {
14562 self.metadata = v.map(|x| x.into());
14563 self
14564 }
14565
14566 /// Sets the value of [materials][crate::model::SlsaProvenance::materials].
14567 ///
14568 /// # Example
14569 /// ```ignore,no_run
14570 /// # use google_cloud_grafeas_v1::model::SlsaProvenance;
14571 /// use google_cloud_grafeas_v1::model::slsa_provenance::Material;
14572 /// let x = SlsaProvenance::new()
14573 /// .set_materials([
14574 /// Material::default()/* use setters */,
14575 /// Material::default()/* use (different) setters */,
14576 /// ]);
14577 /// ```
14578 pub fn set_materials<T, V>(mut self, v: T) -> Self
14579 where
14580 T: std::iter::IntoIterator<Item = V>,
14581 V: std::convert::Into<crate::model::slsa_provenance::Material>,
14582 {
14583 use std::iter::Iterator;
14584 self.materials = v.into_iter().map(|i| i.into()).collect();
14585 self
14586 }
14587}
14588
14589impl wkt::message::Message for SlsaProvenance {
14590 fn typename() -> &'static str {
14591 "type.googleapis.com/grafeas.v1.SlsaProvenance"
14592 }
14593}
14594
14595/// Defines additional types related to [SlsaProvenance].
14596pub mod slsa_provenance {
14597 #[allow(unused_imports)]
14598 use super::*;
14599
14600 /// Steps taken to build the artifact.
14601 /// For a TaskRun, typically each container corresponds to one step in the
14602 /// recipe.
14603 #[derive(Clone, Default, PartialEq)]
14604 #[non_exhaustive]
14605 pub struct SlsaRecipe {
14606 /// URI indicating what type of recipe was performed. It determines the
14607 /// meaning of recipe.entryPoint, recipe.arguments, recipe.environment, and
14608 /// materials.
14609 pub r#type: std::string::String,
14610
14611 /// Index in materials containing the recipe steps that are not implied by
14612 /// recipe.type. For example, if the recipe type were "make", then this would
14613 /// point to the source containing the Makefile, not the make program itself.
14614 /// Set to -1 if the recipe doesn't come from a material, as zero is default
14615 /// unset value for int64.
14616 pub defined_in_material: i64,
14617
14618 /// String identifying the entry point into the build.
14619 /// This is often a path to a configuration file and/or a target label within
14620 /// that file. The syntax and meaning are defined by recipe.type. For
14621 /// example, if the recipe type were "make", then this would reference the
14622 /// directory in which to run make as well as which target to use.
14623 pub entry_point: std::string::String,
14624
14625 /// Collection of all external inputs that influenced the build on top of
14626 /// recipe.definedInMaterial and recipe.entryPoint. For example, if the
14627 /// recipe type were "make", then this might be the flags passed to make
14628 /// aside from the target, which is captured in recipe.entryPoint. Depending
14629 /// on the recipe Type, the structure may be different.
14630 pub arguments: std::option::Option<wkt::Any>,
14631
14632 /// Any other builder-controlled inputs necessary for correctly evaluating
14633 /// the recipe. Usually only needed for reproducing the build but not
14634 /// evaluated as part of policy. Depending on the recipe Type, the structure
14635 /// may be different.
14636 pub environment: std::option::Option<wkt::Any>,
14637
14638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14639 }
14640
14641 impl SlsaRecipe {
14642 pub fn new() -> Self {
14643 std::default::Default::default()
14644 }
14645
14646 /// Sets the value of [r#type][crate::model::slsa_provenance::SlsaRecipe::type].
14647 ///
14648 /// # Example
14649 /// ```ignore,no_run
14650 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14651 /// let x = SlsaRecipe::new().set_type("example");
14652 /// ```
14653 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14654 self.r#type = v.into();
14655 self
14656 }
14657
14658 /// Sets the value of [defined_in_material][crate::model::slsa_provenance::SlsaRecipe::defined_in_material].
14659 ///
14660 /// # Example
14661 /// ```ignore,no_run
14662 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14663 /// let x = SlsaRecipe::new().set_defined_in_material(42);
14664 /// ```
14665 pub fn set_defined_in_material<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14666 self.defined_in_material = v.into();
14667 self
14668 }
14669
14670 /// Sets the value of [entry_point][crate::model::slsa_provenance::SlsaRecipe::entry_point].
14671 ///
14672 /// # Example
14673 /// ```ignore,no_run
14674 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14675 /// let x = SlsaRecipe::new().set_entry_point("example");
14676 /// ```
14677 pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14678 self.entry_point = v.into();
14679 self
14680 }
14681
14682 /// Sets the value of [arguments][crate::model::slsa_provenance::SlsaRecipe::arguments].
14683 ///
14684 /// # Example
14685 /// ```ignore,no_run
14686 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14687 /// use wkt::Any;
14688 /// let x = SlsaRecipe::new().set_arguments(Any::default()/* use setters */);
14689 /// ```
14690 pub fn set_arguments<T>(mut self, v: T) -> Self
14691 where
14692 T: std::convert::Into<wkt::Any>,
14693 {
14694 self.arguments = std::option::Option::Some(v.into());
14695 self
14696 }
14697
14698 /// Sets or clears the value of [arguments][crate::model::slsa_provenance::SlsaRecipe::arguments].
14699 ///
14700 /// # Example
14701 /// ```ignore,no_run
14702 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14703 /// use wkt::Any;
14704 /// let x = SlsaRecipe::new().set_or_clear_arguments(Some(Any::default()/* use setters */));
14705 /// let x = SlsaRecipe::new().set_or_clear_arguments(None::<Any>);
14706 /// ```
14707 pub fn set_or_clear_arguments<T>(mut self, v: std::option::Option<T>) -> Self
14708 where
14709 T: std::convert::Into<wkt::Any>,
14710 {
14711 self.arguments = v.map(|x| x.into());
14712 self
14713 }
14714
14715 /// Sets the value of [environment][crate::model::slsa_provenance::SlsaRecipe::environment].
14716 ///
14717 /// # Example
14718 /// ```ignore,no_run
14719 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14720 /// use wkt::Any;
14721 /// let x = SlsaRecipe::new().set_environment(Any::default()/* use setters */);
14722 /// ```
14723 pub fn set_environment<T>(mut self, v: T) -> Self
14724 where
14725 T: std::convert::Into<wkt::Any>,
14726 {
14727 self.environment = std::option::Option::Some(v.into());
14728 self
14729 }
14730
14731 /// Sets or clears the value of [environment][crate::model::slsa_provenance::SlsaRecipe::environment].
14732 ///
14733 /// # Example
14734 /// ```ignore,no_run
14735 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaRecipe;
14736 /// use wkt::Any;
14737 /// let x = SlsaRecipe::new().set_or_clear_environment(Some(Any::default()/* use setters */));
14738 /// let x = SlsaRecipe::new().set_or_clear_environment(None::<Any>);
14739 /// ```
14740 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
14741 where
14742 T: std::convert::Into<wkt::Any>,
14743 {
14744 self.environment = v.map(|x| x.into());
14745 self
14746 }
14747 }
14748
14749 impl wkt::message::Message for SlsaRecipe {
14750 fn typename() -> &'static str {
14751 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaRecipe"
14752 }
14753 }
14754
14755 /// Indicates that the builder claims certain fields in this message to be
14756 /// complete.
14757 #[derive(Clone, Default, PartialEq)]
14758 #[non_exhaustive]
14759 pub struct SlsaCompleteness {
14760 /// If true, the builder claims that recipe.arguments is complete, meaning
14761 /// that all external inputs are properly captured in the recipe.
14762 pub arguments: bool,
14763
14764 /// If true, the builder claims that recipe.environment is claimed to be
14765 /// complete.
14766 pub environment: bool,
14767
14768 /// If true, the builder claims that materials are complete, usually through
14769 /// some controls to prevent network access. Sometimes called "hermetic".
14770 pub materials: bool,
14771
14772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14773 }
14774
14775 impl SlsaCompleteness {
14776 pub fn new() -> Self {
14777 std::default::Default::default()
14778 }
14779
14780 /// Sets the value of [arguments][crate::model::slsa_provenance::SlsaCompleteness::arguments].
14781 ///
14782 /// # Example
14783 /// ```ignore,no_run
14784 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14785 /// let x = SlsaCompleteness::new().set_arguments(true);
14786 /// ```
14787 pub fn set_arguments<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14788 self.arguments = v.into();
14789 self
14790 }
14791
14792 /// Sets the value of [environment][crate::model::slsa_provenance::SlsaCompleteness::environment].
14793 ///
14794 /// # Example
14795 /// ```ignore,no_run
14796 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14797 /// let x = SlsaCompleteness::new().set_environment(true);
14798 /// ```
14799 pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14800 self.environment = v.into();
14801 self
14802 }
14803
14804 /// Sets the value of [materials][crate::model::slsa_provenance::SlsaCompleteness::materials].
14805 ///
14806 /// # Example
14807 /// ```ignore,no_run
14808 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14809 /// let x = SlsaCompleteness::new().set_materials(true);
14810 /// ```
14811 pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14812 self.materials = v.into();
14813 self
14814 }
14815 }
14816
14817 impl wkt::message::Message for SlsaCompleteness {
14818 fn typename() -> &'static str {
14819 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaCompleteness"
14820 }
14821 }
14822
14823 /// Other properties of the build.
14824 #[derive(Clone, Default, PartialEq)]
14825 #[non_exhaustive]
14826 pub struct SlsaMetadata {
14827 /// Identifies the particular build invocation, which can be useful for
14828 /// finding associated logs or other ad-hoc analysis. The value SHOULD be
14829 /// globally unique, per in-toto Provenance spec.
14830 pub build_invocation_id: std::string::String,
14831
14832 /// The timestamp of when the build started.
14833 pub build_started_on: std::option::Option<wkt::Timestamp>,
14834
14835 /// The timestamp of when the build completed.
14836 pub build_finished_on: std::option::Option<wkt::Timestamp>,
14837
14838 /// Indicates that the builder claims certain fields in this message to be
14839 /// complete.
14840 pub completeness: std::option::Option<crate::model::slsa_provenance::SlsaCompleteness>,
14841
14842 /// If true, the builder claims that running the recipe on materials will
14843 /// produce bit-for-bit identical output.
14844 pub reproducible: bool,
14845
14846 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14847 }
14848
14849 impl SlsaMetadata {
14850 pub fn new() -> Self {
14851 std::default::Default::default()
14852 }
14853
14854 /// Sets the value of [build_invocation_id][crate::model::slsa_provenance::SlsaMetadata::build_invocation_id].
14855 ///
14856 /// # Example
14857 /// ```ignore,no_run
14858 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14859 /// let x = SlsaMetadata::new().set_build_invocation_id("example");
14860 /// ```
14861 pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
14862 mut self,
14863 v: T,
14864 ) -> Self {
14865 self.build_invocation_id = v.into();
14866 self
14867 }
14868
14869 /// Sets the value of [build_started_on][crate::model::slsa_provenance::SlsaMetadata::build_started_on].
14870 ///
14871 /// # Example
14872 /// ```ignore,no_run
14873 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14874 /// use wkt::Timestamp;
14875 /// let x = SlsaMetadata::new().set_build_started_on(Timestamp::default()/* use setters */);
14876 /// ```
14877 pub fn set_build_started_on<T>(mut self, v: T) -> Self
14878 where
14879 T: std::convert::Into<wkt::Timestamp>,
14880 {
14881 self.build_started_on = std::option::Option::Some(v.into());
14882 self
14883 }
14884
14885 /// Sets or clears the value of [build_started_on][crate::model::slsa_provenance::SlsaMetadata::build_started_on].
14886 ///
14887 /// # Example
14888 /// ```ignore,no_run
14889 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14890 /// use wkt::Timestamp;
14891 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(Some(Timestamp::default()/* use setters */));
14892 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(None::<Timestamp>);
14893 /// ```
14894 pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
14895 where
14896 T: std::convert::Into<wkt::Timestamp>,
14897 {
14898 self.build_started_on = v.map(|x| x.into());
14899 self
14900 }
14901
14902 /// Sets the value of [build_finished_on][crate::model::slsa_provenance::SlsaMetadata::build_finished_on].
14903 ///
14904 /// # Example
14905 /// ```ignore,no_run
14906 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14907 /// use wkt::Timestamp;
14908 /// let x = SlsaMetadata::new().set_build_finished_on(Timestamp::default()/* use setters */);
14909 /// ```
14910 pub fn set_build_finished_on<T>(mut self, v: T) -> Self
14911 where
14912 T: std::convert::Into<wkt::Timestamp>,
14913 {
14914 self.build_finished_on = std::option::Option::Some(v.into());
14915 self
14916 }
14917
14918 /// Sets or clears the value of [build_finished_on][crate::model::slsa_provenance::SlsaMetadata::build_finished_on].
14919 ///
14920 /// # Example
14921 /// ```ignore,no_run
14922 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14923 /// use wkt::Timestamp;
14924 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(Some(Timestamp::default()/* use setters */));
14925 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(None::<Timestamp>);
14926 /// ```
14927 pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
14928 where
14929 T: std::convert::Into<wkt::Timestamp>,
14930 {
14931 self.build_finished_on = v.map(|x| x.into());
14932 self
14933 }
14934
14935 /// Sets the value of [completeness][crate::model::slsa_provenance::SlsaMetadata::completeness].
14936 ///
14937 /// # Example
14938 /// ```ignore,no_run
14939 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14940 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14941 /// let x = SlsaMetadata::new().set_completeness(SlsaCompleteness::default()/* use setters */);
14942 /// ```
14943 pub fn set_completeness<T>(mut self, v: T) -> Self
14944 where
14945 T: std::convert::Into<crate::model::slsa_provenance::SlsaCompleteness>,
14946 {
14947 self.completeness = std::option::Option::Some(v.into());
14948 self
14949 }
14950
14951 /// Sets or clears the value of [completeness][crate::model::slsa_provenance::SlsaMetadata::completeness].
14952 ///
14953 /// # Example
14954 /// ```ignore,no_run
14955 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14956 /// use google_cloud_grafeas_v1::model::slsa_provenance::SlsaCompleteness;
14957 /// let x = SlsaMetadata::new().set_or_clear_completeness(Some(SlsaCompleteness::default()/* use setters */));
14958 /// let x = SlsaMetadata::new().set_or_clear_completeness(None::<SlsaCompleteness>);
14959 /// ```
14960 pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
14961 where
14962 T: std::convert::Into<crate::model::slsa_provenance::SlsaCompleteness>,
14963 {
14964 self.completeness = v.map(|x| x.into());
14965 self
14966 }
14967
14968 /// Sets the value of [reproducible][crate::model::slsa_provenance::SlsaMetadata::reproducible].
14969 ///
14970 /// # Example
14971 /// ```ignore,no_run
14972 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaMetadata;
14973 /// let x = SlsaMetadata::new().set_reproducible(true);
14974 /// ```
14975 pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14976 self.reproducible = v.into();
14977 self
14978 }
14979 }
14980
14981 impl wkt::message::Message for SlsaMetadata {
14982 fn typename() -> &'static str {
14983 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaMetadata"
14984 }
14985 }
14986
14987 #[derive(Clone, Default, PartialEq)]
14988 #[non_exhaustive]
14989 pub struct SlsaBuilder {
14990 pub id: std::string::String,
14991
14992 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14993 }
14994
14995 impl SlsaBuilder {
14996 pub fn new() -> Self {
14997 std::default::Default::default()
14998 }
14999
15000 /// Sets the value of [id][crate::model::slsa_provenance::SlsaBuilder::id].
15001 ///
15002 /// # Example
15003 /// ```ignore,no_run
15004 /// # use google_cloud_grafeas_v1::model::slsa_provenance::SlsaBuilder;
15005 /// let x = SlsaBuilder::new().set_id("example");
15006 /// ```
15007 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15008 self.id = v.into();
15009 self
15010 }
15011 }
15012
15013 impl wkt::message::Message for SlsaBuilder {
15014 fn typename() -> &'static str {
15015 "type.googleapis.com/grafeas.v1.SlsaProvenance.SlsaBuilder"
15016 }
15017 }
15018
15019 #[derive(Clone, Default, PartialEq)]
15020 #[non_exhaustive]
15021 pub struct Material {
15022 pub uri: std::string::String,
15023
15024 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
15025
15026 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15027 }
15028
15029 impl Material {
15030 pub fn new() -> Self {
15031 std::default::Default::default()
15032 }
15033
15034 /// Sets the value of [uri][crate::model::slsa_provenance::Material::uri].
15035 ///
15036 /// # Example
15037 /// ```ignore,no_run
15038 /// # use google_cloud_grafeas_v1::model::slsa_provenance::Material;
15039 /// let x = Material::new().set_uri("example");
15040 /// ```
15041 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15042 self.uri = v.into();
15043 self
15044 }
15045
15046 /// Sets the value of [digest][crate::model::slsa_provenance::Material::digest].
15047 ///
15048 /// # Example
15049 /// ```ignore,no_run
15050 /// # use google_cloud_grafeas_v1::model::slsa_provenance::Material;
15051 /// let x = Material::new().set_digest([
15052 /// ("key0", "abc"),
15053 /// ("key1", "xyz"),
15054 /// ]);
15055 /// ```
15056 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
15057 where
15058 T: std::iter::IntoIterator<Item = (K, V)>,
15059 K: std::convert::Into<std::string::String>,
15060 V: std::convert::Into<std::string::String>,
15061 {
15062 use std::iter::Iterator;
15063 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15064 self
15065 }
15066 }
15067
15068 impl wkt::message::Message for Material {
15069 fn typename() -> &'static str {
15070 "type.googleapis.com/grafeas.v1.SlsaProvenance.Material"
15071 }
15072 }
15073}
15074
15075#[derive(Clone, Default, PartialEq)]
15076#[non_exhaustive]
15077pub struct SlsaProvenanceZeroTwo {
15078 pub builder: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
15079
15080 pub build_type: std::string::String,
15081
15082 pub invocation: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
15083
15084 pub build_config: std::option::Option<wkt::Struct>,
15085
15086 pub metadata: std::option::Option<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
15087
15088 pub materials: std::vec::Vec<crate::model::slsa_provenance_zero_two::SlsaMaterial>,
15089
15090 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15091}
15092
15093impl SlsaProvenanceZeroTwo {
15094 pub fn new() -> Self {
15095 std::default::Default::default()
15096 }
15097
15098 /// Sets the value of [builder][crate::model::SlsaProvenanceZeroTwo::builder].
15099 ///
15100 /// # Example
15101 /// ```ignore,no_run
15102 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15103 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaBuilder;
15104 /// let x = SlsaProvenanceZeroTwo::new().set_builder(SlsaBuilder::default()/* use setters */);
15105 /// ```
15106 pub fn set_builder<T>(mut self, v: T) -> Self
15107 where
15108 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
15109 {
15110 self.builder = std::option::Option::Some(v.into());
15111 self
15112 }
15113
15114 /// Sets or clears the value of [builder][crate::model::SlsaProvenanceZeroTwo::builder].
15115 ///
15116 /// # Example
15117 /// ```ignore,no_run
15118 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15119 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaBuilder;
15120 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_builder(Some(SlsaBuilder::default()/* use setters */));
15121 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_builder(None::<SlsaBuilder>);
15122 /// ```
15123 pub fn set_or_clear_builder<T>(mut self, v: std::option::Option<T>) -> Self
15124 where
15125 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaBuilder>,
15126 {
15127 self.builder = v.map(|x| x.into());
15128 self
15129 }
15130
15131 /// Sets the value of [build_type][crate::model::SlsaProvenanceZeroTwo::build_type].
15132 ///
15133 /// # Example
15134 /// ```ignore,no_run
15135 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15136 /// let x = SlsaProvenanceZeroTwo::new().set_build_type("example");
15137 /// ```
15138 pub fn set_build_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15139 self.build_type = v.into();
15140 self
15141 }
15142
15143 /// Sets the value of [invocation][crate::model::SlsaProvenanceZeroTwo::invocation].
15144 ///
15145 /// # Example
15146 /// ```ignore,no_run
15147 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15148 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15149 /// let x = SlsaProvenanceZeroTwo::new().set_invocation(SlsaInvocation::default()/* use setters */);
15150 /// ```
15151 pub fn set_invocation<T>(mut self, v: T) -> Self
15152 where
15153 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
15154 {
15155 self.invocation = std::option::Option::Some(v.into());
15156 self
15157 }
15158
15159 /// Sets or clears the value of [invocation][crate::model::SlsaProvenanceZeroTwo::invocation].
15160 ///
15161 /// # Example
15162 /// ```ignore,no_run
15163 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15164 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15165 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_invocation(Some(SlsaInvocation::default()/* use setters */));
15166 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_invocation(None::<SlsaInvocation>);
15167 /// ```
15168 pub fn set_or_clear_invocation<T>(mut self, v: std::option::Option<T>) -> Self
15169 where
15170 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaInvocation>,
15171 {
15172 self.invocation = v.map(|x| x.into());
15173 self
15174 }
15175
15176 /// Sets the value of [build_config][crate::model::SlsaProvenanceZeroTwo::build_config].
15177 ///
15178 /// # Example
15179 /// ```ignore,no_run
15180 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15181 /// use wkt::Struct;
15182 /// let x = SlsaProvenanceZeroTwo::new().set_build_config(Struct::default()/* use setters */);
15183 /// ```
15184 pub fn set_build_config<T>(mut self, v: T) -> Self
15185 where
15186 T: std::convert::Into<wkt::Struct>,
15187 {
15188 self.build_config = std::option::Option::Some(v.into());
15189 self
15190 }
15191
15192 /// Sets or clears the value of [build_config][crate::model::SlsaProvenanceZeroTwo::build_config].
15193 ///
15194 /// # Example
15195 /// ```ignore,no_run
15196 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15197 /// use wkt::Struct;
15198 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_build_config(Some(Struct::default()/* use setters */));
15199 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_build_config(None::<Struct>);
15200 /// ```
15201 pub fn set_or_clear_build_config<T>(mut self, v: std::option::Option<T>) -> Self
15202 where
15203 T: std::convert::Into<wkt::Struct>,
15204 {
15205 self.build_config = v.map(|x| x.into());
15206 self
15207 }
15208
15209 /// Sets the value of [metadata][crate::model::SlsaProvenanceZeroTwo::metadata].
15210 ///
15211 /// # Example
15212 /// ```ignore,no_run
15213 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15214 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15215 /// let x = SlsaProvenanceZeroTwo::new().set_metadata(SlsaMetadata::default()/* use setters */);
15216 /// ```
15217 pub fn set_metadata<T>(mut self, v: T) -> Self
15218 where
15219 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
15220 {
15221 self.metadata = std::option::Option::Some(v.into());
15222 self
15223 }
15224
15225 /// Sets or clears the value of [metadata][crate::model::SlsaProvenanceZeroTwo::metadata].
15226 ///
15227 /// # Example
15228 /// ```ignore,no_run
15229 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15230 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15231 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_metadata(Some(SlsaMetadata::default()/* use setters */));
15232 /// let x = SlsaProvenanceZeroTwo::new().set_or_clear_metadata(None::<SlsaMetadata>);
15233 /// ```
15234 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15235 where
15236 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMetadata>,
15237 {
15238 self.metadata = v.map(|x| x.into());
15239 self
15240 }
15241
15242 /// Sets the value of [materials][crate::model::SlsaProvenanceZeroTwo::materials].
15243 ///
15244 /// # Example
15245 /// ```ignore,no_run
15246 /// # use google_cloud_grafeas_v1::model::SlsaProvenanceZeroTwo;
15247 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMaterial;
15248 /// let x = SlsaProvenanceZeroTwo::new()
15249 /// .set_materials([
15250 /// SlsaMaterial::default()/* use setters */,
15251 /// SlsaMaterial::default()/* use (different) setters */,
15252 /// ]);
15253 /// ```
15254 pub fn set_materials<T, V>(mut self, v: T) -> Self
15255 where
15256 T: std::iter::IntoIterator<Item = V>,
15257 V: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaMaterial>,
15258 {
15259 use std::iter::Iterator;
15260 self.materials = v.into_iter().map(|i| i.into()).collect();
15261 self
15262 }
15263}
15264
15265impl wkt::message::Message for SlsaProvenanceZeroTwo {
15266 fn typename() -> &'static str {
15267 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo"
15268 }
15269}
15270
15271/// Defines additional types related to [SlsaProvenanceZeroTwo].
15272pub mod slsa_provenance_zero_two {
15273 #[allow(unused_imports)]
15274 use super::*;
15275
15276 /// Identifies the entity that executed the recipe, which is trusted to have
15277 /// correctly performed the operation and populated this provenance.
15278 #[derive(Clone, Default, PartialEq)]
15279 #[non_exhaustive]
15280 pub struct SlsaBuilder {
15281 pub id: std::string::String,
15282
15283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15284 }
15285
15286 impl SlsaBuilder {
15287 pub fn new() -> Self {
15288 std::default::Default::default()
15289 }
15290
15291 /// Sets the value of [id][crate::model::slsa_provenance_zero_two::SlsaBuilder::id].
15292 ///
15293 /// # Example
15294 /// ```ignore,no_run
15295 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaBuilder;
15296 /// let x = SlsaBuilder::new().set_id("example");
15297 /// ```
15298 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15299 self.id = v.into();
15300 self
15301 }
15302 }
15303
15304 impl wkt::message::Message for SlsaBuilder {
15305 fn typename() -> &'static str {
15306 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaBuilder"
15307 }
15308 }
15309
15310 /// The collection of artifacts that influenced the build including sources,
15311 /// dependencies, build tools, base images, and so on.
15312 #[derive(Clone, Default, PartialEq)]
15313 #[non_exhaustive]
15314 pub struct SlsaMaterial {
15315 pub uri: std::string::String,
15316
15317 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
15318
15319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15320 }
15321
15322 impl SlsaMaterial {
15323 pub fn new() -> Self {
15324 std::default::Default::default()
15325 }
15326
15327 /// Sets the value of [uri][crate::model::slsa_provenance_zero_two::SlsaMaterial::uri].
15328 ///
15329 /// # Example
15330 /// ```ignore,no_run
15331 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMaterial;
15332 /// let x = SlsaMaterial::new().set_uri("example");
15333 /// ```
15334 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15335 self.uri = v.into();
15336 self
15337 }
15338
15339 /// Sets the value of [digest][crate::model::slsa_provenance_zero_two::SlsaMaterial::digest].
15340 ///
15341 /// # Example
15342 /// ```ignore,no_run
15343 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMaterial;
15344 /// let x = SlsaMaterial::new().set_digest([
15345 /// ("key0", "abc"),
15346 /// ("key1", "xyz"),
15347 /// ]);
15348 /// ```
15349 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
15350 where
15351 T: std::iter::IntoIterator<Item = (K, V)>,
15352 K: std::convert::Into<std::string::String>,
15353 V: std::convert::Into<std::string::String>,
15354 {
15355 use std::iter::Iterator;
15356 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15357 self
15358 }
15359 }
15360
15361 impl wkt::message::Message for SlsaMaterial {
15362 fn typename() -> &'static str {
15363 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaMaterial"
15364 }
15365 }
15366
15367 /// Identifies the event that kicked off the build.
15368 #[derive(Clone, Default, PartialEq)]
15369 #[non_exhaustive]
15370 pub struct SlsaInvocation {
15371 pub config_source:
15372 std::option::Option<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
15373
15374 pub parameters: std::option::Option<wkt::Struct>,
15375
15376 pub environment: std::option::Option<wkt::Struct>,
15377
15378 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15379 }
15380
15381 impl SlsaInvocation {
15382 pub fn new() -> Self {
15383 std::default::Default::default()
15384 }
15385
15386 /// Sets the value of [config_source][crate::model::slsa_provenance_zero_two::SlsaInvocation::config_source].
15387 ///
15388 /// # Example
15389 /// ```ignore,no_run
15390 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15391 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15392 /// let x = SlsaInvocation::new().set_config_source(SlsaConfigSource::default()/* use setters */);
15393 /// ```
15394 pub fn set_config_source<T>(mut self, v: T) -> Self
15395 where
15396 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
15397 {
15398 self.config_source = std::option::Option::Some(v.into());
15399 self
15400 }
15401
15402 /// Sets or clears the value of [config_source][crate::model::slsa_provenance_zero_two::SlsaInvocation::config_source].
15403 ///
15404 /// # Example
15405 /// ```ignore,no_run
15406 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15407 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15408 /// let x = SlsaInvocation::new().set_or_clear_config_source(Some(SlsaConfigSource::default()/* use setters */));
15409 /// let x = SlsaInvocation::new().set_or_clear_config_source(None::<SlsaConfigSource>);
15410 /// ```
15411 pub fn set_or_clear_config_source<T>(mut self, v: std::option::Option<T>) -> Self
15412 where
15413 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaConfigSource>,
15414 {
15415 self.config_source = v.map(|x| x.into());
15416 self
15417 }
15418
15419 /// Sets the value of [parameters][crate::model::slsa_provenance_zero_two::SlsaInvocation::parameters].
15420 ///
15421 /// # Example
15422 /// ```ignore,no_run
15423 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15424 /// use wkt::Struct;
15425 /// let x = SlsaInvocation::new().set_parameters(Struct::default()/* use setters */);
15426 /// ```
15427 pub fn set_parameters<T>(mut self, v: T) -> Self
15428 where
15429 T: std::convert::Into<wkt::Struct>,
15430 {
15431 self.parameters = std::option::Option::Some(v.into());
15432 self
15433 }
15434
15435 /// Sets or clears the value of [parameters][crate::model::slsa_provenance_zero_two::SlsaInvocation::parameters].
15436 ///
15437 /// # Example
15438 /// ```ignore,no_run
15439 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15440 /// use wkt::Struct;
15441 /// let x = SlsaInvocation::new().set_or_clear_parameters(Some(Struct::default()/* use setters */));
15442 /// let x = SlsaInvocation::new().set_or_clear_parameters(None::<Struct>);
15443 /// ```
15444 pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
15445 where
15446 T: std::convert::Into<wkt::Struct>,
15447 {
15448 self.parameters = v.map(|x| x.into());
15449 self
15450 }
15451
15452 /// Sets the value of [environment][crate::model::slsa_provenance_zero_two::SlsaInvocation::environment].
15453 ///
15454 /// # Example
15455 /// ```ignore,no_run
15456 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15457 /// use wkt::Struct;
15458 /// let x = SlsaInvocation::new().set_environment(Struct::default()/* use setters */);
15459 /// ```
15460 pub fn set_environment<T>(mut self, v: T) -> Self
15461 where
15462 T: std::convert::Into<wkt::Struct>,
15463 {
15464 self.environment = std::option::Option::Some(v.into());
15465 self
15466 }
15467
15468 /// Sets or clears the value of [environment][crate::model::slsa_provenance_zero_two::SlsaInvocation::environment].
15469 ///
15470 /// # Example
15471 /// ```ignore,no_run
15472 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaInvocation;
15473 /// use wkt::Struct;
15474 /// let x = SlsaInvocation::new().set_or_clear_environment(Some(Struct::default()/* use setters */));
15475 /// let x = SlsaInvocation::new().set_or_clear_environment(None::<Struct>);
15476 /// ```
15477 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
15478 where
15479 T: std::convert::Into<wkt::Struct>,
15480 {
15481 self.environment = v.map(|x| x.into());
15482 self
15483 }
15484 }
15485
15486 impl wkt::message::Message for SlsaInvocation {
15487 fn typename() -> &'static str {
15488 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaInvocation"
15489 }
15490 }
15491
15492 /// Describes where the config file that kicked off the build came from.
15493 /// This is effectively a pointer to the source where buildConfig came from.
15494 #[derive(Clone, Default, PartialEq)]
15495 #[non_exhaustive]
15496 pub struct SlsaConfigSource {
15497 pub uri: std::string::String,
15498
15499 pub digest: std::collections::HashMap<std::string::String, std::string::String>,
15500
15501 pub entry_point: std::string::String,
15502
15503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15504 }
15505
15506 impl SlsaConfigSource {
15507 pub fn new() -> Self {
15508 std::default::Default::default()
15509 }
15510
15511 /// Sets the value of [uri][crate::model::slsa_provenance_zero_two::SlsaConfigSource::uri].
15512 ///
15513 /// # Example
15514 /// ```ignore,no_run
15515 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15516 /// let x = SlsaConfigSource::new().set_uri("example");
15517 /// ```
15518 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15519 self.uri = v.into();
15520 self
15521 }
15522
15523 /// Sets the value of [digest][crate::model::slsa_provenance_zero_two::SlsaConfigSource::digest].
15524 ///
15525 /// # Example
15526 /// ```ignore,no_run
15527 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15528 /// let x = SlsaConfigSource::new().set_digest([
15529 /// ("key0", "abc"),
15530 /// ("key1", "xyz"),
15531 /// ]);
15532 /// ```
15533 pub fn set_digest<T, K, V>(mut self, v: T) -> Self
15534 where
15535 T: std::iter::IntoIterator<Item = (K, V)>,
15536 K: std::convert::Into<std::string::String>,
15537 V: std::convert::Into<std::string::String>,
15538 {
15539 use std::iter::Iterator;
15540 self.digest = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15541 self
15542 }
15543
15544 /// Sets the value of [entry_point][crate::model::slsa_provenance_zero_two::SlsaConfigSource::entry_point].
15545 ///
15546 /// # Example
15547 /// ```ignore,no_run
15548 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaConfigSource;
15549 /// let x = SlsaConfigSource::new().set_entry_point("example");
15550 /// ```
15551 pub fn set_entry_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15552 self.entry_point = v.into();
15553 self
15554 }
15555 }
15556
15557 impl wkt::message::Message for SlsaConfigSource {
15558 fn typename() -> &'static str {
15559 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaConfigSource"
15560 }
15561 }
15562
15563 /// Other properties of the build.
15564 #[derive(Clone, Default, PartialEq)]
15565 #[non_exhaustive]
15566 pub struct SlsaMetadata {
15567 pub build_invocation_id: std::string::String,
15568
15569 pub build_started_on: std::option::Option<wkt::Timestamp>,
15570
15571 pub build_finished_on: std::option::Option<wkt::Timestamp>,
15572
15573 pub completeness:
15574 std::option::Option<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
15575
15576 pub reproducible: bool,
15577
15578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15579 }
15580
15581 impl SlsaMetadata {
15582 pub fn new() -> Self {
15583 std::default::Default::default()
15584 }
15585
15586 /// Sets the value of [build_invocation_id][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_invocation_id].
15587 ///
15588 /// # Example
15589 /// ```ignore,no_run
15590 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15591 /// let x = SlsaMetadata::new().set_build_invocation_id("example");
15592 /// ```
15593 pub fn set_build_invocation_id<T: std::convert::Into<std::string::String>>(
15594 mut self,
15595 v: T,
15596 ) -> Self {
15597 self.build_invocation_id = v.into();
15598 self
15599 }
15600
15601 /// Sets the value of [build_started_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_started_on].
15602 ///
15603 /// # Example
15604 /// ```ignore,no_run
15605 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15606 /// use wkt::Timestamp;
15607 /// let x = SlsaMetadata::new().set_build_started_on(Timestamp::default()/* use setters */);
15608 /// ```
15609 pub fn set_build_started_on<T>(mut self, v: T) -> Self
15610 where
15611 T: std::convert::Into<wkt::Timestamp>,
15612 {
15613 self.build_started_on = std::option::Option::Some(v.into());
15614 self
15615 }
15616
15617 /// Sets or clears the value of [build_started_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_started_on].
15618 ///
15619 /// # Example
15620 /// ```ignore,no_run
15621 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15622 /// use wkt::Timestamp;
15623 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(Some(Timestamp::default()/* use setters */));
15624 /// let x = SlsaMetadata::new().set_or_clear_build_started_on(None::<Timestamp>);
15625 /// ```
15626 pub fn set_or_clear_build_started_on<T>(mut self, v: std::option::Option<T>) -> Self
15627 where
15628 T: std::convert::Into<wkt::Timestamp>,
15629 {
15630 self.build_started_on = v.map(|x| x.into());
15631 self
15632 }
15633
15634 /// Sets the value of [build_finished_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_finished_on].
15635 ///
15636 /// # Example
15637 /// ```ignore,no_run
15638 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15639 /// use wkt::Timestamp;
15640 /// let x = SlsaMetadata::new().set_build_finished_on(Timestamp::default()/* use setters */);
15641 /// ```
15642 pub fn set_build_finished_on<T>(mut self, v: T) -> Self
15643 where
15644 T: std::convert::Into<wkt::Timestamp>,
15645 {
15646 self.build_finished_on = std::option::Option::Some(v.into());
15647 self
15648 }
15649
15650 /// Sets or clears the value of [build_finished_on][crate::model::slsa_provenance_zero_two::SlsaMetadata::build_finished_on].
15651 ///
15652 /// # Example
15653 /// ```ignore,no_run
15654 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15655 /// use wkt::Timestamp;
15656 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(Some(Timestamp::default()/* use setters */));
15657 /// let x = SlsaMetadata::new().set_or_clear_build_finished_on(None::<Timestamp>);
15658 /// ```
15659 pub fn set_or_clear_build_finished_on<T>(mut self, v: std::option::Option<T>) -> Self
15660 where
15661 T: std::convert::Into<wkt::Timestamp>,
15662 {
15663 self.build_finished_on = v.map(|x| x.into());
15664 self
15665 }
15666
15667 /// Sets the value of [completeness][crate::model::slsa_provenance_zero_two::SlsaMetadata::completeness].
15668 ///
15669 /// # Example
15670 /// ```ignore,no_run
15671 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15672 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15673 /// let x = SlsaMetadata::new().set_completeness(SlsaCompleteness::default()/* use setters */);
15674 /// ```
15675 pub fn set_completeness<T>(mut self, v: T) -> Self
15676 where
15677 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
15678 {
15679 self.completeness = std::option::Option::Some(v.into());
15680 self
15681 }
15682
15683 /// Sets or clears the value of [completeness][crate::model::slsa_provenance_zero_two::SlsaMetadata::completeness].
15684 ///
15685 /// # Example
15686 /// ```ignore,no_run
15687 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15688 /// use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15689 /// let x = SlsaMetadata::new().set_or_clear_completeness(Some(SlsaCompleteness::default()/* use setters */));
15690 /// let x = SlsaMetadata::new().set_or_clear_completeness(None::<SlsaCompleteness>);
15691 /// ```
15692 pub fn set_or_clear_completeness<T>(mut self, v: std::option::Option<T>) -> Self
15693 where
15694 T: std::convert::Into<crate::model::slsa_provenance_zero_two::SlsaCompleteness>,
15695 {
15696 self.completeness = v.map(|x| x.into());
15697 self
15698 }
15699
15700 /// Sets the value of [reproducible][crate::model::slsa_provenance_zero_two::SlsaMetadata::reproducible].
15701 ///
15702 /// # Example
15703 /// ```ignore,no_run
15704 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaMetadata;
15705 /// let x = SlsaMetadata::new().set_reproducible(true);
15706 /// ```
15707 pub fn set_reproducible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15708 self.reproducible = v.into();
15709 self
15710 }
15711 }
15712
15713 impl wkt::message::Message for SlsaMetadata {
15714 fn typename() -> &'static str {
15715 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaMetadata"
15716 }
15717 }
15718
15719 /// Indicates that the builder claims certain fields in this message to be
15720 /// complete.
15721 #[derive(Clone, Default, PartialEq)]
15722 #[non_exhaustive]
15723 pub struct SlsaCompleteness {
15724 pub parameters: bool,
15725
15726 pub environment: bool,
15727
15728 pub materials: bool,
15729
15730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15731 }
15732
15733 impl SlsaCompleteness {
15734 pub fn new() -> Self {
15735 std::default::Default::default()
15736 }
15737
15738 /// Sets the value of [parameters][crate::model::slsa_provenance_zero_two::SlsaCompleteness::parameters].
15739 ///
15740 /// # Example
15741 /// ```ignore,no_run
15742 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15743 /// let x = SlsaCompleteness::new().set_parameters(true);
15744 /// ```
15745 pub fn set_parameters<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15746 self.parameters = v.into();
15747 self
15748 }
15749
15750 /// Sets the value of [environment][crate::model::slsa_provenance_zero_two::SlsaCompleteness::environment].
15751 ///
15752 /// # Example
15753 /// ```ignore,no_run
15754 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15755 /// let x = SlsaCompleteness::new().set_environment(true);
15756 /// ```
15757 pub fn set_environment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15758 self.environment = v.into();
15759 self
15760 }
15761
15762 /// Sets the value of [materials][crate::model::slsa_provenance_zero_two::SlsaCompleteness::materials].
15763 ///
15764 /// # Example
15765 /// ```ignore,no_run
15766 /// # use google_cloud_grafeas_v1::model::slsa_provenance_zero_two::SlsaCompleteness;
15767 /// let x = SlsaCompleteness::new().set_materials(true);
15768 /// ```
15769 pub fn set_materials<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15770 self.materials = v.into();
15771 self
15772 }
15773 }
15774
15775 impl wkt::message::Message for SlsaCompleteness {
15776 fn typename() -> &'static str {
15777 "type.googleapis.com/grafeas.v1.SlsaProvenanceZeroTwo.SlsaCompleteness"
15778 }
15779 }
15780}
15781
15782/// An Upgrade Note represents a potential upgrade of a package to a given
15783/// version. For each package version combination (i.e. bash 4.0, bash 4.1,
15784/// bash 4.1.2), there will be an Upgrade Note. For Windows, windows_update field
15785/// represents the information related to the update.
15786#[derive(Clone, Default, PartialEq)]
15787#[non_exhaustive]
15788pub struct UpgradeNote {
15789 /// Required for non-Windows OS. The package this Upgrade is for.
15790 pub package: std::string::String,
15791
15792 /// Required for non-Windows OS. The version of the package in machine + human
15793 /// readable form.
15794 pub version: std::option::Option<crate::model::Version>,
15795
15796 /// Metadata about the upgrade for each specific operating system.
15797 pub distributions: std::vec::Vec<crate::model::UpgradeDistribution>,
15798
15799 /// Required for Windows OS. Represents the metadata about the Windows update.
15800 pub windows_update: std::option::Option<crate::model::WindowsUpdate>,
15801
15802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15803}
15804
15805impl UpgradeNote {
15806 pub fn new() -> Self {
15807 std::default::Default::default()
15808 }
15809
15810 /// Sets the value of [package][crate::model::UpgradeNote::package].
15811 ///
15812 /// # Example
15813 /// ```ignore,no_run
15814 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15815 /// let x = UpgradeNote::new().set_package("example");
15816 /// ```
15817 pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15818 self.package = v.into();
15819 self
15820 }
15821
15822 /// Sets the value of [version][crate::model::UpgradeNote::version].
15823 ///
15824 /// # Example
15825 /// ```ignore,no_run
15826 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15827 /// use google_cloud_grafeas_v1::model::Version;
15828 /// let x = UpgradeNote::new().set_version(Version::default()/* use setters */);
15829 /// ```
15830 pub fn set_version<T>(mut self, v: T) -> Self
15831 where
15832 T: std::convert::Into<crate::model::Version>,
15833 {
15834 self.version = std::option::Option::Some(v.into());
15835 self
15836 }
15837
15838 /// Sets or clears the value of [version][crate::model::UpgradeNote::version].
15839 ///
15840 /// # Example
15841 /// ```ignore,no_run
15842 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15843 /// use google_cloud_grafeas_v1::model::Version;
15844 /// let x = UpgradeNote::new().set_or_clear_version(Some(Version::default()/* use setters */));
15845 /// let x = UpgradeNote::new().set_or_clear_version(None::<Version>);
15846 /// ```
15847 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
15848 where
15849 T: std::convert::Into<crate::model::Version>,
15850 {
15851 self.version = v.map(|x| x.into());
15852 self
15853 }
15854
15855 /// Sets the value of [distributions][crate::model::UpgradeNote::distributions].
15856 ///
15857 /// # Example
15858 /// ```ignore,no_run
15859 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15860 /// use google_cloud_grafeas_v1::model::UpgradeDistribution;
15861 /// let x = UpgradeNote::new()
15862 /// .set_distributions([
15863 /// UpgradeDistribution::default()/* use setters */,
15864 /// UpgradeDistribution::default()/* use (different) setters */,
15865 /// ]);
15866 /// ```
15867 pub fn set_distributions<T, V>(mut self, v: T) -> Self
15868 where
15869 T: std::iter::IntoIterator<Item = V>,
15870 V: std::convert::Into<crate::model::UpgradeDistribution>,
15871 {
15872 use std::iter::Iterator;
15873 self.distributions = v.into_iter().map(|i| i.into()).collect();
15874 self
15875 }
15876
15877 /// Sets the value of [windows_update][crate::model::UpgradeNote::windows_update].
15878 ///
15879 /// # Example
15880 /// ```ignore,no_run
15881 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15882 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
15883 /// let x = UpgradeNote::new().set_windows_update(WindowsUpdate::default()/* use setters */);
15884 /// ```
15885 pub fn set_windows_update<T>(mut self, v: T) -> Self
15886 where
15887 T: std::convert::Into<crate::model::WindowsUpdate>,
15888 {
15889 self.windows_update = std::option::Option::Some(v.into());
15890 self
15891 }
15892
15893 /// Sets or clears the value of [windows_update][crate::model::UpgradeNote::windows_update].
15894 ///
15895 /// # Example
15896 /// ```ignore,no_run
15897 /// # use google_cloud_grafeas_v1::model::UpgradeNote;
15898 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
15899 /// let x = UpgradeNote::new().set_or_clear_windows_update(Some(WindowsUpdate::default()/* use setters */));
15900 /// let x = UpgradeNote::new().set_or_clear_windows_update(None::<WindowsUpdate>);
15901 /// ```
15902 pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
15903 where
15904 T: std::convert::Into<crate::model::WindowsUpdate>,
15905 {
15906 self.windows_update = v.map(|x| x.into());
15907 self
15908 }
15909}
15910
15911impl wkt::message::Message for UpgradeNote {
15912 fn typename() -> &'static str {
15913 "type.googleapis.com/grafeas.v1.UpgradeNote"
15914 }
15915}
15916
15917/// The Upgrade Distribution represents metadata about the Upgrade for each
15918/// operating system (CPE). Some distributions have additional metadata around
15919/// updates, classifying them into various categories and severities.
15920#[derive(Clone, Default, PartialEq)]
15921#[non_exhaustive]
15922pub struct UpgradeDistribution {
15923 /// Required - The specific operating system this metadata applies to. See
15924 /// <https://cpe.mitre.org/specification/>.
15925 pub cpe_uri: std::string::String,
15926
15927 /// The operating system classification of this Upgrade, as specified by the
15928 /// upstream operating system upgrade feed. For Windows the classification is
15929 /// one of the category_ids listed at
15930 /// <https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ff357803>(v=vs.85)
15931 pub classification: std::string::String,
15932
15933 /// The severity as specified by the upstream operating system.
15934 pub severity: std::string::String,
15935
15936 /// The cve tied to this Upgrade.
15937 pub cve: std::vec::Vec<std::string::String>,
15938
15939 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15940}
15941
15942impl UpgradeDistribution {
15943 pub fn new() -> Self {
15944 std::default::Default::default()
15945 }
15946
15947 /// Sets the value of [cpe_uri][crate::model::UpgradeDistribution::cpe_uri].
15948 ///
15949 /// # Example
15950 /// ```ignore,no_run
15951 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15952 /// let x = UpgradeDistribution::new().set_cpe_uri("example");
15953 /// ```
15954 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15955 self.cpe_uri = v.into();
15956 self
15957 }
15958
15959 /// Sets the value of [classification][crate::model::UpgradeDistribution::classification].
15960 ///
15961 /// # Example
15962 /// ```ignore,no_run
15963 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15964 /// let x = UpgradeDistribution::new().set_classification("example");
15965 /// ```
15966 pub fn set_classification<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15967 self.classification = v.into();
15968 self
15969 }
15970
15971 /// Sets the value of [severity][crate::model::UpgradeDistribution::severity].
15972 ///
15973 /// # Example
15974 /// ```ignore,no_run
15975 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15976 /// let x = UpgradeDistribution::new().set_severity("example");
15977 /// ```
15978 pub fn set_severity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15979 self.severity = v.into();
15980 self
15981 }
15982
15983 /// Sets the value of [cve][crate::model::UpgradeDistribution::cve].
15984 ///
15985 /// # Example
15986 /// ```ignore,no_run
15987 /// # use google_cloud_grafeas_v1::model::UpgradeDistribution;
15988 /// let x = UpgradeDistribution::new().set_cve(["a", "b", "c"]);
15989 /// ```
15990 pub fn set_cve<T, V>(mut self, v: T) -> Self
15991 where
15992 T: std::iter::IntoIterator<Item = V>,
15993 V: std::convert::Into<std::string::String>,
15994 {
15995 use std::iter::Iterator;
15996 self.cve = v.into_iter().map(|i| i.into()).collect();
15997 self
15998 }
15999}
16000
16001impl wkt::message::Message for UpgradeDistribution {
16002 fn typename() -> &'static str {
16003 "type.googleapis.com/grafeas.v1.UpgradeDistribution"
16004 }
16005}
16006
16007/// Windows Update represents the metadata about the update for the Windows
16008/// operating system. The fields in this message come from the Windows Update API
16009/// documented at
16010/// <https://docs.microsoft.com/en-us/windows/win32/api/wuapi/nn-wuapi-iupdate>.
16011#[derive(Clone, Default, PartialEq)]
16012#[non_exhaustive]
16013pub struct WindowsUpdate {
16014 /// Required - The unique identifier for the update.
16015 pub identity: std::option::Option<crate::model::windows_update::Identity>,
16016
16017 /// The localized title of the update.
16018 pub title: std::string::String,
16019
16020 /// The localized description of the update.
16021 pub description: std::string::String,
16022
16023 /// The list of categories to which the update belongs.
16024 pub categories: std::vec::Vec<crate::model::windows_update::Category>,
16025
16026 /// The Microsoft Knowledge Base article IDs that are associated with the
16027 /// update.
16028 pub kb_article_ids: std::vec::Vec<std::string::String>,
16029
16030 /// The hyperlink to the support information for the update.
16031 pub support_url: std::string::String,
16032
16033 /// The last published timestamp of the update.
16034 pub last_published_timestamp: std::option::Option<wkt::Timestamp>,
16035
16036 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16037}
16038
16039impl WindowsUpdate {
16040 pub fn new() -> Self {
16041 std::default::Default::default()
16042 }
16043
16044 /// Sets the value of [identity][crate::model::WindowsUpdate::identity].
16045 ///
16046 /// # Example
16047 /// ```ignore,no_run
16048 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16049 /// use google_cloud_grafeas_v1::model::windows_update::Identity;
16050 /// let x = WindowsUpdate::new().set_identity(Identity::default()/* use setters */);
16051 /// ```
16052 pub fn set_identity<T>(mut self, v: T) -> Self
16053 where
16054 T: std::convert::Into<crate::model::windows_update::Identity>,
16055 {
16056 self.identity = std::option::Option::Some(v.into());
16057 self
16058 }
16059
16060 /// Sets or clears the value of [identity][crate::model::WindowsUpdate::identity].
16061 ///
16062 /// # Example
16063 /// ```ignore,no_run
16064 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16065 /// use google_cloud_grafeas_v1::model::windows_update::Identity;
16066 /// let x = WindowsUpdate::new().set_or_clear_identity(Some(Identity::default()/* use setters */));
16067 /// let x = WindowsUpdate::new().set_or_clear_identity(None::<Identity>);
16068 /// ```
16069 pub fn set_or_clear_identity<T>(mut self, v: std::option::Option<T>) -> Self
16070 where
16071 T: std::convert::Into<crate::model::windows_update::Identity>,
16072 {
16073 self.identity = v.map(|x| x.into());
16074 self
16075 }
16076
16077 /// Sets the value of [title][crate::model::WindowsUpdate::title].
16078 ///
16079 /// # Example
16080 /// ```ignore,no_run
16081 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16082 /// let x = WindowsUpdate::new().set_title("example");
16083 /// ```
16084 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16085 self.title = v.into();
16086 self
16087 }
16088
16089 /// Sets the value of [description][crate::model::WindowsUpdate::description].
16090 ///
16091 /// # Example
16092 /// ```ignore,no_run
16093 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16094 /// let x = WindowsUpdate::new().set_description("example");
16095 /// ```
16096 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16097 self.description = v.into();
16098 self
16099 }
16100
16101 /// Sets the value of [categories][crate::model::WindowsUpdate::categories].
16102 ///
16103 /// # Example
16104 /// ```ignore,no_run
16105 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16106 /// use google_cloud_grafeas_v1::model::windows_update::Category;
16107 /// let x = WindowsUpdate::new()
16108 /// .set_categories([
16109 /// Category::default()/* use setters */,
16110 /// Category::default()/* use (different) setters */,
16111 /// ]);
16112 /// ```
16113 pub fn set_categories<T, V>(mut self, v: T) -> Self
16114 where
16115 T: std::iter::IntoIterator<Item = V>,
16116 V: std::convert::Into<crate::model::windows_update::Category>,
16117 {
16118 use std::iter::Iterator;
16119 self.categories = v.into_iter().map(|i| i.into()).collect();
16120 self
16121 }
16122
16123 /// Sets the value of [kb_article_ids][crate::model::WindowsUpdate::kb_article_ids].
16124 ///
16125 /// # Example
16126 /// ```ignore,no_run
16127 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16128 /// let x = WindowsUpdate::new().set_kb_article_ids(["a", "b", "c"]);
16129 /// ```
16130 pub fn set_kb_article_ids<T, V>(mut self, v: T) -> Self
16131 where
16132 T: std::iter::IntoIterator<Item = V>,
16133 V: std::convert::Into<std::string::String>,
16134 {
16135 use std::iter::Iterator;
16136 self.kb_article_ids = v.into_iter().map(|i| i.into()).collect();
16137 self
16138 }
16139
16140 /// Sets the value of [support_url][crate::model::WindowsUpdate::support_url].
16141 ///
16142 /// # Example
16143 /// ```ignore,no_run
16144 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16145 /// let x = WindowsUpdate::new().set_support_url("example");
16146 /// ```
16147 pub fn set_support_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16148 self.support_url = v.into();
16149 self
16150 }
16151
16152 /// Sets the value of [last_published_timestamp][crate::model::WindowsUpdate::last_published_timestamp].
16153 ///
16154 /// # Example
16155 /// ```ignore,no_run
16156 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16157 /// use wkt::Timestamp;
16158 /// let x = WindowsUpdate::new().set_last_published_timestamp(Timestamp::default()/* use setters */);
16159 /// ```
16160 pub fn set_last_published_timestamp<T>(mut self, v: T) -> Self
16161 where
16162 T: std::convert::Into<wkt::Timestamp>,
16163 {
16164 self.last_published_timestamp = std::option::Option::Some(v.into());
16165 self
16166 }
16167
16168 /// Sets or clears the value of [last_published_timestamp][crate::model::WindowsUpdate::last_published_timestamp].
16169 ///
16170 /// # Example
16171 /// ```ignore,no_run
16172 /// # use google_cloud_grafeas_v1::model::WindowsUpdate;
16173 /// use wkt::Timestamp;
16174 /// let x = WindowsUpdate::new().set_or_clear_last_published_timestamp(Some(Timestamp::default()/* use setters */));
16175 /// let x = WindowsUpdate::new().set_or_clear_last_published_timestamp(None::<Timestamp>);
16176 /// ```
16177 pub fn set_or_clear_last_published_timestamp<T>(mut self, v: std::option::Option<T>) -> Self
16178 where
16179 T: std::convert::Into<wkt::Timestamp>,
16180 {
16181 self.last_published_timestamp = v.map(|x| x.into());
16182 self
16183 }
16184}
16185
16186impl wkt::message::Message for WindowsUpdate {
16187 fn typename() -> &'static str {
16188 "type.googleapis.com/grafeas.v1.WindowsUpdate"
16189 }
16190}
16191
16192/// Defines additional types related to [WindowsUpdate].
16193pub mod windows_update {
16194 #[allow(unused_imports)]
16195 use super::*;
16196
16197 /// The unique identifier of the update.
16198 #[derive(Clone, Default, PartialEq)]
16199 #[non_exhaustive]
16200 pub struct Identity {
16201 /// The revision independent identifier of the update.
16202 pub update_id: std::string::String,
16203
16204 /// The revision number of the update.
16205 pub revision: i32,
16206
16207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16208 }
16209
16210 impl Identity {
16211 pub fn new() -> Self {
16212 std::default::Default::default()
16213 }
16214
16215 /// Sets the value of [update_id][crate::model::windows_update::Identity::update_id].
16216 ///
16217 /// # Example
16218 /// ```ignore,no_run
16219 /// # use google_cloud_grafeas_v1::model::windows_update::Identity;
16220 /// let x = Identity::new().set_update_id("example");
16221 /// ```
16222 pub fn set_update_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16223 self.update_id = v.into();
16224 self
16225 }
16226
16227 /// Sets the value of [revision][crate::model::windows_update::Identity::revision].
16228 ///
16229 /// # Example
16230 /// ```ignore,no_run
16231 /// # use google_cloud_grafeas_v1::model::windows_update::Identity;
16232 /// let x = Identity::new().set_revision(42);
16233 /// ```
16234 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16235 self.revision = v.into();
16236 self
16237 }
16238 }
16239
16240 impl wkt::message::Message for Identity {
16241 fn typename() -> &'static str {
16242 "type.googleapis.com/grafeas.v1.WindowsUpdate.Identity"
16243 }
16244 }
16245
16246 /// The category to which the update belongs.
16247 #[derive(Clone, Default, PartialEq)]
16248 #[non_exhaustive]
16249 pub struct Category {
16250 /// The identifier of the category.
16251 pub category_id: std::string::String,
16252
16253 /// The localized name of the category.
16254 pub name: std::string::String,
16255
16256 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16257 }
16258
16259 impl Category {
16260 pub fn new() -> Self {
16261 std::default::Default::default()
16262 }
16263
16264 /// Sets the value of [category_id][crate::model::windows_update::Category::category_id].
16265 ///
16266 /// # Example
16267 /// ```ignore,no_run
16268 /// # use google_cloud_grafeas_v1::model::windows_update::Category;
16269 /// let x = Category::new().set_category_id("example");
16270 /// ```
16271 pub fn set_category_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16272 self.category_id = v.into();
16273 self
16274 }
16275
16276 /// Sets the value of [name][crate::model::windows_update::Category::name].
16277 ///
16278 /// # Example
16279 /// ```ignore,no_run
16280 /// # use google_cloud_grafeas_v1::model::windows_update::Category;
16281 /// let x = Category::new().set_name("example");
16282 /// ```
16283 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16284 self.name = v.into();
16285 self
16286 }
16287 }
16288
16289 impl wkt::message::Message for Category {
16290 fn typename() -> &'static str {
16291 "type.googleapis.com/grafeas.v1.WindowsUpdate.Category"
16292 }
16293 }
16294}
16295
16296/// An Upgrade Occurrence represents that a specific resource_url could install a
16297/// specific upgrade. This presence is supplied via local sources (i.e. it is
16298/// present in the mirror and the running system has noticed its availability).
16299/// For Windows, both distribution and windows_update contain information for the
16300/// Windows update.
16301#[derive(Clone, Default, PartialEq)]
16302#[non_exhaustive]
16303pub struct UpgradeOccurrence {
16304 /// Required for non-Windows OS. The package this Upgrade is for.
16305 pub package: std::string::String,
16306
16307 /// Required for non-Windows OS. The version of the package in a machine +
16308 /// human readable form.
16309 pub parsed_version: std::option::Option<crate::model::Version>,
16310
16311 /// Metadata about the upgrade for available for the specific operating system
16312 /// for the resource_url. This allows efficient filtering, as well as
16313 /// making it easier to use the occurrence.
16314 pub distribution: std::option::Option<crate::model::UpgradeDistribution>,
16315
16316 /// Required for Windows OS. Represents the metadata about the Windows update.
16317 pub windows_update: std::option::Option<crate::model::WindowsUpdate>,
16318
16319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16320}
16321
16322impl UpgradeOccurrence {
16323 pub fn new() -> Self {
16324 std::default::Default::default()
16325 }
16326
16327 /// Sets the value of [package][crate::model::UpgradeOccurrence::package].
16328 ///
16329 /// # Example
16330 /// ```ignore,no_run
16331 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16332 /// let x = UpgradeOccurrence::new().set_package("example");
16333 /// ```
16334 pub fn set_package<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16335 self.package = v.into();
16336 self
16337 }
16338
16339 /// Sets the value of [parsed_version][crate::model::UpgradeOccurrence::parsed_version].
16340 ///
16341 /// # Example
16342 /// ```ignore,no_run
16343 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16344 /// use google_cloud_grafeas_v1::model::Version;
16345 /// let x = UpgradeOccurrence::new().set_parsed_version(Version::default()/* use setters */);
16346 /// ```
16347 pub fn set_parsed_version<T>(mut self, v: T) -> Self
16348 where
16349 T: std::convert::Into<crate::model::Version>,
16350 {
16351 self.parsed_version = std::option::Option::Some(v.into());
16352 self
16353 }
16354
16355 /// Sets or clears the value of [parsed_version][crate::model::UpgradeOccurrence::parsed_version].
16356 ///
16357 /// # Example
16358 /// ```ignore,no_run
16359 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16360 /// use google_cloud_grafeas_v1::model::Version;
16361 /// let x = UpgradeOccurrence::new().set_or_clear_parsed_version(Some(Version::default()/* use setters */));
16362 /// let x = UpgradeOccurrence::new().set_or_clear_parsed_version(None::<Version>);
16363 /// ```
16364 pub fn set_or_clear_parsed_version<T>(mut self, v: std::option::Option<T>) -> Self
16365 where
16366 T: std::convert::Into<crate::model::Version>,
16367 {
16368 self.parsed_version = v.map(|x| x.into());
16369 self
16370 }
16371
16372 /// Sets the value of [distribution][crate::model::UpgradeOccurrence::distribution].
16373 ///
16374 /// # Example
16375 /// ```ignore,no_run
16376 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16377 /// use google_cloud_grafeas_v1::model::UpgradeDistribution;
16378 /// let x = UpgradeOccurrence::new().set_distribution(UpgradeDistribution::default()/* use setters */);
16379 /// ```
16380 pub fn set_distribution<T>(mut self, v: T) -> Self
16381 where
16382 T: std::convert::Into<crate::model::UpgradeDistribution>,
16383 {
16384 self.distribution = std::option::Option::Some(v.into());
16385 self
16386 }
16387
16388 /// Sets or clears the value of [distribution][crate::model::UpgradeOccurrence::distribution].
16389 ///
16390 /// # Example
16391 /// ```ignore,no_run
16392 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16393 /// use google_cloud_grafeas_v1::model::UpgradeDistribution;
16394 /// let x = UpgradeOccurrence::new().set_or_clear_distribution(Some(UpgradeDistribution::default()/* use setters */));
16395 /// let x = UpgradeOccurrence::new().set_or_clear_distribution(None::<UpgradeDistribution>);
16396 /// ```
16397 pub fn set_or_clear_distribution<T>(mut self, v: std::option::Option<T>) -> Self
16398 where
16399 T: std::convert::Into<crate::model::UpgradeDistribution>,
16400 {
16401 self.distribution = v.map(|x| x.into());
16402 self
16403 }
16404
16405 /// Sets the value of [windows_update][crate::model::UpgradeOccurrence::windows_update].
16406 ///
16407 /// # Example
16408 /// ```ignore,no_run
16409 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16410 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
16411 /// let x = UpgradeOccurrence::new().set_windows_update(WindowsUpdate::default()/* use setters */);
16412 /// ```
16413 pub fn set_windows_update<T>(mut self, v: T) -> Self
16414 where
16415 T: std::convert::Into<crate::model::WindowsUpdate>,
16416 {
16417 self.windows_update = std::option::Option::Some(v.into());
16418 self
16419 }
16420
16421 /// Sets or clears the value of [windows_update][crate::model::UpgradeOccurrence::windows_update].
16422 ///
16423 /// # Example
16424 /// ```ignore,no_run
16425 /// # use google_cloud_grafeas_v1::model::UpgradeOccurrence;
16426 /// use google_cloud_grafeas_v1::model::WindowsUpdate;
16427 /// let x = UpgradeOccurrence::new().set_or_clear_windows_update(Some(WindowsUpdate::default()/* use setters */));
16428 /// let x = UpgradeOccurrence::new().set_or_clear_windows_update(None::<WindowsUpdate>);
16429 /// ```
16430 pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
16431 where
16432 T: std::convert::Into<crate::model::WindowsUpdate>,
16433 {
16434 self.windows_update = v.map(|x| x.into());
16435 self
16436 }
16437}
16438
16439impl wkt::message::Message for UpgradeOccurrence {
16440 fn typename() -> &'static str {
16441 "type.googleapis.com/grafeas.v1.UpgradeOccurrence"
16442 }
16443}
16444
16445/// A single VulnerabilityAssessmentNote represents
16446/// one particular product's vulnerability assessment for one CVE.
16447#[derive(Clone, Default, PartialEq)]
16448#[non_exhaustive]
16449pub struct VulnerabilityAssessmentNote {
16450 /// The title of the note. E.g. `Vex-Debian-11.4`
16451 pub title: std::string::String,
16452
16453 /// A one sentence description of this Vex.
16454 pub short_description: std::string::String,
16455
16456 /// A detailed description of this Vex.
16457 pub long_description: std::string::String,
16458
16459 /// Identifies the language used by this document,
16460 /// corresponding to IETF BCP 47 / RFC 5646.
16461 pub language_code: std::string::String,
16462
16463 /// Publisher details of this Note.
16464 pub publisher: std::option::Option<crate::model::vulnerability_assessment_note::Publisher>,
16465
16466 /// The product affected by this vex.
16467 pub product: std::option::Option<crate::model::vulnerability_assessment_note::Product>,
16468
16469 /// Represents a vulnerability assessment for the product.
16470 pub assessment: std::option::Option<crate::model::vulnerability_assessment_note::Assessment>,
16471
16472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16473}
16474
16475impl VulnerabilityAssessmentNote {
16476 pub fn new() -> Self {
16477 std::default::Default::default()
16478 }
16479
16480 /// Sets the value of [title][crate::model::VulnerabilityAssessmentNote::title].
16481 ///
16482 /// # Example
16483 /// ```ignore,no_run
16484 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16485 /// let x = VulnerabilityAssessmentNote::new().set_title("example");
16486 /// ```
16487 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16488 self.title = v.into();
16489 self
16490 }
16491
16492 /// Sets the value of [short_description][crate::model::VulnerabilityAssessmentNote::short_description].
16493 ///
16494 /// # Example
16495 /// ```ignore,no_run
16496 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16497 /// let x = VulnerabilityAssessmentNote::new().set_short_description("example");
16498 /// ```
16499 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
16500 mut self,
16501 v: T,
16502 ) -> Self {
16503 self.short_description = v.into();
16504 self
16505 }
16506
16507 /// Sets the value of [long_description][crate::model::VulnerabilityAssessmentNote::long_description].
16508 ///
16509 /// # Example
16510 /// ```ignore,no_run
16511 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16512 /// let x = VulnerabilityAssessmentNote::new().set_long_description("example");
16513 /// ```
16514 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
16515 mut self,
16516 v: T,
16517 ) -> Self {
16518 self.long_description = v.into();
16519 self
16520 }
16521
16522 /// Sets the value of [language_code][crate::model::VulnerabilityAssessmentNote::language_code].
16523 ///
16524 /// # Example
16525 /// ```ignore,no_run
16526 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16527 /// let x = VulnerabilityAssessmentNote::new().set_language_code("example");
16528 /// ```
16529 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16530 self.language_code = v.into();
16531 self
16532 }
16533
16534 /// Sets the value of [publisher][crate::model::VulnerabilityAssessmentNote::publisher].
16535 ///
16536 /// # Example
16537 /// ```ignore,no_run
16538 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16539 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16540 /// let x = VulnerabilityAssessmentNote::new().set_publisher(Publisher::default()/* use setters */);
16541 /// ```
16542 pub fn set_publisher<T>(mut self, v: T) -> Self
16543 where
16544 T: std::convert::Into<crate::model::vulnerability_assessment_note::Publisher>,
16545 {
16546 self.publisher = std::option::Option::Some(v.into());
16547 self
16548 }
16549
16550 /// Sets or clears the value of [publisher][crate::model::VulnerabilityAssessmentNote::publisher].
16551 ///
16552 /// # Example
16553 /// ```ignore,no_run
16554 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16555 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16556 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_publisher(Some(Publisher::default()/* use setters */));
16557 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_publisher(None::<Publisher>);
16558 /// ```
16559 pub fn set_or_clear_publisher<T>(mut self, v: std::option::Option<T>) -> Self
16560 where
16561 T: std::convert::Into<crate::model::vulnerability_assessment_note::Publisher>,
16562 {
16563 self.publisher = v.map(|x| x.into());
16564 self
16565 }
16566
16567 /// Sets the value of [product][crate::model::VulnerabilityAssessmentNote::product].
16568 ///
16569 /// # Example
16570 /// ```ignore,no_run
16571 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16572 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16573 /// let x = VulnerabilityAssessmentNote::new().set_product(Product::default()/* use setters */);
16574 /// ```
16575 pub fn set_product<T>(mut self, v: T) -> Self
16576 where
16577 T: std::convert::Into<crate::model::vulnerability_assessment_note::Product>,
16578 {
16579 self.product = std::option::Option::Some(v.into());
16580 self
16581 }
16582
16583 /// Sets or clears the value of [product][crate::model::VulnerabilityAssessmentNote::product].
16584 ///
16585 /// # Example
16586 /// ```ignore,no_run
16587 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16588 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16589 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_product(Some(Product::default()/* use setters */));
16590 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_product(None::<Product>);
16591 /// ```
16592 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
16593 where
16594 T: std::convert::Into<crate::model::vulnerability_assessment_note::Product>,
16595 {
16596 self.product = v.map(|x| x.into());
16597 self
16598 }
16599
16600 /// Sets the value of [assessment][crate::model::VulnerabilityAssessmentNote::assessment].
16601 ///
16602 /// # Example
16603 /// ```ignore,no_run
16604 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16605 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16606 /// let x = VulnerabilityAssessmentNote::new().set_assessment(Assessment::default()/* use setters */);
16607 /// ```
16608 pub fn set_assessment<T>(mut self, v: T) -> Self
16609 where
16610 T: std::convert::Into<crate::model::vulnerability_assessment_note::Assessment>,
16611 {
16612 self.assessment = std::option::Option::Some(v.into());
16613 self
16614 }
16615
16616 /// Sets or clears the value of [assessment][crate::model::VulnerabilityAssessmentNote::assessment].
16617 ///
16618 /// # Example
16619 /// ```ignore,no_run
16620 /// # use google_cloud_grafeas_v1::model::VulnerabilityAssessmentNote;
16621 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16622 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_assessment(Some(Assessment::default()/* use setters */));
16623 /// let x = VulnerabilityAssessmentNote::new().set_or_clear_assessment(None::<Assessment>);
16624 /// ```
16625 pub fn set_or_clear_assessment<T>(mut self, v: std::option::Option<T>) -> Self
16626 where
16627 T: std::convert::Into<crate::model::vulnerability_assessment_note::Assessment>,
16628 {
16629 self.assessment = v.map(|x| x.into());
16630 self
16631 }
16632}
16633
16634impl wkt::message::Message for VulnerabilityAssessmentNote {
16635 fn typename() -> &'static str {
16636 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote"
16637 }
16638}
16639
16640/// Defines additional types related to [VulnerabilityAssessmentNote].
16641pub mod vulnerability_assessment_note {
16642 #[allow(unused_imports)]
16643 use super::*;
16644
16645 /// Publisher contains information about the publisher of
16646 /// this Note.
16647 /// (-- api-linter: core::0123::resource-annotation=disabled
16648 /// aip.dev/not-precedent: Publisher is not a separate resource. --)
16649 #[derive(Clone, Default, PartialEq)]
16650 #[non_exhaustive]
16651 pub struct Publisher {
16652 /// Name of the publisher.
16653 /// Examples: 'Google', 'Google Cloud Platform'.
16654 pub name: std::string::String,
16655
16656 /// Provides information about the authority of the issuing party to
16657 /// release the document, in particular, the party's constituency and
16658 /// responsibilities or other obligations.
16659 pub issuing_authority: std::string::String,
16660
16661 /// The context or namespace.
16662 /// Contains a URL which is under control of the issuing party and can
16663 /// be used as a globally unique identifier for that issuing party.
16664 /// Example: <https://csaf.io>
16665 pub publisher_namespace: std::string::String,
16666
16667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16668 }
16669
16670 impl Publisher {
16671 pub fn new() -> Self {
16672 std::default::Default::default()
16673 }
16674
16675 /// Sets the value of [name][crate::model::vulnerability_assessment_note::Publisher::name].
16676 ///
16677 /// # Example
16678 /// ```ignore,no_run
16679 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16680 /// let x = Publisher::new().set_name("example");
16681 /// ```
16682 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16683 self.name = v.into();
16684 self
16685 }
16686
16687 /// Sets the value of [issuing_authority][crate::model::vulnerability_assessment_note::Publisher::issuing_authority].
16688 ///
16689 /// # Example
16690 /// ```ignore,no_run
16691 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16692 /// let x = Publisher::new().set_issuing_authority("example");
16693 /// ```
16694 pub fn set_issuing_authority<T: std::convert::Into<std::string::String>>(
16695 mut self,
16696 v: T,
16697 ) -> Self {
16698 self.issuing_authority = v.into();
16699 self
16700 }
16701
16702 /// Sets the value of [publisher_namespace][crate::model::vulnerability_assessment_note::Publisher::publisher_namespace].
16703 ///
16704 /// # Example
16705 /// ```ignore,no_run
16706 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Publisher;
16707 /// let x = Publisher::new().set_publisher_namespace("example");
16708 /// ```
16709 pub fn set_publisher_namespace<T: std::convert::Into<std::string::String>>(
16710 mut self,
16711 v: T,
16712 ) -> Self {
16713 self.publisher_namespace = v.into();
16714 self
16715 }
16716 }
16717
16718 impl wkt::message::Message for Publisher {
16719 fn typename() -> &'static str {
16720 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Publisher"
16721 }
16722 }
16723
16724 /// Product contains information about a product and how to uniquely identify
16725 /// it.
16726 /// (-- api-linter: core::0123::resource-annotation=disabled
16727 /// aip.dev/not-precedent: Product is not a separate resource. --)
16728 #[derive(Clone, Default, PartialEq)]
16729 #[non_exhaustive]
16730 pub struct Product {
16731 /// Name of the product.
16732 pub name: std::string::String,
16733
16734 /// Token that identifies a product so that it can be referred to from other
16735 /// parts in the document. There is no predefined format as long as it
16736 /// uniquely identifies a group in the context of the current document.
16737 pub id: std::string::String,
16738
16739 pub identifier:
16740 std::option::Option<crate::model::vulnerability_assessment_note::product::Identifier>,
16741
16742 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16743 }
16744
16745 impl Product {
16746 pub fn new() -> Self {
16747 std::default::Default::default()
16748 }
16749
16750 /// Sets the value of [name][crate::model::vulnerability_assessment_note::Product::name].
16751 ///
16752 /// # Example
16753 /// ```ignore,no_run
16754 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16755 /// let x = Product::new().set_name("example");
16756 /// ```
16757 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16758 self.name = v.into();
16759 self
16760 }
16761
16762 /// Sets the value of [id][crate::model::vulnerability_assessment_note::Product::id].
16763 ///
16764 /// # Example
16765 /// ```ignore,no_run
16766 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16767 /// let x = Product::new().set_id("example");
16768 /// ```
16769 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16770 self.id = v.into();
16771 self
16772 }
16773
16774 /// Sets the value of [identifier][crate::model::vulnerability_assessment_note::Product::identifier].
16775 ///
16776 /// Note that all the setters affecting `identifier` are mutually
16777 /// exclusive.
16778 ///
16779 /// # Example
16780 /// ```ignore,no_run
16781 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16782 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::product::Identifier;
16783 /// let x = Product::new().set_identifier(Some(Identifier::GenericUri("example".to_string())));
16784 /// ```
16785 pub fn set_identifier<
16786 T: std::convert::Into<
16787 std::option::Option<
16788 crate::model::vulnerability_assessment_note::product::Identifier,
16789 >,
16790 >,
16791 >(
16792 mut self,
16793 v: T,
16794 ) -> Self {
16795 self.identifier = v.into();
16796 self
16797 }
16798
16799 /// The value of [identifier][crate::model::vulnerability_assessment_note::Product::identifier]
16800 /// if it holds a `GenericUri`, `None` if the field is not set or
16801 /// holds a different branch.
16802 pub fn generic_uri(&self) -> std::option::Option<&std::string::String> {
16803 #[allow(unreachable_patterns)]
16804 self.identifier.as_ref().and_then(|v| match v {
16805 crate::model::vulnerability_assessment_note::product::Identifier::GenericUri(v) => {
16806 std::option::Option::Some(v)
16807 }
16808 _ => std::option::Option::None,
16809 })
16810 }
16811
16812 /// Sets the value of [identifier][crate::model::vulnerability_assessment_note::Product::identifier]
16813 /// to hold a `GenericUri`.
16814 ///
16815 /// Note that all the setters affecting `identifier` are
16816 /// mutually exclusive.
16817 ///
16818 /// # Example
16819 /// ```ignore,no_run
16820 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Product;
16821 /// let x = Product::new().set_generic_uri("example");
16822 /// assert!(x.generic_uri().is_some());
16823 /// ```
16824 pub fn set_generic_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16825 self.identifier = std::option::Option::Some(
16826 crate::model::vulnerability_assessment_note::product::Identifier::GenericUri(
16827 v.into(),
16828 ),
16829 );
16830 self
16831 }
16832 }
16833
16834 impl wkt::message::Message for Product {
16835 fn typename() -> &'static str {
16836 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Product"
16837 }
16838 }
16839
16840 /// Defines additional types related to [Product].
16841 pub mod product {
16842 #[allow(unused_imports)]
16843 use super::*;
16844
16845 #[derive(Clone, Debug, PartialEq)]
16846 #[non_exhaustive]
16847 pub enum Identifier {
16848 /// Contains a URI which is vendor-specific.
16849 /// Example: The artifact repository URL of an image.
16850 GenericUri(std::string::String),
16851 }
16852 }
16853
16854 /// Assessment provides all information that is related to a single
16855 /// vulnerability for this product.
16856 #[derive(Clone, Default, PartialEq)]
16857 #[non_exhaustive]
16858 pub struct Assessment {
16859 /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE)
16860 /// tracking number for the vulnerability.
16861 /// Deprecated: Use vulnerability_id instead to denote CVEs.
16862 #[deprecated]
16863 pub cve: std::string::String,
16864
16865 /// The vulnerability identifier for this Assessment. Will hold one of
16866 /// common identifiers e.g. CVE, GHSA etc.
16867 pub vulnerability_id: std::string::String,
16868
16869 /// A one sentence description of this Vex.
16870 pub short_description: std::string::String,
16871
16872 /// A detailed description of this Vex.
16873 pub long_description: std::string::String,
16874
16875 /// Holds a list of references associated with this vulnerability item and
16876 /// assessment. These uris have additional information about the
16877 /// vulnerability and the assessment itself. E.g. Link to a document which
16878 /// details how this assessment concluded the state of this vulnerability.
16879 pub related_uris: std::vec::Vec<crate::model::RelatedUrl>,
16880
16881 /// Provides the state of this Vulnerability assessment.
16882 pub state: crate::model::vulnerability_assessment_note::assessment::State,
16883
16884 /// Contains information about the impact of this vulnerability,
16885 /// this will change with time.
16886 pub impacts: std::vec::Vec<std::string::String>,
16887
16888 /// Justification provides the justification when the state of the
16889 /// assessment if NOT_AFFECTED.
16890 pub justification: std::option::Option<
16891 crate::model::vulnerability_assessment_note::assessment::Justification,
16892 >,
16893
16894 /// Specifies details on how to handle (and presumably, fix) a vulnerability.
16895 pub remediations:
16896 std::vec::Vec<crate::model::vulnerability_assessment_note::assessment::Remediation>,
16897
16898 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16899 }
16900
16901 impl Assessment {
16902 pub fn new() -> Self {
16903 std::default::Default::default()
16904 }
16905
16906 /// Sets the value of [cve][crate::model::vulnerability_assessment_note::Assessment::cve].
16907 ///
16908 /// # Example
16909 /// ```ignore,no_run
16910 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16911 /// let x = Assessment::new().set_cve("example");
16912 /// ```
16913 #[deprecated]
16914 pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16915 self.cve = v.into();
16916 self
16917 }
16918
16919 /// Sets the value of [vulnerability_id][crate::model::vulnerability_assessment_note::Assessment::vulnerability_id].
16920 ///
16921 /// # Example
16922 /// ```ignore,no_run
16923 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16924 /// let x = Assessment::new().set_vulnerability_id("example");
16925 /// ```
16926 pub fn set_vulnerability_id<T: std::convert::Into<std::string::String>>(
16927 mut self,
16928 v: T,
16929 ) -> Self {
16930 self.vulnerability_id = v.into();
16931 self
16932 }
16933
16934 /// Sets the value of [short_description][crate::model::vulnerability_assessment_note::Assessment::short_description].
16935 ///
16936 /// # Example
16937 /// ```ignore,no_run
16938 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16939 /// let x = Assessment::new().set_short_description("example");
16940 /// ```
16941 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
16942 mut self,
16943 v: T,
16944 ) -> Self {
16945 self.short_description = v.into();
16946 self
16947 }
16948
16949 /// Sets the value of [long_description][crate::model::vulnerability_assessment_note::Assessment::long_description].
16950 ///
16951 /// # Example
16952 /// ```ignore,no_run
16953 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16954 /// let x = Assessment::new().set_long_description("example");
16955 /// ```
16956 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
16957 mut self,
16958 v: T,
16959 ) -> Self {
16960 self.long_description = v.into();
16961 self
16962 }
16963
16964 /// Sets the value of [related_uris][crate::model::vulnerability_assessment_note::Assessment::related_uris].
16965 ///
16966 /// # Example
16967 /// ```ignore,no_run
16968 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16969 /// use google_cloud_grafeas_v1::model::RelatedUrl;
16970 /// let x = Assessment::new()
16971 /// .set_related_uris([
16972 /// RelatedUrl::default()/* use setters */,
16973 /// RelatedUrl::default()/* use (different) setters */,
16974 /// ]);
16975 /// ```
16976 pub fn set_related_uris<T, V>(mut self, v: T) -> Self
16977 where
16978 T: std::iter::IntoIterator<Item = V>,
16979 V: std::convert::Into<crate::model::RelatedUrl>,
16980 {
16981 use std::iter::Iterator;
16982 self.related_uris = v.into_iter().map(|i| i.into()).collect();
16983 self
16984 }
16985
16986 /// Sets the value of [state][crate::model::vulnerability_assessment_note::Assessment::state].
16987 ///
16988 /// # Example
16989 /// ```ignore,no_run
16990 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
16991 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::State;
16992 /// let x0 = Assessment::new().set_state(State::Affected);
16993 /// let x1 = Assessment::new().set_state(State::NotAffected);
16994 /// let x2 = Assessment::new().set_state(State::Fixed);
16995 /// ```
16996 pub fn set_state<
16997 T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::State>,
16998 >(
16999 mut self,
17000 v: T,
17001 ) -> Self {
17002 self.state = v.into();
17003 self
17004 }
17005
17006 /// Sets the value of [impacts][crate::model::vulnerability_assessment_note::Assessment::impacts].
17007 ///
17008 /// # Example
17009 /// ```ignore,no_run
17010 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
17011 /// let x = Assessment::new().set_impacts(["a", "b", "c"]);
17012 /// ```
17013 pub fn set_impacts<T, V>(mut self, v: T) -> Self
17014 where
17015 T: std::iter::IntoIterator<Item = V>,
17016 V: std::convert::Into<std::string::String>,
17017 {
17018 use std::iter::Iterator;
17019 self.impacts = v.into_iter().map(|i| i.into()).collect();
17020 self
17021 }
17022
17023 /// Sets the value of [justification][crate::model::vulnerability_assessment_note::Assessment::justification].
17024 ///
17025 /// # Example
17026 /// ```ignore,no_run
17027 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
17028 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
17029 /// let x = Assessment::new().set_justification(Justification::default()/* use setters */);
17030 /// ```
17031 pub fn set_justification<T>(mut self, v: T) -> Self
17032 where
17033 T: std::convert::Into<
17034 crate::model::vulnerability_assessment_note::assessment::Justification,
17035 >,
17036 {
17037 self.justification = std::option::Option::Some(v.into());
17038 self
17039 }
17040
17041 /// Sets or clears the value of [justification][crate::model::vulnerability_assessment_note::Assessment::justification].
17042 ///
17043 /// # Example
17044 /// ```ignore,no_run
17045 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
17046 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
17047 /// let x = Assessment::new().set_or_clear_justification(Some(Justification::default()/* use setters */));
17048 /// let x = Assessment::new().set_or_clear_justification(None::<Justification>);
17049 /// ```
17050 pub fn set_or_clear_justification<T>(mut self, v: std::option::Option<T>) -> Self
17051 where
17052 T: std::convert::Into<
17053 crate::model::vulnerability_assessment_note::assessment::Justification,
17054 >,
17055 {
17056 self.justification = v.map(|x| x.into());
17057 self
17058 }
17059
17060 /// Sets the value of [remediations][crate::model::vulnerability_assessment_note::Assessment::remediations].
17061 ///
17062 /// # Example
17063 /// ```ignore,no_run
17064 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::Assessment;
17065 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17066 /// let x = Assessment::new()
17067 /// .set_remediations([
17068 /// Remediation::default()/* use setters */,
17069 /// Remediation::default()/* use (different) setters */,
17070 /// ]);
17071 /// ```
17072 pub fn set_remediations<T, V>(mut self, v: T) -> Self
17073 where
17074 T: std::iter::IntoIterator<Item = V>,
17075 V: std::convert::Into<
17076 crate::model::vulnerability_assessment_note::assessment::Remediation,
17077 >,
17078 {
17079 use std::iter::Iterator;
17080 self.remediations = v.into_iter().map(|i| i.into()).collect();
17081 self
17082 }
17083 }
17084
17085 impl wkt::message::Message for Assessment {
17086 fn typename() -> &'static str {
17087 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment"
17088 }
17089 }
17090
17091 /// Defines additional types related to [Assessment].
17092 pub mod assessment {
17093 #[allow(unused_imports)]
17094 use super::*;
17095
17096 /// Justification provides the justification when the state of the
17097 /// assessment if NOT_AFFECTED.
17098 #[derive(Clone, Default, PartialEq)]
17099 #[non_exhaustive]
17100 pub struct Justification {
17101
17102 /// The justification type for this vulnerability.
17103 pub justification_type: crate::model::vulnerability_assessment_note::assessment::justification::JustificationType,
17104
17105 /// Additional details on why this justification was chosen.
17106 pub details: std::string::String,
17107
17108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17109 }
17110
17111 impl Justification {
17112 pub fn new() -> Self {
17113 std::default::Default::default()
17114 }
17115
17116 /// Sets the value of [justification_type][crate::model::vulnerability_assessment_note::assessment::Justification::justification_type].
17117 ///
17118 /// # Example
17119 /// ```ignore,no_run
17120 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
17121 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::justification::JustificationType;
17122 /// let x0 = Justification::new().set_justification_type(JustificationType::ComponentNotPresent);
17123 /// let x1 = Justification::new().set_justification_type(JustificationType::VulnerableCodeNotPresent);
17124 /// let x2 = Justification::new().set_justification_type(JustificationType::VulnerableCodeNotInExecutePath);
17125 /// ```
17126 pub fn set_justification_type<T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::justification::JustificationType>>(mut self, v: T) -> Self{
17127 self.justification_type = v.into();
17128 self
17129 }
17130
17131 /// Sets the value of [details][crate::model::vulnerability_assessment_note::assessment::Justification::details].
17132 ///
17133 /// # Example
17134 /// ```ignore,no_run
17135 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
17136 /// let x = Justification::new().set_details("example");
17137 /// ```
17138 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17139 self.details = v.into();
17140 self
17141 }
17142 }
17143
17144 impl wkt::message::Message for Justification {
17145 fn typename() -> &'static str {
17146 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification"
17147 }
17148 }
17149
17150 /// Defines additional types related to [Justification].
17151 pub mod justification {
17152 #[allow(unused_imports)]
17153 use super::*;
17154
17155 /// Provides the type of justification.
17156 ///
17157 /// # Working with unknown values
17158 ///
17159 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17160 /// additional enum variants at any time. Adding new variants is not considered
17161 /// a breaking change. Applications should write their code in anticipation of:
17162 ///
17163 /// - New values appearing in future releases of the client library, **and**
17164 /// - New values received dynamically, without application changes.
17165 ///
17166 /// Please consult the [Working with enums] section in the user guide for some
17167 /// guidelines.
17168 ///
17169 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17170 #[derive(Clone, Debug, PartialEq)]
17171 #[non_exhaustive]
17172 pub enum JustificationType {
17173 /// JUSTIFICATION_TYPE_UNSPECIFIED.
17174 Unspecified,
17175 /// The vulnerable component is not present in the product.
17176 ComponentNotPresent,
17177 /// The vulnerable code is not present. Typically this case
17178 /// occurs when source code is configured or built in a way that excludes
17179 /// the vulnerable code.
17180 VulnerableCodeNotPresent,
17181 /// The vulnerable code can not be executed.
17182 /// Typically this case occurs when the product includes the vulnerable
17183 /// code but does not call or use the vulnerable code.
17184 VulnerableCodeNotInExecutePath,
17185 /// The vulnerable code cannot be controlled by an attacker to exploit
17186 /// the vulnerability.
17187 VulnerableCodeCannotBeControlledByAdversary,
17188 /// The product includes built-in protections or features that prevent
17189 /// exploitation of the vulnerability. These built-in protections cannot
17190 /// be subverted by the attacker and cannot be configured or disabled by
17191 /// the user. These mitigations completely prevent exploitation based on
17192 /// known attack vectors.
17193 InlineMitigationsAlreadyExist,
17194 /// If set, the enum was initialized with an unknown value.
17195 ///
17196 /// Applications can examine the value using [JustificationType::value] or
17197 /// [JustificationType::name].
17198 UnknownValue(justification_type::UnknownValue),
17199 }
17200
17201 #[doc(hidden)]
17202 pub mod justification_type {
17203 #[allow(unused_imports)]
17204 use super::*;
17205 #[derive(Clone, Debug, PartialEq)]
17206 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17207 }
17208
17209 impl JustificationType {
17210 /// Gets the enum value.
17211 ///
17212 /// Returns `None` if the enum contains an unknown value deserialized from
17213 /// the string representation of enums.
17214 pub fn value(&self) -> std::option::Option<i32> {
17215 match self {
17216 Self::Unspecified => std::option::Option::Some(0),
17217 Self::ComponentNotPresent => std::option::Option::Some(1),
17218 Self::VulnerableCodeNotPresent => std::option::Option::Some(2),
17219 Self::VulnerableCodeNotInExecutePath => std::option::Option::Some(3),
17220 Self::VulnerableCodeCannotBeControlledByAdversary => {
17221 std::option::Option::Some(4)
17222 }
17223 Self::InlineMitigationsAlreadyExist => std::option::Option::Some(5),
17224 Self::UnknownValue(u) => u.0.value(),
17225 }
17226 }
17227
17228 /// Gets the enum value as a string.
17229 ///
17230 /// Returns `None` if the enum contains an unknown value deserialized from
17231 /// the integer representation of enums.
17232 pub fn name(&self) -> std::option::Option<&str> {
17233 match self {
17234 Self::Unspecified => {
17235 std::option::Option::Some("JUSTIFICATION_TYPE_UNSPECIFIED")
17236 }
17237 Self::ComponentNotPresent => {
17238 std::option::Option::Some("COMPONENT_NOT_PRESENT")
17239 }
17240 Self::VulnerableCodeNotPresent => {
17241 std::option::Option::Some("VULNERABLE_CODE_NOT_PRESENT")
17242 }
17243 Self::VulnerableCodeNotInExecutePath => {
17244 std::option::Option::Some("VULNERABLE_CODE_NOT_IN_EXECUTE_PATH")
17245 }
17246 Self::VulnerableCodeCannotBeControlledByAdversary => {
17247 std::option::Option::Some(
17248 "VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY",
17249 )
17250 }
17251 Self::InlineMitigationsAlreadyExist => {
17252 std::option::Option::Some("INLINE_MITIGATIONS_ALREADY_EXIST")
17253 }
17254 Self::UnknownValue(u) => u.0.name(),
17255 }
17256 }
17257 }
17258
17259 impl std::default::Default for JustificationType {
17260 fn default() -> Self {
17261 use std::convert::From;
17262 Self::from(0)
17263 }
17264 }
17265
17266 impl std::fmt::Display for JustificationType {
17267 fn fmt(
17268 &self,
17269 f: &mut std::fmt::Formatter<'_>,
17270 ) -> std::result::Result<(), std::fmt::Error> {
17271 wkt::internal::display_enum(f, self.name(), self.value())
17272 }
17273 }
17274
17275 impl std::convert::From<i32> for JustificationType {
17276 fn from(value: i32) -> Self {
17277 match value {
17278 0 => Self::Unspecified,
17279 1 => Self::ComponentNotPresent,
17280 2 => Self::VulnerableCodeNotPresent,
17281 3 => Self::VulnerableCodeNotInExecutePath,
17282 4 => Self::VulnerableCodeCannotBeControlledByAdversary,
17283 5 => Self::InlineMitigationsAlreadyExist,
17284 _ => Self::UnknownValue(justification_type::UnknownValue(
17285 wkt::internal::UnknownEnumValue::Integer(value),
17286 )),
17287 }
17288 }
17289 }
17290
17291 impl std::convert::From<&str> for JustificationType {
17292 fn from(value: &str) -> Self {
17293 use std::string::ToString;
17294 match value {
17295 "JUSTIFICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17296 "COMPONENT_NOT_PRESENT" => Self::ComponentNotPresent,
17297 "VULNERABLE_CODE_NOT_PRESENT" => Self::VulnerableCodeNotPresent,
17298 "VULNERABLE_CODE_NOT_IN_EXECUTE_PATH" => {
17299 Self::VulnerableCodeNotInExecutePath
17300 }
17301 "VULNERABLE_CODE_CANNOT_BE_CONTROLLED_BY_ADVERSARY" => {
17302 Self::VulnerableCodeCannotBeControlledByAdversary
17303 }
17304 "INLINE_MITIGATIONS_ALREADY_EXIST" => Self::InlineMitigationsAlreadyExist,
17305 _ => Self::UnknownValue(justification_type::UnknownValue(
17306 wkt::internal::UnknownEnumValue::String(value.to_string()),
17307 )),
17308 }
17309 }
17310 }
17311
17312 impl serde::ser::Serialize for JustificationType {
17313 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17314 where
17315 S: serde::Serializer,
17316 {
17317 match self {
17318 Self::Unspecified => serializer.serialize_i32(0),
17319 Self::ComponentNotPresent => serializer.serialize_i32(1),
17320 Self::VulnerableCodeNotPresent => serializer.serialize_i32(2),
17321 Self::VulnerableCodeNotInExecutePath => serializer.serialize_i32(3),
17322 Self::VulnerableCodeCannotBeControlledByAdversary => {
17323 serializer.serialize_i32(4)
17324 }
17325 Self::InlineMitigationsAlreadyExist => serializer.serialize_i32(5),
17326 Self::UnknownValue(u) => u.0.serialize(serializer),
17327 }
17328 }
17329 }
17330
17331 impl<'de> serde::de::Deserialize<'de> for JustificationType {
17332 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17333 where
17334 D: serde::Deserializer<'de>,
17335 {
17336 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JustificationType>::new(
17337 ".grafeas.v1.VulnerabilityAssessmentNote.Assessment.Justification.JustificationType"))
17338 }
17339 }
17340 }
17341
17342 /// Specifies details on how to handle (and presumably, fix) a vulnerability.
17343 #[derive(Clone, Default, PartialEq)]
17344 #[non_exhaustive]
17345 pub struct Remediation {
17346
17347 /// The type of remediation that can be applied.
17348 pub remediation_type: crate::model::vulnerability_assessment_note::assessment::remediation::RemediationType,
17349
17350 /// Contains a comprehensive human-readable discussion of the remediation.
17351 pub details: std::string::String,
17352
17353 /// Contains the URL where to obtain the remediation.
17354 pub remediation_uri: std::option::Option<crate::model::RelatedUrl>,
17355
17356 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17357 }
17358
17359 impl Remediation {
17360 pub fn new() -> Self {
17361 std::default::Default::default()
17362 }
17363
17364 /// Sets the value of [remediation_type][crate::model::vulnerability_assessment_note::assessment::Remediation::remediation_type].
17365 ///
17366 /// # Example
17367 /// ```ignore,no_run
17368 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17369 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::remediation::RemediationType;
17370 /// let x0 = Remediation::new().set_remediation_type(RemediationType::Mitigation);
17371 /// let x1 = Remediation::new().set_remediation_type(RemediationType::NoFixPlanned);
17372 /// let x2 = Remediation::new().set_remediation_type(RemediationType::NoneAvailable);
17373 /// ```
17374 pub fn set_remediation_type<T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::remediation::RemediationType>>(mut self, v: T) -> Self{
17375 self.remediation_type = v.into();
17376 self
17377 }
17378
17379 /// Sets the value of [details][crate::model::vulnerability_assessment_note::assessment::Remediation::details].
17380 ///
17381 /// # Example
17382 /// ```ignore,no_run
17383 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17384 /// let x = Remediation::new().set_details("example");
17385 /// ```
17386 pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17387 self.details = v.into();
17388 self
17389 }
17390
17391 /// Sets the value of [remediation_uri][crate::model::vulnerability_assessment_note::assessment::Remediation::remediation_uri].
17392 ///
17393 /// # Example
17394 /// ```ignore,no_run
17395 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17396 /// use google_cloud_grafeas_v1::model::RelatedUrl;
17397 /// let x = Remediation::new().set_remediation_uri(RelatedUrl::default()/* use setters */);
17398 /// ```
17399 pub fn set_remediation_uri<T>(mut self, v: T) -> Self
17400 where
17401 T: std::convert::Into<crate::model::RelatedUrl>,
17402 {
17403 self.remediation_uri = std::option::Option::Some(v.into());
17404 self
17405 }
17406
17407 /// Sets or clears the value of [remediation_uri][crate::model::vulnerability_assessment_note::assessment::Remediation::remediation_uri].
17408 ///
17409 /// # Example
17410 /// ```ignore,no_run
17411 /// # use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
17412 /// use google_cloud_grafeas_v1::model::RelatedUrl;
17413 /// let x = Remediation::new().set_or_clear_remediation_uri(Some(RelatedUrl::default()/* use setters */));
17414 /// let x = Remediation::new().set_or_clear_remediation_uri(None::<RelatedUrl>);
17415 /// ```
17416 pub fn set_or_clear_remediation_uri<T>(mut self, v: std::option::Option<T>) -> Self
17417 where
17418 T: std::convert::Into<crate::model::RelatedUrl>,
17419 {
17420 self.remediation_uri = v.map(|x| x.into());
17421 self
17422 }
17423 }
17424
17425 impl wkt::message::Message for Remediation {
17426 fn typename() -> &'static str {
17427 "type.googleapis.com/grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation"
17428 }
17429 }
17430
17431 /// Defines additional types related to [Remediation].
17432 pub mod remediation {
17433 #[allow(unused_imports)]
17434 use super::*;
17435
17436 /// The type of remediation that can be applied.
17437 ///
17438 /// # Working with unknown values
17439 ///
17440 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17441 /// additional enum variants at any time. Adding new variants is not considered
17442 /// a breaking change. Applications should write their code in anticipation of:
17443 ///
17444 /// - New values appearing in future releases of the client library, **and**
17445 /// - New values received dynamically, without application changes.
17446 ///
17447 /// Please consult the [Working with enums] section in the user guide for some
17448 /// guidelines.
17449 ///
17450 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17451 #[derive(Clone, Debug, PartialEq)]
17452 #[non_exhaustive]
17453 pub enum RemediationType {
17454 /// No remediation type specified.
17455 Unspecified,
17456 /// A MITIGATION is available.
17457 Mitigation,
17458 /// No fix is planned.
17459 NoFixPlanned,
17460 /// Not available.
17461 NoneAvailable,
17462 /// A vendor fix is available.
17463 VendorFix,
17464 /// A workaround is available.
17465 Workaround,
17466 /// If set, the enum was initialized with an unknown value.
17467 ///
17468 /// Applications can examine the value using [RemediationType::value] or
17469 /// [RemediationType::name].
17470 UnknownValue(remediation_type::UnknownValue),
17471 }
17472
17473 #[doc(hidden)]
17474 pub mod remediation_type {
17475 #[allow(unused_imports)]
17476 use super::*;
17477 #[derive(Clone, Debug, PartialEq)]
17478 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17479 }
17480
17481 impl RemediationType {
17482 /// Gets the enum value.
17483 ///
17484 /// Returns `None` if the enum contains an unknown value deserialized from
17485 /// the string representation of enums.
17486 pub fn value(&self) -> std::option::Option<i32> {
17487 match self {
17488 Self::Unspecified => std::option::Option::Some(0),
17489 Self::Mitigation => std::option::Option::Some(1),
17490 Self::NoFixPlanned => std::option::Option::Some(2),
17491 Self::NoneAvailable => std::option::Option::Some(3),
17492 Self::VendorFix => std::option::Option::Some(4),
17493 Self::Workaround => std::option::Option::Some(5),
17494 Self::UnknownValue(u) => u.0.value(),
17495 }
17496 }
17497
17498 /// Gets the enum value as a string.
17499 ///
17500 /// Returns `None` if the enum contains an unknown value deserialized from
17501 /// the integer representation of enums.
17502 pub fn name(&self) -> std::option::Option<&str> {
17503 match self {
17504 Self::Unspecified => {
17505 std::option::Option::Some("REMEDIATION_TYPE_UNSPECIFIED")
17506 }
17507 Self::Mitigation => std::option::Option::Some("MITIGATION"),
17508 Self::NoFixPlanned => std::option::Option::Some("NO_FIX_PLANNED"),
17509 Self::NoneAvailable => std::option::Option::Some("NONE_AVAILABLE"),
17510 Self::VendorFix => std::option::Option::Some("VENDOR_FIX"),
17511 Self::Workaround => std::option::Option::Some("WORKAROUND"),
17512 Self::UnknownValue(u) => u.0.name(),
17513 }
17514 }
17515 }
17516
17517 impl std::default::Default for RemediationType {
17518 fn default() -> Self {
17519 use std::convert::From;
17520 Self::from(0)
17521 }
17522 }
17523
17524 impl std::fmt::Display for RemediationType {
17525 fn fmt(
17526 &self,
17527 f: &mut std::fmt::Formatter<'_>,
17528 ) -> std::result::Result<(), std::fmt::Error> {
17529 wkt::internal::display_enum(f, self.name(), self.value())
17530 }
17531 }
17532
17533 impl std::convert::From<i32> for RemediationType {
17534 fn from(value: i32) -> Self {
17535 match value {
17536 0 => Self::Unspecified,
17537 1 => Self::Mitigation,
17538 2 => Self::NoFixPlanned,
17539 3 => Self::NoneAvailable,
17540 4 => Self::VendorFix,
17541 5 => Self::Workaround,
17542 _ => Self::UnknownValue(remediation_type::UnknownValue(
17543 wkt::internal::UnknownEnumValue::Integer(value),
17544 )),
17545 }
17546 }
17547 }
17548
17549 impl std::convert::From<&str> for RemediationType {
17550 fn from(value: &str) -> Self {
17551 use std::string::ToString;
17552 match value {
17553 "REMEDIATION_TYPE_UNSPECIFIED" => Self::Unspecified,
17554 "MITIGATION" => Self::Mitigation,
17555 "NO_FIX_PLANNED" => Self::NoFixPlanned,
17556 "NONE_AVAILABLE" => Self::NoneAvailable,
17557 "VENDOR_FIX" => Self::VendorFix,
17558 "WORKAROUND" => Self::Workaround,
17559 _ => Self::UnknownValue(remediation_type::UnknownValue(
17560 wkt::internal::UnknownEnumValue::String(value.to_string()),
17561 )),
17562 }
17563 }
17564 }
17565
17566 impl serde::ser::Serialize for RemediationType {
17567 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17568 where
17569 S: serde::Serializer,
17570 {
17571 match self {
17572 Self::Unspecified => serializer.serialize_i32(0),
17573 Self::Mitigation => serializer.serialize_i32(1),
17574 Self::NoFixPlanned => serializer.serialize_i32(2),
17575 Self::NoneAvailable => serializer.serialize_i32(3),
17576 Self::VendorFix => serializer.serialize_i32(4),
17577 Self::Workaround => serializer.serialize_i32(5),
17578 Self::UnknownValue(u) => u.0.serialize(serializer),
17579 }
17580 }
17581 }
17582
17583 impl<'de> serde::de::Deserialize<'de> for RemediationType {
17584 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17585 where
17586 D: serde::Deserializer<'de>,
17587 {
17588 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RemediationType>::new(
17589 ".grafeas.v1.VulnerabilityAssessmentNote.Assessment.Remediation.RemediationType"))
17590 }
17591 }
17592 }
17593
17594 /// Provides the state of this Vulnerability assessment.
17595 ///
17596 /// # Working with unknown values
17597 ///
17598 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17599 /// additional enum variants at any time. Adding new variants is not considered
17600 /// a breaking change. Applications should write their code in anticipation of:
17601 ///
17602 /// - New values appearing in future releases of the client library, **and**
17603 /// - New values received dynamically, without application changes.
17604 ///
17605 /// Please consult the [Working with enums] section in the user guide for some
17606 /// guidelines.
17607 ///
17608 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17609 #[derive(Clone, Debug, PartialEq)]
17610 #[non_exhaustive]
17611 pub enum State {
17612 /// No state is specified.
17613 Unspecified,
17614 /// This product is known to be affected by this vulnerability.
17615 Affected,
17616 /// This product is known to be not affected by this vulnerability.
17617 NotAffected,
17618 /// This product contains a fix for this vulnerability.
17619 Fixed,
17620 /// It is not known yet whether these versions are or are not affected
17621 /// by the vulnerability. However, it is still under investigation.
17622 UnderInvestigation,
17623 /// If set, the enum was initialized with an unknown value.
17624 ///
17625 /// Applications can examine the value using [State::value] or
17626 /// [State::name].
17627 UnknownValue(state::UnknownValue),
17628 }
17629
17630 #[doc(hidden)]
17631 pub mod state {
17632 #[allow(unused_imports)]
17633 use super::*;
17634 #[derive(Clone, Debug, PartialEq)]
17635 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17636 }
17637
17638 impl State {
17639 /// Gets the enum value.
17640 ///
17641 /// Returns `None` if the enum contains an unknown value deserialized from
17642 /// the string representation of enums.
17643 pub fn value(&self) -> std::option::Option<i32> {
17644 match self {
17645 Self::Unspecified => std::option::Option::Some(0),
17646 Self::Affected => std::option::Option::Some(1),
17647 Self::NotAffected => std::option::Option::Some(2),
17648 Self::Fixed => std::option::Option::Some(3),
17649 Self::UnderInvestigation => std::option::Option::Some(4),
17650 Self::UnknownValue(u) => u.0.value(),
17651 }
17652 }
17653
17654 /// Gets the enum value as a string.
17655 ///
17656 /// Returns `None` if the enum contains an unknown value deserialized from
17657 /// the integer representation of enums.
17658 pub fn name(&self) -> std::option::Option<&str> {
17659 match self {
17660 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17661 Self::Affected => std::option::Option::Some("AFFECTED"),
17662 Self::NotAffected => std::option::Option::Some("NOT_AFFECTED"),
17663 Self::Fixed => std::option::Option::Some("FIXED"),
17664 Self::UnderInvestigation => std::option::Option::Some("UNDER_INVESTIGATION"),
17665 Self::UnknownValue(u) => u.0.name(),
17666 }
17667 }
17668 }
17669
17670 impl std::default::Default for State {
17671 fn default() -> Self {
17672 use std::convert::From;
17673 Self::from(0)
17674 }
17675 }
17676
17677 impl std::fmt::Display for State {
17678 fn fmt(
17679 &self,
17680 f: &mut std::fmt::Formatter<'_>,
17681 ) -> std::result::Result<(), std::fmt::Error> {
17682 wkt::internal::display_enum(f, self.name(), self.value())
17683 }
17684 }
17685
17686 impl std::convert::From<i32> for State {
17687 fn from(value: i32) -> Self {
17688 match value {
17689 0 => Self::Unspecified,
17690 1 => Self::Affected,
17691 2 => Self::NotAffected,
17692 3 => Self::Fixed,
17693 4 => Self::UnderInvestigation,
17694 _ => Self::UnknownValue(state::UnknownValue(
17695 wkt::internal::UnknownEnumValue::Integer(value),
17696 )),
17697 }
17698 }
17699 }
17700
17701 impl std::convert::From<&str> for State {
17702 fn from(value: &str) -> Self {
17703 use std::string::ToString;
17704 match value {
17705 "STATE_UNSPECIFIED" => Self::Unspecified,
17706 "AFFECTED" => Self::Affected,
17707 "NOT_AFFECTED" => Self::NotAffected,
17708 "FIXED" => Self::Fixed,
17709 "UNDER_INVESTIGATION" => Self::UnderInvestigation,
17710 _ => Self::UnknownValue(state::UnknownValue(
17711 wkt::internal::UnknownEnumValue::String(value.to_string()),
17712 )),
17713 }
17714 }
17715 }
17716
17717 impl serde::ser::Serialize for State {
17718 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17719 where
17720 S: serde::Serializer,
17721 {
17722 match self {
17723 Self::Unspecified => serializer.serialize_i32(0),
17724 Self::Affected => serializer.serialize_i32(1),
17725 Self::NotAffected => serializer.serialize_i32(2),
17726 Self::Fixed => serializer.serialize_i32(3),
17727 Self::UnderInvestigation => serializer.serialize_i32(4),
17728 Self::UnknownValue(u) => u.0.serialize(serializer),
17729 }
17730 }
17731 }
17732
17733 impl<'de> serde::de::Deserialize<'de> for State {
17734 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17735 where
17736 D: serde::Deserializer<'de>,
17737 {
17738 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17739 ".grafeas.v1.VulnerabilityAssessmentNote.Assessment.State",
17740 ))
17741 }
17742 }
17743 }
17744}
17745
17746/// A security vulnerability that can be found in resources.
17747#[derive(Clone, Default, PartialEq)]
17748#[non_exhaustive]
17749pub struct VulnerabilityNote {
17750 /// The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10
17751 /// where 0 indicates low severity and 10 indicates high severity.
17752 pub cvss_score: f32,
17753
17754 /// The note provider assigned severity of this vulnerability.
17755 pub severity: crate::model::Severity,
17756
17757 /// Details of all known distros and packages affected by this vulnerability.
17758 pub details: std::vec::Vec<crate::model::vulnerability_note::Detail>,
17759
17760 /// The full description of the CVSSv3 for this vulnerability.
17761 pub cvss_v3: std::option::Option<crate::model::CVSSv3>,
17762
17763 /// Windows details get their own format because the information format and
17764 /// model don't match a normal detail. Specifically Windows updates are done as
17765 /// patches, thus Windows vulnerabilities really are a missing package, rather
17766 /// than a package being at an incorrect version.
17767 pub windows_details: std::vec::Vec<crate::model::vulnerability_note::WindowsDetail>,
17768
17769 /// The time this information was last changed at the source. This is an
17770 /// upstream timestamp from the underlying information source - e.g. Ubuntu
17771 /// security tracker.
17772 pub source_update_time: std::option::Option<wkt::Timestamp>,
17773
17774 /// CVSS version used to populate cvss_score and severity.
17775 pub cvss_version: crate::model::CVSSVersion,
17776
17777 /// The full description of the v2 CVSS for this vulnerability.
17778 pub cvss_v2: std::option::Option<crate::model::Cvss>,
17779
17780 /// The time this advisory was published by the source.
17781 pub advisory_publish_time: std::option::Option<wkt::Timestamp>,
17782
17783 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17784}
17785
17786impl VulnerabilityNote {
17787 pub fn new() -> Self {
17788 std::default::Default::default()
17789 }
17790
17791 /// Sets the value of [cvss_score][crate::model::VulnerabilityNote::cvss_score].
17792 ///
17793 /// # Example
17794 /// ```ignore,no_run
17795 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17796 /// let x = VulnerabilityNote::new().set_cvss_score(42.0);
17797 /// ```
17798 pub fn set_cvss_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17799 self.cvss_score = v.into();
17800 self
17801 }
17802
17803 /// Sets the value of [severity][crate::model::VulnerabilityNote::severity].
17804 ///
17805 /// # Example
17806 /// ```ignore,no_run
17807 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17808 /// use google_cloud_grafeas_v1::model::Severity;
17809 /// let x0 = VulnerabilityNote::new().set_severity(Severity::Minimal);
17810 /// let x1 = VulnerabilityNote::new().set_severity(Severity::Low);
17811 /// let x2 = VulnerabilityNote::new().set_severity(Severity::Medium);
17812 /// ```
17813 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
17814 self.severity = v.into();
17815 self
17816 }
17817
17818 /// Sets the value of [details][crate::model::VulnerabilityNote::details].
17819 ///
17820 /// # Example
17821 /// ```ignore,no_run
17822 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17823 /// use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
17824 /// let x = VulnerabilityNote::new()
17825 /// .set_details([
17826 /// Detail::default()/* use setters */,
17827 /// Detail::default()/* use (different) setters */,
17828 /// ]);
17829 /// ```
17830 pub fn set_details<T, V>(mut self, v: T) -> Self
17831 where
17832 T: std::iter::IntoIterator<Item = V>,
17833 V: std::convert::Into<crate::model::vulnerability_note::Detail>,
17834 {
17835 use std::iter::Iterator;
17836 self.details = v.into_iter().map(|i| i.into()).collect();
17837 self
17838 }
17839
17840 /// Sets the value of [cvss_v3][crate::model::VulnerabilityNote::cvss_v3].
17841 ///
17842 /// # Example
17843 /// ```ignore,no_run
17844 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17845 /// use google_cloud_grafeas_v1::model::CVSSv3;
17846 /// let x = VulnerabilityNote::new().set_cvss_v3(CVSSv3::default()/* use setters */);
17847 /// ```
17848 pub fn set_cvss_v3<T>(mut self, v: T) -> Self
17849 where
17850 T: std::convert::Into<crate::model::CVSSv3>,
17851 {
17852 self.cvss_v3 = std::option::Option::Some(v.into());
17853 self
17854 }
17855
17856 /// Sets or clears the value of [cvss_v3][crate::model::VulnerabilityNote::cvss_v3].
17857 ///
17858 /// # Example
17859 /// ```ignore,no_run
17860 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17861 /// use google_cloud_grafeas_v1::model::CVSSv3;
17862 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v3(Some(CVSSv3::default()/* use setters */));
17863 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v3(None::<CVSSv3>);
17864 /// ```
17865 pub fn set_or_clear_cvss_v3<T>(mut self, v: std::option::Option<T>) -> Self
17866 where
17867 T: std::convert::Into<crate::model::CVSSv3>,
17868 {
17869 self.cvss_v3 = v.map(|x| x.into());
17870 self
17871 }
17872
17873 /// Sets the value of [windows_details][crate::model::VulnerabilityNote::windows_details].
17874 ///
17875 /// # Example
17876 /// ```ignore,no_run
17877 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17878 /// use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
17879 /// let x = VulnerabilityNote::new()
17880 /// .set_windows_details([
17881 /// WindowsDetail::default()/* use setters */,
17882 /// WindowsDetail::default()/* use (different) setters */,
17883 /// ]);
17884 /// ```
17885 pub fn set_windows_details<T, V>(mut self, v: T) -> Self
17886 where
17887 T: std::iter::IntoIterator<Item = V>,
17888 V: std::convert::Into<crate::model::vulnerability_note::WindowsDetail>,
17889 {
17890 use std::iter::Iterator;
17891 self.windows_details = v.into_iter().map(|i| i.into()).collect();
17892 self
17893 }
17894
17895 /// Sets the value of [source_update_time][crate::model::VulnerabilityNote::source_update_time].
17896 ///
17897 /// # Example
17898 /// ```ignore,no_run
17899 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17900 /// use wkt::Timestamp;
17901 /// let x = VulnerabilityNote::new().set_source_update_time(Timestamp::default()/* use setters */);
17902 /// ```
17903 pub fn set_source_update_time<T>(mut self, v: T) -> Self
17904 where
17905 T: std::convert::Into<wkt::Timestamp>,
17906 {
17907 self.source_update_time = std::option::Option::Some(v.into());
17908 self
17909 }
17910
17911 /// Sets or clears the value of [source_update_time][crate::model::VulnerabilityNote::source_update_time].
17912 ///
17913 /// # Example
17914 /// ```ignore,no_run
17915 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17916 /// use wkt::Timestamp;
17917 /// let x = VulnerabilityNote::new().set_or_clear_source_update_time(Some(Timestamp::default()/* use setters */));
17918 /// let x = VulnerabilityNote::new().set_or_clear_source_update_time(None::<Timestamp>);
17919 /// ```
17920 pub fn set_or_clear_source_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17921 where
17922 T: std::convert::Into<wkt::Timestamp>,
17923 {
17924 self.source_update_time = v.map(|x| x.into());
17925 self
17926 }
17927
17928 /// Sets the value of [cvss_version][crate::model::VulnerabilityNote::cvss_version].
17929 ///
17930 /// # Example
17931 /// ```ignore,no_run
17932 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17933 /// use google_cloud_grafeas_v1::model::CVSSVersion;
17934 /// let x0 = VulnerabilityNote::new().set_cvss_version(CVSSVersion::CvssVersion2);
17935 /// let x1 = VulnerabilityNote::new().set_cvss_version(CVSSVersion::CvssVersion3);
17936 /// ```
17937 pub fn set_cvss_version<T: std::convert::Into<crate::model::CVSSVersion>>(
17938 mut self,
17939 v: T,
17940 ) -> Self {
17941 self.cvss_version = v.into();
17942 self
17943 }
17944
17945 /// Sets the value of [cvss_v2][crate::model::VulnerabilityNote::cvss_v2].
17946 ///
17947 /// # Example
17948 /// ```ignore,no_run
17949 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17950 /// use google_cloud_grafeas_v1::model::Cvss;
17951 /// let x = VulnerabilityNote::new().set_cvss_v2(Cvss::default()/* use setters */);
17952 /// ```
17953 pub fn set_cvss_v2<T>(mut self, v: T) -> Self
17954 where
17955 T: std::convert::Into<crate::model::Cvss>,
17956 {
17957 self.cvss_v2 = std::option::Option::Some(v.into());
17958 self
17959 }
17960
17961 /// Sets or clears the value of [cvss_v2][crate::model::VulnerabilityNote::cvss_v2].
17962 ///
17963 /// # Example
17964 /// ```ignore,no_run
17965 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17966 /// use google_cloud_grafeas_v1::model::Cvss;
17967 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v2(Some(Cvss::default()/* use setters */));
17968 /// let x = VulnerabilityNote::new().set_or_clear_cvss_v2(None::<Cvss>);
17969 /// ```
17970 pub fn set_or_clear_cvss_v2<T>(mut self, v: std::option::Option<T>) -> Self
17971 where
17972 T: std::convert::Into<crate::model::Cvss>,
17973 {
17974 self.cvss_v2 = v.map(|x| x.into());
17975 self
17976 }
17977
17978 /// Sets the value of [advisory_publish_time][crate::model::VulnerabilityNote::advisory_publish_time].
17979 ///
17980 /// # Example
17981 /// ```ignore,no_run
17982 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17983 /// use wkt::Timestamp;
17984 /// let x = VulnerabilityNote::new().set_advisory_publish_time(Timestamp::default()/* use setters */);
17985 /// ```
17986 pub fn set_advisory_publish_time<T>(mut self, v: T) -> Self
17987 where
17988 T: std::convert::Into<wkt::Timestamp>,
17989 {
17990 self.advisory_publish_time = std::option::Option::Some(v.into());
17991 self
17992 }
17993
17994 /// Sets or clears the value of [advisory_publish_time][crate::model::VulnerabilityNote::advisory_publish_time].
17995 ///
17996 /// # Example
17997 /// ```ignore,no_run
17998 /// # use google_cloud_grafeas_v1::model::VulnerabilityNote;
17999 /// use wkt::Timestamp;
18000 /// let x = VulnerabilityNote::new().set_or_clear_advisory_publish_time(Some(Timestamp::default()/* use setters */));
18001 /// let x = VulnerabilityNote::new().set_or_clear_advisory_publish_time(None::<Timestamp>);
18002 /// ```
18003 pub fn set_or_clear_advisory_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
18004 where
18005 T: std::convert::Into<wkt::Timestamp>,
18006 {
18007 self.advisory_publish_time = v.map(|x| x.into());
18008 self
18009 }
18010}
18011
18012impl wkt::message::Message for VulnerabilityNote {
18013 fn typename() -> &'static str {
18014 "type.googleapis.com/grafeas.v1.VulnerabilityNote"
18015 }
18016}
18017
18018/// Defines additional types related to [VulnerabilityNote].
18019pub mod vulnerability_note {
18020 #[allow(unused_imports)]
18021 use super::*;
18022
18023 /// A detail for a distro and package affected by this vulnerability and its
18024 /// associated fix (if one is available).
18025 #[derive(Clone, Default, PartialEq)]
18026 #[non_exhaustive]
18027 pub struct Detail {
18028 /// The distro assigned severity of this vulnerability.
18029 pub severity_name: std::string::String,
18030
18031 /// A vendor-specific description of this vulnerability.
18032 pub description: std::string::String,
18033
18034 /// The type of package; whether native or non native (e.g., ruby gems,
18035 /// node.js packages, etc.).
18036 pub package_type: std::string::String,
18037
18038 /// Required. The [CPE URI](https://cpe.mitre.org/specification/) this
18039 /// vulnerability affects.
18040 pub affected_cpe_uri: std::string::String,
18041
18042 /// Required. The package this vulnerability affects.
18043 pub affected_package: std::string::String,
18044
18045 /// The version number at the start of an interval in which this
18046 /// vulnerability exists. A vulnerability can affect a package between
18047 /// version numbers that are disjoint sets of intervals (example:
18048 /// [1.0.0-1.1.0], [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be
18049 /// represented in its own Detail. If a specific affected version is provided
18050 /// by a vulnerability database, affected_version_start and
18051 /// affected_version_end will be the same in that Detail.
18052 pub affected_version_start: std::option::Option<crate::model::Version>,
18053
18054 /// The version number at the end of an interval in which this vulnerability
18055 /// exists. A vulnerability can affect a package between version numbers
18056 /// that are disjoint sets of intervals (example: [1.0.0-1.1.0],
18057 /// [2.4.6-2.4.8] and [4.5.6-4.6.8]) each of which will be represented in its
18058 /// own Detail. If a specific affected version is provided by a vulnerability
18059 /// database, affected_version_start and affected_version_end will be the
18060 /// same in that Detail.
18061 pub affected_version_end: std::option::Option<crate::model::Version>,
18062
18063 /// The distro recommended [CPE URI](https://cpe.mitre.org/specification/)
18064 /// to update to that contains a fix for this vulnerability. It is possible
18065 /// for this to be different from the affected_cpe_uri.
18066 pub fixed_cpe_uri: std::string::String,
18067
18068 /// The distro recommended package to update to that contains a fix for this
18069 /// vulnerability. It is possible for this to be different from the
18070 /// affected_package.
18071 pub fixed_package: std::string::String,
18072
18073 /// The distro recommended version to update to that contains a
18074 /// fix for this vulnerability. Setting this to VersionKind.MAXIMUM means no
18075 /// such version is yet available.
18076 pub fixed_version: std::option::Option<crate::model::Version>,
18077
18078 /// Whether this detail is obsolete. Occurrences are expected not to point to
18079 /// obsolete details.
18080 pub is_obsolete: bool,
18081
18082 /// The time this information was last changed at the source. This is an
18083 /// upstream timestamp from the underlying information source - e.g. Ubuntu
18084 /// security tracker.
18085 pub source_update_time: std::option::Option<wkt::Timestamp>,
18086
18087 /// The source from which the information in this Detail was obtained.
18088 pub source: std::string::String,
18089
18090 /// The name of the vendor of the product.
18091 pub vendor: std::string::String,
18092
18093 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18094 }
18095
18096 impl Detail {
18097 pub fn new() -> Self {
18098 std::default::Default::default()
18099 }
18100
18101 /// Sets the value of [severity_name][crate::model::vulnerability_note::Detail::severity_name].
18102 ///
18103 /// # Example
18104 /// ```ignore,no_run
18105 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18106 /// let x = Detail::new().set_severity_name("example");
18107 /// ```
18108 pub fn set_severity_name<T: std::convert::Into<std::string::String>>(
18109 mut self,
18110 v: T,
18111 ) -> Self {
18112 self.severity_name = v.into();
18113 self
18114 }
18115
18116 /// Sets the value of [description][crate::model::vulnerability_note::Detail::description].
18117 ///
18118 /// # Example
18119 /// ```ignore,no_run
18120 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18121 /// let x = Detail::new().set_description("example");
18122 /// ```
18123 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18124 self.description = v.into();
18125 self
18126 }
18127
18128 /// Sets the value of [package_type][crate::model::vulnerability_note::Detail::package_type].
18129 ///
18130 /// # Example
18131 /// ```ignore,no_run
18132 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18133 /// let x = Detail::new().set_package_type("example");
18134 /// ```
18135 pub fn set_package_type<T: std::convert::Into<std::string::String>>(
18136 mut self,
18137 v: T,
18138 ) -> Self {
18139 self.package_type = v.into();
18140 self
18141 }
18142
18143 /// Sets the value of [affected_cpe_uri][crate::model::vulnerability_note::Detail::affected_cpe_uri].
18144 ///
18145 /// # Example
18146 /// ```ignore,no_run
18147 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18148 /// let x = Detail::new().set_affected_cpe_uri("example");
18149 /// ```
18150 pub fn set_affected_cpe_uri<T: std::convert::Into<std::string::String>>(
18151 mut self,
18152 v: T,
18153 ) -> Self {
18154 self.affected_cpe_uri = v.into();
18155 self
18156 }
18157
18158 /// Sets the value of [affected_package][crate::model::vulnerability_note::Detail::affected_package].
18159 ///
18160 /// # Example
18161 /// ```ignore,no_run
18162 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18163 /// let x = Detail::new().set_affected_package("example");
18164 /// ```
18165 pub fn set_affected_package<T: std::convert::Into<std::string::String>>(
18166 mut self,
18167 v: T,
18168 ) -> Self {
18169 self.affected_package = v.into();
18170 self
18171 }
18172
18173 /// Sets the value of [affected_version_start][crate::model::vulnerability_note::Detail::affected_version_start].
18174 ///
18175 /// # Example
18176 /// ```ignore,no_run
18177 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18178 /// use google_cloud_grafeas_v1::model::Version;
18179 /// let x = Detail::new().set_affected_version_start(Version::default()/* use setters */);
18180 /// ```
18181 pub fn set_affected_version_start<T>(mut self, v: T) -> Self
18182 where
18183 T: std::convert::Into<crate::model::Version>,
18184 {
18185 self.affected_version_start = std::option::Option::Some(v.into());
18186 self
18187 }
18188
18189 /// Sets or clears the value of [affected_version_start][crate::model::vulnerability_note::Detail::affected_version_start].
18190 ///
18191 /// # Example
18192 /// ```ignore,no_run
18193 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18194 /// use google_cloud_grafeas_v1::model::Version;
18195 /// let x = Detail::new().set_or_clear_affected_version_start(Some(Version::default()/* use setters */));
18196 /// let x = Detail::new().set_or_clear_affected_version_start(None::<Version>);
18197 /// ```
18198 pub fn set_or_clear_affected_version_start<T>(mut self, v: std::option::Option<T>) -> Self
18199 where
18200 T: std::convert::Into<crate::model::Version>,
18201 {
18202 self.affected_version_start = v.map(|x| x.into());
18203 self
18204 }
18205
18206 /// Sets the value of [affected_version_end][crate::model::vulnerability_note::Detail::affected_version_end].
18207 ///
18208 /// # Example
18209 /// ```ignore,no_run
18210 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18211 /// use google_cloud_grafeas_v1::model::Version;
18212 /// let x = Detail::new().set_affected_version_end(Version::default()/* use setters */);
18213 /// ```
18214 pub fn set_affected_version_end<T>(mut self, v: T) -> Self
18215 where
18216 T: std::convert::Into<crate::model::Version>,
18217 {
18218 self.affected_version_end = std::option::Option::Some(v.into());
18219 self
18220 }
18221
18222 /// Sets or clears the value of [affected_version_end][crate::model::vulnerability_note::Detail::affected_version_end].
18223 ///
18224 /// # Example
18225 /// ```ignore,no_run
18226 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18227 /// use google_cloud_grafeas_v1::model::Version;
18228 /// let x = Detail::new().set_or_clear_affected_version_end(Some(Version::default()/* use setters */));
18229 /// let x = Detail::new().set_or_clear_affected_version_end(None::<Version>);
18230 /// ```
18231 pub fn set_or_clear_affected_version_end<T>(mut self, v: std::option::Option<T>) -> Self
18232 where
18233 T: std::convert::Into<crate::model::Version>,
18234 {
18235 self.affected_version_end = v.map(|x| x.into());
18236 self
18237 }
18238
18239 /// Sets the value of [fixed_cpe_uri][crate::model::vulnerability_note::Detail::fixed_cpe_uri].
18240 ///
18241 /// # Example
18242 /// ```ignore,no_run
18243 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18244 /// let x = Detail::new().set_fixed_cpe_uri("example");
18245 /// ```
18246 pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
18247 mut self,
18248 v: T,
18249 ) -> Self {
18250 self.fixed_cpe_uri = v.into();
18251 self
18252 }
18253
18254 /// Sets the value of [fixed_package][crate::model::vulnerability_note::Detail::fixed_package].
18255 ///
18256 /// # Example
18257 /// ```ignore,no_run
18258 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18259 /// let x = Detail::new().set_fixed_package("example");
18260 /// ```
18261 pub fn set_fixed_package<T: std::convert::Into<std::string::String>>(
18262 mut self,
18263 v: T,
18264 ) -> Self {
18265 self.fixed_package = v.into();
18266 self
18267 }
18268
18269 /// Sets the value of [fixed_version][crate::model::vulnerability_note::Detail::fixed_version].
18270 ///
18271 /// # Example
18272 /// ```ignore,no_run
18273 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18274 /// use google_cloud_grafeas_v1::model::Version;
18275 /// let x = Detail::new().set_fixed_version(Version::default()/* use setters */);
18276 /// ```
18277 pub fn set_fixed_version<T>(mut self, v: T) -> Self
18278 where
18279 T: std::convert::Into<crate::model::Version>,
18280 {
18281 self.fixed_version = std::option::Option::Some(v.into());
18282 self
18283 }
18284
18285 /// Sets or clears the value of [fixed_version][crate::model::vulnerability_note::Detail::fixed_version].
18286 ///
18287 /// # Example
18288 /// ```ignore,no_run
18289 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18290 /// use google_cloud_grafeas_v1::model::Version;
18291 /// let x = Detail::new().set_or_clear_fixed_version(Some(Version::default()/* use setters */));
18292 /// let x = Detail::new().set_or_clear_fixed_version(None::<Version>);
18293 /// ```
18294 pub fn set_or_clear_fixed_version<T>(mut self, v: std::option::Option<T>) -> Self
18295 where
18296 T: std::convert::Into<crate::model::Version>,
18297 {
18298 self.fixed_version = v.map(|x| x.into());
18299 self
18300 }
18301
18302 /// Sets the value of [is_obsolete][crate::model::vulnerability_note::Detail::is_obsolete].
18303 ///
18304 /// # Example
18305 /// ```ignore,no_run
18306 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18307 /// let x = Detail::new().set_is_obsolete(true);
18308 /// ```
18309 pub fn set_is_obsolete<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18310 self.is_obsolete = v.into();
18311 self
18312 }
18313
18314 /// Sets the value of [source_update_time][crate::model::vulnerability_note::Detail::source_update_time].
18315 ///
18316 /// # Example
18317 /// ```ignore,no_run
18318 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18319 /// use wkt::Timestamp;
18320 /// let x = Detail::new().set_source_update_time(Timestamp::default()/* use setters */);
18321 /// ```
18322 pub fn set_source_update_time<T>(mut self, v: T) -> Self
18323 where
18324 T: std::convert::Into<wkt::Timestamp>,
18325 {
18326 self.source_update_time = std::option::Option::Some(v.into());
18327 self
18328 }
18329
18330 /// Sets or clears the value of [source_update_time][crate::model::vulnerability_note::Detail::source_update_time].
18331 ///
18332 /// # Example
18333 /// ```ignore,no_run
18334 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18335 /// use wkt::Timestamp;
18336 /// let x = Detail::new().set_or_clear_source_update_time(Some(Timestamp::default()/* use setters */));
18337 /// let x = Detail::new().set_or_clear_source_update_time(None::<Timestamp>);
18338 /// ```
18339 pub fn set_or_clear_source_update_time<T>(mut self, v: std::option::Option<T>) -> Self
18340 where
18341 T: std::convert::Into<wkt::Timestamp>,
18342 {
18343 self.source_update_time = v.map(|x| x.into());
18344 self
18345 }
18346
18347 /// Sets the value of [source][crate::model::vulnerability_note::Detail::source].
18348 ///
18349 /// # Example
18350 /// ```ignore,no_run
18351 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18352 /// let x = Detail::new().set_source("example");
18353 /// ```
18354 pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18355 self.source = v.into();
18356 self
18357 }
18358
18359 /// Sets the value of [vendor][crate::model::vulnerability_note::Detail::vendor].
18360 ///
18361 /// # Example
18362 /// ```ignore,no_run
18363 /// # use google_cloud_grafeas_v1::model::vulnerability_note::Detail;
18364 /// let x = Detail::new().set_vendor("example");
18365 /// ```
18366 pub fn set_vendor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18367 self.vendor = v.into();
18368 self
18369 }
18370 }
18371
18372 impl wkt::message::Message for Detail {
18373 fn typename() -> &'static str {
18374 "type.googleapis.com/grafeas.v1.VulnerabilityNote.Detail"
18375 }
18376 }
18377
18378 #[derive(Clone, Default, PartialEq)]
18379 #[non_exhaustive]
18380 pub struct WindowsDetail {
18381 /// Required. The [CPE URI](https://cpe.mitre.org/specification/) this
18382 /// vulnerability affects.
18383 pub cpe_uri: std::string::String,
18384
18385 /// Required. The name of this vulnerability.
18386 pub name: std::string::String,
18387
18388 /// The description of this vulnerability.
18389 pub description: std::string::String,
18390
18391 /// Required. The names of the KBs which have hotfixes to mitigate this
18392 /// vulnerability. Note that there may be multiple hotfixes (and thus
18393 /// multiple KBs) that mitigate a given vulnerability. Currently any listed
18394 /// KBs presence is considered a fix.
18395 pub fixing_kbs:
18396 std::vec::Vec<crate::model::vulnerability_note::windows_detail::KnowledgeBase>,
18397
18398 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18399 }
18400
18401 impl WindowsDetail {
18402 pub fn new() -> Self {
18403 std::default::Default::default()
18404 }
18405
18406 /// Sets the value of [cpe_uri][crate::model::vulnerability_note::WindowsDetail::cpe_uri].
18407 ///
18408 /// # Example
18409 /// ```ignore,no_run
18410 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18411 /// let x = WindowsDetail::new().set_cpe_uri("example");
18412 /// ```
18413 pub fn set_cpe_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18414 self.cpe_uri = v.into();
18415 self
18416 }
18417
18418 /// Sets the value of [name][crate::model::vulnerability_note::WindowsDetail::name].
18419 ///
18420 /// # Example
18421 /// ```ignore,no_run
18422 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18423 /// let x = WindowsDetail::new().set_name("example");
18424 /// ```
18425 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18426 self.name = v.into();
18427 self
18428 }
18429
18430 /// Sets the value of [description][crate::model::vulnerability_note::WindowsDetail::description].
18431 ///
18432 /// # Example
18433 /// ```ignore,no_run
18434 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18435 /// let x = WindowsDetail::new().set_description("example");
18436 /// ```
18437 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18438 self.description = v.into();
18439 self
18440 }
18441
18442 /// Sets the value of [fixing_kbs][crate::model::vulnerability_note::WindowsDetail::fixing_kbs].
18443 ///
18444 /// # Example
18445 /// ```ignore,no_run
18446 /// # use google_cloud_grafeas_v1::model::vulnerability_note::WindowsDetail;
18447 /// use google_cloud_grafeas_v1::model::vulnerability_note::windows_detail::KnowledgeBase;
18448 /// let x = WindowsDetail::new()
18449 /// .set_fixing_kbs([
18450 /// KnowledgeBase::default()/* use setters */,
18451 /// KnowledgeBase::default()/* use (different) setters */,
18452 /// ]);
18453 /// ```
18454 pub fn set_fixing_kbs<T, V>(mut self, v: T) -> Self
18455 where
18456 T: std::iter::IntoIterator<Item = V>,
18457 V: std::convert::Into<crate::model::vulnerability_note::windows_detail::KnowledgeBase>,
18458 {
18459 use std::iter::Iterator;
18460 self.fixing_kbs = v.into_iter().map(|i| i.into()).collect();
18461 self
18462 }
18463 }
18464
18465 impl wkt::message::Message for WindowsDetail {
18466 fn typename() -> &'static str {
18467 "type.googleapis.com/grafeas.v1.VulnerabilityNote.WindowsDetail"
18468 }
18469 }
18470
18471 /// Defines additional types related to [WindowsDetail].
18472 pub mod windows_detail {
18473 #[allow(unused_imports)]
18474 use super::*;
18475
18476 #[derive(Clone, Default, PartialEq)]
18477 #[non_exhaustive]
18478 pub struct KnowledgeBase {
18479 /// The KB name (generally of the form KB[0-9]+ (e.g., KB123456)).
18480 pub name: std::string::String,
18481
18482 /// A link to the KB in the [Windows update catalog]
18483 /// (<https://www.catalog.update.microsoft.com/>).
18484 pub url: std::string::String,
18485
18486 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18487 }
18488
18489 impl KnowledgeBase {
18490 pub fn new() -> Self {
18491 std::default::Default::default()
18492 }
18493
18494 /// Sets the value of [name][crate::model::vulnerability_note::windows_detail::KnowledgeBase::name].
18495 ///
18496 /// # Example
18497 /// ```ignore,no_run
18498 /// # use google_cloud_grafeas_v1::model::vulnerability_note::windows_detail::KnowledgeBase;
18499 /// let x = KnowledgeBase::new().set_name("example");
18500 /// ```
18501 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18502 self.name = v.into();
18503 self
18504 }
18505
18506 /// Sets the value of [url][crate::model::vulnerability_note::windows_detail::KnowledgeBase::url].
18507 ///
18508 /// # Example
18509 /// ```ignore,no_run
18510 /// # use google_cloud_grafeas_v1::model::vulnerability_note::windows_detail::KnowledgeBase;
18511 /// let x = KnowledgeBase::new().set_url("example");
18512 /// ```
18513 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18514 self.url = v.into();
18515 self
18516 }
18517 }
18518
18519 impl wkt::message::Message for KnowledgeBase {
18520 fn typename() -> &'static str {
18521 "type.googleapis.com/grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase"
18522 }
18523 }
18524 }
18525}
18526
18527/// An occurrence of a severity vulnerability on a resource.
18528#[derive(Clone, Default, PartialEq)]
18529#[non_exhaustive]
18530pub struct VulnerabilityOccurrence {
18531 /// The type of package; whether native or non native (e.g., ruby gems, node.js
18532 /// packages, etc.).
18533 pub r#type: std::string::String,
18534
18535 /// Output only. The note provider assigned severity of this vulnerability.
18536 pub severity: crate::model::Severity,
18537
18538 /// Output only. The CVSS score of this vulnerability. CVSS score is on a
18539 /// scale of 0 - 10 where 0 indicates low severity and 10 indicates high
18540 /// severity.
18541 pub cvss_score: f32,
18542
18543 /// The cvss v3 score for the vulnerability.
18544 pub cvssv3: std::option::Option<crate::model::Cvss>,
18545
18546 /// Required. The set of affected locations and their fixes (if available)
18547 /// within the associated resource.
18548 pub package_issue: std::vec::Vec<crate::model::vulnerability_occurrence::PackageIssue>,
18549
18550 /// Output only. A one sentence description of this vulnerability.
18551 pub short_description: std::string::String,
18552
18553 /// Output only. A detailed description of this vulnerability.
18554 pub long_description: std::string::String,
18555
18556 /// Output only. URLs related to this vulnerability.
18557 pub related_urls: std::vec::Vec<crate::model::RelatedUrl>,
18558
18559 /// The distro assigned severity for this vulnerability when it is available,
18560 /// otherwise this is the note provider assigned severity.
18561 ///
18562 /// When there are multiple PackageIssues for this vulnerability, they can have
18563 /// different effective severities because some might be provided by the distro
18564 /// while others are provided by the language ecosystem for a language pack.
18565 /// For this reason, it is advised to use the effective severity on the
18566 /// PackageIssue level. In the case where multiple PackageIssues have differing
18567 /// effective severities, this field should be the highest severity for any of
18568 /// the PackageIssues.
18569 pub effective_severity: crate::model::Severity,
18570
18571 /// Output only. Whether at least one of the affected packages has a fix
18572 /// available.
18573 pub fix_available: bool,
18574
18575 /// Output only. CVSS version used to populate cvss_score and severity.
18576 pub cvss_version: crate::model::CVSSVersion,
18577
18578 /// The cvss v2 score for the vulnerability.
18579 pub cvss_v2: std::option::Option<crate::model::Cvss>,
18580
18581 pub vex_assessment: std::option::Option<crate::model::vulnerability_occurrence::VexAssessment>,
18582
18583 /// Occurrence-specific extra details about the vulnerability.
18584 pub extra_details: std::string::String,
18585
18586 /// Risk information about the vulnerability, such as CISA, EPSS, etc.
18587 pub risk: std::option::Option<crate::model::Risk>,
18588
18589 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18590}
18591
18592impl VulnerabilityOccurrence {
18593 pub fn new() -> Self {
18594 std::default::Default::default()
18595 }
18596
18597 /// Sets the value of [r#type][crate::model::VulnerabilityOccurrence::type].
18598 ///
18599 /// # Example
18600 /// ```ignore,no_run
18601 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18602 /// let x = VulnerabilityOccurrence::new().set_type("example");
18603 /// ```
18604 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18605 self.r#type = v.into();
18606 self
18607 }
18608
18609 /// Sets the value of [severity][crate::model::VulnerabilityOccurrence::severity].
18610 ///
18611 /// # Example
18612 /// ```ignore,no_run
18613 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18614 /// use google_cloud_grafeas_v1::model::Severity;
18615 /// let x0 = VulnerabilityOccurrence::new().set_severity(Severity::Minimal);
18616 /// let x1 = VulnerabilityOccurrence::new().set_severity(Severity::Low);
18617 /// let x2 = VulnerabilityOccurrence::new().set_severity(Severity::Medium);
18618 /// ```
18619 pub fn set_severity<T: std::convert::Into<crate::model::Severity>>(mut self, v: T) -> Self {
18620 self.severity = v.into();
18621 self
18622 }
18623
18624 /// Sets the value of [cvss_score][crate::model::VulnerabilityOccurrence::cvss_score].
18625 ///
18626 /// # Example
18627 /// ```ignore,no_run
18628 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18629 /// let x = VulnerabilityOccurrence::new().set_cvss_score(42.0);
18630 /// ```
18631 pub fn set_cvss_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
18632 self.cvss_score = v.into();
18633 self
18634 }
18635
18636 /// Sets the value of [cvssv3][crate::model::VulnerabilityOccurrence::cvssv3].
18637 ///
18638 /// # Example
18639 /// ```ignore,no_run
18640 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18641 /// use google_cloud_grafeas_v1::model::Cvss;
18642 /// let x = VulnerabilityOccurrence::new().set_cvssv3(Cvss::default()/* use setters */);
18643 /// ```
18644 pub fn set_cvssv3<T>(mut self, v: T) -> Self
18645 where
18646 T: std::convert::Into<crate::model::Cvss>,
18647 {
18648 self.cvssv3 = std::option::Option::Some(v.into());
18649 self
18650 }
18651
18652 /// Sets or clears the value of [cvssv3][crate::model::VulnerabilityOccurrence::cvssv3].
18653 ///
18654 /// # Example
18655 /// ```ignore,no_run
18656 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18657 /// use google_cloud_grafeas_v1::model::Cvss;
18658 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvssv3(Some(Cvss::default()/* use setters */));
18659 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvssv3(None::<Cvss>);
18660 /// ```
18661 pub fn set_or_clear_cvssv3<T>(mut self, v: std::option::Option<T>) -> Self
18662 where
18663 T: std::convert::Into<crate::model::Cvss>,
18664 {
18665 self.cvssv3 = v.map(|x| x.into());
18666 self
18667 }
18668
18669 /// Sets the value of [package_issue][crate::model::VulnerabilityOccurrence::package_issue].
18670 ///
18671 /// # Example
18672 /// ```ignore,no_run
18673 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18674 /// use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18675 /// let x = VulnerabilityOccurrence::new()
18676 /// .set_package_issue([
18677 /// PackageIssue::default()/* use setters */,
18678 /// PackageIssue::default()/* use (different) setters */,
18679 /// ]);
18680 /// ```
18681 pub fn set_package_issue<T, V>(mut self, v: T) -> Self
18682 where
18683 T: std::iter::IntoIterator<Item = V>,
18684 V: std::convert::Into<crate::model::vulnerability_occurrence::PackageIssue>,
18685 {
18686 use std::iter::Iterator;
18687 self.package_issue = v.into_iter().map(|i| i.into()).collect();
18688 self
18689 }
18690
18691 /// Sets the value of [short_description][crate::model::VulnerabilityOccurrence::short_description].
18692 ///
18693 /// # Example
18694 /// ```ignore,no_run
18695 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18696 /// let x = VulnerabilityOccurrence::new().set_short_description("example");
18697 /// ```
18698 pub fn set_short_description<T: std::convert::Into<std::string::String>>(
18699 mut self,
18700 v: T,
18701 ) -> Self {
18702 self.short_description = v.into();
18703 self
18704 }
18705
18706 /// Sets the value of [long_description][crate::model::VulnerabilityOccurrence::long_description].
18707 ///
18708 /// # Example
18709 /// ```ignore,no_run
18710 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18711 /// let x = VulnerabilityOccurrence::new().set_long_description("example");
18712 /// ```
18713 pub fn set_long_description<T: std::convert::Into<std::string::String>>(
18714 mut self,
18715 v: T,
18716 ) -> Self {
18717 self.long_description = v.into();
18718 self
18719 }
18720
18721 /// Sets the value of [related_urls][crate::model::VulnerabilityOccurrence::related_urls].
18722 ///
18723 /// # Example
18724 /// ```ignore,no_run
18725 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18726 /// use google_cloud_grafeas_v1::model::RelatedUrl;
18727 /// let x = VulnerabilityOccurrence::new()
18728 /// .set_related_urls([
18729 /// RelatedUrl::default()/* use setters */,
18730 /// RelatedUrl::default()/* use (different) setters */,
18731 /// ]);
18732 /// ```
18733 pub fn set_related_urls<T, V>(mut self, v: T) -> Self
18734 where
18735 T: std::iter::IntoIterator<Item = V>,
18736 V: std::convert::Into<crate::model::RelatedUrl>,
18737 {
18738 use std::iter::Iterator;
18739 self.related_urls = v.into_iter().map(|i| i.into()).collect();
18740 self
18741 }
18742
18743 /// Sets the value of [effective_severity][crate::model::VulnerabilityOccurrence::effective_severity].
18744 ///
18745 /// # Example
18746 /// ```ignore,no_run
18747 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18748 /// use google_cloud_grafeas_v1::model::Severity;
18749 /// let x0 = VulnerabilityOccurrence::new().set_effective_severity(Severity::Minimal);
18750 /// let x1 = VulnerabilityOccurrence::new().set_effective_severity(Severity::Low);
18751 /// let x2 = VulnerabilityOccurrence::new().set_effective_severity(Severity::Medium);
18752 /// ```
18753 pub fn set_effective_severity<T: std::convert::Into<crate::model::Severity>>(
18754 mut self,
18755 v: T,
18756 ) -> Self {
18757 self.effective_severity = v.into();
18758 self
18759 }
18760
18761 /// Sets the value of [fix_available][crate::model::VulnerabilityOccurrence::fix_available].
18762 ///
18763 /// # Example
18764 /// ```ignore,no_run
18765 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18766 /// let x = VulnerabilityOccurrence::new().set_fix_available(true);
18767 /// ```
18768 pub fn set_fix_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18769 self.fix_available = v.into();
18770 self
18771 }
18772
18773 /// Sets the value of [cvss_version][crate::model::VulnerabilityOccurrence::cvss_version].
18774 ///
18775 /// # Example
18776 /// ```ignore,no_run
18777 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18778 /// use google_cloud_grafeas_v1::model::CVSSVersion;
18779 /// let x0 = VulnerabilityOccurrence::new().set_cvss_version(CVSSVersion::CvssVersion2);
18780 /// let x1 = VulnerabilityOccurrence::new().set_cvss_version(CVSSVersion::CvssVersion3);
18781 /// ```
18782 pub fn set_cvss_version<T: std::convert::Into<crate::model::CVSSVersion>>(
18783 mut self,
18784 v: T,
18785 ) -> Self {
18786 self.cvss_version = v.into();
18787 self
18788 }
18789
18790 /// Sets the value of [cvss_v2][crate::model::VulnerabilityOccurrence::cvss_v2].
18791 ///
18792 /// # Example
18793 /// ```ignore,no_run
18794 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18795 /// use google_cloud_grafeas_v1::model::Cvss;
18796 /// let x = VulnerabilityOccurrence::new().set_cvss_v2(Cvss::default()/* use setters */);
18797 /// ```
18798 pub fn set_cvss_v2<T>(mut self, v: T) -> Self
18799 where
18800 T: std::convert::Into<crate::model::Cvss>,
18801 {
18802 self.cvss_v2 = std::option::Option::Some(v.into());
18803 self
18804 }
18805
18806 /// Sets or clears the value of [cvss_v2][crate::model::VulnerabilityOccurrence::cvss_v2].
18807 ///
18808 /// # Example
18809 /// ```ignore,no_run
18810 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18811 /// use google_cloud_grafeas_v1::model::Cvss;
18812 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvss_v2(Some(Cvss::default()/* use setters */));
18813 /// let x = VulnerabilityOccurrence::new().set_or_clear_cvss_v2(None::<Cvss>);
18814 /// ```
18815 pub fn set_or_clear_cvss_v2<T>(mut self, v: std::option::Option<T>) -> Self
18816 where
18817 T: std::convert::Into<crate::model::Cvss>,
18818 {
18819 self.cvss_v2 = v.map(|x| x.into());
18820 self
18821 }
18822
18823 /// Sets the value of [vex_assessment][crate::model::VulnerabilityOccurrence::vex_assessment].
18824 ///
18825 /// # Example
18826 /// ```ignore,no_run
18827 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18828 /// use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
18829 /// let x = VulnerabilityOccurrence::new().set_vex_assessment(VexAssessment::default()/* use setters */);
18830 /// ```
18831 pub fn set_vex_assessment<T>(mut self, v: T) -> Self
18832 where
18833 T: std::convert::Into<crate::model::vulnerability_occurrence::VexAssessment>,
18834 {
18835 self.vex_assessment = std::option::Option::Some(v.into());
18836 self
18837 }
18838
18839 /// Sets or clears the value of [vex_assessment][crate::model::VulnerabilityOccurrence::vex_assessment].
18840 ///
18841 /// # Example
18842 /// ```ignore,no_run
18843 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18844 /// use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
18845 /// let x = VulnerabilityOccurrence::new().set_or_clear_vex_assessment(Some(VexAssessment::default()/* use setters */));
18846 /// let x = VulnerabilityOccurrence::new().set_or_clear_vex_assessment(None::<VexAssessment>);
18847 /// ```
18848 pub fn set_or_clear_vex_assessment<T>(mut self, v: std::option::Option<T>) -> Self
18849 where
18850 T: std::convert::Into<crate::model::vulnerability_occurrence::VexAssessment>,
18851 {
18852 self.vex_assessment = v.map(|x| x.into());
18853 self
18854 }
18855
18856 /// Sets the value of [extra_details][crate::model::VulnerabilityOccurrence::extra_details].
18857 ///
18858 /// # Example
18859 /// ```ignore,no_run
18860 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18861 /// let x = VulnerabilityOccurrence::new().set_extra_details("example");
18862 /// ```
18863 pub fn set_extra_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18864 self.extra_details = v.into();
18865 self
18866 }
18867
18868 /// Sets the value of [risk][crate::model::VulnerabilityOccurrence::risk].
18869 ///
18870 /// # Example
18871 /// ```ignore,no_run
18872 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18873 /// use google_cloud_grafeas_v1::model::Risk;
18874 /// let x = VulnerabilityOccurrence::new().set_risk(Risk::default()/* use setters */);
18875 /// ```
18876 pub fn set_risk<T>(mut self, v: T) -> Self
18877 where
18878 T: std::convert::Into<crate::model::Risk>,
18879 {
18880 self.risk = std::option::Option::Some(v.into());
18881 self
18882 }
18883
18884 /// Sets or clears the value of [risk][crate::model::VulnerabilityOccurrence::risk].
18885 ///
18886 /// # Example
18887 /// ```ignore,no_run
18888 /// # use google_cloud_grafeas_v1::model::VulnerabilityOccurrence;
18889 /// use google_cloud_grafeas_v1::model::Risk;
18890 /// let x = VulnerabilityOccurrence::new().set_or_clear_risk(Some(Risk::default()/* use setters */));
18891 /// let x = VulnerabilityOccurrence::new().set_or_clear_risk(None::<Risk>);
18892 /// ```
18893 pub fn set_or_clear_risk<T>(mut self, v: std::option::Option<T>) -> Self
18894 where
18895 T: std::convert::Into<crate::model::Risk>,
18896 {
18897 self.risk = v.map(|x| x.into());
18898 self
18899 }
18900}
18901
18902impl wkt::message::Message for VulnerabilityOccurrence {
18903 fn typename() -> &'static str {
18904 "type.googleapis.com/grafeas.v1.VulnerabilityOccurrence"
18905 }
18906}
18907
18908/// Defines additional types related to [VulnerabilityOccurrence].
18909pub mod vulnerability_occurrence {
18910 #[allow(unused_imports)]
18911 use super::*;
18912
18913 /// A detail for a distro and package this vulnerability occurrence was found
18914 /// in and its associated fix (if one is available).
18915 #[derive(Clone, Default, PartialEq)]
18916 #[non_exhaustive]
18917 pub struct PackageIssue {
18918 /// Required. The [CPE URI](https://cpe.mitre.org/specification/) this
18919 /// vulnerability was found in.
18920 pub affected_cpe_uri: std::string::String,
18921
18922 /// Required. The package this vulnerability was found in.
18923 pub affected_package: std::string::String,
18924
18925 /// Required. The version of the package that is installed on the resource
18926 /// affected by this vulnerability.
18927 pub affected_version: std::option::Option<crate::model::Version>,
18928
18929 /// The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability
18930 /// was fixed in. It is possible for this to be different from the
18931 /// affected_cpe_uri.
18932 pub fixed_cpe_uri: std::string::String,
18933
18934 /// The package this vulnerability was fixed in. It is possible for this to
18935 /// be different from the affected_package.
18936 pub fixed_package: std::string::String,
18937
18938 /// Required. The version of the package this vulnerability was fixed in.
18939 /// Setting this to VersionKind.MAXIMUM means no fix is yet available.
18940 pub fixed_version: std::option::Option<crate::model::Version>,
18941
18942 /// Output only. Whether a fix is available for this package.
18943 pub fix_available: bool,
18944
18945 /// The type of package (e.g. OS, MAVEN, GO).
18946 pub package_type: std::string::String,
18947
18948 /// The distro or language system assigned severity for this vulnerability
18949 /// when that is available and note provider assigned severity when it is not
18950 /// available.
18951 pub effective_severity: crate::model::Severity,
18952
18953 /// The location at which this package was found.
18954 pub file_location: std::vec::Vec<crate::model::FileLocation>,
18955
18956 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18957 }
18958
18959 impl PackageIssue {
18960 pub fn new() -> Self {
18961 std::default::Default::default()
18962 }
18963
18964 /// Sets the value of [affected_cpe_uri][crate::model::vulnerability_occurrence::PackageIssue::affected_cpe_uri].
18965 ///
18966 /// # Example
18967 /// ```ignore,no_run
18968 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18969 /// let x = PackageIssue::new().set_affected_cpe_uri("example");
18970 /// ```
18971 pub fn set_affected_cpe_uri<T: std::convert::Into<std::string::String>>(
18972 mut self,
18973 v: T,
18974 ) -> Self {
18975 self.affected_cpe_uri = v.into();
18976 self
18977 }
18978
18979 /// Sets the value of [affected_package][crate::model::vulnerability_occurrence::PackageIssue::affected_package].
18980 ///
18981 /// # Example
18982 /// ```ignore,no_run
18983 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18984 /// let x = PackageIssue::new().set_affected_package("example");
18985 /// ```
18986 pub fn set_affected_package<T: std::convert::Into<std::string::String>>(
18987 mut self,
18988 v: T,
18989 ) -> Self {
18990 self.affected_package = v.into();
18991 self
18992 }
18993
18994 /// Sets the value of [affected_version][crate::model::vulnerability_occurrence::PackageIssue::affected_version].
18995 ///
18996 /// # Example
18997 /// ```ignore,no_run
18998 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
18999 /// use google_cloud_grafeas_v1::model::Version;
19000 /// let x = PackageIssue::new().set_affected_version(Version::default()/* use setters */);
19001 /// ```
19002 pub fn set_affected_version<T>(mut self, v: T) -> Self
19003 where
19004 T: std::convert::Into<crate::model::Version>,
19005 {
19006 self.affected_version = std::option::Option::Some(v.into());
19007 self
19008 }
19009
19010 /// Sets or clears the value of [affected_version][crate::model::vulnerability_occurrence::PackageIssue::affected_version].
19011 ///
19012 /// # Example
19013 /// ```ignore,no_run
19014 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19015 /// use google_cloud_grafeas_v1::model::Version;
19016 /// let x = PackageIssue::new().set_or_clear_affected_version(Some(Version::default()/* use setters */));
19017 /// let x = PackageIssue::new().set_or_clear_affected_version(None::<Version>);
19018 /// ```
19019 pub fn set_or_clear_affected_version<T>(mut self, v: std::option::Option<T>) -> Self
19020 where
19021 T: std::convert::Into<crate::model::Version>,
19022 {
19023 self.affected_version = v.map(|x| x.into());
19024 self
19025 }
19026
19027 /// Sets the value of [fixed_cpe_uri][crate::model::vulnerability_occurrence::PackageIssue::fixed_cpe_uri].
19028 ///
19029 /// # Example
19030 /// ```ignore,no_run
19031 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19032 /// let x = PackageIssue::new().set_fixed_cpe_uri("example");
19033 /// ```
19034 pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
19035 mut self,
19036 v: T,
19037 ) -> Self {
19038 self.fixed_cpe_uri = v.into();
19039 self
19040 }
19041
19042 /// Sets the value of [fixed_package][crate::model::vulnerability_occurrence::PackageIssue::fixed_package].
19043 ///
19044 /// # Example
19045 /// ```ignore,no_run
19046 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19047 /// let x = PackageIssue::new().set_fixed_package("example");
19048 /// ```
19049 pub fn set_fixed_package<T: std::convert::Into<std::string::String>>(
19050 mut self,
19051 v: T,
19052 ) -> Self {
19053 self.fixed_package = v.into();
19054 self
19055 }
19056
19057 /// Sets the value of [fixed_version][crate::model::vulnerability_occurrence::PackageIssue::fixed_version].
19058 ///
19059 /// # Example
19060 /// ```ignore,no_run
19061 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19062 /// use google_cloud_grafeas_v1::model::Version;
19063 /// let x = PackageIssue::new().set_fixed_version(Version::default()/* use setters */);
19064 /// ```
19065 pub fn set_fixed_version<T>(mut self, v: T) -> Self
19066 where
19067 T: std::convert::Into<crate::model::Version>,
19068 {
19069 self.fixed_version = std::option::Option::Some(v.into());
19070 self
19071 }
19072
19073 /// Sets or clears the value of [fixed_version][crate::model::vulnerability_occurrence::PackageIssue::fixed_version].
19074 ///
19075 /// # Example
19076 /// ```ignore,no_run
19077 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19078 /// use google_cloud_grafeas_v1::model::Version;
19079 /// let x = PackageIssue::new().set_or_clear_fixed_version(Some(Version::default()/* use setters */));
19080 /// let x = PackageIssue::new().set_or_clear_fixed_version(None::<Version>);
19081 /// ```
19082 pub fn set_or_clear_fixed_version<T>(mut self, v: std::option::Option<T>) -> Self
19083 where
19084 T: std::convert::Into<crate::model::Version>,
19085 {
19086 self.fixed_version = v.map(|x| x.into());
19087 self
19088 }
19089
19090 /// Sets the value of [fix_available][crate::model::vulnerability_occurrence::PackageIssue::fix_available].
19091 ///
19092 /// # Example
19093 /// ```ignore,no_run
19094 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19095 /// let x = PackageIssue::new().set_fix_available(true);
19096 /// ```
19097 pub fn set_fix_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19098 self.fix_available = v.into();
19099 self
19100 }
19101
19102 /// Sets the value of [package_type][crate::model::vulnerability_occurrence::PackageIssue::package_type].
19103 ///
19104 /// # Example
19105 /// ```ignore,no_run
19106 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19107 /// let x = PackageIssue::new().set_package_type("example");
19108 /// ```
19109 pub fn set_package_type<T: std::convert::Into<std::string::String>>(
19110 mut self,
19111 v: T,
19112 ) -> Self {
19113 self.package_type = v.into();
19114 self
19115 }
19116
19117 /// Sets the value of [effective_severity][crate::model::vulnerability_occurrence::PackageIssue::effective_severity].
19118 ///
19119 /// # Example
19120 /// ```ignore,no_run
19121 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19122 /// use google_cloud_grafeas_v1::model::Severity;
19123 /// let x0 = PackageIssue::new().set_effective_severity(Severity::Minimal);
19124 /// let x1 = PackageIssue::new().set_effective_severity(Severity::Low);
19125 /// let x2 = PackageIssue::new().set_effective_severity(Severity::Medium);
19126 /// ```
19127 pub fn set_effective_severity<T: std::convert::Into<crate::model::Severity>>(
19128 mut self,
19129 v: T,
19130 ) -> Self {
19131 self.effective_severity = v.into();
19132 self
19133 }
19134
19135 /// Sets the value of [file_location][crate::model::vulnerability_occurrence::PackageIssue::file_location].
19136 ///
19137 /// # Example
19138 /// ```ignore,no_run
19139 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::PackageIssue;
19140 /// use google_cloud_grafeas_v1::model::FileLocation;
19141 /// let x = PackageIssue::new()
19142 /// .set_file_location([
19143 /// FileLocation::default()/* use setters */,
19144 /// FileLocation::default()/* use (different) setters */,
19145 /// ]);
19146 /// ```
19147 pub fn set_file_location<T, V>(mut self, v: T) -> Self
19148 where
19149 T: std::iter::IntoIterator<Item = V>,
19150 V: std::convert::Into<crate::model::FileLocation>,
19151 {
19152 use std::iter::Iterator;
19153 self.file_location = v.into_iter().map(|i| i.into()).collect();
19154 self
19155 }
19156 }
19157
19158 impl wkt::message::Message for PackageIssue {
19159 fn typename() -> &'static str {
19160 "type.googleapis.com/grafeas.v1.VulnerabilityOccurrence.PackageIssue"
19161 }
19162 }
19163
19164 /// VexAssessment provides all publisher provided Vex information that is
19165 /// related to this vulnerability.
19166 #[derive(Clone, Default, PartialEq)]
19167 #[non_exhaustive]
19168 pub struct VexAssessment {
19169 /// Holds the MITRE standard Common Vulnerabilities and Exposures (CVE)
19170 /// tracking number for the vulnerability.
19171 /// Deprecated: Use vulnerability_id instead to denote CVEs.
19172 #[deprecated]
19173 pub cve: std::string::String,
19174
19175 /// The vulnerability identifier for this Assessment. Will hold one of
19176 /// common identifiers e.g. CVE, GHSA etc.
19177 pub vulnerability_id: std::string::String,
19178
19179 /// Holds a list of references associated with this vulnerability item and
19180 /// assessment.
19181 pub related_uris: std::vec::Vec<crate::model::RelatedUrl>,
19182
19183 /// The VulnerabilityAssessment note from which this VexAssessment was
19184 /// generated.
19185 /// This will be of the form: `projects/[PROJECT_ID]/notes/[NOTE_ID]`.
19186 /// (-- api-linter: core::0122::name-suffix=disabled
19187 /// aip.dev/not-precedent: The suffix is kept for consistency. --)
19188 pub note_name: std::string::String,
19189
19190 /// Provides the state of this Vulnerability assessment.
19191 pub state: crate::model::vulnerability_assessment_note::assessment::State,
19192
19193 /// Contains information about the impact of this vulnerability,
19194 /// this will change with time.
19195 pub impacts: std::vec::Vec<std::string::String>,
19196
19197 /// Specifies details on how to handle (and presumably, fix) a vulnerability.
19198 pub remediations:
19199 std::vec::Vec<crate::model::vulnerability_assessment_note::assessment::Remediation>,
19200
19201 /// Justification provides the justification when the state of the
19202 /// assessment if NOT_AFFECTED.
19203 pub justification: std::option::Option<
19204 crate::model::vulnerability_assessment_note::assessment::Justification,
19205 >,
19206
19207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19208 }
19209
19210 impl VexAssessment {
19211 pub fn new() -> Self {
19212 std::default::Default::default()
19213 }
19214
19215 /// Sets the value of [cve][crate::model::vulnerability_occurrence::VexAssessment::cve].
19216 ///
19217 /// # Example
19218 /// ```ignore,no_run
19219 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19220 /// let x = VexAssessment::new().set_cve("example");
19221 /// ```
19222 #[deprecated]
19223 pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19224 self.cve = v.into();
19225 self
19226 }
19227
19228 /// Sets the value of [vulnerability_id][crate::model::vulnerability_occurrence::VexAssessment::vulnerability_id].
19229 ///
19230 /// # Example
19231 /// ```ignore,no_run
19232 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19233 /// let x = VexAssessment::new().set_vulnerability_id("example");
19234 /// ```
19235 pub fn set_vulnerability_id<T: std::convert::Into<std::string::String>>(
19236 mut self,
19237 v: T,
19238 ) -> Self {
19239 self.vulnerability_id = v.into();
19240 self
19241 }
19242
19243 /// Sets the value of [related_uris][crate::model::vulnerability_occurrence::VexAssessment::related_uris].
19244 ///
19245 /// # Example
19246 /// ```ignore,no_run
19247 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19248 /// use google_cloud_grafeas_v1::model::RelatedUrl;
19249 /// let x = VexAssessment::new()
19250 /// .set_related_uris([
19251 /// RelatedUrl::default()/* use setters */,
19252 /// RelatedUrl::default()/* use (different) setters */,
19253 /// ]);
19254 /// ```
19255 pub fn set_related_uris<T, V>(mut self, v: T) -> Self
19256 where
19257 T: std::iter::IntoIterator<Item = V>,
19258 V: std::convert::Into<crate::model::RelatedUrl>,
19259 {
19260 use std::iter::Iterator;
19261 self.related_uris = v.into_iter().map(|i| i.into()).collect();
19262 self
19263 }
19264
19265 /// Sets the value of [note_name][crate::model::vulnerability_occurrence::VexAssessment::note_name].
19266 ///
19267 /// # Example
19268 /// ```ignore,no_run
19269 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19270 /// let x = VexAssessment::new().set_note_name("example");
19271 /// ```
19272 pub fn set_note_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19273 self.note_name = v.into();
19274 self
19275 }
19276
19277 /// Sets the value of [state][crate::model::vulnerability_occurrence::VexAssessment::state].
19278 ///
19279 /// # Example
19280 /// ```ignore,no_run
19281 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19282 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::State;
19283 /// let x0 = VexAssessment::new().set_state(State::Affected);
19284 /// let x1 = VexAssessment::new().set_state(State::NotAffected);
19285 /// let x2 = VexAssessment::new().set_state(State::Fixed);
19286 /// ```
19287 pub fn set_state<
19288 T: std::convert::Into<crate::model::vulnerability_assessment_note::assessment::State>,
19289 >(
19290 mut self,
19291 v: T,
19292 ) -> Self {
19293 self.state = v.into();
19294 self
19295 }
19296
19297 /// Sets the value of [impacts][crate::model::vulnerability_occurrence::VexAssessment::impacts].
19298 ///
19299 /// # Example
19300 /// ```ignore,no_run
19301 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19302 /// let x = VexAssessment::new().set_impacts(["a", "b", "c"]);
19303 /// ```
19304 pub fn set_impacts<T, V>(mut self, v: T) -> Self
19305 where
19306 T: std::iter::IntoIterator<Item = V>,
19307 V: std::convert::Into<std::string::String>,
19308 {
19309 use std::iter::Iterator;
19310 self.impacts = v.into_iter().map(|i| i.into()).collect();
19311 self
19312 }
19313
19314 /// Sets the value of [remediations][crate::model::vulnerability_occurrence::VexAssessment::remediations].
19315 ///
19316 /// # Example
19317 /// ```ignore,no_run
19318 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19319 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Remediation;
19320 /// let x = VexAssessment::new()
19321 /// .set_remediations([
19322 /// Remediation::default()/* use setters */,
19323 /// Remediation::default()/* use (different) setters */,
19324 /// ]);
19325 /// ```
19326 pub fn set_remediations<T, V>(mut self, v: T) -> Self
19327 where
19328 T: std::iter::IntoIterator<Item = V>,
19329 V: std::convert::Into<
19330 crate::model::vulnerability_assessment_note::assessment::Remediation,
19331 >,
19332 {
19333 use std::iter::Iterator;
19334 self.remediations = v.into_iter().map(|i| i.into()).collect();
19335 self
19336 }
19337
19338 /// Sets the value of [justification][crate::model::vulnerability_occurrence::VexAssessment::justification].
19339 ///
19340 /// # Example
19341 /// ```ignore,no_run
19342 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19343 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
19344 /// let x = VexAssessment::new().set_justification(Justification::default()/* use setters */);
19345 /// ```
19346 pub fn set_justification<T>(mut self, v: T) -> Self
19347 where
19348 T: std::convert::Into<
19349 crate::model::vulnerability_assessment_note::assessment::Justification,
19350 >,
19351 {
19352 self.justification = std::option::Option::Some(v.into());
19353 self
19354 }
19355
19356 /// Sets or clears the value of [justification][crate::model::vulnerability_occurrence::VexAssessment::justification].
19357 ///
19358 /// # Example
19359 /// ```ignore,no_run
19360 /// # use google_cloud_grafeas_v1::model::vulnerability_occurrence::VexAssessment;
19361 /// use google_cloud_grafeas_v1::model::vulnerability_assessment_note::assessment::Justification;
19362 /// let x = VexAssessment::new().set_or_clear_justification(Some(Justification::default()/* use setters */));
19363 /// let x = VexAssessment::new().set_or_clear_justification(None::<Justification>);
19364 /// ```
19365 pub fn set_or_clear_justification<T>(mut self, v: std::option::Option<T>) -> Self
19366 where
19367 T: std::convert::Into<
19368 crate::model::vulnerability_assessment_note::assessment::Justification,
19369 >,
19370 {
19371 self.justification = v.map(|x| x.into());
19372 self
19373 }
19374 }
19375
19376 impl wkt::message::Message for VexAssessment {
19377 fn typename() -> &'static str {
19378 "type.googleapis.com/grafeas.v1.VulnerabilityOccurrence.VexAssessment"
19379 }
19380 }
19381}
19382
19383/// Kind represents the kinds of notes supported.
19384///
19385/// # Working with unknown values
19386///
19387/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19388/// additional enum variants at any time. Adding new variants is not considered
19389/// a breaking change. Applications should write their code in anticipation of:
19390///
19391/// - New values appearing in future releases of the client library, **and**
19392/// - New values received dynamically, without application changes.
19393///
19394/// Please consult the [Working with enums] section in the user guide for some
19395/// guidelines.
19396///
19397/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19398#[derive(Clone, Debug, PartialEq)]
19399#[non_exhaustive]
19400pub enum NoteKind {
19401 /// Default value. This value is unused.
19402 Unspecified,
19403 /// The note and occurrence represent a package vulnerability.
19404 Vulnerability,
19405 /// The note and occurrence assert build provenance.
19406 Build,
19407 /// This represents an image basis relationship.
19408 Image,
19409 /// This represents a package installed via a package manager.
19410 Package,
19411 /// The note and occurrence track deployment events.
19412 Deployment,
19413 /// The note and occurrence track the initial discovery status of a resource.
19414 Discovery,
19415 /// This represents a logical "role" that can attest to artifacts.
19416 Attestation,
19417 /// This represents an available package upgrade.
19418 Upgrade,
19419 /// This represents a Compliance Note
19420 Compliance,
19421 /// This represents a DSSE attestation Note
19422 DsseAttestation,
19423 /// This represents a Vulnerability Assessment.
19424 VulnerabilityAssessment,
19425 /// This represents an SBOM Reference.
19426 SbomReference,
19427 /// This represents a secret.
19428 Secret,
19429 /// If set, the enum was initialized with an unknown value.
19430 ///
19431 /// Applications can examine the value using [NoteKind::value] or
19432 /// [NoteKind::name].
19433 UnknownValue(note_kind::UnknownValue),
19434}
19435
19436#[doc(hidden)]
19437pub mod note_kind {
19438 #[allow(unused_imports)]
19439 use super::*;
19440 #[derive(Clone, Debug, PartialEq)]
19441 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19442}
19443
19444impl NoteKind {
19445 /// Gets the enum value.
19446 ///
19447 /// Returns `None` if the enum contains an unknown value deserialized from
19448 /// the string representation of enums.
19449 pub fn value(&self) -> std::option::Option<i32> {
19450 match self {
19451 Self::Unspecified => std::option::Option::Some(0),
19452 Self::Vulnerability => std::option::Option::Some(1),
19453 Self::Build => std::option::Option::Some(2),
19454 Self::Image => std::option::Option::Some(3),
19455 Self::Package => std::option::Option::Some(4),
19456 Self::Deployment => std::option::Option::Some(5),
19457 Self::Discovery => std::option::Option::Some(6),
19458 Self::Attestation => std::option::Option::Some(7),
19459 Self::Upgrade => std::option::Option::Some(8),
19460 Self::Compliance => std::option::Option::Some(9),
19461 Self::DsseAttestation => std::option::Option::Some(10),
19462 Self::VulnerabilityAssessment => std::option::Option::Some(11),
19463 Self::SbomReference => std::option::Option::Some(12),
19464 Self::Secret => std::option::Option::Some(13),
19465 Self::UnknownValue(u) => u.0.value(),
19466 }
19467 }
19468
19469 /// Gets the enum value as a string.
19470 ///
19471 /// Returns `None` if the enum contains an unknown value deserialized from
19472 /// the integer representation of enums.
19473 pub fn name(&self) -> std::option::Option<&str> {
19474 match self {
19475 Self::Unspecified => std::option::Option::Some("NOTE_KIND_UNSPECIFIED"),
19476 Self::Vulnerability => std::option::Option::Some("VULNERABILITY"),
19477 Self::Build => std::option::Option::Some("BUILD"),
19478 Self::Image => std::option::Option::Some("IMAGE"),
19479 Self::Package => std::option::Option::Some("PACKAGE"),
19480 Self::Deployment => std::option::Option::Some("DEPLOYMENT"),
19481 Self::Discovery => std::option::Option::Some("DISCOVERY"),
19482 Self::Attestation => std::option::Option::Some("ATTESTATION"),
19483 Self::Upgrade => std::option::Option::Some("UPGRADE"),
19484 Self::Compliance => std::option::Option::Some("COMPLIANCE"),
19485 Self::DsseAttestation => std::option::Option::Some("DSSE_ATTESTATION"),
19486 Self::VulnerabilityAssessment => std::option::Option::Some("VULNERABILITY_ASSESSMENT"),
19487 Self::SbomReference => std::option::Option::Some("SBOM_REFERENCE"),
19488 Self::Secret => std::option::Option::Some("SECRET"),
19489 Self::UnknownValue(u) => u.0.name(),
19490 }
19491 }
19492}
19493
19494impl std::default::Default for NoteKind {
19495 fn default() -> Self {
19496 use std::convert::From;
19497 Self::from(0)
19498 }
19499}
19500
19501impl std::fmt::Display for NoteKind {
19502 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19503 wkt::internal::display_enum(f, self.name(), self.value())
19504 }
19505}
19506
19507impl std::convert::From<i32> for NoteKind {
19508 fn from(value: i32) -> Self {
19509 match value {
19510 0 => Self::Unspecified,
19511 1 => Self::Vulnerability,
19512 2 => Self::Build,
19513 3 => Self::Image,
19514 4 => Self::Package,
19515 5 => Self::Deployment,
19516 6 => Self::Discovery,
19517 7 => Self::Attestation,
19518 8 => Self::Upgrade,
19519 9 => Self::Compliance,
19520 10 => Self::DsseAttestation,
19521 11 => Self::VulnerabilityAssessment,
19522 12 => Self::SbomReference,
19523 13 => Self::Secret,
19524 _ => Self::UnknownValue(note_kind::UnknownValue(
19525 wkt::internal::UnknownEnumValue::Integer(value),
19526 )),
19527 }
19528 }
19529}
19530
19531impl std::convert::From<&str> for NoteKind {
19532 fn from(value: &str) -> Self {
19533 use std::string::ToString;
19534 match value {
19535 "NOTE_KIND_UNSPECIFIED" => Self::Unspecified,
19536 "VULNERABILITY" => Self::Vulnerability,
19537 "BUILD" => Self::Build,
19538 "IMAGE" => Self::Image,
19539 "PACKAGE" => Self::Package,
19540 "DEPLOYMENT" => Self::Deployment,
19541 "DISCOVERY" => Self::Discovery,
19542 "ATTESTATION" => Self::Attestation,
19543 "UPGRADE" => Self::Upgrade,
19544 "COMPLIANCE" => Self::Compliance,
19545 "DSSE_ATTESTATION" => Self::DsseAttestation,
19546 "VULNERABILITY_ASSESSMENT" => Self::VulnerabilityAssessment,
19547 "SBOM_REFERENCE" => Self::SbomReference,
19548 "SECRET" => Self::Secret,
19549 _ => Self::UnknownValue(note_kind::UnknownValue(
19550 wkt::internal::UnknownEnumValue::String(value.to_string()),
19551 )),
19552 }
19553 }
19554}
19555
19556impl serde::ser::Serialize for NoteKind {
19557 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19558 where
19559 S: serde::Serializer,
19560 {
19561 match self {
19562 Self::Unspecified => serializer.serialize_i32(0),
19563 Self::Vulnerability => serializer.serialize_i32(1),
19564 Self::Build => serializer.serialize_i32(2),
19565 Self::Image => serializer.serialize_i32(3),
19566 Self::Package => serializer.serialize_i32(4),
19567 Self::Deployment => serializer.serialize_i32(5),
19568 Self::Discovery => serializer.serialize_i32(6),
19569 Self::Attestation => serializer.serialize_i32(7),
19570 Self::Upgrade => serializer.serialize_i32(8),
19571 Self::Compliance => serializer.serialize_i32(9),
19572 Self::DsseAttestation => serializer.serialize_i32(10),
19573 Self::VulnerabilityAssessment => serializer.serialize_i32(11),
19574 Self::SbomReference => serializer.serialize_i32(12),
19575 Self::Secret => serializer.serialize_i32(13),
19576 Self::UnknownValue(u) => u.0.serialize(serializer),
19577 }
19578 }
19579}
19580
19581impl<'de> serde::de::Deserialize<'de> for NoteKind {
19582 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19583 where
19584 D: serde::Deserializer<'de>,
19585 {
19586 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NoteKind>::new(
19587 ".grafeas.v1.NoteKind",
19588 ))
19589 }
19590}
19591
19592/// CVSS Version.
19593///
19594/// # Working with unknown values
19595///
19596/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19597/// additional enum variants at any time. Adding new variants is not considered
19598/// a breaking change. Applications should write their code in anticipation of:
19599///
19600/// - New values appearing in future releases of the client library, **and**
19601/// - New values received dynamically, without application changes.
19602///
19603/// Please consult the [Working with enums] section in the user guide for some
19604/// guidelines.
19605///
19606/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19607#[derive(Clone, Debug, PartialEq)]
19608#[non_exhaustive]
19609pub enum CVSSVersion {
19610 Unspecified,
19611 CvssVersion2,
19612 CvssVersion3,
19613 /// If set, the enum was initialized with an unknown value.
19614 ///
19615 /// Applications can examine the value using [CVSSVersion::value] or
19616 /// [CVSSVersion::name].
19617 UnknownValue(cvss_version::UnknownValue),
19618}
19619
19620#[doc(hidden)]
19621pub mod cvss_version {
19622 #[allow(unused_imports)]
19623 use super::*;
19624 #[derive(Clone, Debug, PartialEq)]
19625 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19626}
19627
19628impl CVSSVersion {
19629 /// Gets the enum value.
19630 ///
19631 /// Returns `None` if the enum contains an unknown value deserialized from
19632 /// the string representation of enums.
19633 pub fn value(&self) -> std::option::Option<i32> {
19634 match self {
19635 Self::Unspecified => std::option::Option::Some(0),
19636 Self::CvssVersion2 => std::option::Option::Some(1),
19637 Self::CvssVersion3 => std::option::Option::Some(2),
19638 Self::UnknownValue(u) => u.0.value(),
19639 }
19640 }
19641
19642 /// Gets the enum value as a string.
19643 ///
19644 /// Returns `None` if the enum contains an unknown value deserialized from
19645 /// the integer representation of enums.
19646 pub fn name(&self) -> std::option::Option<&str> {
19647 match self {
19648 Self::Unspecified => std::option::Option::Some("CVSS_VERSION_UNSPECIFIED"),
19649 Self::CvssVersion2 => std::option::Option::Some("CVSS_VERSION_2"),
19650 Self::CvssVersion3 => std::option::Option::Some("CVSS_VERSION_3"),
19651 Self::UnknownValue(u) => u.0.name(),
19652 }
19653 }
19654}
19655
19656impl std::default::Default for CVSSVersion {
19657 fn default() -> Self {
19658 use std::convert::From;
19659 Self::from(0)
19660 }
19661}
19662
19663impl std::fmt::Display for CVSSVersion {
19664 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19665 wkt::internal::display_enum(f, self.name(), self.value())
19666 }
19667}
19668
19669impl std::convert::From<i32> for CVSSVersion {
19670 fn from(value: i32) -> Self {
19671 match value {
19672 0 => Self::Unspecified,
19673 1 => Self::CvssVersion2,
19674 2 => Self::CvssVersion3,
19675 _ => Self::UnknownValue(cvss_version::UnknownValue(
19676 wkt::internal::UnknownEnumValue::Integer(value),
19677 )),
19678 }
19679 }
19680}
19681
19682impl std::convert::From<&str> for CVSSVersion {
19683 fn from(value: &str) -> Self {
19684 use std::string::ToString;
19685 match value {
19686 "CVSS_VERSION_UNSPECIFIED" => Self::Unspecified,
19687 "CVSS_VERSION_2" => Self::CvssVersion2,
19688 "CVSS_VERSION_3" => Self::CvssVersion3,
19689 _ => Self::UnknownValue(cvss_version::UnknownValue(
19690 wkt::internal::UnknownEnumValue::String(value.to_string()),
19691 )),
19692 }
19693 }
19694}
19695
19696impl serde::ser::Serialize for CVSSVersion {
19697 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19698 where
19699 S: serde::Serializer,
19700 {
19701 match self {
19702 Self::Unspecified => serializer.serialize_i32(0),
19703 Self::CvssVersion2 => serializer.serialize_i32(1),
19704 Self::CvssVersion3 => serializer.serialize_i32(2),
19705 Self::UnknownValue(u) => u.0.serialize(serializer),
19706 }
19707 }
19708}
19709
19710impl<'de> serde::de::Deserialize<'de> for CVSSVersion {
19711 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19712 where
19713 D: serde::Deserializer<'de>,
19714 {
19715 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CVSSVersion>::new(
19716 ".grafeas.v1.CVSSVersion",
19717 ))
19718 }
19719}
19720
19721/// Instruction set architectures supported by various package managers.
19722///
19723/// # Working with unknown values
19724///
19725/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19726/// additional enum variants at any time. Adding new variants is not considered
19727/// a breaking change. Applications should write their code in anticipation of:
19728///
19729/// - New values appearing in future releases of the client library, **and**
19730/// - New values received dynamically, without application changes.
19731///
19732/// Please consult the [Working with enums] section in the user guide for some
19733/// guidelines.
19734///
19735/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19736#[derive(Clone, Debug, PartialEq)]
19737#[non_exhaustive]
19738pub enum Architecture {
19739 /// Unknown architecture.
19740 Unspecified,
19741 /// X86 architecture.
19742 X86,
19743 /// X64 architecture.
19744 X64,
19745 /// If set, the enum was initialized with an unknown value.
19746 ///
19747 /// Applications can examine the value using [Architecture::value] or
19748 /// [Architecture::name].
19749 UnknownValue(architecture::UnknownValue),
19750}
19751
19752#[doc(hidden)]
19753pub mod architecture {
19754 #[allow(unused_imports)]
19755 use super::*;
19756 #[derive(Clone, Debug, PartialEq)]
19757 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19758}
19759
19760impl Architecture {
19761 /// Gets the enum value.
19762 ///
19763 /// Returns `None` if the enum contains an unknown value deserialized from
19764 /// the string representation of enums.
19765 pub fn value(&self) -> std::option::Option<i32> {
19766 match self {
19767 Self::Unspecified => std::option::Option::Some(0),
19768 Self::X86 => std::option::Option::Some(1),
19769 Self::X64 => std::option::Option::Some(2),
19770 Self::UnknownValue(u) => u.0.value(),
19771 }
19772 }
19773
19774 /// Gets the enum value as a string.
19775 ///
19776 /// Returns `None` if the enum contains an unknown value deserialized from
19777 /// the integer representation of enums.
19778 pub fn name(&self) -> std::option::Option<&str> {
19779 match self {
19780 Self::Unspecified => std::option::Option::Some("ARCHITECTURE_UNSPECIFIED"),
19781 Self::X86 => std::option::Option::Some("X86"),
19782 Self::X64 => std::option::Option::Some("X64"),
19783 Self::UnknownValue(u) => u.0.name(),
19784 }
19785 }
19786}
19787
19788impl std::default::Default for Architecture {
19789 fn default() -> Self {
19790 use std::convert::From;
19791 Self::from(0)
19792 }
19793}
19794
19795impl std::fmt::Display for Architecture {
19796 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19797 wkt::internal::display_enum(f, self.name(), self.value())
19798 }
19799}
19800
19801impl std::convert::From<i32> for Architecture {
19802 fn from(value: i32) -> Self {
19803 match value {
19804 0 => Self::Unspecified,
19805 1 => Self::X86,
19806 2 => Self::X64,
19807 _ => Self::UnknownValue(architecture::UnknownValue(
19808 wkt::internal::UnknownEnumValue::Integer(value),
19809 )),
19810 }
19811 }
19812}
19813
19814impl std::convert::From<&str> for Architecture {
19815 fn from(value: &str) -> Self {
19816 use std::string::ToString;
19817 match value {
19818 "ARCHITECTURE_UNSPECIFIED" => Self::Unspecified,
19819 "X86" => Self::X86,
19820 "X64" => Self::X64,
19821 _ => Self::UnknownValue(architecture::UnknownValue(
19822 wkt::internal::UnknownEnumValue::String(value.to_string()),
19823 )),
19824 }
19825 }
19826}
19827
19828impl serde::ser::Serialize for Architecture {
19829 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19830 where
19831 S: serde::Serializer,
19832 {
19833 match self {
19834 Self::Unspecified => serializer.serialize_i32(0),
19835 Self::X86 => serializer.serialize_i32(1),
19836 Self::X64 => serializer.serialize_i32(2),
19837 Self::UnknownValue(u) => u.0.serialize(serializer),
19838 }
19839 }
19840}
19841
19842impl<'de> serde::de::Deserialize<'de> for Architecture {
19843 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19844 where
19845 D: serde::Deserializer<'de>,
19846 {
19847 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Architecture>::new(
19848 ".grafeas.v1.Architecture",
19849 ))
19850 }
19851}
19852
19853/// Kind of secret.
19854///
19855/// # Working with unknown values
19856///
19857/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19858/// additional enum variants at any time. Adding new variants is not considered
19859/// a breaking change. Applications should write their code in anticipation of:
19860///
19861/// - New values appearing in future releases of the client library, **and**
19862/// - New values received dynamically, without application changes.
19863///
19864/// Please consult the [Working with enums] section in the user guide for some
19865/// guidelines.
19866///
19867/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19868#[derive(Clone, Debug, PartialEq)]
19869#[non_exhaustive]
19870pub enum SecretKind {
19871 /// Unspecified
19872 Unspecified,
19873 /// The secret kind is unknown.
19874 Unknown,
19875 /// A Google Cloud service account key per:
19876 /// <https://cloud.google.com/iam/docs/creating-managing-service-account-keys>
19877 GcpServiceAccountKey,
19878 /// A Google Cloud API key per:
19879 /// <https://cloud.google.com/docs/authentication/api-keys>
19880 GcpApiKey,
19881 /// A Google Cloud OAuth2 client credentials per:
19882 /// <https://developers.google.com/identity/protocols/oauth2>
19883 GcpOauth2ClientCredentials,
19884 /// A Google Cloud OAuth2 access token per:
19885 /// <https://cloud.google.com/docs/authentication/token-types#access>
19886 GcpOauth2AccessToken,
19887 /// An Anthropic Admin API key.
19888 AnthropicAdminApiKey,
19889 /// An Anthropic API key.
19890 AnthropicApiKey,
19891 /// An Azure access token.
19892 AzureAccessToken,
19893 /// An Azure Identity Platform ID token.
19894 AzureIdentityToken,
19895 /// A Docker Hub personal access token.
19896 DockerHubPersonalAccessToken,
19897 /// A GitHub App refresh token.
19898 GithubAppRefreshToken,
19899 /// A GitHub App server-to-server token.
19900 GithubAppServerToServerToken,
19901 /// A GitHub App user-to-server token.
19902 GithubAppUserToServerToken,
19903 /// A GitHub personal access token (classic).
19904 GithubClassicPersonalAccessToken,
19905 /// A GitHub fine-grained personal access token.
19906 GithubFineGrainedPersonalAccessToken,
19907 /// A GitHub OAuth token.
19908 GithubOauthToken,
19909 /// A Hugging Face API key.
19910 HuggingfaceApiKey,
19911 /// An OpenAI API key.
19912 OpenaiApiKey,
19913 /// A Perplexity API key.
19914 PerplexityApiKey,
19915 /// A Stripe secret key.
19916 StripeSecretKey,
19917 /// A Stripe restricted key.
19918 StripeRestrictedKey,
19919 /// A Stripe webhook secret.
19920 StripeWebhookSecret,
19921 /// If set, the enum was initialized with an unknown value.
19922 ///
19923 /// Applications can examine the value using [SecretKind::value] or
19924 /// [SecretKind::name].
19925 UnknownValue(secret_kind::UnknownValue),
19926}
19927
19928#[doc(hidden)]
19929pub mod secret_kind {
19930 #[allow(unused_imports)]
19931 use super::*;
19932 #[derive(Clone, Debug, PartialEq)]
19933 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19934}
19935
19936impl SecretKind {
19937 /// Gets the enum value.
19938 ///
19939 /// Returns `None` if the enum contains an unknown value deserialized from
19940 /// the string representation of enums.
19941 pub fn value(&self) -> std::option::Option<i32> {
19942 match self {
19943 Self::Unspecified => std::option::Option::Some(0),
19944 Self::Unknown => std::option::Option::Some(1),
19945 Self::GcpServiceAccountKey => std::option::Option::Some(2),
19946 Self::GcpApiKey => std::option::Option::Some(3),
19947 Self::GcpOauth2ClientCredentials => std::option::Option::Some(4),
19948 Self::GcpOauth2AccessToken => std::option::Option::Some(5),
19949 Self::AnthropicAdminApiKey => std::option::Option::Some(6),
19950 Self::AnthropicApiKey => std::option::Option::Some(7),
19951 Self::AzureAccessToken => std::option::Option::Some(8),
19952 Self::AzureIdentityToken => std::option::Option::Some(9),
19953 Self::DockerHubPersonalAccessToken => std::option::Option::Some(10),
19954 Self::GithubAppRefreshToken => std::option::Option::Some(11),
19955 Self::GithubAppServerToServerToken => std::option::Option::Some(12),
19956 Self::GithubAppUserToServerToken => std::option::Option::Some(13),
19957 Self::GithubClassicPersonalAccessToken => std::option::Option::Some(14),
19958 Self::GithubFineGrainedPersonalAccessToken => std::option::Option::Some(15),
19959 Self::GithubOauthToken => std::option::Option::Some(16),
19960 Self::HuggingfaceApiKey => std::option::Option::Some(17),
19961 Self::OpenaiApiKey => std::option::Option::Some(18),
19962 Self::PerplexityApiKey => std::option::Option::Some(19),
19963 Self::StripeSecretKey => std::option::Option::Some(20),
19964 Self::StripeRestrictedKey => std::option::Option::Some(21),
19965 Self::StripeWebhookSecret => std::option::Option::Some(22),
19966 Self::UnknownValue(u) => u.0.value(),
19967 }
19968 }
19969
19970 /// Gets the enum value as a string.
19971 ///
19972 /// Returns `None` if the enum contains an unknown value deserialized from
19973 /// the integer representation of enums.
19974 pub fn name(&self) -> std::option::Option<&str> {
19975 match self {
19976 Self::Unspecified => std::option::Option::Some("SECRET_KIND_UNSPECIFIED"),
19977 Self::Unknown => std::option::Option::Some("SECRET_KIND_UNKNOWN"),
19978 Self::GcpServiceAccountKey => {
19979 std::option::Option::Some("SECRET_KIND_GCP_SERVICE_ACCOUNT_KEY")
19980 }
19981 Self::GcpApiKey => std::option::Option::Some("SECRET_KIND_GCP_API_KEY"),
19982 Self::GcpOauth2ClientCredentials => {
19983 std::option::Option::Some("SECRET_KIND_GCP_OAUTH2_CLIENT_CREDENTIALS")
19984 }
19985 Self::GcpOauth2AccessToken => {
19986 std::option::Option::Some("SECRET_KIND_GCP_OAUTH2_ACCESS_TOKEN")
19987 }
19988 Self::AnthropicAdminApiKey => {
19989 std::option::Option::Some("SECRET_KIND_ANTHROPIC_ADMIN_API_KEY")
19990 }
19991 Self::AnthropicApiKey => std::option::Option::Some("SECRET_KIND_ANTHROPIC_API_KEY"),
19992 Self::AzureAccessToken => std::option::Option::Some("SECRET_KIND_AZURE_ACCESS_TOKEN"),
19993 Self::AzureIdentityToken => {
19994 std::option::Option::Some("SECRET_KIND_AZURE_IDENTITY_TOKEN")
19995 }
19996 Self::DockerHubPersonalAccessToken => {
19997 std::option::Option::Some("SECRET_KIND_DOCKER_HUB_PERSONAL_ACCESS_TOKEN")
19998 }
19999 Self::GithubAppRefreshToken => {
20000 std::option::Option::Some("SECRET_KIND_GITHUB_APP_REFRESH_TOKEN")
20001 }
20002 Self::GithubAppServerToServerToken => {
20003 std::option::Option::Some("SECRET_KIND_GITHUB_APP_SERVER_TO_SERVER_TOKEN")
20004 }
20005 Self::GithubAppUserToServerToken => {
20006 std::option::Option::Some("SECRET_KIND_GITHUB_APP_USER_TO_SERVER_TOKEN")
20007 }
20008 Self::GithubClassicPersonalAccessToken => {
20009 std::option::Option::Some("SECRET_KIND_GITHUB_CLASSIC_PERSONAL_ACCESS_TOKEN")
20010 }
20011 Self::GithubFineGrainedPersonalAccessToken => {
20012 std::option::Option::Some("SECRET_KIND_GITHUB_FINE_GRAINED_PERSONAL_ACCESS_TOKEN")
20013 }
20014 Self::GithubOauthToken => std::option::Option::Some("SECRET_KIND_GITHUB_OAUTH_TOKEN"),
20015 Self::HuggingfaceApiKey => std::option::Option::Some("SECRET_KIND_HUGGINGFACE_API_KEY"),
20016 Self::OpenaiApiKey => std::option::Option::Some("SECRET_KIND_OPENAI_API_KEY"),
20017 Self::PerplexityApiKey => std::option::Option::Some("SECRET_KIND_PERPLEXITY_API_KEY"),
20018 Self::StripeSecretKey => std::option::Option::Some("SECRET_KIND_STRIPE_SECRET_KEY"),
20019 Self::StripeRestrictedKey => {
20020 std::option::Option::Some("SECRET_KIND_STRIPE_RESTRICTED_KEY")
20021 }
20022 Self::StripeWebhookSecret => {
20023 std::option::Option::Some("SECRET_KIND_STRIPE_WEBHOOK_SECRET")
20024 }
20025 Self::UnknownValue(u) => u.0.name(),
20026 }
20027 }
20028}
20029
20030impl std::default::Default for SecretKind {
20031 fn default() -> Self {
20032 use std::convert::From;
20033 Self::from(0)
20034 }
20035}
20036
20037impl std::fmt::Display for SecretKind {
20038 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20039 wkt::internal::display_enum(f, self.name(), self.value())
20040 }
20041}
20042
20043impl std::convert::From<i32> for SecretKind {
20044 fn from(value: i32) -> Self {
20045 match value {
20046 0 => Self::Unspecified,
20047 1 => Self::Unknown,
20048 2 => Self::GcpServiceAccountKey,
20049 3 => Self::GcpApiKey,
20050 4 => Self::GcpOauth2ClientCredentials,
20051 5 => Self::GcpOauth2AccessToken,
20052 6 => Self::AnthropicAdminApiKey,
20053 7 => Self::AnthropicApiKey,
20054 8 => Self::AzureAccessToken,
20055 9 => Self::AzureIdentityToken,
20056 10 => Self::DockerHubPersonalAccessToken,
20057 11 => Self::GithubAppRefreshToken,
20058 12 => Self::GithubAppServerToServerToken,
20059 13 => Self::GithubAppUserToServerToken,
20060 14 => Self::GithubClassicPersonalAccessToken,
20061 15 => Self::GithubFineGrainedPersonalAccessToken,
20062 16 => Self::GithubOauthToken,
20063 17 => Self::HuggingfaceApiKey,
20064 18 => Self::OpenaiApiKey,
20065 19 => Self::PerplexityApiKey,
20066 20 => Self::StripeSecretKey,
20067 21 => Self::StripeRestrictedKey,
20068 22 => Self::StripeWebhookSecret,
20069 _ => Self::UnknownValue(secret_kind::UnknownValue(
20070 wkt::internal::UnknownEnumValue::Integer(value),
20071 )),
20072 }
20073 }
20074}
20075
20076impl std::convert::From<&str> for SecretKind {
20077 fn from(value: &str) -> Self {
20078 use std::string::ToString;
20079 match value {
20080 "SECRET_KIND_UNSPECIFIED" => Self::Unspecified,
20081 "SECRET_KIND_UNKNOWN" => Self::Unknown,
20082 "SECRET_KIND_GCP_SERVICE_ACCOUNT_KEY" => Self::GcpServiceAccountKey,
20083 "SECRET_KIND_GCP_API_KEY" => Self::GcpApiKey,
20084 "SECRET_KIND_GCP_OAUTH2_CLIENT_CREDENTIALS" => Self::GcpOauth2ClientCredentials,
20085 "SECRET_KIND_GCP_OAUTH2_ACCESS_TOKEN" => Self::GcpOauth2AccessToken,
20086 "SECRET_KIND_ANTHROPIC_ADMIN_API_KEY" => Self::AnthropicAdminApiKey,
20087 "SECRET_KIND_ANTHROPIC_API_KEY" => Self::AnthropicApiKey,
20088 "SECRET_KIND_AZURE_ACCESS_TOKEN" => Self::AzureAccessToken,
20089 "SECRET_KIND_AZURE_IDENTITY_TOKEN" => Self::AzureIdentityToken,
20090 "SECRET_KIND_DOCKER_HUB_PERSONAL_ACCESS_TOKEN" => Self::DockerHubPersonalAccessToken,
20091 "SECRET_KIND_GITHUB_APP_REFRESH_TOKEN" => Self::GithubAppRefreshToken,
20092 "SECRET_KIND_GITHUB_APP_SERVER_TO_SERVER_TOKEN" => Self::GithubAppServerToServerToken,
20093 "SECRET_KIND_GITHUB_APP_USER_TO_SERVER_TOKEN" => Self::GithubAppUserToServerToken,
20094 "SECRET_KIND_GITHUB_CLASSIC_PERSONAL_ACCESS_TOKEN" => {
20095 Self::GithubClassicPersonalAccessToken
20096 }
20097 "SECRET_KIND_GITHUB_FINE_GRAINED_PERSONAL_ACCESS_TOKEN" => {
20098 Self::GithubFineGrainedPersonalAccessToken
20099 }
20100 "SECRET_KIND_GITHUB_OAUTH_TOKEN" => Self::GithubOauthToken,
20101 "SECRET_KIND_HUGGINGFACE_API_KEY" => Self::HuggingfaceApiKey,
20102 "SECRET_KIND_OPENAI_API_KEY" => Self::OpenaiApiKey,
20103 "SECRET_KIND_PERPLEXITY_API_KEY" => Self::PerplexityApiKey,
20104 "SECRET_KIND_STRIPE_SECRET_KEY" => Self::StripeSecretKey,
20105 "SECRET_KIND_STRIPE_RESTRICTED_KEY" => Self::StripeRestrictedKey,
20106 "SECRET_KIND_STRIPE_WEBHOOK_SECRET" => Self::StripeWebhookSecret,
20107 _ => Self::UnknownValue(secret_kind::UnknownValue(
20108 wkt::internal::UnknownEnumValue::String(value.to_string()),
20109 )),
20110 }
20111 }
20112}
20113
20114impl serde::ser::Serialize for SecretKind {
20115 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20116 where
20117 S: serde::Serializer,
20118 {
20119 match self {
20120 Self::Unspecified => serializer.serialize_i32(0),
20121 Self::Unknown => serializer.serialize_i32(1),
20122 Self::GcpServiceAccountKey => serializer.serialize_i32(2),
20123 Self::GcpApiKey => serializer.serialize_i32(3),
20124 Self::GcpOauth2ClientCredentials => serializer.serialize_i32(4),
20125 Self::GcpOauth2AccessToken => serializer.serialize_i32(5),
20126 Self::AnthropicAdminApiKey => serializer.serialize_i32(6),
20127 Self::AnthropicApiKey => serializer.serialize_i32(7),
20128 Self::AzureAccessToken => serializer.serialize_i32(8),
20129 Self::AzureIdentityToken => serializer.serialize_i32(9),
20130 Self::DockerHubPersonalAccessToken => serializer.serialize_i32(10),
20131 Self::GithubAppRefreshToken => serializer.serialize_i32(11),
20132 Self::GithubAppServerToServerToken => serializer.serialize_i32(12),
20133 Self::GithubAppUserToServerToken => serializer.serialize_i32(13),
20134 Self::GithubClassicPersonalAccessToken => serializer.serialize_i32(14),
20135 Self::GithubFineGrainedPersonalAccessToken => serializer.serialize_i32(15),
20136 Self::GithubOauthToken => serializer.serialize_i32(16),
20137 Self::HuggingfaceApiKey => serializer.serialize_i32(17),
20138 Self::OpenaiApiKey => serializer.serialize_i32(18),
20139 Self::PerplexityApiKey => serializer.serialize_i32(19),
20140 Self::StripeSecretKey => serializer.serialize_i32(20),
20141 Self::StripeRestrictedKey => serializer.serialize_i32(21),
20142 Self::StripeWebhookSecret => serializer.serialize_i32(22),
20143 Self::UnknownValue(u) => u.0.serialize(serializer),
20144 }
20145 }
20146}
20147
20148impl<'de> serde::de::Deserialize<'de> for SecretKind {
20149 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20150 where
20151 D: serde::Deserializer<'de>,
20152 {
20153 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SecretKind>::new(
20154 ".grafeas.v1.SecretKind",
20155 ))
20156 }
20157}
20158
20159/// Note provider assigned severity/impact ranking.
20160///
20161/// # Working with unknown values
20162///
20163/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
20164/// additional enum variants at any time. Adding new variants is not considered
20165/// a breaking change. Applications should write their code in anticipation of:
20166///
20167/// - New values appearing in future releases of the client library, **and**
20168/// - New values received dynamically, without application changes.
20169///
20170/// Please consult the [Working with enums] section in the user guide for some
20171/// guidelines.
20172///
20173/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
20174#[derive(Clone, Debug, PartialEq)]
20175#[non_exhaustive]
20176pub enum Severity {
20177 /// Unknown.
20178 Unspecified,
20179 /// Minimal severity.
20180 Minimal,
20181 /// Low severity.
20182 Low,
20183 /// Medium severity.
20184 Medium,
20185 /// High severity.
20186 High,
20187 /// Critical severity.
20188 Critical,
20189 /// If set, the enum was initialized with an unknown value.
20190 ///
20191 /// Applications can examine the value using [Severity::value] or
20192 /// [Severity::name].
20193 UnknownValue(severity::UnknownValue),
20194}
20195
20196#[doc(hidden)]
20197pub mod severity {
20198 #[allow(unused_imports)]
20199 use super::*;
20200 #[derive(Clone, Debug, PartialEq)]
20201 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20202}
20203
20204impl Severity {
20205 /// Gets the enum value.
20206 ///
20207 /// Returns `None` if the enum contains an unknown value deserialized from
20208 /// the string representation of enums.
20209 pub fn value(&self) -> std::option::Option<i32> {
20210 match self {
20211 Self::Unspecified => std::option::Option::Some(0),
20212 Self::Minimal => std::option::Option::Some(1),
20213 Self::Low => std::option::Option::Some(2),
20214 Self::Medium => std::option::Option::Some(3),
20215 Self::High => std::option::Option::Some(4),
20216 Self::Critical => std::option::Option::Some(5),
20217 Self::UnknownValue(u) => u.0.value(),
20218 }
20219 }
20220
20221 /// Gets the enum value as a string.
20222 ///
20223 /// Returns `None` if the enum contains an unknown value deserialized from
20224 /// the integer representation of enums.
20225 pub fn name(&self) -> std::option::Option<&str> {
20226 match self {
20227 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
20228 Self::Minimal => std::option::Option::Some("MINIMAL"),
20229 Self::Low => std::option::Option::Some("LOW"),
20230 Self::Medium => std::option::Option::Some("MEDIUM"),
20231 Self::High => std::option::Option::Some("HIGH"),
20232 Self::Critical => std::option::Option::Some("CRITICAL"),
20233 Self::UnknownValue(u) => u.0.name(),
20234 }
20235 }
20236}
20237
20238impl std::default::Default for Severity {
20239 fn default() -> Self {
20240 use std::convert::From;
20241 Self::from(0)
20242 }
20243}
20244
20245impl std::fmt::Display for Severity {
20246 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20247 wkt::internal::display_enum(f, self.name(), self.value())
20248 }
20249}
20250
20251impl std::convert::From<i32> for Severity {
20252 fn from(value: i32) -> Self {
20253 match value {
20254 0 => Self::Unspecified,
20255 1 => Self::Minimal,
20256 2 => Self::Low,
20257 3 => Self::Medium,
20258 4 => Self::High,
20259 5 => Self::Critical,
20260 _ => Self::UnknownValue(severity::UnknownValue(
20261 wkt::internal::UnknownEnumValue::Integer(value),
20262 )),
20263 }
20264 }
20265}
20266
20267impl std::convert::From<&str> for Severity {
20268 fn from(value: &str) -> Self {
20269 use std::string::ToString;
20270 match value {
20271 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
20272 "MINIMAL" => Self::Minimal,
20273 "LOW" => Self::Low,
20274 "MEDIUM" => Self::Medium,
20275 "HIGH" => Self::High,
20276 "CRITICAL" => Self::Critical,
20277 _ => Self::UnknownValue(severity::UnknownValue(
20278 wkt::internal::UnknownEnumValue::String(value.to_string()),
20279 )),
20280 }
20281 }
20282}
20283
20284impl serde::ser::Serialize for Severity {
20285 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20286 where
20287 S: serde::Serializer,
20288 {
20289 match self {
20290 Self::Unspecified => serializer.serialize_i32(0),
20291 Self::Minimal => serializer.serialize_i32(1),
20292 Self::Low => serializer.serialize_i32(2),
20293 Self::Medium => serializer.serialize_i32(3),
20294 Self::High => serializer.serialize_i32(4),
20295 Self::Critical => serializer.serialize_i32(5),
20296 Self::UnknownValue(u) => u.0.serialize(serializer),
20297 }
20298 }
20299}
20300
20301impl<'de> serde::de::Deserialize<'de> for Severity {
20302 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20303 where
20304 D: serde::Deserializer<'de>,
20305 {
20306 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
20307 ".grafeas.v1.Severity",
20308 ))
20309 }
20310}